diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-05 17:51:10 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-05 17:51:10 +0000 |
commit | af041136d7035b26b065a2abf00748724f5313be (patch) | |
tree | 530e371b108e4a193b9859aad5e1f1c95ee24392 /insns.def | |
parent | 1966617674ddc9a43de7923f15b73cf12e654915 (diff) | |
download | ruby-af041136d7035b26b065a2abf00748724f5313be.tar.gz |
Speedup `Proc#call` [Feature #14318]
* vm_insnhelper.c (vm_call_opt_call): do same process of `yield` instead of
invoking `Proc`.
* vm_insnhelper.c (vm_invoke_block): invoke given block handler instead of
using a block handler in the current frame.
Also do not check blcok handler here (caller should check it).
* insns.def (invokeblock): catch up this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -947,11 +947,18 @@ invokeblock (VALUE val) // inc += 1 - ci->orig_argc; { struct rb_calling_info calling; + VALUE block_handler; + calling.argc = ci->orig_argc; calling.block_handler = VM_BLOCK_HANDLER_NONE; calling.recv = Qundef; /* should not be used */ - val = vm_invoke_block(ec, GET_CFP(), &calling, ci); + block_handler = VM_CF_BLOCK_HANDLER(GET_CFP()); + if (block_handler == VM_BLOCK_HANDLER_NONE) { + rb_vm_localjump_error("no block given (yield)", Qnil, 0); + } + + val = vm_invoke_block(ec, GET_CFP(), &calling, ci, block_handler); if (val == Qundef) { RESTORE_REGS(); NEXT_INSN(); |