mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
check is_incremental_marking() again
is_incremental_marking() can be changed after checking the flag without locking, especially on `GC.stress = true`.
This commit is contained in:
parent
a1bb110b56
commit
e586345b77
1 changed files with 10 additions and 1 deletions
9
gc.c
9
gc.c
|
@ -7803,6 +7803,7 @@ rb_gc_writebarrier(VALUE a, VALUE b)
|
|||
if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const");
|
||||
if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: b is special const");
|
||||
|
||||
retry:
|
||||
if (!is_incremental_marking(objspace)) {
|
||||
if (!RVALUE_OLD_P(a) || RVALUE_OLD_P(b)) {
|
||||
// do nothing
|
||||
|
@ -7812,12 +7813,20 @@ rb_gc_writebarrier(VALUE a, VALUE b)
|
|||
}
|
||||
}
|
||||
else {
|
||||
bool retry = false;
|
||||
/* slow path */
|
||||
RB_VM_LOCK_ENTER_NO_BARRIER();
|
||||
{
|
||||
if (is_incremental_marking(objspace)) {
|
||||
gc_writebarrier_incremental(a, b, objspace);
|
||||
}
|
||||
else {
|
||||
retry = true;
|
||||
}
|
||||
}
|
||||
RB_VM_LOCK_LEAVE_NO_BARRIER();
|
||||
|
||||
if (retry) goto retry;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue