mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user