aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/copy.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-26 10:38:49 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-26 10:38:49 +0100
commitcb16ed8d78c9b19e85305dbaad9b5773085e509d (patch)
tree7a8979c83889989d684bc2e6804acc57ac0336dc /erts/emulator/beam/copy.c
parent8eb65d33f0be00b06c3b8e44b5a2a830a106b831 (diff)
parent15ce2d396e5c3e5fe7c775a18764db1f7f589e54 (diff)
downloadotp-cb16ed8d78c9b19e85305dbaad9b5773085e509d.tar.gz
otp-cb16ed8d78c9b19e85305dbaad9b5773085e509d.tar.bz2
otp-cb16ed8d78c9b19e85305dbaad9b5773085e509d.zip
Merge branch 'egil/maps/refactor-tagscheme/OTP-12585'
* egil/maps/refactor-tagscheme/OTP-12585: erts: Refactor Map - use multiple values ESTACK_PUSHN erts: GC needs the size even if the frag is not referenced Revert "hipe: Handle separate hashmap tag correctly" erts: Combine flat and hash maps under one unifying tag
Diffstat (limited to 'erts/emulator/beam/copy.c')
-rw-r--r--erts/emulator/beam/copy.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c
index 027b85b079..4d12dae787 100644
--- a/erts/emulator/beam/copy.c
+++ b/erts/emulator/beam/copy.c
@@ -127,8 +127,25 @@ Uint size_object(Eterm obj)
obj = *bptr;
break;
}
- case HASHMAP_SUBTAG:
+ case MAP_SUBTAG:
switch (MAP_HEADER_TYPE(hdr)) {
+ case MAP_HEADER_TAG_FLATMAP_HEAD :
+ {
+ Uint n;
+ flatmap_t *mp;
+ mp = (flatmap_t*)flatmap_val_rel(obj,base);
+ ptr = (Eterm *)mp;
+ n = flatmap_get_size(mp) + 1;
+ sum += n + 2;
+ ptr += 2; /* hdr + size words */
+ while (n--) {
+ obj = *ptr++;
+ if (!IS_CONST(obj)) {
+ ESTACK_PUSH(s, obj);
+ }
+ }
+ goto pop_next;
+ }
case MAP_HEADER_TAG_HAMT_HEAD_BITMAP :
case MAP_HEADER_TAG_HAMT_HEAD_ARRAY :
case MAP_HEADER_TAG_HAMT_NODE_BITMAP :
@@ -183,25 +200,7 @@ Uint size_object(Eterm obj)
goto pop_next;
}
break;
- case MAP_SUBTAG:
- {
- Uint n;
- flatmap_t *mp;
- mp = (flatmap_t*)flatmap_val_rel(obj,base);
- ptr = (Eterm *)mp;
- n = flatmap_get_size(mp) + 1;
- sum += n + 2;
- ptr += 2; /* hdr + size words */
- while (n--) {
- obj = *ptr++;
- if (!IS_CONST(obj)) {
- ESTACK_PUSH(s, obj);
- }
- }
- goto pop_next;
- }
- break;
- case BIN_MATCHSTATE_SUBTAG:
+ case BIN_MATCHSTATE_SUBTAG:
erl_exit(ERTS_ABORT_EXIT,
"size_object: matchstate term not allowed");
default:
@@ -369,15 +368,6 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
}
}
break;
- case MAP_SUBTAG:
- {
- i = flatmap_get_size(objp) + 3;
- *argp = make_flatmap_rel(htop, dst_base);
- while (i--) {
- *htop++ = *objp++;
- }
- }
- break;
case REFC_BINARY_SUBTAG:
{
ProcBin* pb;
@@ -502,9 +492,16 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
*argp = make_external_rel(tp, dst_base);
}
break;
- case HASHMAP_SUBTAG:
+ case MAP_SUBTAG:
tp = htop;
switch (MAP_HEADER_TYPE(hdr)) {
+ case MAP_HEADER_TAG_FLATMAP_HEAD :
+ i = flatmap_get_size(objp) + 3;
+ *argp = make_flatmap_rel(htop, dst_base);
+ while (i--) {
+ *htop++ = *objp++;
+ }
+ break;
case MAP_HEADER_TAG_HAMT_HEAD_BITMAP :
case MAP_HEADER_TAG_HAMT_HEAD_ARRAY :
*htop++ = *objp++;