From c2eee0aab3ab0961031fa23dbac24c5966421b5c Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 26 Oct 2017 10:53:42 +0000 Subject: vm_push_frame() accepts `ec` instead of `th`. * vm_insnhelper.c (vm_push_frame): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- insns.def | 2 +- vm.c | 14 +++++++------- vm_args.c | 2 +- vm_eval.c | 2 +- vm_insnhelper.c | 47 ++++++++++++++++------------------------------- 5 files changed, 26 insertions(+), 41 deletions(-) diff --git a/insns.def b/insns.def index e7e4ffd5ec..766870af53 100644 --- a/insns.def +++ b/insns.def @@ -835,7 +835,7 @@ defineclass rb_iseq_check(class_iseq); /* enter scope */ - vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass, + vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass, GET_BLOCK_HANDLER(), (VALUE)vm_cref_push(th, klass, NULL, FALSE), class_iseq->body->iseq_encoded, GET_SP(), diff --git a/vm.c b/vm.c index 9349cc2d4d..26031f9550 100644 --- a/vm.c +++ b/vm.c @@ -449,7 +449,7 @@ vm_set_top_stack(rb_thread_t *th, const rb_iseq_t *iseq) } /* for return */ - vm_push_frame(th, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, th->top_self, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, th->top_self, VM_BLOCK_HANDLER_NONE, (VALUE)vm_cref_new_toplevel(th), /* cref or me */ iseq->body->iseq_encoded, th->ec->cfp->sp, @@ -459,7 +459,7 @@ vm_set_top_stack(rb_thread_t *th, const rb_iseq_t *iseq) static void vm_set_eval_stack(rb_thread_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block) { - vm_push_frame(th, iseq, VM_FRAME_MAGIC_EVAL | VM_FRAME_FLAG_FINISH, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_EVAL | VM_FRAME_FLAG_FINISH, vm_block_self(base_block), VM_GUARDED_PREV_EP(vm_block_ep(base_block)), (VALUE)cref, /* cref or me */ iseq->body->iseq_encoded, @@ -976,7 +976,7 @@ invoke_block(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct rb { int arg_size = iseq->body->param.size; - vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH, self, + vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_FINISH, self, VM_GUARDED_PREV_EP(captured->ep), (VALUE)cref, /* cref or method */ iseq->body->iseq_encoded + opt_pc, @@ -993,7 +993,7 @@ invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct int arg_size = iseq->body->param.size; VALUE ret; - vm_push_frame(th, iseq, type | VM_FRAME_FLAG_BMETHOD, self, + vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_BMETHOD, self, VM_GUARDED_PREV_EP(captured->ep), (VALUE)me, iseq->body->iseq_encoded + opt_pc, @@ -1990,7 +1990,7 @@ vm_exec(rb_thread_t *th) /* push block frame */ cfp->sp[0] = (VALUE)err; - vm_push_frame(th, catch_iseq, VM_FRAME_MAGIC_RESCUE, + vm_push_frame(th->ec, catch_iseq, VM_FRAME_MAGIC_RESCUE, cfp->self, VM_GUARDED_PREV_EP(cfp->ep), 0, /* cref or me */ @@ -2108,7 +2108,7 @@ rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_iseq_t *iseq = rb_iseq_new(0, filename, filename, Qnil, 0, ISEQ_TYPE_TOP); VALUE val; - vm_push_frame(th, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, recv, block_handler, (VALUE)vm_cref_new_toplevel(th), /* cref or me */ 0, reg_cfp->sp, 0, 0); @@ -2546,7 +2546,7 @@ th_init(rb_thread_t *th, VALUE self) th->ec->cfp = (void *)(th->ec->vm_stack + th->ec->vm_stack_size); - vm_push_frame(th, 0 /* dummy iseq */, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_CFRAME /* dummy frame */, + vm_push_frame(th->ec, 0 /* dummy iseq */, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_CFRAME /* dummy frame */, Qnil /* dummy self */, VM_BLOCK_HANDLER_NONE /* dummy block ptr */, 0 /* dummy cref/me */, 0 /* dummy pc */, th->ec->vm_stack, 0, 0); diff --git a/vm_args.c b/vm_args.c index 6eff1a4939..b37ce65b47 100644 --- a/vm_args.c +++ b/vm_args.c @@ -693,7 +693,7 @@ raise_argument_error(rb_thread_t *th, const rb_iseq_t *iseq, const VALUE exc) VALUE at; if (iseq) { - vm_push_frame(th, iseq, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL, Qnil /* self */, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL, Qnil /* self */, VM_BLOCK_HANDLER_NONE /* specval*/, Qfalse /* me or cref */, iseq->body->iseq_encoded, th->ec->cfp->sp, 0, 0 /* stack_max */); diff --git a/vm_eval.c b/vm_eval.c index 8e5b6689e9..3cf000fbe9 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -76,7 +76,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, struct rb_calling_info *calling, cons { rb_control_frame_t *reg_cfp = th->ec->cfp; - vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv, + vm_push_frame(th->ec, 0, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv, block_handler, (VALUE)me, 0, reg_cfp->sp, 0, 0); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 393e930b3b..b19047fd22 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -197,16 +197,16 @@ vm_check_frame(VALUE type, #endif /* VM_CHECK_MODE > 0 */ static inline rb_control_frame_t * -vm_push_frame_(rb_execution_context_t *ec, - const rb_iseq_t *iseq, - VALUE type, - VALUE self, - VALUE specval, - VALUE cref_or_me, - const VALUE *pc, - VALUE *sp, - int local_size, - int stack_max) +vm_push_frame(rb_execution_context_t *ec, + const rb_iseq_t *iseq, + VALUE type, + VALUE self, + VALUE specval, + VALUE cref_or_me, + const VALUE *pc, + VALUE *sp, + int local_size, + int stack_max) { rb_control_frame_t *const cfp = ec->cfp - 1; int i; @@ -254,21 +254,6 @@ vm_push_frame_(rb_execution_context_t *ec, return cfp; } -static rb_control_frame_t * -vm_push_frame(rb_thread_t *th, - const rb_iseq_t *iseq, - VALUE type, - VALUE self, - VALUE specval, - VALUE cref_or_me, - const VALUE *pc, - VALUE *sp, - int local_size, - int stack_max) -{ - return vm_push_frame_(th->ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); -} - rb_control_frame_t * rb_vm_push_frame(rb_execution_context_t *ec, const rb_iseq_t *iseq, @@ -281,7 +266,7 @@ rb_vm_push_frame(rb_execution_context_t *ec, int local_size, int stack_max) { - return vm_push_frame_(ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); + return vm_push_frame(ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); } /* return TRUE if the frame is finished */ @@ -1674,7 +1659,7 @@ vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_ca VALUE *sp = argv + param_size; cfp->sp = argv - 1 /* recv */; - vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling->recv, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling->recv, calling->block_handler, (VALUE)me, iseq->body->iseq_encoded + opt_pc, sp, local_size - param_size, @@ -1720,7 +1705,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_ *sp++ = src_argv[i]; } - vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL | finish_flag, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL | finish_flag, calling->recv, calling->block_handler, (VALUE)me, iseq->body->iseq_encoded + opt_pc, sp, iseq->body->local_table_size - iseq->body->param.size, @@ -1928,7 +1913,7 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->def->original_id); EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, ci->mid, me->owner, Qundef); - vm_push_frame(th, NULL, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv, + vm_push_frame(th->ec, NULL, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv, block_handler, (VALUE)me, 0, th->ec->cfp->sp, 0, 0); @@ -2559,7 +2544,7 @@ vm_yield_with_cfunc(rb_thread_t *th, blockarg = vm_block_handler_to_proc(th, block_handler); - vm_push_frame(th, (const rb_iseq_t *)captured->code.ifunc, + vm_push_frame(th->ec, (const rb_iseq_t *)captured->code.ifunc, VM_FRAME_MAGIC_IFUNC | VM_FRAME_FLAG_CFRAME, self, VM_GUARDED_PREV_EP(captured->ep), @@ -2676,7 +2661,7 @@ vm_invoke_iseq_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, SET_SP(rsp); - vm_push_frame(th, iseq, + vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0), captured->self, VM_GUARDED_PREV_EP(captured->ep), 0, -- cgit v1.2.3