aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_guard.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-16 15:01:55 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-16 15:01:55 +0200
commit51a270568842ffd4f764293f25044337695618fa (patch)
tree94c0a04c05be3fee0bd6f3a4321ee91a2855c2ac /erts/emulator/beam/erl_bif_guard.c
parent77484f2430133ec98ce0c63e037c3e3d183910be (diff)
parent647c66952afa9036c060a7685071bb27e01c2151 (diff)
downloadotp-51a270568842ffd4f764293f25044337695618fa.tar.gz
otp-51a270568842ffd4f764293f25044337695618fa.tar.bz2
otp-51a270568842ffd4f764293f25044337695618fa.zip
Merge branch 'egil/maps-refactor'
* egil/maps-refactor: erts: Use make_small for size terms on flat maps Conflicts: erts/emulator/beam/erl_bif_guard.c
Diffstat (limited to 'erts/emulator/beam/erl_bif_guard.c')
-rw-r--r--erts/emulator/beam/erl_bif_guard.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index 069327ee9d..6226ec2d04 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -459,26 +459,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_flatmap(arg)) {
flatmap_t *mp = (flatmap_t*)flatmap_val(arg);
- size = flatmap_get_size(mp);
+ return make_small(flatmap_get_size(mp));
} else if (is_hashmap(arg)) {
+ Eterm* hp;
+ Uint size;
size = hashmap_size(arg);
- } else {
- p->fvalue = arg;
- BIF_ERROR(p, BADMAP);
- }
- 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);
+ 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);
+ }
+ p->fvalue = arg;
+ BIF_ERROR(p, BADMAP);
}
Eterm erts_gc_abs_1(Process* p, Eterm* reg, Uint live)