ruby-changes:44354
From: nobu <ko1@a...>
Date: Sat, 15 Oct 2016 18:06:01 +0900 (JST)
Subject: [ruby-changes:44354] nobu:r56427 (trunk): vm_args.c: cache procs
nobu 2016-10-15 18:05:58 +0900 (Sat, 15 Oct 2016) New Revision: 56427 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56427 Log: vm_args.c: cache procs * vm_args.c (vm_caller_setup_arg_block): cache proc with refinements. [Feature #9451] Modified files: trunk/vm_args.c Index: vm_args.c =================================================================== --- vm_args.c (revision 56426) +++ vm_args.c (revision 56427) @@ -828,7 +828,14 @@ vm_caller_setup_arg_block(const rb_threa https://github.com/ruby/ruby/blob/trunk/vm_args.c#L828 if (SYMBOL_P(block_code) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) { const rb_cref_t *cref = vm_env_cref(reg_cfp->ep); if (cref && !NIL_P(cref->refinements)) { - block_code = rb_func_proc_new(refine_sym_proc_call, block_code); + VALUE ref = cref->refinements; + VALUE func = rb_hash_lookup(ref, block_code); + if (NIL_P(func)) { + /* TODO: limit cached funcs */ + func = rb_func_proc_new(refine_sym_proc_call, block_code); + rb_hash_aset(ref, block_code, func); + } + block_code = func; } calling->block_handler = block_code; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/