diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-02-19 16:25:03 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-03-12 19:15:26 +0100 |
commit | 9cfaa729d7319ede30f62ffaaf82eb10fbaf8a60 (patch) | |
tree | b08c2cc5a185e7f2f203f3150543fd1a385db6df /erts/emulator/beam/erl_bif_guard.c | |
parent | 7a12c43da25e3dcad54212f538ebae3dc13f5c2e (diff) | |
download | otp-9cfaa729d7319ede30f62ffaaf82eb10fbaf8a60.tar.gz otp-9cfaa729d7319ede30f62ffaaf82eb10fbaf8a60.tar.bz2 otp-9cfaa729d7319ede30f62ffaaf82eb10fbaf8a60.zip |
erts: Move hashmap:size/1 to maps
Diffstat (limited to 'erts/emulator/beam/erl_bif_guard.c')
-rw-r--r-- | erts/emulator/beam/erl_bif_guard.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c index bbd8aa31d9..a5d1d3a5cb 100644 --- a/erts/emulator/beam/erl_bif_guard.c +++ b/erts/emulator/beam/erl_bif_guard.c @@ -34,6 +34,7 @@ #include "big.h" #include "erl_binary.h" #include "erl_map.h" +#include "erl_hashmap.h" static Eterm gc_double_to_integer(Process* p, double x, Eterm* reg, Uint live); @@ -459,23 +460,25 @@ Eterm erts_gc_byte_size_1(Process* p, Eterm* reg, Uint live) Eterm erts_gc_map_size_1(Process* p, Eterm* reg, Uint live) { Eterm arg = reg[live]; + Eterm* hp; + Uint size; if (is_map(arg)) { map_t *mp = (map_t*)map_val(arg); - Uint size = map_get_size(mp); - if (IS_USMALL(0, size)) { - return make_small(size); - } else { - Eterm* hp; - if (ERTS_NEED_GC(p, BIG_UINT_HEAP_SIZE)) { - erts_garbage_collect(p, BIG_UINT_HEAP_SIZE, reg, live); - } - hp = p->htop; - p->htop += BIG_UINT_HEAP_SIZE; - return uint_to_big(size, hp); - } + size = map_get_size(mp); + } else if (is_hashmap(arg)) { + size = hashmap_size(arg); } else { BIF_ERROR(p, BADARG); } + if (IS_USMALL(0, size)) { + return make_small(size); + } + if (ERTS_NEED_GC(p, BIG_UINT_HEAP_SIZE)) { + erts_garbage_collect(p, BIG_UINT_HEAP_SIZE, reg, live); + } + hp = p->htop; + p->htop += BIG_UINT_HEAP_SIZE; + return uint_to_big(size, hp); } Eterm erts_gc_abs_1(Process* p, Eterm* reg, Uint live) |