aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_a.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-31 19:14:10 +0200
committerBjörn Gustavsson <[email protected]>2012-10-09 15:24:41 +0200
commited7ab81375d599c73cbe0d2195102187957c25d6 (patch)
treef2e4114919a1e79be55f6171997febf33c0b9f27 /lib/compiler/src/beam_a.erl
parentb44f86b779f0b8579e4df2a98930ac3150c6c07c (diff)
downloadotp-ed7ab81375d599c73cbe0d2195102187957c25d6.tar.gz
otp-ed7ab81375d599c73cbe0d2195102187957c25d6.tar.bz2
otp-ed7ab81375d599c73cbe0d2195102187957c25d6.zip
Rewrite bs_add, bs_utf*_size to BIF instructions in optimizations
We can remove some code bloat by handling the special instructions as BIF instructions in the optimization passes. Also note that bs_utf*_size was not handled by beam_utils:check_liveness/3 (meaning the conservative answer instead of the correct answer would be returned).
Diffstat (limited to 'lib/compiler/src/beam_a.erl')
-rw-r--r--lib/compiler/src/beam_a.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_a.erl b/lib/compiler/src/beam_a.erl
index 4a8ba9743a..3709b94c3c 100644
--- a/lib/compiler/src/beam_a.erl
+++ b/lib/compiler/src/beam_a.erl
@@ -58,4 +58,10 @@ rename_instr({bs_put_utf32=I,F,Fl,Src}) ->
{bs_put,F,{I,Fl},[Src]};
%% rename_instr({bs_put_string,_,_}=I) ->
%% {bs_put,{f,0},I,[]};
+rename_instr({bs_add=I,F,[Src1,Src2,U],Dst}) when is_integer(U) ->
+ {bif,I,F,[Src1,Src2,{integer,U}],Dst};
+rename_instr({bs_utf8_size=I,F,Src,Dst}) ->
+ {bif,I,F,[Src],Dst};
+rename_instr({bs_utf16_size=I,F,Src,Dst}) ->
+ {bif,I,F,[Src],Dst};
rename_instr(I) -> I.