diff options
author | Damien George <damien.p.george@gmail.com> | 2014-08-24 16:28:17 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-08-24 16:28:17 +0100 |
commit | 3c658a4e755a75e495303957208486e583ddb270 (patch) | |
tree | 6418fea9bf3dcf4aed2145db94fda4c0de1d0321 /py/emitglue.h | |
parent | 25fc41dd316c38df3e2a6cfe4b53322d76dc92fc (diff) | |
download | micropython-3c658a4e755a75e495303957208486e583ddb270.tar.gz micropython-3c658a4e755a75e495303957208486e583ddb270.zip |
py: Fix bug where GC collected native/viper/asm function data.
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC. This patch is a comprehensive fix for this.
Addresses issue #820.
Diffstat (limited to 'py/emitglue.h')
-rw-r--r-- | py/emitglue.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/py/emitglue.h b/py/emitglue.h index f8363465e2..087b2296e9 100644 --- a/py/emitglue.h +++ b/py/emitglue.h @@ -37,17 +37,17 @@ typedef enum { typedef struct _mp_code_t { mp_raw_code_kind_t kind : 3; - uint scope_flags : 7; - uint n_pos_args : 11; - uint n_kwonly_args : 11; + mp_uint_t scope_flags : 7; + mp_uint_t n_pos_args : 11; + mp_uint_t n_kwonly_args : 11; qstr *arg_names; union { struct { byte *code; - uint len; + mp_uint_t len; } u_byte; struct { - void *fun; + void *fun_data; mp_uint_t type_sig; // for viper, compressed as 2-bit types; ret is MSB, then arg0, arg1, etc } u_native; }; @@ -55,8 +55,8 @@ typedef struct _mp_code_t { mp_raw_code_t *mp_emit_glue_new_raw_code(void); -void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, byte *code, uint len, uint n_pos_args, uint n_kwonly_args, qstr *arg_names, uint scope_flags); -void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *f, uint len, int n_args, mp_uint_t type_sig); +void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, byte *code, mp_uint_t len, mp_uint_t n_pos_args, mp_uint_t n_kwonly_args, qstr *arg_names, 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, mp_uint_t n_args, mp_uint_t type_sig); mp_obj_t mp_make_function_from_raw_code(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(mp_raw_code_t *rc, uint n_closed_over, const mp_obj_t *args); +mp_obj_t mp_make_closure_from_raw_code(mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args); |