diff options
author | John Högberg <john@erlang.org> | 2019-10-07 15:09:43 +0200 |
---|---|---|
committer | John Högberg <john@erlang.org> | 2019-10-07 15:46:18 +0200 |
commit | 45817396761e68633dfc76418a1c1f4922d4dcbc (patch) | |
tree | b77767bf77b1c763233442aee5fd906e14aa1789 /lib/compiler/src/beam_call_types.erl | |
parent | cce8de4d5f4646a6aaa7449458eed3366c6f821a (diff) | |
download | erlang-45817396761e68633dfc76418a1c1f4922d4dcbc.tar.gz |
compiler: Limit tuple element type information to first 12 elements
This fixes the catastrophic growth of type information in cases
where we have extremely nested and wide tuples, such as the
generated test code in beam_SUITE:packed_registers/1.
The effect on type optimization is rather minimal, with only a
handful degradations in all of OTP.
Diffstat (limited to 'lib/compiler/src/beam_call_types.erl')
-rw-r--r-- | lib/compiler/src/beam_call_types.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index 571542f2a3..4dbedde7ae 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -216,7 +216,7 @@ types(erlang, element, [PosType, TupleType]) -> RetType = case TupleType of #t_tuple{size=Sz,elements=Es} when Index =< Sz, Index >= 1 -> - beam_types:get_element_type(Index, Es); + beam_types:get_tuple_element(Index, Es); _ -> any end, @@ -229,7 +229,7 @@ types(erlang, setelement, [PosType, TupleType, ArgType]) -> %% This is an exact index, update the type of said %% element or return 'none' if it's known to be out of %% bounds. - Es = beam_types:set_element_type(Index, ArgType, Es0), + Es = beam_types:set_tuple_element(Index, ArgType, Es0), case T#t_tuple.exact of false -> T#t_tuple{size=max(Index, Size),elements=Es}; @@ -416,7 +416,7 @@ types(lists, keyfind, [KeyType,PosType,_]) -> TupleType = case PosType of #t_integer{elements={Index,Index}} when is_integer(Index), Index >= 1 -> - Es = beam_types:set_element_type(Index, KeyType, #{}), + Es = beam_types:set_tuple_element(Index, KeyType, #{}), #t_tuple{size=Index,elements=Es}; _ -> #t_tuple{} @@ -536,6 +536,6 @@ lists_zip_type(Types) -> end, list, Types). make_two_tuple(Type1, Type2) -> - Es0 = beam_types:set_element_type(1, Type1, #{}), - Es = beam_types:set_element_type(2, Type2, Es0), + Es0 = beam_types:set_tuple_element(1, Type1, #{}), + Es = beam_types:set_tuple_element(2, Type2, Es0), #t_tuple{size=2,exact=true,elements=Es}. |