aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-03 12:46:05 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-12 19:15:31 +0100
commit9794b73998690178538a1dfc193565dcd477b4fe (patch)
tree64a98ff673023c77410fd671639d2bbed7d9176c /erts/emulator/beam/beam_emu.c
parentba117527441b58886a06c0feff40677b9fa48983 (diff)
downloadotp-9794b73998690178538a1dfc193565dcd477b4fe.tar.gz
otp-9794b73998690178538a1dfc193565dcd477b4fe.tar.bz2
otp-9794b73998690178538a1dfc193565dcd477b4fe.zip
erts: Fix update_map_assoc instruction
Did not build a hashmap once the small limit was exceeded.
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 1166b32a3b..c753e57ddc 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -6781,8 +6781,19 @@ update_map_assoc(Process* p, Eterm* reg, Eterm map, BeamInstr* I)
n = kp - p->htop - 1; /* Actual number of keys/values */
*p->htop = make_arityval(n);
+ p->htop = hp;
mp->size = n;
- p->htop = hp;
+
+ /* The expensive case, need to build a hashmap */
+ if (n > MAP_SMALL_MAP_LIMIT) {
+ res = erts_hashmap_from_ks_and_vs(p,map_get_keys(mp),map_get_values(mp),n);
+ if (p->mbuf) {
+ Uint live = Arg(3);
+ reg[live] = res;
+ erts_garbage_collect(p, 0, reg, live+1);
+ res = reg[live];
+ }
+ }
return res;
}