diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-05-20 21:18:44 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-05-21 09:47:49 +0200 |
commit | 73cc0c766d0205bec3220ccc1cbe68d35c5759a6 (patch) | |
tree | 9740e28667995a05ac24b70a8ae66dd3244c2b9a /lib | |
parent | 4034b89a07a97766dba5e6213b1eb4d76ba6df9e (diff) | |
download | otp-73cc0c766d0205bec3220ccc1cbe68d35c5759a6.tar.gz otp-73cc0c766d0205bec3220ccc1cbe68d35c5759a6.tar.bz2 otp-73cc0c766d0205bec3220ccc1cbe68d35c5759a6.zip |
compiler: Teach beam_bsm get_map_elements instruction
Allows for 'creation of sub binary delayed' optimization if
map instructions are in a clause.
Reported-by: José Valim
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_bsm.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_bsm.erl b/lib/compiler/src/beam_bsm.erl index 2a15c1ddf3..ee3e88959d 100644 --- a/lib/compiler/src/beam_bsm.erl +++ b/lib/compiler/src/beam_bsm.erl @@ -242,6 +242,12 @@ btb_reaches_match_2([{bif,_,{f,F},Ss,Dst}=I|Is], Regs0, D0) -> Regs = btb_kill([Dst], Regs0), D = btb_follow_branch(F, Regs, D0), btb_reaches_match_1(Is, Regs, D); +btb_reaches_match_2([{get_map_elements,{f,F},Src,{list,Ls}}=I|Is], Regs0, D0) -> + {Ss,Ds} = beam_utils:split_even(Ls), + btb_ensure_not_used([Src|Ss], I, Regs0), + Regs = btb_kill(Ds, Regs0), + D = btb_follow_branch(F, Regs, D0), + btb_reaches_match_1(Is, Regs, D); btb_reaches_match_2([{test,bs_start_match2,{f,F},Live,[Ctx,_],Ctx}=I|Is], Regs0, D0) -> CtxRegs = btb_context_regs(Regs0), |