diff options
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/doc/src/notes.xml | 52 | ||||
-rw-r--r-- | lib/compiler/src/beam_ssa_pre_codegen.erl | 15 | ||||
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 8 | ||||
-rw-r--r-- | lib/compiler/test/beam_validator_SUITE.erl | 19 | ||||
-rw-r--r-- | lib/compiler/vsn.mk | 2 |
5 files changed, 81 insertions, 15 deletions
diff --git a/lib/compiler/doc/src/notes.xml b/lib/compiler/doc/src/notes.xml index 440b50d509..b175669bd8 100644 --- a/lib/compiler/doc/src/notes.xml +++ b/lib/compiler/doc/src/notes.xml @@ -32,6 +32,58 @@ <p>This document describes the changes made to the Compiler application.</p> +<section><title>Compiler 7.2.5</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>Fixed a bug that prevented certain variable-sized + binary comprehensions from compiling.</p> + <p> + Own Id: OTP-15186 Aux Id: ERL-665 </p> + </item> + <item> + <p>When compiling from Core Erlang, funs created in + certain expressions that were only used for their + side-effects were subtly broken.</p> + <p> + Own Id: OTP-15188 Aux Id: ERL-658 </p> + </item> + <item> + <p>There could be an internal consistency failure when a + <c>receive</c> was nested in a + <c>try</c>/<c>catch</c>.</p> + <p> + Own Id: OTP-15218 Aux Id: ERL-684 </p> + </item> + <item> + <p>In rare circumstances, the matched out tail of a + binary could be the entire original binary.</p> + <p> + Own Id: OTP-15219 Aux Id: ERL-689 </p> + </item> + <item> + <p>When <c>is_map_key/2</c> was used in a guard together + with the <c>not/1</c> or <c>or/2</c> operators, the error + behavior could be wrong when <c>is_map_key/2</c> was + passed a non-map as the second argument. </p> + <p>In rare circumstances, compiling code that uses + <c>is_map_key/2</c> could cause an internal consistency + check failure.</p> + <p> + Own Id: OTP-15227 Aux Id: ERL-699 </p> + </item> + <item> + <p>The compiler could crash when compiling a function + with multiple receives in multiple clauses.</p> + <p> + Own Id: OTP-15235 Aux Id: ERL-703 </p> + </item> + </list> + </section> + +</section> + <section><title>Compiler 7.2.4</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/compiler/src/beam_ssa_pre_codegen.erl b/lib/compiler/src/beam_ssa_pre_codegen.erl index 9b5f52d26b..36137ef046 100644 --- a/lib/compiler/src/beam_ssa_pre_codegen.erl +++ b/lib/compiler/src/beam_ssa_pre_codegen.erl @@ -23,11 +23,10 @@ %% it has been annotated and transformed to help the code generator. %% %% * Some instructions are translated to other instructions closer to -%% the BEAM instructions. For example, the put_tuple instruction is -%% broken apart into the put_tuple_arity and put_tuple_elements -%% instructions. Similary, the binary matching instructions are -%% transformed from the optimization-friendly internal format to -%% instruction more similar to the actual BEAM instructions. +%% the BEAM instructions. For example, the binary matching +%% instructions are transformed from the optimization-friendly +%% internal format to instruction more similar to the actual BEAM +%% instructions. %% %% * Blocks that will need an instruction for allocating a stack frame %% are annotated with a {frame_size,Size} annotation. @@ -1010,11 +1009,11 @@ is_trap_bif(_, _, _) -> false. %%% used during matching. %%% %%% Depending on where variables are defined and used, they must -%%% be handling in two different ways. +%%% be handled in two different ways. %%% %%% Variables that are always defined in the receive (before branching %%% out into the different clauses of the receive) and used after the -%%% receive, must be handled in the following way: Before each +%%% receive must be handled in the following way: Before each %%% remove_message instruction, each such variable must be copied, and %%% all variables must be consolidated using a phi node in the %%% common exit block for the receive. @@ -1715,7 +1714,7 @@ update_live_phis(_, _, Live) -> Live. %% reserve_yregs(St0) -> St. %% In each block that allocates a stack frame, insert instructions %% that copy variables that must be in Y registers (given by -%% YRegisters) to new variables. +%% the `yregs` annotation) to new variables. %% %% Also allocate specific Y registers for try and catch tags. %% The outermost try/catch tag is placed in y0, any directly diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 3d3fa10706..ca065295d6 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -592,7 +592,7 @@ valfun_4({bif,tuple_size,{f,Fail},[Tuple],Dst}=I, Vst0) -> TupleType0 = get_term_type(Tuple, Vst0), Vst1 = branch_state(Fail, Vst0), TupleType = upgrade_tuple_type({tuple,[0]}, TupleType0), - Vst = set_type(TupleType, Tuple, Vst1), + Vst = set_aliased_type(TupleType, Tuple, Vst1), set_type_reg_expr({integer,[]}, I, Dst, Vst); valfun_4({bif,element,{f,Fail},[Pos,Tuple],Dst}, Vst0) -> TupleType0 = get_term_type(Tuple, Vst0), @@ -609,20 +609,20 @@ valfun_4(raw_raise=I, Vst) -> valfun_4({bif,map_get,{f,Fail},[_Key,Map]=Src,Dst}, Vst0) -> validate_src(Src, Vst0), Vst1 = branch_state(Fail, Vst0), - Vst = set_type(map, Map, Vst1), + Vst = set_aliased_type(map, Map, Vst1), Type = propagate_fragility(term, Src, Vst), set_type_reg(Type, Dst, Vst); valfun_4({bif,is_map_key,{f,Fail},[_Key,Map]=Src,Dst}, Vst0) -> validate_src(Src, Vst0), Vst1 = branch_state(Fail, Vst0), - Vst = set_type(map, Map, Vst1), + Vst = set_aliased_type(map, Map, Vst1), Type = propagate_fragility(bool, Src, Vst), set_type_reg(Type, Dst, Vst); valfun_4({bif,Op,{f,Fail},[Cons]=Src,Dst}, Vst0) when Op =:= hd; Op =:= tl -> validate_src(Src, Vst0), Vst1 = branch_state(Fail, Vst0), - Vst = set_type(cons, Cons, Vst1), + Vst = set_aliased_type(cons, Cons, Vst1), Type0 = bif_type(Op, Src, Vst), Type = propagate_fragility(Type0, Src, Vst), set_type_reg(Type, Dst, Vst); diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index d3e544a9cc..661b48a080 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -34,7 +34,7 @@ undef_label/1,illegal_instruction/1,failing_gc_guard_bif/1, map_field_lists/1,cover_bin_opt/1, val_dsetel/1,bad_tuples/1,bad_try_catch_nesting/1, - receive_stacked/1]). + receive_stacked/1,aliased_types/1]). -include_lib("common_test/include/ct.hrl"). @@ -63,7 +63,7 @@ groups() -> undef_label,illegal_instruction,failing_gc_guard_bif, map_field_lists,cover_bin_opt,val_dsetel, bad_tuples,bad_try_catch_nesting, - receive_stacked]}]. + receive_stacked,aliased_types]}]. init_per_suite(Config) -> test_lib:recompile(?MODULE), @@ -579,6 +579,21 @@ receive_stacked(Config) -> ok. +%% ERL-735: validator failed to track types on aliased registers, rejecting +%% legitimate optimizations. +%% +%% move x0 y0 +%% bif hd L1 x0 +%% get_hd y0 %% The validator failed to see that y0 was a list +aliased_types(Config) when is_list(Config) -> + Bug = lists:seq(1, 5), + if + Config =/= [gurka, gaffel] -> %% Pointless branch. + _ = hd(Bug), + lists:seq(1, 5), + hd(Bug) + end. + %%%------------------------------------------------------------------------- transform_remove(Remove, Module) -> diff --git a/lib/compiler/vsn.mk b/lib/compiler/vsn.mk index bb6ee00cd7..c7e7fb6754 100644 --- a/lib/compiler/vsn.mk +++ b/lib/compiler/vsn.mk @@ -1 +1 @@ -COMPILER_VSN = 7.2.4 +COMPILER_VSN = 7.2.5 |