aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-07-02 15:52:19 +0200
committerHans Bolinder <[email protected]>2015-08-25 09:24:56 +0200
commitf51ee4709129bc2259e8dd443a278124b0d7e312 (patch)
treecb02982be3c50af8ef4e045957c02d3ade934299 /lib/hipe
parent9a5788654c0e6a08b404ac3e68bf3894cf7e8252 (diff)
downloadotp-f51ee4709129bc2259e8dd443a278124b0d7e312.tar.gz
otp-f51ee4709129bc2259e8dd443a278124b0d7e312.tar.bz2
otp-f51ee4709129bc2259e8dd443a278124b0d7e312.zip
dialyzer: Optimize expansion of parameters of opaque types
Opaque recursive parameters are expanded faster.
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/erl_types.erl25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index f00663444a..56ec757dbf 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -4249,26 +4249,27 @@ type_from_form(Name, Args, TypeNames, ET, Site0, MR, V, D, L) ->
{type, {{Module, _FileName, Form, ArgNames}, _Type}} ->
case can_unfold_more(TypeName, TypeNames) of
true ->
+ NewTypeNames = [TypeName|TypeNames],
{ArgTypes, L1} =
list_from_form(Args, TypeNames, ET, Site0, MR, V, D, L),
List = lists:zip(ArgNames, ArgTypes),
TmpV = dict:from_list(List),
Site = TypeName,
- t_from_form(Form, [TypeName|TypeNames], ET, Site, MR, TmpV, D, L1);
+ t_from_form(Form, NewTypeNames, ET, Site, MR, TmpV, D, L1);
false ->
{t_any(), L}
end;
{opaque, {{Module, _FileName, Form, ArgNames}, Type}} ->
case can_unfold_more(TypeName, TypeNames) of
true ->
+ NewTypeNames = [TypeName|TypeNames],
{ArgTypes, L1} =
- list_from_form(Args, TypeNames, ET, Site0, MR, V, D, L),
+ list_from_form(Args, NewTypeNames, ET, Site0, MR, V, D, L),
List = lists:zip(ArgNames, ArgTypes),
TmpV = dict:from_list(List),
Site = TypeName,
{Rep, L2} =
- t_from_form(Form, [TypeName|TypeNames], ET, Site, MR,
- TmpV, D, L1),
+ t_from_form(Form, NewTypeNames, ET, Site, MR, TmpV, D, L1),
Rep1 = choose_opaque_type(Rep, Type),
Rep2 = case cannot_have_opaque(Rep1, TypeName, TypeNames) of
true -> Rep1;
@@ -4278,7 +4279,7 @@ type_from_form(Name, Args, TypeNames, ET, Site0, MR, V, D, L) ->
end,
{Rep2, L2};
false -> {t_any(), L}
- end;
+ end;
error ->
Msg = io_lib:format("Unable to find type ~w/~w\n", [Name, ArgsLen]),
throw({error, Msg})
@@ -4303,11 +4304,11 @@ remote_from_form(RemMod, Name, Args, TypeNames, ET, S, MR, V, D, L) ->
{type, {{_Mod, _FileLine, Form, ArgNames}, _Type}} ->
case can_unfold_more(RemType, TypeNames) of
true ->
- {ArgTypes, L1} =
- list_from_form(Args, TypeNames, ET, S, MR, V, D, L),
+ NewTypeNames = [RemType|TypeNames],
+ {ArgTypes, L1} = list_from_form(Args, TypeNames,
+ ET, S, MR, V, D, L),
List = lists:zip(ArgNames, ArgTypes),
TmpVarDict = dict:from_list(List),
- NewTypeNames = [RemType|TypeNames],
Site = RemType,
t_from_form(Form, NewTypeNames, ET,
Site, MR, TmpVarDict, D, L1);
@@ -4318,8 +4319,8 @@ remote_from_form(RemMod, Name, Args, TypeNames, ET, S, MR, V, D, L) ->
case can_unfold_more(RemType, TypeNames) of
true ->
NewTypeNames = [RemType|TypeNames],
- {ArgTypes, L1} =
- list_from_form(Args, TypeNames, ET, S, MR, V, D, L),
+ {ArgTypes, L1} = list_from_form(Args, NewTypeNames,
+ ET, S, MR, V, D, L),
List = lists:zip(ArgNames, ArgTypes),
TmpVarDict = dict:from_list(List),
Site = RemType,
@@ -4328,7 +4329,9 @@ remote_from_form(RemMod, Name, Args, TypeNames, ET, S, MR, V, D, L) ->
TmpVarDict, D, L1),
NewRep1 = choose_opaque_type(NewRep, Type),
NewRep2 =
- case cannot_have_opaque(NewRep1, RemType, TypeNames) of
+ case
+ cannot_have_opaque(NewRep1, RemType, TypeNames)
+ of
true -> NewRep1;
false ->
ArgTypes2 = subst_all_vars_to_any_list(ArgTypes),