ruby-changes:61458
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Wed, 3 Jun 2020 16:14:04 +0900 (JST)
Subject: [ruby-changes:61458] 796f9edae0 (master): vm_invoke_block: insertion of unused args
https://git.ruby-lang.org/ruby.git/commit/?id=796f9edae0 From 796f9edae0a48c2949345febd8189809fbfdb192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 26 May 2020 10:22:51 +0900 Subject: 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. diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 5e9df01..2d9b96b 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 https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3386 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, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3410 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, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3425 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) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3460 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, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3476 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; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/