aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-01-25 09:41:18 +0100
committerJohn Högberg <[email protected]>2019-01-25 09:41:18 +0100
commit3284d6f9e291735489c136f88d2ca5ec12352660 (patch)
tree627962a2bc9000a97aa484adee9cabfe3bf83e81
parent7160deffbc2828b13ef5e1162d76b0b8851bab55 (diff)
parent6adc50b534d0db2be2e0bf5c4029cf22e45a84a1 (diff)
downloadotp-3284d6f9e291735489c136f88d2ca5ec12352660.tar.gz
otp-3284d6f9e291735489c136f88d2ca5ec12352660.tar.bz2
otp-3284d6f9e291735489c136f88d2ca5ec12352660.zip
Merge branch 'john/compiler/trim-ignore-annos'
* john/compiler/trim-ignore-annos: beam_trim: Ignore type annotations
-rw-r--r--lib/compiler/src/beam_trim.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_trim.erl b/lib/compiler/src/beam_trim.erl
index 51ff580a7a..acf3838da4 100644
--- a/lib/compiler/src/beam_trim.erl
+++ b/lib/compiler/src/beam_trim.erl
@@ -200,6 +200,8 @@ create_map(Trim, Moves) ->
(Any) -> Any
end.
+remap([{'%',_}=I|Is], Map, Acc) ->
+ remap(Is, Map, [I|Acc]);
remap([{block,Bl0}|Is], Map, Acc) ->
Bl = remap_block(Bl0, Map, []),
remap(Is, Map, [{block,Bl}|Acc]);
@@ -279,6 +281,8 @@ safe_labels([_|Is], Acc) ->
safe_labels(Is, Acc);
safe_labels([], Acc) -> cerl_sets:from_list(Acc).
+is_safe_label([{'%',_}|Is]) ->
+ is_safe_label(Is);
is_safe_label([{line,_}|Is]) ->
is_safe_label(Is);
is_safe_label([{badmatch,{Tag,_}}|_]) ->
@@ -337,6 +341,8 @@ frame_layout_2(Is) -> reverse(Is).
%% to safe labels (i.e., the code at those labels don't depend
%% on the contents of any Y register).
+frame_size([{'%',_}|Is], Safe) ->
+ frame_size(Is, Safe);
frame_size([{block,_}|Is], Safe) ->
frame_size(Is, Safe);
frame_size([{call_fun,_}|Is], Safe) ->
@@ -393,6 +399,8 @@ frame_size_branch(L, Is, Safe) ->
%% This function handles the same instructions as frame_size/2. It
%% assumes that any labels in the instructions are safe labels.
+is_not_used(Y, [{'%',_}|Is]) ->
+ is_not_used(Y, Is);
is_not_used(Y, [{apply,_}|Is]) ->
is_not_used(Y, Is);
is_not_used(Y, [{bif,_,{f,_},Ss,Dst}|Is]) ->