aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-10-03 13:22:32 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-01-28 15:56:28 +0100
commitc0bb7f866257168e0a05110767fc7096a93d351d (patch)
treeaafff8dda62734beb98b6a6470a34e69edab89bc /lib/compiler/src
parentaee6128a1bfb2356440b27a9c7db44650336e4c3 (diff)
downloadotp-c0bb7f866257168e0a05110767fc7096a93d351d.tar.gz
otp-c0bb7f866257168e0a05110767fc7096a93d351d.tar.bz2
otp-c0bb7f866257168e0a05110767fc7096a93d351d.zip
sys_core_fold: Remove optimization that has become invalid
With the => and := operators for updating maps, this optimization is no longer valid.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/sys_core_fold.erl29
1 files changed, 1 insertions, 28 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 2cd6ea0e53..6792e2c894 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -418,35 +418,8 @@ expr(#c_try{anno=A,arg=E0,vars=Vs0,body=B0,evars=Evs0,handler=H0}=Try, _, Sub0)
expr_list(Es, Ctxt, Sub) ->
[expr(E, Ctxt, Sub) || E <- Es].
-%% traverse pairs in reverse
-%% - remove later literals since they will be overwritten.
-
pair_list(Es, Ctxt, Sub) ->
- pair_list_reversed(lists:reverse(Es), Ctxt, Sub, [], gb_sets:empty()).
-
-pair_list_reversed([],_,_,Es,_) -> Es;
-pair_list_reversed([E|Es],Ctxt,Sub,Out,Keys) ->
- Pair = pair(E,Ctxt,Sub),
- case map_has_key(Pair,Keys) of
- {false,Keys1} ->
- pair_list_reversed(Es,Ctxt,Sub,[Pair|Out],Keys1);
- {true,K} ->
- add_warning(E, {map_pair_key_overloaded,K}),
- pair_list_reversed(Es,Ctxt,Sub,Out,Keys)
- end.
-
-%% check if key already is present in map, i.e. #{ a=>1, a=>2 }
-%% where 'a' is duplicate. Update maps set with the key if not present.
-
-map_has_key(MapPair,Ks) ->
- K = map_get_literal_key_from_pair(MapPair),
- case gb_sets:is_element(K,Ks) of
- false -> {false, gb_sets:add(K,Ks)};
- true -> {true, K}
- end.
-
-map_get_literal_key_from_pair(#c_map_pair_assoc{key=#c_literal{val=K}}) -> K;
-map_get_literal_key_from_pair(#c_map_pair_exact{key=#c_literal{val=K}}) -> K.
+ [pair(E, Ctxt, Sub) || E <- Es].
pair(#c_map_pair_assoc{key=K,val=V}, effect, Sub) ->
make_effect_seq([K,V], Sub);