aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/external.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/external.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/external.c')
-rw-r--r--erts/emulator/beam/external.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index b0b232f185..2a9189b51e 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -2604,7 +2604,7 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
break;
case MAP_DEF:
- {
+ if (is_flatmap(obj)) {
flatmap_t *mp = (flatmap_t*)flatmap_val(obj);
Uint size = flatmap_get_size(mp);
@@ -2618,11 +2618,7 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
WSTACK_PUSH4(s, (UWord)kptr, (UWord)vptr,
ENC_MAP_PAIR, size);
}
- }
- break;
-
- case HASHMAP_DEF:
- {
+ } else {
Eterm hdr;
Uint node_sz;
ptr = boxed_val(obj);
@@ -2656,7 +2652,6 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
}
}
break;
-
case FLOAT_DEF:
GET_DOUBLE(obj, f);
if (dflags & DFLAG_NEW_FLOATS) {
@@ -3607,7 +3602,7 @@ dec_term_atom_common:
kptr = hp - 1;
mp = (flatmap_t*)hp;
- hp += MAP_HEADER_SIZE;
+ hp += MAP_HEADER_FLATMAP_SZ;
hp += size;
vptr = hp - 1;
@@ -3893,7 +3888,7 @@ dec_term_atom_common:
while (maps_list) {
next = (Eterm *)(EXPAND_POINTER(*maps_list));
- *maps_list = MAP_HEADER;
+ *maps_list = MAP_HEADER_FLATMAP;
if (!erts_validate_and_sort_flatmap((flatmap_t*)maps_list))
goto error;
maps_list = next;
@@ -4121,7 +4116,7 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj,
}
break;
case MAP_DEF:
- {
+ if (is_flatmap(obj)) {
flatmap_t *mp = (flatmap_t*)flatmap_val(obj);
Uint size = flatmap_get_size(mp);
Uint i;
@@ -4158,11 +4153,7 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj,
++ptr;
}
goto outer_loop;
- }
- break;
-
- case HASHMAP_DEF:
- {
+ } else {
Eterm *ptr;
Eterm hdr;
Uint node_sz;
@@ -4190,7 +4181,6 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj,
}
result += 1 + 4; /* tag + 4 bytes size */
}
-
break;
case FLOAT_DEF:
if (dflags & DFLAG_NEW_FLOATS) {