diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-10-14 23:56:46 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-10-15 00:20:49 +1100 |
| commit | de71035e02e11bf89b09d2ec6292518d29f0f0e7 (patch) | |
| tree | 08b4f62890d82d009ba04d064d65f68b0e485eb5 /py/runtime0.h | |
| parent | 6c6050ca43e5ee9d6d504eaad4cd1957aa6ffd7c (diff) | |
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.
Diffstat (limited to 'py/runtime0.h')
| -rw-r--r-- | py/runtime0.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/py/runtime0.h b/py/runtime0.h index 78d744d29..56cc6cfd3 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -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 |
