aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_map.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-10-15 20:10:46 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-12-07 19:34:39 +0100
commit2ae91c3ade0538500ff4dbda29ad539e595f64df (patch)
tree5d3e77bfd2c97b6391710b1030c766fedde0d3ca /erts/emulator/beam/erl_map.c
parente656b6e26de27db6a4235961f7e667998d3a2832 (diff)
downloadotp-2ae91c3ade0538500ff4dbda29ad539e595f64df.tar.gz
otp-2ae91c3ade0538500ff4dbda29ad539e595f64df.tar.bz2
otp-2ae91c3ade0538500ff4dbda29ad539e595f64df.zip
erts: Change erts_internal:map_type/1 into term_type/1
to support other terms, not just maps
Diffstat (limited to 'erts/emulator/beam/erl_map.c')
-rw-r--r--erts/emulator/beam/erl_map.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c
index 29b3024644..ac10b9a3e3 100644
--- a/erts/emulator/beam/erl_map.c
+++ b/erts/emulator/beam/erl_map.c
@@ -2698,29 +2698,38 @@ BIF_RETTYPE erts_internal_map_to_tuple_keys_1(BIF_ALIST_1) {
}
/*
- * erts_internal:map_type/1
+ * erts_internal:term_type/1
*
* Used in erts_debug:size/1
*/
-BIF_RETTYPE erts_internal_map_type_1(BIF_ALIST_1) {
- DECL_AM(hashmap);
- DECL_AM(hashmap_node);
- DECL_AM(flatmap);
+BIF_RETTYPE erts_internal_term_type_1(BIF_ALIST_1) {
if (is_map(BIF_ARG_1)) {
Eterm hdr = *(boxed_val(BIF_ARG_1));
ASSERT(is_header(hdr));
switch (hdr & _HEADER_MAP_SUBTAG_MASK) {
case HAMT_SUBTAG_HEAD_FLATMAP:
- BIF_RET(AM_flatmap);
+ BIF_RET(ERTS_MAKE_AM("flatmap"));
case HAMT_SUBTAG_HEAD_ARRAY:
case HAMT_SUBTAG_HEAD_BITMAP:
- BIF_RET(AM_hashmap);
+ BIF_RET(ERTS_MAKE_AM("hashmap"));
case HAMT_SUBTAG_NODE_BITMAP:
- BIF_RET(AM_hashmap_node);
+ BIF_RET(ERTS_MAKE_AM("hashmap_node"));
default:
erl_exit(1, "bad header");
}
+ } else if (is_immed(BIF_ARG_1)) {
+ if (is_small(BIF_ARG_1)) {
+ BIF_RET(ERTS_MAKE_AM("small"));
+ } else if (is_ifloat(BIF_ARG_1)) {
+ BIF_RET(ERTS_MAKE_AM("ifloat"));
+ }
+ } else if (is_boxed(BIF_ARG_1)) {
+ if (is_big(BIF_ARG_1)) {
+ BIF_RET(ERTS_MAKE_AM("big"));
+ } else if (is_hfloat(BIF_ARG_1)) {
+ BIF_RET(ERTS_MAKE_AM("hfloat"));
+ }
}
BIF_P->fvalue = BIF_ARG_1;
BIF_ERROR(BIF_P, BADMAP);