Commit 969e4bbe authored by Damien George's avatar Damien George
Browse files

py/gc: Scan GC blocks as an array of pointers, not an array of objects.

The GC should search for pointers within the heap.  This patch makes a
difference when an object is larger than a pointer (eg 64-bit NaN
boxing).
parent 3911d5af
...@@ -200,11 +200,10 @@ STATIC void gc_drain_stack(void) { ...@@ -200,11 +200,10 @@ STATIC void gc_drain_stack(void) {
} while (ATB_GET_KIND(block + n_blocks) == AT_TAIL); } while (ATB_GET_KIND(block + n_blocks) == AT_TAIL);
// check this block's children // check this block's children
mp_obj_t *scan = (mp_obj_t*)PTR_FROM_BLOCK(block); void **ptrs = (void**)PTR_FROM_BLOCK(block);
for (mp_uint_t i = n_blocks * WORDS_PER_BLOCK; i > 0; i--, scan++) { for (size_t i = n_blocks * BYTES_PER_BLOCK / sizeof(void*); i > 0; i--, ptrs++) {
mp_obj_t obj = *scan; void *ptr = *ptrs;
void *ptr2 = MP_OBJ_TO_PTR(obj); VERIFY_MARK_AND_PUSH(ptr);
VERIFY_MARK_AND_PUSH(ptr2);
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment