Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bootstrap/bin/no_dot_erlang.boot
Binary file not shown.
Binary file modified bootstrap/bin/start.boot
Binary file not shown.
Binary file modified bootstrap/bin/start_clean.boot
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_a.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_asm.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_block.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_call_types.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_core_to_ssa.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_dict.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_disasm.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_jump.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_alias.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_bc_size.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_bsm.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_check.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_codegen.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_destructive_update.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_lint.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_opt.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_pp.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_pre_codegen.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_ss.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_throw.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_ssa_type.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_trim.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_types.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/beam_validator.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/cerl.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/core_parse.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/sys_core_fold.beam
Binary file not shown.
Binary file modified bootstrap/lib/compiler/ebin/v3_core.beam
Binary file not shown.
Binary file modified bootstrap/lib/kernel/ebin/gen_tcp_socket.beam
Binary file not shown.
Binary file modified bootstrap/lib/kernel/ebin/inet_db.beam
Binary file not shown.
Binary file modified bootstrap/lib/stdlib/ebin/erl_lint.beam
Binary file not shown.
Binary file modified bootstrap/lib/stdlib/ebin/erl_parse.beam
Binary file not shown.
Binary file modified bootstrap/lib/stdlib/ebin/zip.beam
Binary file not shown.
4 changes: 2 additions & 2 deletions erts/emulator/test/op_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1006,11 +1006,11 @@ combined_relops(_Config) ->
{func_info,{atom,?FUNCTION_NAME},{atom,test},1},
{label,2},
{test,is_ge,{f,4},
[{tr,{x,0},{t_integer,{0,1000}}},
[{tr,{x,0},#beam_types:t_integer{elements={0,1000}}},
{integer,10}]},
{test,is_ge,
{f,3},
[{tr,{x,0},{t_integer,{0,1000}}},
[{tr,{x,0},#beam_types:t_integer{elements={0,1000}}},
{integer,5}]},
{label,3},
{move,{atom,a},{x,0}},
Expand Down
196 changes: 129 additions & 67 deletions erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,118 +48,182 @@

{function, get_two_tuple_elements, 0, 2}.
{label,1}.
{line,[{location,"get_two_tuple_elements.erl",4}]}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
26}]}.
{func_info,{atom,get_two_tuple_elements},{atom,get_two_tuple_elements},0}.
{label,2}.
{allocate,2,0}.
{init_yregs,{list,[{y,0},{y,1}]}}.
{move,{atom,x},{x,0}}.
{line,[{location,"get_two_tuple_elements.erl",5}]}.
{call,1,{f,9}}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
27}]}.
{call,1,{f,9}}. % id/1
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{move,{x,0},{y,1}}.
{move,{integer,1},{x,0}}.
{line,[{location,"get_two_tuple_elements.erl",5}]}.
{call,1,{f,9}}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{call,1,{f,9}}. % id/1
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{move,{x,0},{y,0}}.
{move,{integer,2},{x,0}}.
{line,[{location,"get_two_tuple_elements.erl",5}]}.
{call,1,{f,9}}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{call,1,{f,9}}. % id/1
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{test_heap,7,1}.
{put_tuple2,{x,0},{list,[{atom,x},{atom,y},{x,0}]}}.
{put_tuple2,{x,1},{list,[{y,0},{x,0}]}}.
{move,{y,1},{x,0}}.
{trim,2,0}.
{line,[{location,"get_two_tuple_elements.erl",5}]}.
{call,2,{f,5}}.
{'%',{var_info,{x,0},[{type,{t_number,any}}]}}.
{test,is_eq_exact,{f,3},[{x,0},{integer,3}]}.
{call,2,{f,5}}. % xx/2
{'%',{var_info,{x,0},[{type,#beam_types:t_integer{elements = {2,4}}}]}}.
{test,is_eq_exact,
{f,3},
[{tr,{x,0},#beam_types:t_integer{elements = {2,4}}},{integer,3}]}.
{move,{atom,ok},{x,0}}.
{deallocate,0}.
return.
{label,3}.
{line,[{location,"get_two_tuple_elements.erl",5}]}.
{badmatch,{x,0}}.


{function, xx, 2, 5}.
{label,4}.
{line,[{location,"get_two_tuple_elements.erl",8}]}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
30}]}.
{func_info,{atom,get_two_tuple_elements},{atom,xx},2}.
{label,5}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{'%',
{var_info,
{x,1},
[{type,
{t_tuple,2,true,
#{1 => {t_union,{t_atom,[x]},none,{t_integer,{1,2}},none,none,none},
2 =>
{t_tuple,3,true,
#{1 => {t_atom,[x]},
2 => {t_atom,[y]},
3 =>
{t_union,
{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}}}}}]}}.
#beam_types:t_tuple{
size = 2,exact = true,
elements =
#{1 =>
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,other = none},
2 =>
#beam_types:t_tuple{
size = 3,exact = true,
elements =
#{1 => #beam_types:t_atom{elements = [x]},
2 => #beam_types:t_atom{elements = [y]},
3 =>
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}}}}}]}}.
{get_tuple_element,{x,1},0,{x,0}}.
{get_tuple_element,{x,1},1,{x,1}}.
{get_tuple_element,{x,1},2,{x,1}}.
{move,nil,{x,2}}.
{call_only,3,{f,7}}.
{call_only,3,{f,7}}. % yy/3


{function, yy, 3, 7}.
{label,6}.
{line,[{location,"get_two_tuple_elements.erl",17}]}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
39}]}.
{func_info,{atom,get_two_tuple_elements},{atom,yy},3}.
{label,7}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{'%',{var_info,{x,1},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{'%',
{var_info,
{x,1},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
{'%',{var_info,{x,2},[{type,nil}]}}.
{line,[{location,"get_two_tuple_elements.erl",18}]}.
{gc_bif,'+',{f,0},2,[{x,0},{x,1}],{x,0}}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
40}]}.
{gc_bif,'+',
{f,0},
2,
[{tr,{x,0},
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,other = none}},
{tr,{x,1},
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,other = none}}],
{x,0}}.
return.


{function, id, 1, 9}.
{label,8}.
{line,[{location,"get_two_tuple_elements.erl",20}]}.
{line,[{location,"erts/emulator/test/tuple_SUITE_data/get_two_tuple_elements.erl",
42}]}.
{func_info,{atom,get_two_tuple_elements},{atom,id},1}.
{label,9}.
{'%',{var_info,{x,0},
[{type,{t_union,{t_atom,[x]},
none,
{t_integer,{1,2}},
none,none,none}}]}}.
{'%',
{var_info,
{x,0},
[{type,
#beam_types:t_union{
atom = #beam_types:t_atom{elements = [x]},
list = none,
number = #beam_types:t_integer{elements = {1,2}},
tuple_set = none,native_record_set = none,
other = none}}]}}.
return.


Expand All @@ -169,7 +233,6 @@
{func_info,{atom,get_two_tuple_elements},{atom,module_info},0}.
{label,11}.
{move,{atom,get_two_tuple_elements},{x,0}}.
{line,[]}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.


