diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-13 11:04:33 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-13 11:04:33 +0100 |
commit | df8127a17eeb3057e820180e318ec3d915111b6a (patch) | |
tree | 55fa023ce2de910492c9c713bfa15f6e6df475c2 /py/runtime.h | |
parent | 68e7c5146ce24a593889df67d50d8f9c0cfa528e (diff) | |
download | micropython-df8127a17eeb3057e820180e318ec3d915111b6a.tar.gz micropython-df8127a17eeb3057e820180e318ec3d915111b6a.zip |
py: Remove unique_codes from emitglue.c. Replace with pointers.
Attempt to address issue #386. unique_code_id's have been removed and
replaced with a pointer to the "raw code" information. This pointer is
stored in the actual byte code (aligned, so the GC can trace it), so
that raw code (ie byte code, native code and inline assembler) is kept
only for as long as it is needed. In memory it's now like a tree: the
outer module's byte code points directly to its children's raw code. So
when the outer code gets freed, if there are no remaining functions that
need the raw code, then the children's code gets freed as well.
This is pretty much like CPython does it, except that CPython stores
indexes in the byte code rather than machine pointers. These indices
index the per-function constant table in order to find the relevant
code.
Diffstat (limited to 'py/runtime.h')
-rw-r--r-- | py/runtime.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/py/runtime.h b/py/runtime.h index 867d633520..a3c6119838 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -29,12 +29,9 @@ mp_obj_t mp_load_const_dec(qstr qstr); mp_obj_t mp_load_const_str(qstr qstr); mp_obj_t mp_load_const_bytes(qstr qstr); -mp_obj_t mp_make_function_from_id(uint unique_code_id, mp_obj_t def_args, mp_obj_t def_kw_args); -mp_obj_t mp_make_function_from_id_and_free(uint unique_code_id, mp_obj_t def_args, mp_obj_t def_kw_args); mp_obj_t mp_make_function_n(int n_args, void *fun); // fun must have the correct signature for n_args fixed arguments mp_obj_t mp_make_function_var(int n_args_min, mp_fun_var_t fun); mp_obj_t mp_make_function_var_between(int n_args_min, int n_args_max, mp_fun_var_t fun); // min and max are inclusive -mp_obj_t mp_make_closure_from_id(uint unique_code_id, mp_obj_t closure_tuple, mp_obj_t def_args, mp_obj_t def_kw_args); mp_obj_t mp_call_function_0(mp_obj_t fun); mp_obj_t mp_call_function_1(mp_obj_t fun, mp_obj_t arg); |