gc_verify_internal_consistency() needs barrier

gc_verify_internal_consistency() accesses all slots (objects) so
all ractors should stop before starting this function.
This commit is contained in:
Koichi Sasada 2020-12-18 01:19:03 +09:00
parent caef364cc5
commit 6538c89f1c

4
gc.c
View File

@ -7059,7 +7059,6 @@ gc_verify_heap_pages(rb_objspace_t *objspace)
static VALUE static VALUE
gc_verify_internal_consistency_m(VALUE dummy) gc_verify_internal_consistency_m(VALUE dummy)
{ {
ASSERT_vm_locking();
gc_verify_internal_consistency(&rb_objspace); gc_verify_internal_consistency(&rb_objspace);
return Qnil; return Qnil;
} }
@ -7143,6 +7142,9 @@ gc_verify_internal_consistency_(rb_objspace_t *objspace)
static void static void
gc_verify_internal_consistency(rb_objspace_t *objspace) gc_verify_internal_consistency(rb_objspace_t *objspace)
{ {
ASSERT_vm_locking();
rb_vm_barrier(); // stop other ractors
unsigned int prev_during_gc = during_gc; unsigned int prev_during_gc = during_gc;
during_gc = FALSE; // stop gc here during_gc = FALSE; // stop gc here
{ {