diff options
author | Björn Gustavsson <[email protected]> | 2018-08-10 12:16:55 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-08-10 12:16:55 +0200 |
commit | 2e46944fce477abc44e5631766b580b6ed62a1a4 (patch) | |
tree | fb65a632763d5ac277e3883157da5016e57f5b3f /lib/compiler/src | |
parent | 82be947e99c912c4961f751d83986624d73fc999 (diff) | |
parent | 77d307e6c3e705e14843101d4c5348c6c079ace0 (diff) | |
download | otp-2e46944fce477abc44e5631766b580b6ed62a1a4.tar.gz otp-2e46944fce477abc44e5631766b580b6ed62a1a4.tar.bz2 otp-2e46944fce477abc44e5631766b580b6ed62a1a4.zip |
Merge branch 'maint'
* maint:
Fix bug in binary matching
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_bsm.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_bsm.erl b/lib/compiler/src/beam_bsm.erl index 1c8e0e9854..abc6e96c85 100644 --- a/lib/compiler/src/beam_bsm.erl +++ b/lib/compiler/src/beam_bsm.erl @@ -310,7 +310,18 @@ btb_reaches_match_2([{test,bs_start_match2,{f,F},Live,[Bin,_],Ctx}|Is], end; btb_reaches_match_2([{test,_,{f,F},Ss}=I|Is], Regs, D0) -> btb_ensure_not_used(Ss, I, Regs), - D = btb_follow_branch(F, Regs, D0), + D1 = btb_follow_branch(F, Regs, D0), + D = case Is of + [{bs_context_to_binary,_}|_] -> + %% bs_context_to_binary following a test instruction + %% probably needs the current position to be saved as + %% the new start position, but we can't be sure. + %% Therefore, conservatively disable the optimization + %% (instead of forcing a saving of the position). + D1#btb{must_save=true,must_not_save=true}; + _ -> + D1 + end, btb_reaches_match_1(Is, Regs, D); btb_reaches_match_2([{test,_,{f,F},_,Ss,_}=I|Is], Regs, D0) -> btb_ensure_not_used(Ss, I, Regs), |