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).
This commit is contained in:
parent
3911d5af32
commit
969e4bbe6a
9
py/gc.c
9
py/gc.c
@ -200,11 +200,10 @@ STATIC void gc_drain_stack(void) {
|
||||
} while (ATB_GET_KIND(block + n_blocks) == AT_TAIL);
|
||||
|
||||
// check this block's children
|
||||
mp_obj_t *scan = (mp_obj_t*)PTR_FROM_BLOCK(block);
|
||||
for (mp_uint_t i = n_blocks * WORDS_PER_BLOCK; i > 0; i--, scan++) {
|
||||
mp_obj_t obj = *scan;
|
||||
void *ptr2 = MP_OBJ_TO_PTR(obj);
|
||||
VERIFY_MARK_AND_PUSH(ptr2);
|
||||
void **ptrs = (void**)PTR_FROM_BLOCK(block);
|
||||
for (size_t i = n_blocks * BYTES_PER_BLOCK / sizeof(void*); i > 0; i--, ptrs++) {
|
||||
void *ptr = *ptrs;
|
||||
VERIFY_MARK_AND_PUSH(ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user