diff options
author | Björn Gustavsson <[email protected]> | 2012-08-09 11:16:09 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-10-09 09:38:19 +0200 |
commit | cda99c83652fca9473eadba2608c14e5feffa0a0 (patch) | |
tree | 4227a822e55c264f38a887ecdfc8b191b154b445 /lib/compiler/src | |
parent | c3b60f86c622ba6978564aa059d4d881b9549936 (diff) | |
download | otp-cda99c83652fca9473eadba2608c14e5feffa0a0.tar.gz otp-cda99c83652fca9473eadba2608c14e5feffa0a0.tar.bz2 otp-cda99c83652fca9473eadba2608c14e5feffa0a0.zip |
beam_utils:live_opt/1: Correct liveness calculation for 'try'
The liveness at the failure label should be ignored, because if
there is an exception, all x registers will be killed.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_utils.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl index b9c0cd7304..3b24cbfaba 100644 --- a/lib/compiler/src/beam_utils.erl +++ b/lib/compiler/src/beam_utils.erl @@ -810,8 +810,10 @@ live_opt([{select_tuple_arity,Src,Fail,{list,List}}=I|Is], Regs0, D, Acc) -> Regs1 = x_live([Src], Regs0), Regs = live_join_labels([Fail|List], D, Regs1), live_opt(Is, Regs, D, [I|Acc]); -live_opt([{'try',_,Fail}=I|Is], Regs0, D, Acc) -> - Regs = live_join_label(Fail, D, Regs0), +live_opt([{'try',_,_}=I|Is], Regs, D, Acc) -> + %% If an exeption happens, all x registers will be killed. + %% Therefore, we should only base liveness of the code inside + %% the try. live_opt(Is, Regs, D, [I|Acc]); live_opt([{try_case,_}=I|Is], _, D, Acc) -> live_opt(Is, live_call(1), D, [I|Acc]); |