Skip to content

Commit 54ce490

Browse files
committed
Serialization/deserialization of type check caches.
1 parent 3e8a06a commit 54ce490

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/6model/serialization.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ static STRING * concatenate_outputs(PARROT_INTERP, SerializationWriter *writer)
390390
/* This handles the serialization of an STable, and calls off to serialize
391391
* its representation data also. */
392392
static void serialize_stable(PARROT_INTERP, SerializationWriter *writer, PMC *st_pmc) {
393-
STable *st = STABLE_STRUCT(st_pmc);
393+
STable *st = STABLE_STRUCT(st_pmc);
394+
INTVAL i;
394395

395396
/* Ensure there's space in the STables table; grow if not. */
396397
Parrot_Int4 offset = writer->root.num_stables * STABLES_TABLE_ENTRY_SIZE;
@@ -415,6 +416,13 @@ static void serialize_stable(PARROT_INTERP, SerializationWriter *writer, PMC *st
415416
write_obj_ref(interp, writer, st->HOW);
416417
write_obj_ref(interp, writer, st->WHAT);
417418

419+
/* XXX Method cache and v-table. */
420+
421+
/* Type check cache. */
422+
write_int_func(interp, writer, st->type_check_cache_length);
423+
for (i = 0; i < st->type_check_cache_length; i++)
424+
write_ref_func(interp, writer, st->type_check_cache[i]);
425+
418426
/* XXX More to do here. */
419427
printf("WARNING: STable serialization not yet fully implemented\n");
420428
}
@@ -897,6 +905,16 @@ static void deserialize_stable(PARROT_INTERP, SerializationReader *reader, INTVA
897905
/* Read the HOW and WHAT. */
898906
st->HOW = read_obj_ref(interp, reader);
899907
st->WHAT = read_obj_ref(interp, reader);
908+
909+
/* XXX Method cache and v-table. */
910+
911+
/* Type check cache. */
912+
st->type_check_cache_length = read_int_func(interp, reader);
913+
if (st->type_check_cache_length > 0) {
914+
st->type_check_cache = mem_sys_allocate(st->type_check_cache_length * sizeof(PMC *));
915+
for (i = 0; i < st->type_check_cache_length; i++)
916+
st->type_check_cache[i] = read_ref_func(interp, reader);
917+
}
900918

901919
/* XXX More to do here. */
902920
printf("WARNING: STable deserialization not yet fully implemented\n");

0 commit comments

Comments
 (0)