aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_util.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-20 18:01:50 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-25 12:08:17 +0100
commitc157dce842bf78080c533472fcec74df01ed8fdb (patch)
treecc8db9c443261418e1abfc13cc21bb384f8e4ab9 /erts/emulator/beam/erl_db_util.c
parent1f3869b308af19fb9cf471a12b8a1fdeab9da290 (diff)
downloadotp-c157dce842bf78080c533472fcec74df01ed8fdb.tar.gz
otp-c157dce842bf78080c533472fcec74df01ed8fdb.tar.bz2
otp-c157dce842bf78080c533472fcec74df01ed8fdb.zip
erts: Combine flat and hash maps under one unifying tag
Diffstat (limited to 'erts/emulator/beam/erl_db_util.c')
-rw-r--r--erts/emulator/beam/erl_db_util.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index 9d699d4b22..0bf562d937 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -2153,16 +2153,16 @@ restart:
break;
case matchMkFlatMap:
n = *pc++;
- ehp = HAllocX(build_proc, 1 + MAP_HEADER_SIZE + n, HEAP_XTRA);
+ ehp = HAllocX(build_proc, 1 + MAP_HEADER_FLATMAP_SZ + n, HEAP_XTRA);
t = *ehp++ = *--esp;
{
flatmap_t *m = (flatmap_t *)ehp;
- m->thing_word = MAP_HEADER;
+ m->thing_word = MAP_HEADER_FLATMAP;
m->size = n;
m->keys = t;
}
t = make_flatmap(ehp);
- ehp += MAP_HEADER_SIZE;
+ ehp += MAP_HEADER_FLATMAP_SZ;
while (n--) {
*ehp++ = *--esp;
}
@@ -3540,14 +3540,10 @@ static DMCRet dmc_one_term(DMCContext *context,
DMC_PUSH(*stack, c);
break;
case (_TAG_HEADER_MAP >> _TAG_PRIMARY_SIZE):
- n = flatmap_get_size(flatmap_val(c));
- DMC_PUSH(*text, matchPushM);
- ++(context->stack_used);
- DMC_PUSH(*text, n);
- DMC_PUSH(*stack, c);
- break;
- case (_TAG_HEADER_HASHMAP >> _TAG_PRIMARY_SIZE):
- n = hashmap_size(c);
+ if (is_flatmap(c))
+ n = flatmap_get_size(flatmap_val(c));
+ else
+ n = hashmap_size(c);
DMC_PUSH(*text, matchPushM);
++(context->stack_used);
DMC_PUSH(*text, n);