aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_utils.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-09 10:37:56 +0200
committerBjörn Gustavsson <[email protected]>2012-10-09 09:38:19 +0200
commit65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c (patch)
tree4b4ed499fddaeb91bd2593c2e677165af92c148a /lib/compiler/src/beam_utils.erl
parentb667d0f9ff05494ac3b7248a1bd57888fab9f874 (diff)
downloadotp-65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c.tar.gz
otp-65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c.tar.bz2
otp-65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c.zip
beam_utils: Check liveness in catches and try/catch blocks
Less conservative liveness analysis allows more optimizations to be applied (such as the ones in beam_bool).
Diffstat (limited to 'lib/compiler/src/beam_utils.erl')
-rw-r--r--lib/compiler/src/beam_utils.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index 194f089ba1..0bc9d4cafe 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -472,6 +472,16 @@ check_liveness(R, [{make_fun2,_,_,_,NumFree}|Is], St) ->
{x,_} -> {killed,St};
_ -> check_liveness(R, Is, St)
end;
+check_liveness({x,_}=R, [{'catch',_,_}|Is], St) ->
+ %% All x registers will be killed if an exception occurs.
+ %% Therefore we only need to check the liveness for the
+ %% instructions following the catch instruction.
+ check_liveness(R, Is, St);
+check_liveness({x,_}=R, [{'try',_,_}|Is], St) ->
+ %% All x registers will be killed if an exception occurs.
+ %% Therefore we only need to check the liveness for the
+ %% instructions inside the 'try' block.
+ check_liveness(R, Is, St);
check_liveness(R, [{try_end,Y}|Is], St) ->
case R of
Y ->