aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-12-07 07:11:44 +0100
committerBjörn Gustavsson <[email protected]>2011-12-07 07:11:44 +0100
commit060904e7586284f899c478c42e1075643d924517 (patch)
treef0178c60caa65d38ca3961d326cd19a4057e2428 /lib/compiler/src/beam_validator.erl
parent54ec1e2ccc3fd9d61be6a66db807d8a7567c2313 (diff)
parent1687a490039698fab6ccabdbbd61faa5d9d5eb41 (diff)
downloadotp-060904e7586284f899c478c42e1075643d924517.tar.gz
otp-060904e7586284f899c478c42e1075643d924517.tar.bz2
otp-060904e7586284f899c478c42e1075643d924517.zip
Merge branch 'bjorn/compiler/inline-binary-matching/OTP-9770'
* bjorn/compiler/inline-binary-matching/OTP-9770: beam_validator: Fix type for failure label for bs_start_match2/5 inline_SUITE: Add the comma_splitter/1 test case Teach the compiler the 'no_dead' option
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index fe3b1680d9..95f12df40d 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -670,10 +670,20 @@ valfun_4({get_tuple_element,Src,I,Dst}, Vst) ->
valfun_4({test,bs_start_match2,{f,Fail},Live,[Ctx,NeedSlots],Ctx}, Vst0) ->
%% If source and destination registers are the same, match state
%% is OK as input.
- _ = get_move_term_type(Ctx, Vst0),
+ CtxType = get_move_term_type(Ctx, Vst0),
verify_live(Live, Vst0),
Vst1 = prune_x_regs(Live, Vst0),
- Vst = branch_state(Fail, Vst1),
+ BranchVst = case CtxType of
+ {match_context,_,_} ->
+ %% The failure branch will never be taken when Ctx
+ %% is a match context. Therefore, the type for Ctx
+ %% at the failure label must not be match_context
+ %% (or we could reject legal code).
+ set_type_reg(term, Ctx, Vst1);
+ _ ->
+ Vst1
+ end,
+ Vst = branch_state(Fail, BranchVst),
set_type_reg(bsm_match_state(NeedSlots), Ctx, Vst);
valfun_4({test,bs_start_match2,{f,Fail},Live,[Src,Slots],Dst}, Vst0) ->
assert_term(Src, Vst0),