aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-04-21 15:21:48 +0200
committerBjörn Gustavsson <[email protected]>2015-04-29 12:23:41 +0200
commit61eaa7570811d81e2a91d0126461a2dac22786dc (patch)
treeac883c774e6d0d637e848b9cb0f152b35edcde75
parent8c32dda686d2b964b08cc4614ba9c445039b3dd9 (diff)
downloadotp-61eaa7570811d81e2a91d0126461a2dac22786dc.tar.gz
otp-61eaa7570811d81e2a91d0126461a2dac22786dc.tar.bz2
otp-61eaa7570811d81e2a91d0126461a2dac22786dc.zip
beam_utils: Be less conservative about liveness for exit instructions
beam_utils used to be overly conservative about liveness for exit instructions such as: call_ext erlang:exit/1 beam_utils would consider all y registers to be used, to avoid overwriting a catch or try tag. That does not seem to be a real risk. However, we miss opportunities for stack trimming if we consider y registers used by an exit instruction.
-rw-r--r--lib/compiler/src/beam_utils.erl12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index fd666be41e..fca13497ba 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -344,14 +344,10 @@ check_liveness(R, [{call_ext,Live,_}=I|Is], St) ->
false ->
check_liveness(R, Is, St);
true ->
- %% We must make sure we don't check beyond this instruction
- %% or we will fall through into random unrelated code and
- %% get stuck in a loop.
- %%
- %% We don't want to overwrite a 'catch', so consider this
- %% register in use.
- %%
- {used,St}
+ %% We must make sure we don't check beyond this
+ %% instruction or we will fall through into random
+ %% unrelated code and get stuck in a loop.
+ {killed,St}
end
end;
check_liveness(R, [{call_fun,Live}|Is], St) ->