aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-17 15:44:07 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-19 14:57:56 +0100
commitfeffe2deac13ad61477c7ecf63342815c750bfe5 (patch)
tree3553b30996c19120bb7b501ef72707bf7a4bcc4b /erts/emulator/beam
parent3c55267c6176a7183c59fc2ca6c1b278df080373 (diff)
downloadotp-feffe2deac13ad61477c7ecf63342815c750bfe5.tar.gz
otp-feffe2deac13ad61477c7ecf63342815c750bfe5.tar.bz2
otp-feffe2deac13ad61477c7ecf63342815c750bfe5.zip
erts: Ensure maps uses _rel functions in halfword
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_map.c19
-rw-r--r--erts/emulator/beam/erl_map.h13
2 files changed, 23 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c
index 4183b532a9..bd6da0a6f1 100644
--- a/erts/emulator/beam/erl_map.c
+++ b/erts/emulator/beam/erl_map.c
@@ -165,7 +165,7 @@ erts_maps_get(Eterm key, Eterm map)
#endif
{
Uint32 hx;
- if (is_flatmap(map)) {
+ if (is_flatmap_rel(map, map_base)) {
Eterm *ks, *vs;
flatmap_t *mp;
Uint n, i;
@@ -189,16 +189,16 @@ erts_maps_get(Eterm key, Eterm map)
}
for (i = 0; i < n; i++) {
- if (eq_rel(ks[i], NULL, key, map_base)) {
+ if (eq_rel(ks[i], map_base, key, NULL)) {
return &vs[i];
}
}
return NULL;
}
- ASSERT(is_hashmap(map));
+ ASSERT(is_hashmap_rel(map, map_base));
hx = hashmap_make_hash(key);
- return erts_hashmap_get(hx, key, map);
+ return erts_hashmap_get_rel(hx, key, map, map_base);
}
BIF_RETTYPE maps_find_2(BIF_ALIST_2) {
@@ -1833,7 +1833,13 @@ Eterm* hashmap_iterator_prev(ErtsWStack* s) {
}
}
-const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm node) {
+const Eterm *
+#if HALFWORD_HEAP
+erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base)
+#else
+erts_hashmap_get(Uint32 hx, Eterm key, Eterm node)
+#endif
+{
Eterm *ptr, hdr;
Uint ix,slot, lvl = 0;
Uint32 hval,bp;
@@ -1845,7 +1851,8 @@ const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm node) {
case TAG_PRIMARY_LIST: /* LEAF NODE [K|V] */
ptr = list_val(node);
UnUseTmpHeapNoproc(2);
- if (EQ(CAR(ptr), key)) {
+
+ if (eq_rel(CAR(ptr), map_base, key, NULL)) {
return &(CDR(ptr));
}
return NULL;
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h
index d075d87c83..1333a734a8 100644
--- a/erts/emulator/beam/erl_map.h
+++ b/erts/emulator/beam/erl_map.h
@@ -109,7 +109,6 @@ Eterm* hashmap_iterator_next(struct ErtsWStack_* s);
Eterm* hashmap_iterator_prev(struct ErtsWStack_* s);
int hashmap_key_hash_cmp(Eterm* ap, Eterm* bp);
Eterm erts_hashmap_from_array(ErtsHeapFactory*, Eterm *leafs, Uint n, int reject_dupkeys);
-const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);
#define erts_hashmap_from_ks_and_vs(P, KS, VS, N) \
erts_hashmap_from_ks_and_vs_extra((P), (KS), (VS), (N), THE_NON_VALUE, THE_NON_VALUE);
@@ -117,16 +116,24 @@ const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);
Eterm erts_hashmap_from_ks_and_vs_extra(Process *p, Eterm *ks, Eterm *vs, Uint n,
Eterm k, Eterm v);
-#if HALFWORD_HEAP
const Eterm *
+#if HALFWORD_HEAP
erts_maps_get_rel(Eterm key, Eterm map, Eterm *map_base);
# define erts_maps_get(A, B) erts_maps_get_rel(A, B, NULL)
#else
-const Eterm *
erts_maps_get(Eterm key, Eterm map);
# define erts_maps_get_rel(A, B, B_BASE) erts_maps_get(A, B)
#endif
+const Eterm *
+#if HALFWORD_HEAP
+erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base);
+# define erts_hashmap_get(Hx, K, M) erts_hashmap_get_rel(Hx, K, M, NULL)
+#else
+erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);
+# define erts_hashmap_get_rel(Hx, K, M, M_BASE) erts_hashmap_get(Hx, K, M)
+#endif
+
/* hamt nodes v2.0
*
* node :: leaf | array | bitmap