1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

_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
This commit is contained in:
k0kubun 2018-09-11 15:14:56 +00:00
parent 9f6e9b40d3
commit 0325145f4c
3 changed files with 5 additions and 2 deletions

View file

@ -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");

View file

@ -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

View file

@ -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");