summaryrefslogtreecommitdiff
path: root/lib/compiler/src/beam_trim.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2018-11-01 08:18:19 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2018-11-06 10:16:54 +0100
commit1565b1518f77b2c078c59c2554305b7dca668f72 (patch)
tree7f548db0510632bc58fc6b6daff5d6fdd2291f44 /lib/compiler/src/beam_trim.erl
parent4ae91649adf139aa6b2890065006203e14775a70 (diff)
downloaderlang-1565b1518f77b2c078c59c2554305b7dca668f72.tar.gz
beam_trim: Handle the new binary matching instructions
Diffstat (limited to 'lib/compiler/src/beam_trim.erl')
-rw-r--r--lib/compiler/src/beam_trim.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_trim.erl b/lib/compiler/src/beam_trim.erl
index 0f1144e87f..c11ecab927 100644
--- a/lib/compiler/src/beam_trim.erl
+++ b/lib/compiler/src/beam_trim.erl
@@ -166,6 +166,12 @@ try_remap([], _, _) -> throw(not_possible).
remap([{block,Bl0}|Is], Map, Acc) ->
Bl = remap_block(Bl0, Map, []),
remap(Is, Map, [{block,Bl}|Acc]);
+remap([{bs_get_tail,Src,Dst,Live}|Is], Map, Acc) ->
+ I = {bs_get_tail,Map(Src),Map(Dst),Live},
+ remap(Is, Map, [I|Acc]);
+remap([{bs_set_position,Src1,Src2}|Is], Map, Acc) ->
+ I = {bs_set_position,Map(Src1),Map(Src2)},
+ remap(Is, Map, [I|Acc]);
remap([{call_fun,_}=I|Is], Map, Acc) ->
remap(Is, Map, [I|Acc]);
remap([{call,_,_}=I|Is], Map, Acc) ->
@@ -293,6 +299,10 @@ frame_size([{deallocate,N}|_], _) ->
N;
frame_size([{line,_}|Is], Safe) ->
frame_size(Is, Safe);
+frame_size([{bs_set_position,_,_}|Is], Safe) ->
+ frame_size(Is, Safe);
+frame_size([{bs_get_tail,_,_,_}|Is], Safe) ->
+ frame_size(Is, Safe);
frame_size(_, _) -> throw(not_possible).
frame_size_branch(0, Is, Safe) ->
@@ -320,10 +330,15 @@ is_not_used(Y, [{block,Bl}|Is]) ->
killed -> true;
transparent -> is_not_used(Y, Is)
end;
+is_not_used(Y, [{bs_get_tail,Src,Dst,_}|Is]) ->
+ is_not_used_ss_dst(Y, [Src], Dst, Is);
is_not_used(Y, [{bs_init,_,_,_,Ss,Dst}|Is]) ->
is_not_used_ss_dst(Y, Ss, Dst, Is);
is_not_used(Y, [{bs_put,{f,_},_,Ss}|Is]) ->
not member(Y, Ss) andalso is_not_used(Y, Is);
+is_not_used(Y, [{bs_set_position,Src1,Src2}|Is]) ->
+ Y =/= Src1 andalso Y =/= Src2 andalso
+ is_not_used(Y, Is);
is_not_used(Y, [{call,_,_}|Is]) ->
is_not_used(Y, Is);
is_not_used(Y, [{call_ext,_,_}=I|Is]) ->