From 7fd11834676eb4df34f7160aed1cdf798e60d0b9 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 7 Jan 2018 19:18:49 +0000 Subject: Speedup `block.call` [Feature #14330] * insns.def (getblockparamproxy): introduce new instruction to return the `rb_block_param_proxy` object if possible. This object responds to `call` method and invoke given block (completely similar to `yield`). * method.h (OPTIMIZED_METHOD_TYPE_BLOCK_CALL): add new optimized call type which is for `rb_block_param_proxy.cal`. * vm_insnhelper.c (vm_call_method_each_type): ditto. * vm_insnhelper.c (vm_call_opt_block_call): ditto. * vm_core.h (BOP_CALL, PROC_REDEFINED_OP_FLAG): add check for `Proc#call` redefinition. * compile.c (iseq_compile_each0): compile to use new insn `getblockparamproxy` for method call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index bbb52d4ce1..a08e8a6777 100644 --- a/vm_core.h +++ b/vm_core.h @@ -483,6 +483,7 @@ enum ruby_basic_operators { BOP_UMINUS, BOP_MAX, BOP_MIN, + BOP_CALL, BOP_LAST_ }; @@ -619,6 +620,7 @@ typedef struct rb_vm_struct { #define NIL_REDEFINED_OP_FLAG (1 << 9) #define TRUE_REDEFINED_OP_FLAG (1 << 10) #define FALSE_REDEFINED_OP_FLAG (1 << 11) +#define PROC_REDEFINED_OP_FLAG (1 << 12) #define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0)) -- cgit v1.2.3