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

@@ -174,7 +174,10 @@ STATIC bool mp_native_yield_from(mp_obj_t gen, mp_obj_t send_value, mp_obj_t *re
}
// these must correspond to the respective enum in runtime0.h
void *const mp_fun_table[MP_F_NUMBER_OF] = {
const void *const mp_fun_table[MP_F_NUMBER_OF] = {
&mp_const_none_obj,
&mp_const_false_obj,
&mp_const_true_obj,
mp_convert_obj_to_native,
mp_convert_native_to_obj,
mp_native_swap_globals,