diff options
author | Björn Gustavsson <[email protected]> | 2017-10-06 09:22:00 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-10-11 09:59:41 +0200 |
commit | 5fa3ac7e10f45ad433ac6a44f32f9b5e96b56fcd (patch) | |
tree | 1cab3e656e9beebcc8f2eccb0d603c3854fe6386 /lib/compiler | |
parent | 34c8b06de52ac81e2938e93ed7a219d7611c16f9 (diff) | |
download | otp-5fa3ac7e10f45ad433ac6a44f32f9b5e96b56fcd.tar.gz otp-5fa3ac7e10f45ad433ac6a44f32f9b5e96b56fcd.tar.bz2 otp-5fa3ac7e10f45ad433ac6a44f32f9b5e96b56fcd.zip |
Do the receive optimization in the presence of try/catch
Improve the receive optimization to be able to handle code
such as this:
Ref = make_ref(),
try
side_effect()
catch _:_ ->
ok
end,
receive
%% Clauses that all match Ref.
.
.
.
end
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_receive.erl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_receive.erl b/lib/compiler/src/beam_receive.erl index 1403e1e05e..468460eedf 100644 --- a/lib/compiler/src/beam_receive.erl +++ b/lib/compiler/src/beam_receive.erl @@ -207,6 +207,8 @@ opt_update_regs({label,Lbl}, R, L) -> %% A catch label for a previously seen catch instruction is OK. {R,L} end; +opt_update_regs({'try',_,{f,Lbl}}, R, L) -> + {R,gb_sets:add(Lbl, L)}; opt_update_regs({try_end,_}, R, L) -> {R,L}; opt_update_regs({line,_}, R, L) -> |