vm_pop_frame() accepts ec instead of th.

* vm_insnhelper.c (vm_pop_frame): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-10-26 10:55:24 +00:00
parent 9adf6064ce
commit 284d4c08d6
8 changed files with 21 additions and 21 deletions

2
eval.c
View File

@ -803,7 +803,7 @@ rb_raise_jump(VALUE mesg, VALUE cause)
VALUE self = cfp->self; VALUE self = cfp->self;
ID mid = me->called_id; ID mid = me->called_id;
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, me->def->original_id, mid, klass, Qnil); EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, me->def->original_id, mid, klass, Qnil);
rb_longjmp(th, TAG_RAISE, mesg, cause); rb_longjmp(th, TAG_RAISE, mesg, cause);

View File

@ -996,7 +996,7 @@ leave
RUBY_VM_CHECK_INTS(th); RUBY_VM_CHECK_INTS(th);
if (vm_pop_frame(th, GET_CFP(), GET_EP())) { if (vm_pop_frame(th->ec, GET_CFP(), GET_EP())) {
#if OPT_CALL_THREADED_CODE #if OPT_CALL_THREADED_CODE
th->retval = val; th->retval = val;
return 0; return 0;

16
vm.c
View File

@ -540,7 +540,7 @@ rb_vm_pop_cfunc_frame(void)
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, cfp->self, me->def->original_id, me->called_id, me->owner, Qnil); EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, cfp->self, me->def->original_id, me->called_id, me->owner, Qnil);
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id); RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
vm_pop_frame(th, cfp, cfp->ep); vm_pop_frame(th->ec, cfp, cfp->ep);
} }
void void
@ -552,7 +552,7 @@ rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
printf("skipped frame: %s\n", vm_frametype_name(th->ec->cfp)); printf("skipped frame: %s\n", vm_frametype_name(th->ec->cfp));
#endif #endif
if (VM_FRAME_TYPE(th->ec->cfp) != VM_FRAME_MAGIC_CFUNC) { if (VM_FRAME_TYPE(th->ec->cfp) != VM_FRAME_MAGIC_CFUNC) {
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
} }
else { /* unlikely path */ else { /* unlikely path */
rb_vm_pop_cfunc_frame(); rb_vm_pop_cfunc_frame();
@ -963,7 +963,7 @@ rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const I
vm_set_eval_stack(th, iseq, 0, base_block); vm_set_eval_stack(th, iseq, 0, base_block);
vm_bind_update_env(bindval, bind, envval = vm_make_env_object(th->ec, th->ec->cfp)); vm_bind_update_env(bindval, bind, envval = vm_make_env_object(th->ec, th->ec->cfp));
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
env = (const rb_env_t *)envval; env = (const rb_env_t *)envval;
return env->env; return env->env;
@ -1830,7 +1830,7 @@ vm_exec(rb_thread_t *th)
rb_vm_frame_method_entry(th->ec->cfp)->owner, rb_vm_frame_method_entry(th->ec->cfp)->owner,
rb_vm_frame_method_entry(th->ec->cfp)->def->original_id); rb_vm_frame_method_entry(th->ec->cfp)->def->original_id);
} }
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
} }
cfp = th->ec->cfp; cfp = th->ec->cfp;
@ -1864,7 +1864,7 @@ vm_exec(rb_thread_t *th)
result = THROW_DATA_VAL(err); result = THROW_DATA_VAL(err);
THROW_DATA_CATCH_FRAME_SET(err, cfp + 1); THROW_DATA_CATCH_FRAME_SET(err, cfp + 1);
hook_before_rewind(th, th->ec->cfp, TRUE, state, err); hook_before_rewind(th, th->ec->cfp, TRUE, state, err);
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
goto finish_vme; goto finish_vme;
} }
} }
@ -2008,13 +2008,13 @@ vm_exec(rb_thread_t *th)
hook_before_rewind(th, th->ec->cfp, FALSE, state, err); hook_before_rewind(th, th->ec->cfp, FALSE, state, err);
if (VM_FRAME_FINISHED_P(th->ec->cfp)) { if (VM_FRAME_FINISHED_P(th->ec->cfp)) {
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
th->ec->errinfo = (VALUE)err; th->ec->errinfo = (VALUE)err;
TH_TMPPOP_TAG(); TH_TMPPOP_TAG();
TH_JUMP_TAG(th, state); TH_JUMP_TAG(th, state);
} }
else { else {
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
goto exception_handler; goto exception_handler;
} }
} }
@ -2115,7 +2115,7 @@ rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg,
val = (*func)(arg); val = (*func)(arg);
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
return val; return val;
} }

