aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-11-19 18:22:44 +0100
committerBjörn Gustavsson <[email protected]>2013-12-13 12:52:06 +0100
commit8a0b31772fe73503a989df3212546f2098308fa7 (patch)
treecc62e6575326faf61d8ce86bc1d0af725aee94ee /lib
parent27885492f26bc19479ea7f86b15434f4882d67fe (diff)
downloadotp-8a0b31772fe73503a989df3212546f2098308fa7.tar.gz
otp-8a0b31772fe73503a989df3212546f2098308fa7.tar.bz2
otp-8a0b31772fe73503a989df3212546f2098308fa7.zip
Keep exit blocks in order when moving them in beam_jump
This makes applying the pass a second time a no-op.
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/beam_jump.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl
index b29a3565e4..d57fb80ac2 100644
--- a/lib/compiler/src/beam_jump.erl
+++ b/lib/compiler/src/beam_jump.erl
@@ -202,19 +202,19 @@ is_label(_) -> false.
move(Is) ->
move_1(Is, [], []).
-move_1([I|Is], End0, Acc0) ->
+move_1([I|Is], Ends, Acc0) ->
case is_exit_instruction(I) of
false ->
- move_1(Is, End0, [I|Acc0]);
+ move_1(Is, Ends, [I|Acc0]);
true ->
- case extract_seq(Acc0, [I|End0]) of
+ case extract_seq(Acc0, [I]) of
no ->
- move_1(Is, End0, [I|Acc0]);
+ move_1(Is, Ends, [I|Acc0]);
{yes,End,Acc} ->
- move_1(Is, End, Acc)
+ move_1(Is, [End|Ends], Acc)
end
end;
-move_1([], End, Acc) -> reverse(Acc, End).
+move_1([], Ends, Acc) -> reverse(Acc, lists:append(reverse(Ends))).
extract_seq([{line,_}=Line|Is], Acc) ->
extract_seq(Is, [Line|Acc]);