summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-03 04:50:14 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-03 04:50:14 (GMT)
commitfc2764e58c0265e5ba71909b9ed771ec381fa872 (patch)
tree220c19f4f565c436f347f4c0dbc89c2fc8c76258 /insns.def
parentc0181f31fff58249e30fef7b25f0f4fe39484f43 (diff)
insns.def: unwrap vm_exec for yield
Outer vm_exec can catch longjmp. We don't need to call vm_exec first here. This optimizes JIT-ed yield: * Benchmark script ``` require 'benchmark_driver' Benchmark.driver do |x| x.prelude %{ def yielder yield + 1 end } x.report 'yielder', %{ yielder { 1 } } x.loop_count 300_000_000 x.rbenv 'before', 'before,--jit', 'after', 'after,--jit' x.verbose end ``` * Result before: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux] before,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux] last_commit=insns.def: unwrap vm_exec for yield after,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux] last_commit=insns.def: unwrap vm_exec for yield Calculating ------------------------------------- before before,--jit after after,--jit yielder 37.214M 29.222M 35.904M 38.035M i/s - 300.000M times in 8.061581s 10.266312s 8.355716s 7.887447s Comparison: yielder after,--jit: 38035121.0 i/s before: 37213544.0 i/s - 1.02x slower after: 35903565.7 i/s - 1.06x slower before,--jit: 29221787.6 i/s - 1.30x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def4
1 files changed, 2 insertions, 2 deletions
diff --git a/insns.def b/insns.def
index 3b65942..3fdfbdf 100644
--- a/insns.def
+++ b/insns.def
@@ -819,8 +819,8 @@ invokeblock
}
val = vm_invoke_block(ec, GET_CFP(), &calling, ci, block_handler);
- if (val == Qundef) {
- EXEC_EC_CFP(TRUE);
+ if (val == Qundef && (val = mjit_exec(ec)) == Qundef) {
+ EXEC_EC_CFP(FALSE);
}
}