View File

@ -698,7 +698,7 @@ raise_argument_error(rb_thread_t *th, const rb_iseq_t *iseq, const VALUE exc)
iseq->body->iseq_encoded, iseq->body->iseq_encoded,
th->ec->cfp->sp, 0, 0 /* stack_max */); th->ec->cfp->sp, 0, 0 /* stack_max */);
at = rb_threadptr_backtrace_object(th); at = rb_threadptr_backtrace_object(th);
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
} }
else { else {
at = rb_threadptr_backtrace_object(th); at = rb_threadptr_backtrace_object(th);

View File

@ -1509,7 +1509,7 @@ void rb_vm_inc_const_missing_count(void);
void rb_vm_gvl_destroy(rb_vm_t *vm); void rb_vm_gvl_destroy(rb_vm_t *vm);
VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc, VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
const VALUE *argv, const rb_callable_method_entry_t *me); const VALUE *argv, const rb_callable_method_entry_t *me);
void rb_vm_pop_frame(rb_thread_t *th); void rb_vm_pop_frame(rb_execution_context_t *ec);
void rb_thread_start_timer_thread(void); void rb_thread_start_timer_thread(void);
void rb_thread_stop_timer_thread(void); void rb_thread_stop_timer_thread(void);

View File

@ -87,7 +87,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, struct rb_calling_info *calling, cons
CHECK_CFP_CONSISTENCY("vm_call0_cfunc_with_frame"); CHECK_CFP_CONSISTENCY("vm_call0_cfunc_with_frame");
VM_PROFILE_UP(C2C_POPF); VM_PROFILE_UP(C2C_POPF);
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
} }
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, mid, me->owner, val); EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, mid, me->owner, val);
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id); RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);

View File

@ -271,22 +271,22 @@ rb_vm_push_frame(rb_execution_context_t *ec,
/* return TRUE if the frame is finished */ /* return TRUE if the frame is finished */
static inline int static inline int
vm_pop_frame(rb_thread_t *th, rb_control_frame_t *cfp, const VALUE *ep) vm_pop_frame(rb_execution_context_t *ec, rb_control_frame_t *cfp, const VALUE *ep)
{ {
VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS]; VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
if (VM_CHECK_MODE >= 4) rb_gc_verify_internal_consistency(); if (VM_CHECK_MODE >= 4) rb_gc_verify_internal_consistency();
if (VMDEBUG == 2) SDR(); if (VMDEBUG == 2) SDR();
th->ec->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); ec->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
return flags & VM_FRAME_FLAG_FINISH; return flags & VM_FRAME_FLAG_FINISH;
} }
void void
rb_vm_pop_frame(rb_thread_t *th) rb_vm_pop_frame(rb_execution_context_t *ec)
{ {
vm_pop_frame(th, th->ec->cfp, th->ec->cfp->ep); vm_pop_frame(ec, ec->cfp, ec->cfp->ep);
} }
/* method dispatch */ /* method dispatch */
@ -1691,7 +1691,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_
} }
} }
vm_pop_frame(th, cfp, cfp->ep); vm_pop_frame(th->ec, cfp, cfp->ep);
cfp = th->ec->cfp; cfp = th->ec->cfp;
sp_orig = sp = cfp->sp; sp_orig = sp = cfp->sp;
@ -1925,7 +1925,7 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb
CHECK_CFP_CONSISTENCY("vm_call_cfunc"); CHECK_CFP_CONSISTENCY("vm_call_cfunc");
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, ci->mid, me->owner, val); EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, ci->mid, me->owner, val);
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id); RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
@ -2551,7 +2551,7 @@ vm_yield_with_cfunc(rb_thread_t *th,
(VALUE)me, (VALUE)me,
0, th->ec->cfp->sp, 0, 0); 0, th->ec->cfp->sp, 0, 0);
val = (*ifunc->func)(arg, ifunc->data, argc, argv, blockarg); val = (*ifunc->func)(arg, ifunc->data, argc, argv, blockarg);
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
return val; return val;
} }

View File

@ -352,7 +352,7 @@ rb_threadptr_exec_event_hooks_orig(rb_trace_arg_t *trace_arg, int pop_p)
if (VM_FRAME_FINISHED_P(th->ec->cfp)) { if (VM_FRAME_FINISHED_P(th->ec->cfp)) {
th->ec->tag = th->ec->tag->prev; th->ec->tag = th->ec->tag->prev;
} }
rb_vm_pop_frame(th); rb_vm_pop_frame(th->ec);
} }
TH_JUMP_TAG(th, state); TH_JUMP_TAG(th, state);
} }