summaryrefslogtreecommitdiff
path: root/vm_args.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-30 06:47:18 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-30 06:47:18 (GMT)
commitae739c75f859e79eeb9b983573241a3f428d52d8 (patch)
tree0e070df292a27b913eeff25dffdfc1bd58a29fd4 /vm_args.c
parent66296d37745c42cf12e056a0c78a7831c4989c78 (diff)
vm_args.c: optimize symbol block passing
* vm_args.c (vm_caller_setup_arg_block): bypass Symbol#to_proc call to optimize symbol block passing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_args.c b/vm_args.c
index bc336dd..1ed98b5 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -776,7 +776,12 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
proc = *(--reg_cfp->sp);
- if (proc != Qnil) {
+ if (SYMBOL_P(proc) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
+ calling->blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp);
+ calling->blockptr->iseq = (rb_iseq_t *)IFUNC_NEW(rb_sym_proc_call, SYM2ID(proc), 0);
+ calling->blockptr->proc = 0;
+ }
+ else if (!NIL_P(proc)) {
if (!rb_obj_is_proc(proc)) {
VALUE b;
b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");