aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-06 09:22:00 +0200
committerBjörn Gustavsson <[email protected]>2017-10-11 09:59:41 +0200
commit5fa3ac7e10f45ad433ac6a44f32f9b5e96b56fcd (patch)
tree1cab3e656e9beebcc8f2eccb0d603c3854fe6386 /lib/compiler/src
parent34c8b06de52ac81e2938e93ed7a219d7611c16f9 (diff)
downloadotp-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/src')
-rw-r--r--lib/compiler/src/beam_receive.erl2
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) ->