mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
66296d3774
commit
ae739c75f8
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Sep 30 15:47:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_args.c (vm_caller_setup_arg_block): bypass Symbol#to_proc
|
||||
call to optimize symbol block passing.
|
||||
|
||||
Wed Sep 30 01:34:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_free): fix memory leak at syntax error when
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue