From 7da662fb9eb519625b3833fec34419c32620f041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 19 Feb 2015 17:19:31 +0100 Subject: erts: Move erlang:is_hashmap/1 to maps --- erts/emulator/beam/beam_emu.c | 2 +- erts/emulator/beam/bif.tab | 1 - erts/emulator/beam/erl_bif_op.c | 2 +- erts/emulator/beam/erl_hashmap.c | 11 +---------- erts/emulator/beam/erl_term.h | 1 + 5 files changed, 4 insertions(+), 13 deletions(-) (limited to 'erts/emulator/beam') 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)) -- cgit v1.2.3