summaryrefslogtreecommitdiff
path: root/py/objfun.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-11-02 17:27:18 +0000
committerDamien George <damien.p.george@gmail.com>2015-11-13 12:49:18 +0000
commitc8e9c0d89afa90694790fd48e1bf527487a5beb7 (patch)
tree91ca77ecc152b0c2ffc682c705b05b97ef55cf31 /py/objfun.c
parent713ea1800d1f0c82a0c75885ad034705556ab5ef (diff)
py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.
Main changes when MICROPY_PERSISTENT_CODE is enabled are: - qstrs are encoded as 2-byte fixed width in the bytecode - all pointers are removed from bytecode and put in const_table (this includes const objects and raw code pointers) Ultimately this option will enable persistence for not just bytecode but also native code.
Diffstat (limited to 'py/objfun.c')
-rw-r--r--py/objfun.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/objfun.c b/py/objfun.c
index f55d44ca2..a39508e2b 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -106,7 +106,11 @@ const mp_obj_type_t mp_type_fun_builtin = {
qstr mp_obj_code_get_name(const byte *code_info) {
mp_decode_uint(&code_info); // skip code_info_size entry
+ #if MICROPY_PERSISTENT_CODE
+ return code_info[0] | (code_info[1] << 8);
+ #else
return mp_decode_uint(&code_info);
+ #endif
}
#if MICROPY_EMIT_NATIVE