py/emitnative: Put None/False/True in global native const table.

So these constant objects can be loaded by dereferencing the REG_FUN_TABLE
pointer instead of loading immediate values.  This reduces the size of
generated native code (when such constants are used), and means that
pointers to these constants are no longer stored in the assembly code.
This commit is contained in:
Damien George
2018-10-14 23:56:46 +11:00
parent 6c6050ca43
commit de71035e02
3 changed files with 23 additions and 18 deletions

View File

@@ -147,7 +147,10 @@ typedef enum {
} mp_binary_op_t;
typedef enum {
MP_F_CONVERT_OBJ_TO_NATIVE = 0,
MP_F_CONST_NONE_OBJ = 0,
MP_F_CONST_FALSE_OBJ,
MP_F_CONST_TRUE_OBJ,
MP_F_CONVERT_OBJ_TO_NATIVE,
MP_F_CONVERT_NATIVE_TO_OBJ,
MP_F_NATIVE_SWAP_GLOBALS,
MP_F_LOAD_NAME,
@@ -201,6 +204,6 @@ typedef enum {
MP_F_NUMBER_OF,
} mp_fun_kind_t;
extern void *const mp_fun_table[MP_F_NUMBER_OF];
extern const void *const mp_fun_table[MP_F_NUMBER_OF];
#endif // MICROPY_INCLUDED_PY_RUNTIME0_H