diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-01-24 14:13:26 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-01-24 14:13:26 -0800 |
| commit | aa0ce98b3e7228a469fa11709fbd6864242079b4 (patch) | |
| tree | c68af5f3e68352b49159e3d403bdb2fd0ce6d760 /py | |
| parent | da330f0cab09c9150b588ee0c1cb4e09edaee9fc (diff) | |
Fix the initial state and polish a couple comments.
Diffstat (limited to 'py')
| -rw-r--r-- | py/gc.c | 2 | ||||
| -rw-r--r-- | py/gc_long_lived.c | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -147,7 +147,7 @@ void gc_init(void *start, void *end) { #endif // Set first free ATB index to the start of the heap. - MP_STATE_MEM(gc_last_free_atb_index) = 0; + MP_STATE_MEM(gc_first_free_atb_index) = 0; // Set last free ATB index to the end of the heap. MP_STATE_MEM(gc_last_free_atb_index) = MP_STATE_MEM(gc_alloc_table_byte_len) - 1; // Set the lowest long lived ptr to the end of the heap to start. This will be lowered as long diff --git a/py/gc_long_lived.c b/py/gc_long_lived.c index bd0e63d9b..c50bbcd83 100644 --- a/py/gc_long_lived.c +++ b/py/gc_long_lived.c @@ -46,7 +46,6 @@ mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_dep mp_raw_code_t* raw_code = MP_OBJ_TO_PTR(fun_bc->const_table[i]); if (raw_code->kind == MP_CODE_BYTECODE) { raw_code->data.u_byte.bytecode = gc_make_long_lived((byte*) raw_code->data.u_byte.bytecode); - // TODO(tannewt): Do we actually want to recurse here? raw_code->data.u_byte.const_table = gc_make_long_lived((byte*) raw_code->data.u_byte.const_table); } ((mp_uint_t *) fun_bc->const_table)[i] = (mp_uint_t) make_obj_long_lived( @@ -56,6 +55,8 @@ mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_dep fun_bc->const_table = gc_make_long_lived((mp_uint_t*) fun_bc->const_table); // extra_args stores keyword only argument default values. size_t words = gc_nbytes(fun_bc) / sizeof(mp_uint_t*); + // Functions (mp_obj_fun_bc_t) have four pointers (base, globals, bytecode and const_table) + // before the variable length extra_args so remove them from the length. for (size_t i = 0; i < words - 4; i++) { if (fun_bc->extra_args[i] == NULL) { continue; |
