summaryrefslogtreecommitdiff
path: root/py/scope.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/scope.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/scope.h')
-rw-r--r--py/scope.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/scope.h b/py/scope.h
index 77bc69d74..5e9a0eb7b 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -72,11 +72,11 @@ typedef struct _scope_t {
struct _scope_t *parent;
struct _scope_t *next;
mp_parse_node_t pn;
+ mp_raw_code_t *raw_code;
uint16_t source_file; // a qstr
uint16_t simple_name; // a qstr
- mp_raw_code_t *raw_code;
- uint8_t scope_flags; // see runtime0.h
- uint8_t emit_options; // see emitglue.h
+ uint16_t scope_flags; // see runtime0.h
+ uint16_t emit_options; // see emitglue.h
uint16_t num_pos_args;
uint16_t num_kwonly_args;
uint16_t num_def_pos_args;