aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-03-01 06:42:57 +0100
committerBjörn Gustavsson <[email protected]>2018-08-17 09:50:59 +0200
commit3fc40fd57fa01b097b4c363860c4d4762e13db8b (patch)
tree8988da71d06fb0104b82aaee8b9ca645756e715d /lib/compiler/src/compile.erl
parent6065d9f8540cd4621cbace0cd4d485956a720fd6 (diff)
downloadotp-3fc40fd57fa01b097b4c363860c4d4762e13db8b.tar.gz
otp-3fc40fd57fa01b097b4c363860c4d4762e13db8b.tar.bz2
otp-3fc40fd57fa01b097b4c363860c4d4762e13db8b.zip
Don't run unsafe compiler passes
As a preparation for replacing v3_codegen with a new code generator, remove unsafe optimization passes. Especially the older compiler passes have implicit assumptions about how the code is generated. Remove the optimizations in beam_block (keep the code that creates blocks) because they are unsafe. beam_block also calls beam_utils:live_opt/1, which is unsafe. Remove beam_type because it calls beam_utils:live_opt/1, and also because it recalculates the number of heaps words and number of live registers in allocation instructions, thus potentially hiding bugs in other passes. Remove beam_receive because it is unsafe. Remove beam_record because it is the only remaining user of beam_utils:anno_defs/1. Remove beam_reorder because it makes much more sense to run it as an early SSA-based optimization pass. Remove the now unused functions in beam_utils: anno_def/1 delete_annos/1 is_killed_block/2 live_opt/1 usage/3 Note that the following test cases will fail because of the removed optimizations: compile_SUITE:optimized_guards/1 compile_SUITE:bc_options/1 receive_SUITE:ref_opt/1
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl20
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index e1c1f7338e..5fdea23a26 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -751,16 +751,12 @@ asm_passes() ->
[{pass,beam_a},
{iff,da,{listing,"a"}},
{unless,no_postopt,
- [{unless,no_reorder,{pass,beam_reorder}},
- {iff,dre,{listing,"reorder"}},
- {pass,beam_block},
+ [{pass,beam_block},
{iff,dblk,{listing,"block"}},
{unless,no_except,{pass,beam_except}},
{iff,dexcept,{listing,"except"}},
{unless,no_bs_opt,{pass,beam_bs}},
{iff,dbs,{listing,"bs"}},
- {unless,no_topt,{pass,beam_type}},
- {iff,dtype,{listing,"type"}},
{pass,beam_split},
{iff,dsplit,{listing,"split"}},
{unless,no_dead,{pass,beam_dead}},
@@ -773,12 +769,6 @@ asm_passes() ->
{iff,dclean,{listing,"clean"}},
{unless,no_bsm_opt,{pass,beam_bsm}},
{iff,dbsm,{listing,"bsm"}},
- {unless,no_recv_opt,{pass,beam_receive}},
- {iff,drecv,{listing,"recv"}},
- {unless,no_record_opt,{pass,beam_record}},
- {iff,drecord,{listing,"record"}},
- {unless,no_blk2,?pass(block2)},
- {iff,dblk2,{listing,"block2"}},
{unless,no_stack_trimming,{pass,beam_trim}},
{iff,dtrim,{listing,"trim"}},
{pass,beam_flatten}]},
@@ -1354,10 +1344,6 @@ v3_kernel(Code0, #compile{options=Opts,warnings=Ws0}=St) ->
{ok,Code,St}
end.
-block2(Code0, #compile{options=Opts}=St) ->
- {ok,Code} = beam_block:module(Code0, [no_blockify|Opts]),
- {ok,Code,St}.
-
test_old_inliner(#compile{options=Opts}) ->
%% The point of this test is to avoid loading the old inliner
%% if we know that it will not be used.
@@ -1974,12 +1960,8 @@ pre_load() ->
beam_jump,
beam_opcodes,
beam_peep,
- beam_receive,
- beam_record,
- beam_reorder,
beam_split,
beam_trim,
- beam_type,
beam_utils,
beam_validator,
beam_z,