diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-11 15:14:56 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-11 15:14:56 +0000 |
commit | 0325145f4c75bb832ed2f38fc51542e1260bafc6 (patch) | |
tree | 44ea8711b1a76fe3f457e63f46e2af715184632c /tool/ruby_vm | |
parent | 9f6e9b40d395355b678ce3bdd4d62de5dcecdfb3 (diff) | |
download | ruby-0325145f4c75bb832ed2f38fc51542e1260bafc6.tar.gz |
_mjit_compile_insn.erb: move pc on JIT cancel
if and only if it's not moved yet, to avoid potential bugs in the future.
_mjit_compile_send.erb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_insn.erb | 3 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb | 1 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_send.erb | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/tool/ruby_vm/views/_mjit_compile_insn.erb b/tool/ruby_vm/views/_mjit_compile_insn.erb index cb66e034b3..203c60476c 100644 --- a/tool/ruby_vm/views/_mjit_compile_insn.erb +++ b/tool/ruby_vm/views/_mjit_compile_insn.erb @@ -7,6 +7,7 @@ % # details. fprintf(f, "{\n"); { + MAYBE_UNUSED(int pc_moved_p) = FALSE; % # compiler: Prepare operands which may be used by `insn.call_attribute` % insn.opes.each_with_index do |ope, i| MAYBE_UNUSED(<%= ope.fetch(:decl) %>) = (<%= ope.fetch(:type) %>)operands[<%= i %>]; @@ -62,7 +63,7 @@ % unless insn.always_leaf? fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS)) {\n"); fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %> + 1); - if (!body->catch_except_p) { + if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } fprintf(f, " goto cancel;\n"); 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 f33e60cf19..08aeaee69f 100644 --- a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb +++ b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb @@ -8,6 +8,7 @@ % # 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)); */ + pc_moved_p = TRUE; } % % # JIT: move sp to use or preserve stack variables diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index 3f6f6f106f..1c737a1fe3 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -8,6 +8,7 @@ % % # Optimized case of send / opt_send_without_block instructions. { + MAYBE_UNUSED(int pc_moved_p) = FALSE; % # compiler: Prepare operands which may be used by `insn.call_attribute` % insn.opes.each_with_index do |ope, i| MAYBE_UNUSED(<%= ope.fetch(:decl) %>) = (<%= ope.fetch(:type) %>)operands[<%= i %>]; @@ -72,7 +73,7 @@ % # JIT: We should evaluate ISeq modified for TracePoint if it's enabled. Note: This is slow. fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS)) {\n"); fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %> + 1); - if (!body->catch_except_p) { + if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } fprintf(f, " goto cancel;\n"); |