ruby-changes:48327
From: ko1 <ko1@a...>
Date: Thu, 26 Oct 2017 17:41:39 +0900 (JST)
Subject: [ruby-changes:48327] ko1:r60441 (trunk): some functions accept `ec` instead of `th`.
ko1 2017-10-26 17:41:34 +0900 (Thu, 26 Oct 2017) New Revision: 60441 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60441 Log: some functions accept `ec` instead of `th`. * vm.c (vm_make_env_object): accepts `ec`. * vm.c (rb_vm_get_ruby_level_next_cfp): ditto. * vm.c (rb_vm_make_proc): ditto. * vm.c (rb_vm_make_proc_lambda): ditto. * vm_core.h: some macros accept ec instead of th (and make them inline functions): * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW * RUBY_VM_END_CONTROL_FRAME * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P * eval.c (frame_func_id): constify for the first parameter. Modified files: trunk/compile.c trunk/error.c trunk/eval.c trunk/proc.c trunk/vm.c trunk/vm_backtrace.c trunk/vm_core.h trunk/vm_eval.c trunk/vm_insnhelper.c trunk/vm_method.c trunk/vm_trace.c Index: error.c =================================================================== --- error.c (revision 60440) +++ error.c (revision 60441) @@ -1297,10 +1297,9 @@ name_err_initialize(int argc, VALUE *arg https://github.com/ruby/ruby/blob/trunk/error.c#L1297 rb_call_super(argc, argv); rb_ivar_set(self, id_name, name); { - rb_thread_t *th = GET_THREAD(); + const rb_execution_context_t *ec = GET_EC(); rb_control_frame_t *cfp = - rb_vm_get_ruby_level_next_cfp(th, - RUBY_VM_PREVIOUS_CONTROL_FRAME(th->ec->cfp)); + rb_vm_get_ruby_level_next_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(ec->cfp)); if (cfp) iseqw = rb_iseqw_new(cfp->iseq); } rb_ivar_set(self, id_iseq, iseqw); Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 60440) +++ vm_insnhelper.c (revision 60441) @@ -369,7 +369,7 @@ rb_vm_bh_to_procval(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L369 switch (vm_block_handler_type(block_handler)) { case block_handler_type_iseq: case block_handler_type_ifunc: - return rb_vm_make_proc(th, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); + return rb_vm_make_proc(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); case block_handler_type_symbol: return rb_sym_to_proc(VM_BH_TO_SYMBOL(block_handler)); case block_handler_type_proc: @@ -1085,7 +1085,7 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1085 const int flag, const rb_num_t level, const VALUE throwobj) { const rb_control_frame_t *escape_cfp = NULL; - const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th); /* end of control frame pointer */ + const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th->ec); /* end of control frame pointer */ if (flag != 0) { /* do nothing */ @@ -2160,7 +2160,7 @@ current_method_entry(rb_thread_t *th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2160 do { cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); - if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th->ec, cfp)) { /* TODO: orphan block */ return top_cfp; } @@ -2528,7 +2528,7 @@ vm_block_handler_to_proc(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2528 break; case block_handler_type_iseq: case block_handler_type_ifunc: - blockarg = rb_vm_make_proc(th, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); + blockarg = rb_vm_make_proc(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); break; } } @@ -2772,8 +2772,8 @@ vm_invoke_block(rb_thread_t *th, rb_cont https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2772 static VALUE vm_make_proc_with_iseq(const rb_iseq_t *blockiseq) { - rb_thread_t *th = GET_THREAD(); - const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); struct rb_captured_block *captured; if (cfp == 0) { @@ -2783,7 +2783,7 @@ vm_make_proc_with_iseq(const rb_iseq_t * https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2783 captured = VM_CFP_TO_CAPTURED_BLOCK(cfp); captured->code.iseq = blockiseq; - return rb_vm_make_proc(th, captured, rb_cProc); + return rb_vm_make_proc(ec, captured, rb_cProc); } static VALUE Index: proc.c =================================================================== --- proc.c (revision 60440) +++ proc.c (revision 60441) @@ -749,7 +749,7 @@ proc_new(VALUE klass, int8_t is_lambda) https://github.com/ruby/ruby/blob/trunk/proc.c#L749 case block_handler_type_ifunc: case block_handler_type_iseq: - return rb_vm_make_proc_lambda(th, VM_BH_TO_CAPT_BLOCK(block_handler), klass, is_lambda); + return rb_vm_make_proc_lambda(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), klass, is_lambda); } VM_UNREACHABLE(proc_new); return Qnil; @@ -1923,7 +1923,7 @@ rb_mod_define_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/proc.c#L1923 break; case block_handler_type_iseq: case block_handler_type_ifunc: - body = rb_vm_make_proc_lambda(th, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc, TRUE); + body = rb_vm_make_proc_lambda(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc, TRUE); } #endif } Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 60440) +++ vm_backtrace.c (revision 60441) @@ -427,9 +427,9 @@ backtrace_each(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L427 void (*iter_cfunc)(void *arg, const rb_control_frame_t *cfp, ID mid), void *arg) { - rb_control_frame_t *last_cfp = th->ec->cfp; - rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(th); - rb_control_frame_t *cfp; + const rb_control_frame_t *last_cfp = th->ec->cfp; + const rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(th->ec); + const rb_control_frame_t *cfp; ptrdiff_t size, i; /* <- start_cfp (end control frame) @@ -1246,8 +1246,8 @@ int https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1246 rb_profile_frames(int start, int limit, VALUE *buff, int *lines) { int i; - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = th->ec->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(th); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = ec->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(ec); const rb_callable_method_entry_t *cme; for (i=0; i<limit && cfp != end_cfp;) { Index: eval.c =================================================================== --- eval.c (revision 60440) +++ eval.c (revision 60441) @@ -1062,7 +1062,7 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALU https://github.com/ruby/ruby/blob/trunk/eval.c#L1062 } static ID -frame_func_id(rb_control_frame_t *cfp) +frame_func_id(const rb_control_frame_t *cfp) { const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp); @@ -1158,13 +1158,13 @@ prev_frame_func(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L1158 ID rb_frame_last_func(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = th->ec->cfp; + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = ec->cfp; ID mid; while (!(mid = frame_func_id(cfp)) && (cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp), - !RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp))); + !RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(ec, cfp))); return mid; } @@ -1722,10 +1722,10 @@ top_using(VALUE self, VALUE module) https://github.com/ruby/ruby/blob/trunk/eval.c#L1722 } static const VALUE * -errinfo_place(rb_thread_t *th) +errinfo_place(const rb_thread_t *th) { - rb_control_frame_t *cfp = th->ec->cfp; - rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th); + const rb_control_frame_t *cfp = th->ec->cfp; + const rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th->ec); while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, end_cfp)) { if (VM_FRAME_RUBYFRAME_P(cfp)) { Index: vm_trace.c =================================================================== --- vm_trace.c (revision 60440) +++ vm_trace.c (revision 60441) @@ -735,7 +735,7 @@ static void https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L735 fill_path_and_lineno(rb_trace_arg_t *trace_arg) { if (trace_arg->path == Qundef) { - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(trace_arg->th, trace_arg->cfp); + rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(trace_arg->th->ec, trace_arg->cfp); if (cfp) { trace_arg->path = rb_iseq_path(cfp->iseq); Index: vm.c =================================================================== --- vm.c (revision 60440) +++ vm.c (revision 60441) @@ -38,7 +38,7 @@ rb_vm_search_cf_from_ep(const rb_thread_ https://github.com/ruby/ruby/blob/trunk/vm.c#L38 return NULL; } else { - const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th); /* end of control frame pointer */ + const rb_control_frame_t * const eocfp = RUBY_VM_END_CONTROL_FRAME(th->ec); /* end of control frame pointer */ while (cfp < eocfp) { if (cfp->ep == ep) { @@ -290,7 +290,7 @@ static void vm_collect_usage_insn(int in https://github.com/ruby/ruby/blob/trunk/vm.c#L290 static void vm_collect_usage_register(int reg, int isset); #endif -static VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp); +static VALUE vm_make_env_object(const rb_execution_context_t *ec, rb_control_frame_t *cfp); static VALUE vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler); @@ -480,14 +480,14 @@ vm_set_main_stack(rb_thread_t *th, const https://github.com/ruby/ruby/blob/trunk/vm.c#L480 /* save binding */ if (iseq->body->local_table_size > 0) { - vm_bind_update_env(toplevel_binding, bind, vm_make_env_object(th, th->ec->cfp)); + vm_bind_update_env(toplevel_binding, bind, vm_make_env_object(th->ec, th->ec->cfp)); } } rb_control_frame_t * rb_vm_get_binding_creatable_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp) { - while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th->ec, cfp)) { if (cfp->iseq) { return (rb_control_frame_t *)cfp; } @@ -497,9 +497,10 @@ rb_vm_get_binding_creatable_next_cfp(con https://github.com/ruby/ruby/blob/trunk/vm.c#L497 } rb_control_frame_t * -rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp) +rb_vm_get_ruby_level_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp) { - while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(ec, cfp)) bp(); + while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(ec, cfp)) { if (VM_FRAME_RUBYFRAME_P(cfp)) { return (rb_control_frame_t *)cfp; } @@ -517,7 +518,7 @@ vm_get_ruby_level_caller_cfp(const rb_th https://github.com/ruby/ruby/blob/trunk/vm.c#L518 cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); - while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th->ec, cfp)) { if (VM_FRAME_RUBYFRAME_P(cfp)) { return (rb_control_frame_t *)cfp; } @@ -616,12 +617,12 @@ check_env_value(const rb_env_t *env) https://github.com/ruby/ruby/blob/trunk/vm.c#L617 } static void -vm_block_handler_escape(rb_thread_t *th, VALUE block_handler, VALUE *procvalptr) +vm_block_handler_escape(const rb_execution_context_t *ec, VALUE block_handler, VALUE *procvalptr) { switch (vm_block_handler_type(block_handler)) { case block_handler_type_ifunc: case block_handler_type_iseq: - *procvalptr = rb_vm_make_proc(th, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); + *procvalptr = rb_vm_make_proc(ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc); return; case block_handler_type_symbol: @@ -634,7 +635,7 @@ vm_block_handler_escape(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L635 } static VALUE -vm_make_env_each(rb_thread_t *const th, rb_control_frame_t *const cfp) +vm_make_env_each(const rb_execution_context_t * const ec, rb_control_frame_t *const cfp) { VALUE blockprocval = Qfalse; const VALUE * const ep = cfp->ep; @@ -658,7 +659,7 @@ vm_make_env_each(rb_thread_t *const th, https://github.com/ruby/ruby/blob/trunk/vm.c#L659 VM_ASSERT(prev_cfp->ep != NULL); } - vm_make_env_each(th, prev_cfp); + vm_make_env_each(ec, prev_cfp); VM_FORCE_WRITE_SPECIAL_CONST(&ep[VM_ENV_DATA_INDEX_SPECVAL], VM_GUARDED_PREV_EP(prev_cfp->ep)); } } @@ -666,7 +667,7 @@ vm_make_env_each(rb_thread_t *const th, https://github.com/ruby/ruby/blob/trunk/vm.c#L667 VALUE block_handler = VM_ENV_BLOCK_HANDLER(ep); if (block_handler != VM_BLOCK_HANDLER_NONE) { - vm_block_handler_escape(th, block_handler, &blockprocval); + vm_block_handler_escape(ec, block_handler, &blockprocval); VM_STACK_ENV_WRITE(ep, VM_ENV_DATA_INDEX_SPECVAL, blockprocval); } } @@ -718,9 +719,9 @@ vm_make_env_each(rb_thread_t *const th, https://github.com/ruby/ruby/blob/trunk/vm.c#L719 } static VALUE -vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp) +vm_make_env_object(const rb_execution_context_t *ec, rb_control_frame_t *cfp) { - VALUE envval = vm_make_env_each(th, cfp); + VALUE envval = vm_make_env_each(ec, cfp); if (PROCDEBUG) { check_env_value((const rb_env_t *)envval); @@ -734,7 +735,7 @@ rb_vm_stack_to_heap(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L735 { rb_control_frame_t *cfp = th->ec->cfp; while ((cfp = rb_vm_get_binding_creatable_next_cfp(th, cfp)) != 0) { - vm_make_env_object(th, cfp); + vm_make_env_object(th->ec, cfp); cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); } } @@ -867,27 +868,27 @@ rb_proc_create(VALUE klass, const struct https://github.com/ruby/ruby/blob/trunk/vm.c#L868 } VALUE -rb_vm_make_proc(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass) +rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass) { - return rb_vm_make_proc_lambda(th, captured, klass, FALSE); + return rb_vm_make_proc_lambda(ec, captured, klass, FALSE); } VALUE -rb_vm_make_proc_lambda(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda) +rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda) { VALUE procval; if (!VM_ENV_ESCAPED_P(captured->ep)) { rb_control_frame_t *cfp = VM_CAPTURED_BLOCK_TO_CFP(captured); - vm_make_env_object(th, cfp); + vm_make_env_object(ec, cfp); } - VM_ASSERT(VM_EP_IN_HEAP_P(th->ec, captured->ep)); + VM_ASSERT(VM_EP_IN_HEAP_P(ec, captured->ep)); VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq) || imemo_type_p(captured->code.val, imemo_ifunc)); procval = rb_proc_create_from_captured(klass, captured, imemo_type(captured->code.val) == imemo_iseq ? block_type_iseq : block_type_ifunc, - (int8_t)th->ec->safe_level, FALSE, is_lambda); + (int8_t)ec->safe_level, FALSE, is_lambda); return procval; } @@ -897,7 +898,7 @@ VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L898 rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp) { rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp); - rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp); + rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th->ec, src_cfp); VALUE bindval, envval; rb_binding_t *bind; @@ -906,7 +907,7 @@ rb_vm_make_binding(rb_thread_t *th, cons https://github.com/ruby/ruby/blob/trunk/vm.c#L907 } while (1) { - envval = vm_make_env_object(th, cfp); + envval = vm_make_env_object(th->ec, cfp); if (cfp == ruby_level_cfp) { break; } @@ -961,7 +962,7 @@ rb_binding_add_dynavars(VALUE bindval, r https://github.com/ruby/ruby/blob/trunk/vm.c#L962 ALLOCV_END(idtmp); vm_set_eval_stack(th, iseq, 0, base_block); - vm_bind_update_env(bindval, bind, envval = vm_make_env_object(th, th->ec->cfp)); + vm_bind_update_env(bindval, bind, envval = vm_make_env_object(th->ec, th->ec->cfp)); rb_vm_pop_frame(th); env = (const rb_env_t *)envval; @@ -1193,7 +1194,7 @@ vm_normal_frame(rb_thread_t *th, rb_cont https://github.com/ruby/ruby/blob/trunk/vm.c#L1194 { while (cfp->pc == 0) { cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); - if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th->ec, cfp)) { return 0; } } @@ -1257,8 +1258,8 @@ rb_lastline_set(VALUE val) https://github.com/ruby/ruby/blob/trunk/vm.c#L1258 VALUE rb_sourcefilename(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp) { return rb_iseq_path(cfp->iseq); @@ -1271,8 +1272,8 @@ rb_sourcefilename(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L1272 const char * rb_sourcefile(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp) { return RSTRING_PTR(rb_iseq_path(cfp->iseq)); @@ -1285,8 +1286,8 @@ rb_sourcefile(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L1286 int rb_sourceline(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp) { return rb_vm_get_sourceline(cfp); @@ -1299,8 +1300,8 @@ rb_sourceline(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L1300 VALUE rb_source_location(int *pline) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp) { if (pline) *pline = rb_vm_get_sourceline(cfp); @@ -1323,21 +1324,20 @@ rb_source_loc(int *pline) https://github.com/ruby/ruby/blob/trunk/vm.c#L1324 rb_cref_t * rb_vm_cref(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp == NULL) { return NULL; } - return rb_vm_get_cref(cfp->ep); } rb_cref_t * rb_vm_cref_replace_with_duplicated_cref(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); rb_cref_t *cref = vm_cref_replace_with_duplicated_cref(cfp->ep); return cref; } @@ -1345,8 +1345,8 @@ rb_vm_cref_replace_with_duplicated_cref( https://github.com/ruby/ruby/blob/trunk/vm.c#L1345 const rb_cref_t * rb_vm_cref_in_context(VALUE self, VALUE cbase) { - rb_thread_t *th = GET_THREAD(); - const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); const rb_cref_t *cref; if (cfp->self != self) return NULL; if (!vm_env_cref_by_cref(cfp->ep)) return NULL; @@ -1370,8 +1370,8 @@ debug_cref(rb_cref_t *cref) https://github.com/ruby/ruby/blob/trunk/vm.c#L1370 VALUE rb_vm_cbase(void) { - rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec->cfp); + const rb_execution_context_t *ec = GET_EC(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (cfp == 0) { rb_raise(rb_eRuntimeError, "Can't call on top of Fiber or Thread"); Index: vm_core.h =================================================================== --- vm_core.h (revision 60440) +++ vm_core.h (revision 60441) @@ -1238,12 +1238,21 @@ VALUE rb_vm_frame_block_handler(const rb https://github.com/r (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/