aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-12 03:39:36 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-12 03:39:36 +0000
commit6e969a106e9a5aefcef9253a0692d40c4330c980 (patch)
treee5700381924f2b523d727526f1f7fb7849e4e141 /compile.c
parent90fcac16acc37a0edfbf8b038aafd1d1eaa4a988 (diff)
downloadruby-6e969a106e9a5aefcef9253a0692d40c4330c980.tar.gz
make opt_str_freeze leaf
Simply use DISPATCH_ORIGINAL_INSN instead of rb_funcall. This is, when possible, overall performant because method dispatch results are cached inside of CALL_CACHE. Should also be good for JIT. ---- trunk: ruby 2.6.0dev (2018-09-12 trunk 64689) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-09-12 leaf-insn 64688) [x86_64-darwin15] last_commit=make opt_str_freeze leaf Calculating ------------------------------------- trunk ours vm2_freezestring 5.440M 31.411M i/s - 6.000M times in 1.102968s 0.191017s Comparison: vm2_freezestring ours: 31410864.5 i/s trunk: 5439865.4 i/s - 5.77x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index c16721e080..9ce89bccf1 100644
--- a/compile.c
+++ b/compile.c
@@ -6384,10 +6384,14 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
VALUE str = freeze_literal(iseq, node->nd_recv->nd_lit);
if (node->nd_mid == idUMinus) {
- ADD_INSN1(ret, line, opt_str_uminus, str);
+ ADD_INSN3(ret, line, opt_str_uminus, str,
+ new_callinfo(iseq, idUMinus, 0, 0, NULL, FALSE),
+ Qundef /* CALL_CACHE */);
}
else {
- ADD_INSN1(ret, line, opt_str_freeze, str);
+ ADD_INSN3(ret, line, opt_str_freeze, str,
+ new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE),
+ Qundef /* CALL_CACHE */);
}
if (popped) {
ADD_INSN(ret, line, pop);