summaryrefslogtreecommitdiff
path: root/py/gc_long_lived.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2018-01-24 14:13:26 -0800
committerScott Shawcroft <scott.shawcroft@gmail.com>2018-01-24 14:13:26 -0800
commitaa0ce98b3e7228a469fa11709fbd6864242079b4 (patch)
treec68af5f3e68352b49159e3d403bdb2fd0ce6d760 /py/gc_long_lived.c
parentda330f0cab09c9150b588ee0c1cb4e09edaee9fc (diff)
Fix the initial state and polish a couple comments.
Diffstat (limited to 'py/gc_long_lived.c')
-rw-r--r--py/gc_long_lived.c3
1 files changed, 2 insertions, 1 deletions
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;