diff --git a/tool/ruby_vm/models/bare_instructions.rb b/tool/ruby_vm/models/bare_instructions.rb index 5c27af3a38..740949c752 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 5143f7bcb4..f33e60cf19 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) {