Expand All @@ -180,5 +243,4 @@
{label,13}.
{move,{x,0},{x,1}}.
{move,{atom,get_two_tuple_elements},{x,0}}.
{line,[]}.
{call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
1 change: 0 additions & 1 deletion lib/compiler/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ HRL_FILES= \
beam_asm.hrl \
beam_disasm.hrl \
beam_ssa_alias_debug.hrl \
beam_ssa_opt.hrl \
beam_ssa.hrl \
beam_types.hrl \
core_parse.hrl
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/beam_asm.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
%%
%% To aid in the above, the validator will explode upon encountering them in an
%% unfamiliar context.
-record(tr, {r :: beam_reg(), t :: type()}).
-record(tr, {r :: beam_reg(), t :: beam_types:type()}).
3 changes: 3 additions & 0 deletions lib/compiler/src/beam_call_types.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

-export([will_succeed/3, types/3, arith_type/2]).

-type type() :: beam_types:type().
-type normal_type() :: beam_types:normal_type().

%%
%% Define an upper limit for functions that return sizes of data
%% structures. The chosen value is about half the maxium size of a
Expand Down
7 changes: 5 additions & 2 deletions lib/compiler/src/beam_core_to_ssa.erl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ get_anno(#cg_select{anno=Anno}) -> Anno.
ds :: sets:set(), %Defined variables
funs=[], %Fun functions
free=#{}, %Free variables
rec_defaults :: #{atom() => type()}, %Native records.
rec_defaults :: #{atom() => beam_types:type()}, %Native records.
ws=[] :: [warning()], %Warnings.
beam_debug_info=false :: boolean()
}.
Expand All @@ -168,7 +168,10 @@ get_anno(#cg_select{anno=Anno}) -> Anno.
{'ok', #b_module{}, [warning()]}.

module(#c_module{name=#c_literal{val=Mod},exports=Es,attrs=As,defs=Fs}, Options) ->
_ = beam_ssa:module_info(module), %Load modules with records.
%% Load modules with exported native records.
_ = beam_ssa:module_info(module),
_ = beam_ssa_opt:module_info(module),
_ = beam_types:module_info(module),

Records = records(As),
Anno = #{records => Records},
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/beam_dict.erl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fname(Name, #asm{fnames=Fnames}=Dict) ->
{Index,Dict#asm{fnames=Fnames#{Name=>Index}}}
end.

-spec type(type(), bdict()) -> {non_neg_integer(), bdict()} | none.
-spec type(beam_types:type(), bdict()) -> {non_neg_integer(), bdict()} | none.

type(Type, #asm{types=Types0}=Dict) ->
ExtType = beam_types:encode_ext(Type),
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/beam_ssa.erl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
-type var_name() :: atom() | non_neg_integer().

-type literal_value() :: atom() | integer() | float() | list() |
nil() | tuple() | map() | binary() | fun().
nil() | tuple() | map() | binary() | fun() | record().

-type op() :: {'bif',atom()} |
{'float',float_op()} |
Expand Down
11 changes: 9 additions & 2 deletions lib/compiler/src/beam_ssa_alias.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@
%% information.
-define(MAX_REPETITIONS, 16).

-include("beam_ssa_opt.hrl").
-include("beam_ssa.hrl").

-include("beam_types.hrl").
-include("beam_ssa_alias_debug.hrl").

-type func_id() :: beam_ssa_opt:func_id().
-type func_info_db() :: beam_ssa_opt:func_info_db().
-type st_map() :: beam_ssa_opt:st_map().

-import_record(beam_ssa_opt, [func_info, opt_st]).

-ifdef(DEBUG_ALIAS).
-define(DP(FMT, ARGS), io:format(FMT, ARGS)).
-define(DP(FMT), io:format(FMT)).
Expand Down Expand Up @@ -101,7 +108,7 @@ fn(#b_local{name=#b_literal{val=N},arity=A}) ->

-type sharing_state() :: any(). % A graph

-type type_db() :: #{ beam_ssa:b_var() := type() }.
-type type_db() :: #{ beam_ssa:b_var() := beam_types:type() }.

%%%
%%% Optimization pass which calculates the alias status of values and
Expand Down
5 changes: 4 additions & 1 deletion lib/compiler/src/beam_ssa_bc_size.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
-export([opt/1]).

-import(lists, [any/2,member/2,reverse/1,sort/1]).
-import_record(beam_ssa_opt, [func_info, opt_st]).

-include("beam_ssa_opt.hrl").
-include("beam_ssa.hrl").

-type st_map() :: beam_ssa_opt:st_map().

-spec opt(st_map()) -> st_map().

Expand Down
Loading
Loading