mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 01:07:34 +02:00
Handle old stack objects on write barrier
The gc_mut_update write barrier should not assume that the old object is on the heap, lets also gray the old object if it happens to be on the stack. Worst case, we mark an extra object here or there. Best case, may prevent gc_allocated_bytes receiving forward pointers.
This commit is contained in:
parent
a98990b2e0
commit
98a18a225a
1 changed files with 5 additions and 1 deletions
6
gc.c
6
gc.c
|
@ -752,7 +752,11 @@ void gc_mut_update(gc_thread_data *thd, object old_obj, object value)
|
|||
stage = ck_pr_load_int(&gc_stage);
|
||||
if (ck_pr_load_int(&(thd->gc_status)) != STATUS_ASYNC) {
|
||||
pthread_mutex_lock(&(thd->lock));
|
||||
gc_mark_gray(thd, old_obj);
|
||||
if (gc_is_stack_obj(thd, old_obj)) {
|
||||
grayed(old_obj) = 1;
|
||||
} else {
|
||||
gc_mark_gray(thd, old_obj);
|
||||
}
|
||||
if (gc_is_stack_obj(thd, value)) {
|
||||
// Set object to be marked after moved to heap by next GC.
|
||||
// This avoids having to recursively examine the stack now,
|
||||
|
|
Loading…
Add table
Reference in a new issue