aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/copy.c
diff options
context:
space:
mode:
authorNikolaos S. Papaspyrou <[email protected]>2014-04-24 12:59:39 +0300
committerBjörn-Egil Dahlberg <[email protected]>2015-11-17 14:45:46 +0100
commitbcdf32795a3f5a6aad95567cffba78fcecb9f40f (patch)
tree0d93ffa506c6a54833625f41b787882058646d1a /erts/emulator/beam/copy.c
parenteebdde01b149ea45966c7412bc2a062136457b54 (diff)
downloadotp-bcdf32795a3f5a6aad95567cffba78fcecb9f40f.tar.gz
otp-bcdf32795a3f5a6aad95567cffba78fcecb9f40f.tar.bz2
otp-bcdf32795a3f5a6aad95567cffba78fcecb9f40f.zip
Add support for maps in preserved copy
Diffstat (limited to 'erts/emulator/beam/copy.c')
-rw-r--r--erts/emulator/beam/copy.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c
index f74c6b1c89..cb1f38429a 100644
--- a/erts/emulator/beam/copy.c
+++ b/erts/emulator/beam/copy.c
@@ -424,6 +424,19 @@ Uint size_shared(Eterm obj)
}
goto pop_next;
}
+ case MAP_SUBTAG: {
+ map_t *mp = (map_t *) ptr;
+ Uint n = map_get_size(mp) + 1;
+ sum += n + 2;
+ ptr += 2; /* hdr + size words */
+ while (n-- > 0) {
+ obj = *ptr++;
+ if (!IS_CONST(obj)) {
+ EQUEUE_PUT(s, obj);
+ }
+ }
+ goto pop_next;
+ }
case BIN_MATCHSTATE_SUBTAG:
erl_exit(ERTS_ABORT_EXIT,
"size_shared: matchstate term not allowed");
@@ -523,6 +536,18 @@ cleanup:
}
goto cleanup_next;
}
+ case MAP_SUBTAG: {
+ map_t *mp = (map_t *) ptr;
+ Uint n = map_get_size(mp) + 1;
+ ptr += 2; /* hdr + size words */
+ while (n-- > 0) {
+ obj = *ptr++;
+ if (!IS_CONST(obj)) {
+ EQUEUE_PUT_UNCHECKED(s, obj);
+ }
+ }
+ goto cleanup_next;
+ }
default:
goto cleanup_next;
}
@@ -1162,6 +1187,19 @@ Uint copy_shared_calculate(Eterm obj, shcopy_info *info, unsigned flags)
}
goto pop_next;
}
+ case MAP_SUBTAG: {
+ map_t *mp = (map_t *) ptr;
+ Uint n = map_get_size(mp) + 1;
+ sum += n + 2;
+ ptr += 2; /* hdr + size words */
+ while (n-- > 0) {
+ obj = *ptr++;
+ if (!IS_CONST(obj)) {
+ EQUEUE_PUT(s, obj);
+ }
+ }
+ goto pop_next;
+ }
case BIN_MATCHSTATE_SUBTAG:
erl_exit(ERTS_ABORT_EXIT,
"size_shared: matchstate term not allowed");
@@ -1404,6 +1442,23 @@ Uint copy_shared_perform(Eterm obj, Uint size, shcopy_info *info, Eterm** hpp, E
erts_refc_inc(&funp->fe->refc, 2);
goto cleanup_next;
}
+ case MAP_SUBTAG: {
+ map_t *mp = (map_t *) ptr;
+ Uint n = map_get_size(mp) + 1;
+ *resp = make_map(hp);
+ *hp++ = hdr;
+ *hp++ = *++ptr;
+ while (n-- > 0) {
+ obj = *++ptr;
+ if (IS_CONST(obj)) {
+ *hp++ = obj;
+ } else {
+ EQUEUE_PUT_UNCHECKED(s, obj);
+ *hp++ = HEAP_ELEM_TO_BE_FILLED;
+ }
+ }
+ goto cleanup_next;
+ }
case REFC_BINARY_SUBTAG: {
ProcBin* pb = (ProcBin *) ptr;
sz = thing_arityval(hdr);
@@ -1539,6 +1594,12 @@ Uint copy_shared_perform(Eterm obj, Uint size, shcopy_info *info, Eterm** hpp, E
remaining = 1 + funp->num_free;
break;
}
+ case MAP_SUBTAG: {
+ map_t *mp = (map_t *) hscan;
+ remaining = map_get_size(mp) + 1;
+ hscan += 2;
+ break;
+ }
case SUB_BINARY_SUBTAG:
ASSERT(((ErlSubBin *) hscan)->bitoffs +
((ErlSubBin *) hscan)->bitsize > 0);