Skip to content

Commit f9eb249

Browse files
committed
Add slots in the SC for holding object repossession info.
1 parent d770a5a commit f9eb249

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/pmc/serializationcontext.pmc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@ pmclass SerializationContext auto_attrs dynpmc group nqp {
2121
/* Description (probably the file name) if any. */
2222
ATTR STRING *description;
2323

24+
/* Repossession info. The following RIA and RPA have matching indexes, each
25+
* representing the integer of an object in our root set along with the SC
26+
* that the object was originally from. */
27+
ATTR PMC *rep_indexes;
28+
ATTR PMC *rep_scs;
29+
2430
VTABLE void init() {
2531
PMC *root_objects = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
2632
PMC *root_stables = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
2733
PMC *root_codes = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
34+
PMC *rep_indexes = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
35+
PMC *rep_scs = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
2836
SET_ATTR_root_objects(interp, SELF, root_objects);
2937
SET_ATTR_root_stables(interp, SELF, root_stables);
3038
SET_ATTR_root_codes(interp, SELF, root_codes);
39+
SET_ATTR_rep_indexes(interp, SELF, rep_indexes);
40+
SET_ATTR_rep_scs(interp, SELF, rep_scs);
3141
PObj_custom_mark_SET(SELF);
3242
if (!smo_id)
3343
smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0));
@@ -38,7 +48,7 @@ pmclass SerializationContext auto_attrs dynpmc group nqp {
3848
}
3949

4050
VTABLE void mark() {
41-
PMC *root_objects, *root_stables, *root_codes;
51+
PMC *root_objects, *root_stables, *root_codes, *rep_indexes, *rep_scs;
4252
STRING *handle, *description;
4353
GET_ATTR_root_objects(interp, SELF, root_objects);
4454
Parrot_gc_mark_PMC_alive(INTERP, root_objects);
@@ -50,6 +60,10 @@ pmclass SerializationContext auto_attrs dynpmc group nqp {
5060
Parrot_gc_mark_STRING_alive(INTERP, handle);
5161
GET_ATTR_description(interp, SELF, description);
5262
Parrot_gc_mark_STRING_alive(INTERP, description);
63+
GET_ATTR_rep_indexes(interp, SELF, rep_indexes);
64+
Parrot_gc_mark_PMC_alive(INTERP, rep_indexes);
65+
GET_ATTR_rep_scs(interp, SELF, rep_scs);
66+
Parrot_gc_mark_PMC_alive(INTERP, rep_scs);
5367
}
5468

5569
VTABLE PMC* get_pmc_keyed_int(INTVAL idx) {

0 commit comments

Comments
 (0)