aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-04-21 18:00:27 +0200
committerBjörn Gustavsson <[email protected]>2015-04-29 12:23:42 +0200
commit808e43007754cb68dbe947ec6752698167b1c470 (patch)
tree85cf89e05606bb61dfc9246086d3f97cfbed946c /lib/compiler
parent5440c67570b9d436301cdb2f8234730a1fa8287f (diff)
downloadotp-808e43007754cb68dbe947ec6752698167b1c470.tar.gz
otp-808e43007754cb68dbe947ec6752698167b1c470.tar.bz2
otp-808e43007754cb68dbe947ec6752698167b1c470.zip
beam_utils: Teach check_liveness/3 to understand get_map_elements
Understanding get_map_elements improves the stack trimming done by beam_trim.
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/beam_utils.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index fca13497ba..a0132b99e3 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -468,6 +468,22 @@ check_liveness(R, [{loop_rec_end,{f,Fail}}|_], St) ->
check_liveness_at(R, Fail, St);
check_liveness(R, [{line,_}|Is], St) ->
check_liveness(R, Is, St);
+check_liveness(R, [{get_map_elements,{f,Fail},S,{list,L}}|Is], St0) ->
+ {Ss,Ds} = split_even(L),
+ case member(R, [S|Ss]) of
+ true ->
+ {used,St0};
+ false ->
+ case check_liveness_at(R, Fail, St0) of
+ {killed,St}=Killed ->
+ case member(R, Ds) of
+ true -> Killed;
+ false -> check_liveness(R, Is, St)
+ end;
+ Other ->
+ Other
+ end
+ end;
check_liveness(_R, Is, St) when is_list(Is) ->
%% case Is of
%% [I|_] ->