summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitglue.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/emitglue.h')
-rw-r--r--py/emitglue.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/py/emitglue.h b/py/emitglue.h
index a5411dc2e2..9a22a93218 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -54,16 +54,20 @@ typedef struct _mp_qstr_link_entry_t {
uint16_t qst;
} mp_qstr_link_entry_t;
+// compiled bytecode: instance in RAM, referenced by outer scope, usually freed after first (and only) use
+// mpy file: instance in RAM, created when .mpy file is loaded (same comments as above)
+// frozen: instance in ROM
typedef struct _mp_raw_code_t {
mp_uint_t kind : 3; // of type mp_raw_code_kind_t
mp_uint_t scope_flags : 7;
mp_uint_t n_pos_args : 11;
const void *fun_data;
- const mp_uint_t *const_table;
+ #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS
+ size_t fun_data_len; // so mp_raw_code_save and mp_bytecode_print work
+ #endif
+ struct _mp_raw_code_t **children;
#if MICROPY_PERSISTENT_CODE_SAVE
- size_t fun_data_len;
- uint16_t n_obj;
- uint16_t n_raw_code;
+ size_t n_children;
#if MICROPY_PY_SYS_SETTRACE
mp_bytecode_prelude_t prelude;
// line_of_definition is a Python source line where the raw_code was
@@ -89,22 +93,22 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code,
#if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS
size_t len,
#endif
- const mp_uint_t *const_table,
+ mp_raw_code_t **children,
#if MICROPY_PERSISTENT_CODE_SAVE
- uint16_t n_obj, uint16_t n_raw_code,
+ size_t n_children,
#endif
mp_uint_t scope_flags);
void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len,
- const mp_uint_t *const_table,
+ mp_raw_code_t **children,
#if MICROPY_PERSISTENT_CODE_SAVE
+ size_t n_children,
uint16_t prelude_offset,
- uint16_t n_obj, uint16_t n_raw_code,
uint16_t n_qstr, mp_qstr_link_entry_t *qstr_link,
#endif
- mp_uint_t n_pos_args, mp_uint_t scope_flags, mp_uint_t type_sig);
+ mp_uint_t scope_flags, mp_uint_t n_pos_args, mp_uint_t type_sig);
-mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args);
-mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args);
+mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, const mp_obj_t *def_args);
+mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, mp_uint_t n_closed_over, const mp_obj_t *args);
#endif // MICROPY_INCLUDED_PY_EMITGLUE_H