summaryrefslogtreecommitdiff
path: root/insns.def
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
commit02b52b2733baf5a65b0e40a376cdb1bba61c8d6c (patch)
treee5700381924f2b523d727526f1f7fb7849e4e141 /insns.def
parent33c8171c65ac0f66d1c096561e253f6f068fc85c (diff)
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 'insns.def')
-rw-r--r--insns.def22
1 files changed, 18 insertions, 4 deletions
diff --git a/insns.def b/insns.def
index ced6054cce..d606fa722b 100644
--- a/insns.def
+++ b/insns.def
@@ -753,22 +753,36 @@ send
DEFINE_INSN
opt_str_freeze
-(VALUE str)
+(VALUE str, CALL_INFO ci, CALL_CACHE cc)
()
(VALUE val)
-// attr bool leaf = BASIC_OP_UNREDEFINED_P(BOP_FREEZE, STRING_REDEFINED_OP_FLAG);
{
val = vm_opt_str_freeze(str, BOP_FREEZE, idFreeze);
+
+ if (val == Qundef) {
+ PUSH(str);
+#ifndef MJIT_HEADER
+ ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
+ DISPATCH_ORIGINAL_INSN(opt_send_without_block);
+ }
}
DEFINE_INSN
opt_str_uminus
-(VALUE str)
+(VALUE str, CALL_INFO ci, CALL_CACHE cc)
()
(VALUE val)
-// attr bool leaf = BASIC_OP_UNREDEFINED_P(BOP_UMINUS, STRING_REDEFINED_OP_FLAG);
{
val = vm_opt_str_freeze(str, BOP_UMINUS, idUMinus);
+
+ if (val == Qundef) {
+ PUSH(str);
+#ifndef MJIT_HEADER
+ ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
+ DISPATCH_ORIGINAL_INSN(opt_send_without_block);
+ }
}
DEFINE_INSN