diff options
author | Björn Gustavsson <[email protected]> | 2015-03-24 13:26:18 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-04-13 12:37:55 +0200 |
commit | c8893f9aaf6ff585c44259aad21914ccbe904783 (patch) | |
tree | 4f8dcbf42898a8f281b5cc1e7079fafda3049184 /lib/compiler/src/v3_codegen.erl | |
parent | 1414073af81016d54fc9157f2005301b7fcf4fe6 (diff) | |
download | otp-c8893f9aaf6ff585c44259aad21914ccbe904783.tar.gz otp-c8893f9aaf6ff585c44259aad21914ccbe904783.tar.bz2 otp-c8893f9aaf6ff585c44259aad21914ccbe904783.zip |
v3_codegen: Don't sort map keys in map creation/update
It is no longer necessary to sort the keys, since the loader
does the sorting.
Diffstat (limited to 'lib/compiler/src/v3_codegen.erl')
-rw-r--r-- | lib/compiler/src/v3_codegen.erl | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl index 7eec9dd62b..40235d6767 100644 --- a/lib/compiler/src/v3_codegen.erl +++ b/lib/compiler/src/v3_codegen.erl @@ -1549,11 +1549,8 @@ set_cg([{var,R}], {map,Op,Map,Es}, Le, Vdb, Bef, SrcReg = cg_reg_arg(Map,Int0), Line = line(Le#l.a), - %% The instruction needs to store keys in term sorted order - %% All keys has to be unique here - Pairs = map_pair_strip_and_termsort(Es), - %% fetch registers for values to be put into the map + Pairs = [{K,V} || {_,K,V} <- Es], List = flatmap(fun({K,V}) -> [K,cg_reg_arg(V,Int0)] end, Pairs), Live = max_reg(Bef#sr.reg), @@ -1580,16 +1577,6 @@ set_cg([{var,R}], Con, Le, Vdb, Bef, St) -> end, {Ais,clear_dead(Int, Le#l.i, Vdb),St}. -map_pair_strip_and_termsort(Es) -> - %% format in - %% [{map_pair,K,V}] - %% where K is for example {integer, 1} and we want to sort on 1. - Ls = [{K,V}||{_,K,V}<-Es], - lists:sort(fun ({{_,A},_}, {{_,B},_}) -> erts_internal:cmp_term(A,B) =< 0; - ({nil,_}, {{_,B},_}) -> [] =< B; - ({{_,A},_}, {nil,_}) -> A =< [] - end, Ls). - %%% %%% Code generation for constructing binaries. %%% |