aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-02-26 14:52:38 +0100
committerJohn Högberg <[email protected]>2019-02-27 14:59:40 +0100
commitc68eda34ef8b0d2df9cd1d133b99b64d32e8c622 (patch)
treeb9736780ea3190d42398af93da3be003c759c156 /lib/compiler/src/beam_validator.erl
parent1dd050c9064534f4b4aeb13b7af1fd3b988c5e8f (diff)
downloadotp-c68eda34ef8b0d2df9cd1d133b99b64d32e8c622.tar.gz
otp-c68eda34ef8b0d2df9cd1d133b99b64d32e8c622.tar.bz2
otp-c68eda34ef8b0d2df9cd1d133b99b64d32e8c622.zip
beam_validator: Tolerate the 'receive' hack in prim_eval
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 63da5d44ba..6044c1bfab 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -476,6 +476,14 @@ valfun_1({'%', {type_info, Reg, Type}}, Vst) ->
%% that Reg has a certain type, so that we can accept cross-function type
%% optimizations.
update_type(fun meet/2, Type, Reg, Vst);
+valfun_1({'%', {remove_fragility, Reg}}, Vst) ->
+ %% This is a hack to make prim_eval:'receive'/2 work.
+ %%
+ %% Normally it's illegal to pass fragile terms as a function argument as we
+ %% have no way of knowing what the callee will do with it, but we know that
+ %% prim_eval:'receive'/2 won't leak the term, nor cause a GC since it's
+ %% disabled while matching messages.
+ remove_fragility(Reg, Vst);
valfun_1({'%',_}, Vst) ->
Vst;
valfun_1({line,_}, Vst) ->