Skip to content

Commit

Permalink
gc_verify_internal_consistency() needs barrier
Browse files Browse the repository at this point in the history
gc_verify_internal_consistency() accesses all slots (objects) so
all ractors should stop before starting this function.
  • Loading branch information
ko1 committed Dec 17, 2020
1 parent caef364 commit 6538c89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gc.c
Expand Up @@ -7059,7 +7059,6 @@ gc_verify_heap_pages(rb_objspace_t *objspace)
static VALUE
gc_verify_internal_consistency_m(VALUE dummy)
{
ASSERT_vm_locking();
gc_verify_internal_consistency(&rb_objspace);
return Qnil;
}
Expand Down Expand Up @@ -7143,6 +7142,9 @@ gc_verify_internal_consistency_(rb_objspace_t *objspace)
static void
gc_verify_internal_consistency(rb_objspace_t *objspace)
{
ASSERT_vm_locking();
rb_vm_barrier(); // stop other ractors

unsigned int prev_during_gc = during_gc;
during_gc = FALSE; // stop gc here
{
Expand Down

0 comments on commit 6538c89

Please sign in to comment.