aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/atom.h1
-rw-r--r--erts/emulator/beam/bif.tab2
-rw-r--r--erts/emulator/beam/erl_map.c25
3 files changed, 19 insertions, 9 deletions
diff --git a/erts/emulator/beam/atom.h b/erts/emulator/beam/atom.h
index ead56c83d8..2c002ca92f 100644
--- a/erts/emulator/beam/atom.h
+++ b/erts/emulator/beam/atom.h
@@ -129,6 +129,7 @@ typedef enum {
(erts_is_atom_utf8_bytes((byte *) LSTR, sizeof(LSTR) - 1, (TERM)))
#define ERTS_DECL_AM(S) Eterm AM_ ## S = am_atom_put(#S, sizeof(#S) - 1)
#define ERTS_INIT_AM(S) AM_ ## S = am_atom_put(#S, sizeof(#S) - 1)
+#define ERTS_MAKE_AM(Str) am_atom_put(Str, sizeof(Str) - 1)
int atom_table_size(void); /* number of elements */
int atom_table_sz(void); /* table size in bytes, excluding stored objects */
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index c49a3ff313..07d4702b92 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -167,7 +167,7 @@ bif erts_internal:request_system_task/3
bif erts_internal:check_process_code/2
bif erts_internal:map_to_tuple_keys/1
-bif erts_internal:map_type/1
+bif erts_internal:term_type/1
bif erts_internal:map_hashmap_children/1
bif erts_internal:time_unit/0
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);