Skip to content

Commit

Permalink
[Spesh] Move annotations to istrue when split from if_o
Browse files Browse the repository at this point in the history
In commit c7774e3 we unconditionally split if_o/unless_o into
istrue + if_i/unless_i, which fixed rakudo issue #1483.

However, the annotations that would indicate the start of the if_o
instruction, would now inadvertently be placed in the middle of the
split instruction (between istrue and if_i). This would then
presumably fail, e.g. when the istrue would throw an exception (frame
handler would exclude it) or the exception would be 'caught' between
them (FH_GOTO would point between istrue/if_i rather than before).

I couldn't find any case where the frame handler annotation should be
on the if_i rather than the istrue, so that's what I changed to do.
I believe this fixes MoarVM issue #804.
  • Loading branch information
bdw committed Feb 18, 2018
1 parent 8d94732 commit 22d2db5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/spesh/optimize.c
Expand Up @@ -570,6 +570,10 @@ static void decompose_object_conditional(MVMThreadContext *tc, MVMSpeshGraph *g,
MVM_spesh_use_facts(tc, g, flag_facts);
MVM_spesh_manipulate_release_temp_reg(tc, g, temp);

/* Now that we *have* decomposed the if_o, annotations should be moved to
* the new_ins */
new_ins->annotations = ins->annotations;
ins->annotations = NULL;

/* If the boolification mode was "not type object" then we might know
* that from the facts, and may even be able to elimiante this
Expand Down
21 changes: 10 additions & 11 deletions tools/jit-bisect.pl
Expand Up @@ -162,6 +162,12 @@ sub bisect {
)} if $OPTS{spesh};
$ENV{MVM_SPESH_BLOCKING} = 1;

# I find that the addition of the MVM_SPESH_LOG / MVM_JIT_LOG
# environment variable can sometimes change the spesh order of
# frames. So let's add it always so that when we run it for logging
# output, we don't accidentally log the wrong frame.
$ENV{$_} = File::Spec->devnull for qw(MVM_SPESH_LOG MVM_JIT_LOG);

quietly { run_with(\@command, {}, $timeout) } or do {
die "This program is quite alright";
};
Expand Down Expand Up @@ -197,21 +203,14 @@ sub bisect {
printf STDERR ("SPESH Broken frame: %d.\n", $last_good_frame);

# alright, get a spesh diff
my ($good_log, $bad_log) = map sprintf("spesh-%04d.txt", $_), ($last_good_frame, $last_good_frame+1);
printf STDERR ("SPESH Acquiring log: %s\n", $good_log);
run_with(\@command, {
%$spesh_flags,
MVM_SPESH_LOG => sprintf('spesh-%04d.txt', $last_good_frame),
MVM_SPESH_LIMIT => $last_good_frame
}, $timeout);

printf STDERR ("SPESH Acquiring log: %s\n", $bad_log);
my $log_file = sprintf("spesh-%04d.txt", $last_good_frame+1);
printf STDERR ("SPESH Acquiring log: %s\n", $log_file);
run_with(\@command, {
%$spesh_flags,
MVM_SPESH_LOG => $bad_log,
MVM_SPESH_LOG => $log_file,
MVM_SPESH_LIMIT => $last_good_frame + 1
}, $timeout);
print STDERR "Done\n";
print STDERR "Done\n";
} else {
my $last_good_frame = bisect('MVM_JIT_EXPR_LAST_FRAME', \@command, {}, $timeout);
my $last_good_block = bisect('MVM_JIT_EXPR_LAST_BB', \@command, {
Expand Down

0 comments on commit 22d2db5

Please sign in to comment.