summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-11 12:53:52 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-11 12:53:52 (GMT)
commit67bd8fb36b56858cb35aa05c5279b6f281954935 (patch)
treee9b5b76ea81ee725fbc49a727f9026b9f69743ce /tool
parent24e30ef76e33449f72be8387cbcac5f5d21e668d (diff)
_mjit_compile_pc_and_sp.erb: skip moving pc
when catch_except_p is false and insn.always_leaf? is true (never makes arbitrary method call in the insn). On Optcarrot, unfortunately this didn't have measureable performance impact. But still this is a good direction since it becomes much faster when marking all insns as always leaf. bare_instructions.rb: add `#always_leaf?` that indicates the insn can always be considered as leaf. Using dynamic leaf for JIT would be hard since it requires to discard outdated code somehow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/ruby_vm/models/bare_instructions.rb4
-rw-r--r--tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb6
2 files changed, 8 insertions, 2 deletions
diff --git a/tool/ruby_vm/models/bare_instructions.rb b/tool/ruby_vm/models/bare_instructions.rb
index 5c27af3..740949c 100755
--- a/tool/ruby_vm/models/bare_instructions.rb
+++ b/tool/ruby_vm/models/bare_instructions.rb
@@ -105,6 +105,10 @@ class RubyVM::BareInstructions
/\b(false|0)\b/ !~ @attrs['handles_sp'].expr.expr
end
+ def always_leaf?
+ @attrs['leaf'].expr.expr == 'true;'
+ end
+
def complicated_return_values?
@sig[:ret].any? {|i| i == '...' }
end
diff --git a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb
index 5143f7b..f33e60c 100644
--- a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb
+++ b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb
@@ -5,8 +5,10 @@
% # conditions mentioned in the file COPYING are met. Consult the file for
% # details.
%
-% # JIT: Move pc so that catch table lookup condition is met, and for #caller_locations and rb_profile_frames.
- fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
+% # JIT: Move pc for catch table on catch_except_p, and for #caller_locations and rb_profile_frames on !insn.always_leaf?
+ if (body->catch_except_p || <%= insn.always_leaf? ? 'FALSE' : 'TRUE' %>) {
+ fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
+ }
%
% # JIT: move sp to use or preserve stack variables
if (status->local_stack_p) {