aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_map.h
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-09-19 14:37:59 +0200
committerLukas Larsson <[email protected]>2017-10-13 15:44:33 +0200
commit513a322941d208d9dcdc4c39db2966ae4c707fe7 (patch)
tree05662bd1e66cd34b373f2b69fd7f26649610ecb3 /erts/emulator/beam/erl_map.h
parentd945d6f1c71d5442a25e4be60f84fc49ae8b6b4e (diff)
downloadotp-513a322941d208d9dcdc4c39db2966ae4c707fe7.tar.gz
otp-513a322941d208d9dcdc4c39db2966ae4c707fe7.tar.bz2
otp-513a322941d208d9dcdc4c39db2966ae4c707fe7.zip
erts: Implement map iterator using a stack
This version does not work great as the subtrees created are not proper hash maps. Also it is not all that performant as the extra allocations to keep the stack there is expensive.
Diffstat (limited to 'erts/emulator/beam/erl_map.h')
-rw-r--r--erts/emulator/beam/erl_map.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h
index c3ccf80b85..d910e98398 100644
--- a/erts/emulator/beam/erl_map.h
+++ b/erts/emulator/beam/erl_map.h
@@ -56,7 +56,7 @@ typedef struct flatmap_s {
/* the head-node is a bitmap or array with an untagged size */
-#define hashmap_size(x) (((hashmap_head_t*) hashmap_val(x))->size)
+#define hashmap_size(x) (((hashmap_head_t*) hashmap_val(x))->size == -1 ? hashmap_subtree_size(x) : ((hashmap_head_t*) hashmap_val(x))->size)
#define hashmap_make_hash(Key) make_internal_hash(Key, 0)
#define hashmap_restore_hash(Heap,Lvl,Key) \
@@ -106,6 +106,7 @@ Eterm erts_hashmap_from_ks_and_vs_extra(ErtsHeapFactory *factory,
Eterm *ks, Eterm *vs, Uint n,
Eterm k, Eterm v);
+Uint hashmap_subtree_size(Eterm node);
const Eterm *erts_maps_get(Eterm key, Eterm map);
const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);