aboutsummaryrefslogtreecommitdiff
path: root/py/runtime0.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-09-27 23:27:53 +1000
committerDamien George <damien.p.george@gmail.com>2018-09-27 23:39:08 +1000
commit7d4b6cc868ebf0e1cc5dfe5276b22e1b857c411b (patch)
treec24010ac7a5cc689d1f1f3a27d756e7c1ca53568 /py/runtime0.h
parent8a84e08dc853eb294cc53160e902a39ead6fca8e (diff)
py/emitnative: Place const objs for native code in separate const table.
This commit changes native code to handle constant objects like bytecode: instead of storing the pointers inside the native code they are now stored in a separate constant table (such pointers include objects like bignum, bytes, and raw code for nested functions). This removes the need for the GC to scan native code for root pointers, and takes a step towards making native code independent of the runtime (eg so it can be compiled offline by mpy-cross). Note that the changes to the struct scope_t did not increase its size: on a 32-bit architecture it is still 48 bytes, and on a 64-bit architecture it decreased from 80 to 72 bytes.
Diffstat (limited to 'py/runtime0.h')
-rw-r--r--py/runtime0.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/py/runtime0.h b/py/runtime0.h
index 652204b67..2c6b5fae9 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -26,13 +26,15 @@
#ifndef MICROPY_INCLUDED_PY_RUNTIME0_H
#define MICROPY_INCLUDED_PY_RUNTIME0_H
-// These must fit in 8 bits; see scope.h
+// The first four must fit in 8 bits, see emitbc.c
+// The remaining must fit in 16 bits, see scope.h
#define MP_SCOPE_FLAG_VARARGS (0x01)
#define MP_SCOPE_FLAG_VARKEYWORDS (0x02)
#define MP_SCOPE_FLAG_GENERATOR (0x04)
#define MP_SCOPE_FLAG_DEFKWARGS (0x08)
#define MP_SCOPE_FLAG_REFGLOBALS (0x10) // used only if native emitter enabled
-#define MP_SCOPE_FLAG_VIPERRET_POS (5) // top 3 bits used for viper return type
+#define MP_SCOPE_FLAG_HASCONSTS (0x20) // used only if native emitter enabled
+#define MP_SCOPE_FLAG_VIPERRET_POS (6) // 3 bits used for viper return type
// types for native (viper) function signature
#define MP_NATIVE_TYPE_OBJ (0x00)