From 701ed39cc53e40783c4b48c83f9f686eb2668d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 12 Dec 2013 13:24:05 +0100 Subject: compiler: Fix term order compiler for maps --- lib/compiler/src/v3_codegen.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/compiler') diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl index db8ea04778..c8735a76e8 100644 --- a/lib/compiler/src/v3_codegen.erl +++ b/lib/compiler/src/v3_codegen.erl @@ -1572,7 +1572,7 @@ cg_map_pairs(Es0) -> end || {_,Vs} <- R2], %% R3 is now [{Op,{Key,Value}}] - R = lists:sort(R3), + R = termsort(R3), %% R4 is now sorted with all alloc first in the list, followed by %% all exact. @@ -1611,6 +1611,9 @@ map_pair_op_and_key(L) -> {assoc,K} end. +termsort(Ls) -> + lists:sort(fun(A,B) -> erts_internal:cmp_term(A,B) < 0 end, Ls). + %%% %%% Code generation for constructing binaries. %%% -- cgit v1.2.3