aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2013-05-24 18:58:01 +0200
committerFredrik Gustafsson <fredrik@erlang.org>2013-05-28 11:08:48 +0200
commit979537042170236085d754921bfbbe6d4c253494 (patch)
treece246201b1207a7a98f5c97b44a2425ec382e917 /lib/compiler/src
parent7f5fa1b06671d31476e0fc0f28b878a6b5059b1b (diff)
downloadotp-979537042170236085d754921bfbbe6d4c253494.tar.gz
otp-979537042170236085d754921bfbbe6d4c253494.tar.bz2
otp-979537042170236085d754921bfbbe6d4c253494.zip
Fix renaming of bs_put_string instructions
The clause was formerly commented-out because at this point in the code, no bs_put_string instruction has been generated yet when compiling from Erlang. If an Erlang module is compiled to BEAM assembly and the result contains a bs_put_string instruction, the output can't be compiled to binary anymore and the compiler crashes with the following error: $ erlc prs.S Function: compress/1 prs.S:none: internal error in beam_block; crash reason: {{case_clause, {'EXIT', {function_clause, [{beam_utils,live_opt, [[{bs_put_string,1,{string,[0]}}, {bs_init, {f,0}, {bs_append,0,8,{field_flags,[]}}, 0, [{integer,8},{x,0}], {x,1}}, {label,2}], 2, {1,{1,1,nil,nil}}, [{block, [{'%live',2}, {set,[{x,0}],[{x,1}],move}, {'%live',1}]}, return]], [{file,"beam_utils.erl"},{line,639}]}, {beam_utils,live_opt,1, [{file,"beam_utils.erl"},{line,205}]}, {beam_block,function,2, [{file,"beam_block.erl"},{line,38}]}, {lists,mapfoldl,3, [{file,"lists.erl"},{line,1329}]}, {beam_block,module,2, [{file,"beam_block.erl"},{line,29}]}, {compile,'-select_passes/2-anonymous-2-',2, [{file,"compile.erl"},{line,476}]}, {compile,'-internal_comp/4-anonymous-1-',2, [{file,"compile.erl"},{line,276}]}, {compile,fold_comp,3, [{file,"compile.erl"},{line,294}]}]}}}, [{compile,'-select_passes/2-anonymous-2-',2, [{file,"compile.erl"},{line,476}]}, {compile,'-internal_comp/4-anonymous-1-',2, [{file,"compile.erl"},{line,276}]}, {compile,fold_comp,3,[{file,"compile.erl"},{line,294}]}, {compile,internal_comp,4,[{file,"compile.erl"},{line,278}]}, {compile,'-do_compile/2-anonymous-0-',2, [{file,"compile.erl"},{line,152}]}]}
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_a.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_a.erl b/lib/compiler/src/beam_a.erl
index 1c51226314..b348e854a0 100644
--- a/lib/compiler/src/beam_a.erl
+++ b/lib/compiler/src/beam_a.erl
@@ -70,8 +70,8 @@ rename_instr({bs_put_utf16=I,F,Fl,Src}) ->
{bs_put,F,{I,Fl},[Src]};
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_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}) ->