зеркало из https://github.com/github/ruby.git
Move checks for heap traversal to rb_gc_mark_weak
If we are during heap traversal, we don't want to call rb_gc_impl_mark_weak. This commit moves that check from rb_gc_impl_mark_weak to rb_gc_mark_weak.
This commit is contained in:
Родитель
92b7b78e06
Коммит
0fc8422a05
11
gc.c
11
gc.c
|
@ -2104,7 +2104,16 @@ rb_gc_mark_weak(VALUE *ptr)
|
||||||
{
|
{
|
||||||
if (RB_SPECIAL_CONST_P(*ptr)) return;
|
if (RB_SPECIAL_CONST_P(*ptr)) return;
|
||||||
|
|
||||||
rb_gc_impl_mark_weak(rb_gc_get_objspace(), ptr);
|
rb_vm_t *vm = GET_VM();
|
||||||
|
void *objspace = vm->gc.objspace;
|
||||||
|
if (LIKELY(vm->gc.mark_func_data == NULL)) {
|
||||||
|
GC_ASSERT(rb_gc_impl_during_gc_p(objspace));
|
||||||
|
|
||||||
|
rb_gc_impl_mark_weak(objspace, ptr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GC_ASSERT(!rb_gc_impl_during_gc_p(objspace));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -4607,8 +4607,6 @@ rb_gc_impl_mark_weak(void *objspace_ptr, VALUE *ptr)
|
||||||
{
|
{
|
||||||
rb_objspace_t *objspace = objspace_ptr;
|
rb_objspace_t *objspace = objspace_ptr;
|
||||||
|
|
||||||
if (RB_UNLIKELY(!during_gc)) return;
|
|
||||||
|
|
||||||
GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED));
|
GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED));
|
||||||
|
|
||||||
VALUE obj = *ptr;
|
VALUE obj = *ptr;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче