diff --git a/iseq.c b/iseq.c index 19f475b0970658..49f2765551db12 100644 --- a/iseq.c +++ b/iseq.c @@ -159,6 +159,14 @@ iseq_extract_values(const VALUE *code, size_t pos, iseq_value_itr_t * func, void } break; } + case TS_IC: + if (BIN(once) == insn || BIN(trace_once) == insn) { + union iseq_inline_storage_entry *const is = (union iseq_inline_storage_entry *)code[pos + op_no + 1]; + if (is->once.value) { + func(data, is->once.value); + } + } + break; default: break; } @@ -397,13 +405,6 @@ set_relation(rb_iseq_t *iseq, const rb_iseq_t *piseq) } } -void -rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj) -{ - /* TODO: check dedup */ - rb_ary_push(ISEQ_MARK_ARY(iseq), obj); -} - static VALUE prepare_iseq_build(rb_iseq_t *iseq, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_code_location_t *code_location, diff --git a/iseq.h b/iseq.h index f8578bf522d6af..0dd0703d207054 100644 --- a/iseq.h +++ b/iseq.h @@ -174,7 +174,6 @@ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE exception, VALUE body); /* iseq.c */ -void rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj); VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); struct st_table *ruby_insn_make_insn_table(void); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index acb7d7999d7770..22c179e6a667f4 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3294,10 +3294,10 @@ vm_once_dispatch(rb_execution_context_t *ec, ISEQ iseq, IC ic) else if (is->once.running_thread == NULL) { VALUE val; is->once.running_thread = th; - val = is->once.value = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is); + val = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is); + RB_OBJ_WRITE(ec->cfp->iseq, &is->once.value, val); /* is->once.running_thread is cleared by vm_once_clear() */ is->once.running_thread = RUNNING_THREAD_ONCE_DONE; /* success */ - rb_iseq_add_mark_object(ec->cfp->iseq, val); return val; } else if (is->once.running_thread == th) {