summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-05-26 10:22:51 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-03 16:13:47 +0900
commit796f9edae0a48c2949345febd8189809fbfdb192 (patch)
tree8cd58b49943b3c9a532e1494255164a9d9fe095d /vm_insnhelper.c
parentec87a58d556c83bbec44c2df8444d95df56379a4 (diff)
vm_invoke_block: insertion of unused args
This makes it possible for vm_invoke_block to pass its passed arguments verbatimly to calling functions. Because they are tail-called the function calls can be strength-recuced into indirect jumps, which is a huge win.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3152
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 5e9df01317..2d9b96b5e7 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3386,7 +3386,7 @@ vm_yield_setup_args(rb_execution_context_t *ec, const rb_iseq_t *iseq, const int
static VALUE
vm_invoke_iseq_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_callinfo *ci,
- int is_lambda, VALUE block_handler)
+ bool is_lambda, VALUE block_handler)
{
const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
@@ -3410,7 +3410,7 @@ vm_invoke_iseq_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
static VALUE
vm_invoke_symbol_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_callinfo *ci,
- VALUE block_handler)
+ MAYBE_UNUSED(bool is_lambda), VALUE block_handler)
{
VALUE val;
int argc;
@@ -3425,7 +3425,7 @@ vm_invoke_symbol_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
static VALUE
vm_invoke_ifunc_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_callinfo *ci,
- VALUE block_handler)
+ MAYBE_UNUSED(bool is_lambda), VALUE block_handler)
{
VALUE val;
int argc;
@@ -3460,7 +3460,7 @@ vm_proc_to_block_handler(VALUE procval)
static VALUE
vm_invoke_proc_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_callinfo *ci,
- VALUE block_handler)
+ MAYBE_UNUSED(bool is_lambda), VALUE block_handler)
{
return vm_invoke_block(ec, reg_cfp, calling, ci,
block_proc_is_lambda(VM_BH_TO_PROC(block_handler)),
@@ -3476,11 +3476,11 @@ vm_invoke_block(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
case block_handler_type_iseq:
return vm_invoke_iseq_block(ec, reg_cfp, calling, ci, is_lambda, block_handler);
case block_handler_type_ifunc:
- return vm_invoke_ifunc_block(ec, reg_cfp, calling, ci, block_handler);
+ return vm_invoke_ifunc_block(ec, reg_cfp, calling, ci, is_lambda, block_handler);
case block_handler_type_proc:
- return vm_invoke_proc_block(ec, reg_cfp, calling, ci, block_handler);
+ return vm_invoke_proc_block(ec, reg_cfp, calling, ci, is_lambda, block_handler);
case block_handler_type_symbol:
- return vm_invoke_symbol_block(ec, reg_cfp, calling, ci, block_handler);
+ return vm_invoke_symbol_block(ec, reg_cfp, calling, ci, is_lambda, block_handler);
}
VM_UNREACHABLE(vm_invoke_block: unreachable);
return Qnil;