diff options
author | Björn Gustavsson <[email protected]> | 2012-08-31 16:06:37 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-10-09 15:24:41 +0200 |
commit | b44f86b779f0b8579e4df2a98930ac3150c6c07c (patch) | |
tree | ba10bf906e4432f12a9a7aa6d6ee1af7735dfacf /lib/compiler/src/beam_trim.erl | |
parent | 105e056cddaf765952d58813e2ec5c9bdfd4403c (diff) | |
download | otp-b44f86b779f0b8579e4df2a98930ac3150c6c07c.tar.gz otp-b44f86b779f0b8579e4df2a98930ac3150c6c07c.tar.bz2 otp-b44f86b779f0b8579e4df2a98930ac3150c6c07c.zip |
Rewrite bs_put* instructions to a generic bs_put instruction
Seven bs_put_* instructions can be combined into one generic bs_put
instruction to avoid some code bloat. That will also improve some
optimizations (such as beam_trim) that did not handle all bs_put*
variants.
Diffstat (limited to 'lib/compiler/src/beam_trim.erl')
-rw-r--r-- | lib/compiler/src/beam_trim.erl | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/compiler/src/beam_trim.erl b/lib/compiler/src/beam_trim.erl index 5f4fa3b1f8..5856f0d3b5 100644 --- a/lib/compiler/src/beam_trim.erl +++ b/lib/compiler/src/beam_trim.erl @@ -189,16 +189,8 @@ remap([{bs_init2,Fail,Src,Live,U,Flags,D}|Is], Map, Acc) -> remap([{bs_init_bits,Fail,Src,Live,U,Flags,D}|Is], Map, Acc) -> I = {bs_init_bits,Fail,Map(Src),Live,U,Flags,Map(D)}, remap(Is, Map, [I|Acc]); -remap([{bs_put_binary=Op,Fail,Src,U,Flags,D}|Is], Map, Acc) -> - I = {Op,Fail,Map(Src),U,Flags,Map(D)}, - remap(Is, Map, [I|Acc]); -remap([{bs_put_integer=Op,Fail,Src,U,Flags,D}|Is], Map, Acc) -> - I = {Op,Fail,Map(Src),U,Flags,Map(D)}, - remap(Is, Map, [I|Acc]); -remap([{bs_put_float=Op,Fail,Src,U,Flags,D}|Is], Map, Acc) -> - I = {Op,Fail,Map(Src),U,Flags,Map(D)}, - remap(Is, Map, [I|Acc]); -remap([{bs_put_string,_,_}=I|Is], Map, Acc) -> +remap([{bs_put=Op,Fail,Info,Ss}|Is], Map, Acc) -> + I = {Op,Fail,Info,[Map(S) || S <- Ss]}, remap(Is, Map, [I|Acc]); remap([{kill,Y}|T], Map, Acc) -> remap(T, Map, [{kill,Map(Y)}|Acc]); @@ -307,14 +299,8 @@ frame_size([{bs_init2,{f,L},_,_,_,_,_}|Is], Safe) -> frame_size_branch(L, Is, Safe); frame_size([{bs_init_bits,{f,L},_,_,_,_,_}|Is], Safe) -> frame_size_branch(L, Is, Safe); -frame_size([{bs_put_binary,{f,L},_,_,_,_}|Is], Safe) -> +frame_size([{bs_put,{f,L},_,_}|Is], Safe) -> frame_size_branch(L, Is, Safe); -frame_size([{bs_put_integer,{f,L},_,_,_,_}|Is], Safe) -> - frame_size_branch(L, Is, Safe); -frame_size([{bs_put_float,{f,L},_,_,_,_}|Is], Safe) -> - frame_size_branch(L, Is, Safe); -frame_size([{bs_put_string,_,_}|Is], Safe) -> - frame_size(Is, Safe); frame_size([{kill,_}|Is], Safe) -> frame_size(Is, Safe); frame_size([send|Is], Safe) -> |