1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_insnhelper.c: vm_invoke_block_opt_call

* vm_insnhelper.c (vm_invoke_block_opt_call): renamed with sliding
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-08 09:11:26 +00:00
parent 0948eb62e6
commit 380c84ea26

View file

@ -2050,13 +2050,19 @@ vm_call_opt_send(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct
static inline VALUE vm_invoke_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler); static inline VALUE vm_invoke_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler);
NOINLINE(static VALUE NOINLINE(static VALUE
vm_invoke_block_noinline(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, vm_invoke_block_opt_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler)); struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler));
static VALUE static VALUE
vm_invoke_block_noinline(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, vm_invoke_block_opt_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler) struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler)
{ {
int argc = calling->argc;
/* remove self */
if (argc > 0) MEMMOVE(&TOPN(argc), &TOPN(argc-1), VALUE, argc);
DEC_SP(1);
return vm_invoke_block(ec, reg_cfp, calling, ci, block_handler); return vm_invoke_block(ec, reg_cfp, calling, ci, block_handler);
} }
@ -2064,25 +2070,16 @@ static VALUE
vm_call_opt_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc) vm_call_opt_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
{ {
VALUE procval = calling->recv; VALUE procval = calling->recv;
int argc = calling->argc; return vm_invoke_block_opt_call(ec, reg_cfp, calling, ci, VM_BH_FROM_PROC(procval));
/* remove self */
if (argc > 0) MEMMOVE(&TOPN(argc), &TOPN(argc-1), VALUE, argc);
DEC_SP(1);
return vm_invoke_block_noinline(ec, reg_cfp, calling, ci, VM_BH_FROM_PROC(procval));
} }
static VALUE static VALUE
vm_call_opt_block_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc) vm_call_opt_block_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
{ {
int argc = calling->argc;
VALUE block_handler = VM_ENV_BLOCK_HANDLER(reg_cfp->ep); VALUE block_handler = VM_ENV_BLOCK_HANDLER(reg_cfp->ep);
if (BASIC_OP_UNREDEFINED_P(BOP_CALL, PROC_REDEFINED_OP_FLAG)) { if (BASIC_OP_UNREDEFINED_P(BOP_CALL, PROC_REDEFINED_OP_FLAG)) {
if (argc > 0) MEMMOVE(&TOPN(argc), &TOPN(argc-1), VALUE, argc); return vm_invoke_block_opt_call(ec, reg_cfp, calling, ci, block_handler);
DEC_SP(1);
return vm_invoke_block_noinline(ec, reg_cfp, calling, ci, block_handler);
} }
else { else {
calling->recv = rb_vm_bh_to_procval(ec, block_handler); calling->recv = rb_vm_bh_to_procval(ec, block_handler);