aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-02-19 17:19:31 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-12 19:15:26 +0100
commit7da662fb9eb519625b3833fec34419c32620f041 (patch)
tree2d7c8fad2e9e469a754fde76e81a5c0f50b756a1 /erts/emulator/beam
parent903740ac57b00d404f430876b82cb21e0bb684a3 (diff)
downloadotp-7da662fb9eb519625b3833fec34419c32620f041.tar.gz
otp-7da662fb9eb519625b3833fec34419c32620f041.tar.bz2
otp-7da662fb9eb519625b3833fec34419c32620f041.zip
erts: Move erlang:is_hashmap/1 to maps
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/beam_emu.c2
-rw-r--r--erts/emulator/beam/bif.tab1
-rw-r--r--erts/emulator/beam/erl_bif_op.c2
-rw-r--r--erts/emulator/beam/erl_hashmap.c11
-rw-r--r--erts/emulator/beam/erl_term.h1
5 files changed, 4 insertions, 13 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index b734d34872..034436e975 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -699,7 +699,7 @@ void** beam_ops;
Fail; \
}
-#define IsMap(Src, Fail) if (is_not_map(Src)) { Fail; }
+#define IsMap(Src, Fail) if (is_not_map(Src) && is_not_hashmap(Src)) { Fail; }
#define HasMapField(Src, Key, Fail) if (has_not_map_field(Src, Key)) { Fail; }
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 6bd9291d34..f7f6eb9213 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -624,7 +624,6 @@ bif hashmap:info/1
bif hashmap:from_list/1
bif hashmap:new/0
bif hashmap:is_key/2
-bif erlang:is_hashmap/1
bif hashmap:merge/2
#
diff --git a/erts/emulator/beam/erl_bif_op.c b/erts/emulator/beam/erl_bif_op.c
index 37dd6457db..11c6c9e556 100644
--- a/erts/emulator/beam/erl_bif_op.c
+++ b/erts/emulator/beam/erl_bif_op.c
@@ -324,7 +324,7 @@ BIF_RETTYPE is_record_3(BIF_ALIST_3)
BIF_RETTYPE is_map_1(BIF_ALIST_1)
{
- if (is_map(BIF_ARG_1)) {
+ if (is_map(BIF_ARG_1) || is_hashmap(BIF_ARG_1)) {
BIF_RET(am_true);
}
BIF_RET(am_false);
diff --git a/erts/emulator/beam/erl_hashmap.c b/erts/emulator/beam/erl_hashmap.c
index 064ae73acd..e51767146e 100644
--- a/erts/emulator/beam/erl_hashmap.c
+++ b/erts/emulator/beam/erl_hashmap.c
@@ -189,18 +189,9 @@ BIF_RETTYPE hashmap_remove_2(BIF_ALIST_2) {
}
/* hashmap:size/1 */
-
/* erlang:is_hashmap/1 */
-BIF_RETTYPE is_hashmap_1(BIF_ALIST_1) {
- if (is_hashmap(BIF_ARG_1)) {
- BIF_RET(am_true);
- }
- BIF_RET(am_false);
-}
-
-/* hashmap:is_key/2
- */
+/* hashmap:is_key/2 */
BIF_RETTYPE hashmap_is_key_2(BIF_ALIST_2) {
if (is_hashmap(BIF_ARG_1)) {
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index 7605a41cd8..264bf8bd74 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -1013,6 +1013,7 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm)
#define make_hashmap(x) make_boxed((Eterm*)(x))
#define make_hashmap_rel make_boxed_rel
#define is_hashmap(x) (is_boxed((x)) && is_hashmap_header(*boxed_val((x))))
+#define is_not_hashmap(x) (!is_hashmap(x))
#define is_hashmap_rel(RTERM,BASE) is_hashmap(rterm2wterm(RTERM,BASE))
#define is_hashmap_header(x) (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_HASHMAP)
#define hashmap_val(x) _unchecked_boxed_val((x))