diff options
author | Björn Gustavsson <[email protected]> | 2012-08-09 10:37:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-10-09 09:38:19 +0200 |
commit | 65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c (patch) | |
tree | 4b4ed499fddaeb91bd2593c2e677165af92c148a /lib | |
parent | b667d0f9ff05494ac3b7248a1bd57888fab9f874 (diff) | |
download | otp-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')
-rw-r--r-- | lib/compiler/src/beam_utils.erl | 10 |
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 -> |