Skip to content

Commit a0f9501

Browse files
committed
Serialize repossessions table.
1 parent 0de5175 commit a0f9501

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SerializationWriter.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,34 @@ private void growToHold(int idx, int required) {
738738
}
739739
}
740740

741+
/* Goes through the list of repossessions and serializes them all. */
742+
private void serializeRepossessions() {
743+
/* Allocate table space, provided we've actually something to do. */
744+
int numRepos = sc.rep_indexes.size();
745+
if (numRepos == 0)
746+
return;
747+
growToHold(REPOS, numRepos * REPOS_TABLE_ENTRY_SIZE);
748+
749+
/* Make entries. */
750+
for (int i = 0; i < numRepos; i++) {
751+
int objIdx = sc.rep_indexes.get(i) >> 1;
752+
int isST = sc.rep_indexes.get(i) & 1;
753+
SerializationContext origSC = sc.rep_scs.get(i);
754+
755+
/* Work out original object's SC location. */
756+
int origSCIdx = getSCId(origSC);
757+
int origIdx = isST != 0
758+
? origSC.root_stables.indexOf(sc.root_stables.get(objIdx))
759+
: origSC.root_objects.indexOf(sc.root_objects.get(objIdx));
760+
761+
/* Write table row. */
762+
outputs[REPOS].putInt(isST);
763+
outputs[REPOS].putInt(objIdx);
764+
outputs[REPOS].putInt(origSCIdx);
765+
outputs[REPOS].putInt(origIdx);
766+
}
767+
}
768+
741769
/* This is the overall serialization loop. It keeps an index into the list of
742770
* STables and objects in the SC. As we discover new ones, they get added. We
743771
* finished when we've serialized everything. */
@@ -777,7 +805,6 @@ private void serializationLoop() {
777805

778806
/* Finally, serialize repossessions table (this can't make any more
779807
* work, so is done as a separate step here at the end). */
780-
/* XXX */
781-
/*serializeRepossessions();*/
808+
serializeRepossessions();
782809
}
783810
}

0 commit comments

Comments
 (0)