aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
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