aboutsummaryrefslogtreecommitdiff
path: root/py/nativeglue.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-10-14 23:56:46 +1100
committerDamien George <damien.p.george@gmail.com>2018-10-15 00:20:49 +1100
commitde71035e02e11bf89b09d2ec6292518d29f0f0e7 (patch)
tree08b4f62890d82d009ba04d064d65f68b0e485eb5 /py/nativeglue.c
parent6c6050ca43e5ee9d6d504eaad4cd1957aa6ffd7c (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/nativeglue.c')
-rw-r--r--py/nativeglue.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/nativeglue.c b/py/nativeglue.c
index b3a50ef19..b7031a5d2 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -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,