Skip to content

Commit a1d5f90

Browse files
committed
Add container spec serialization/deserialization, which completes all we need to do for at least STable serialization.
1 parent d17d795 commit a1d5f90

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/6model/serialization.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,14 @@ static void serialize_stable(PARROT_INTERP, SerializationWriter *writer, PMC *st
641641
write_ref_func(interp, writer, st->boolification_spec->method);
642642
}
643643

644-
/* XXX More to do here. */
645-
printf("WARNING: STable serialization not yet fully implemented\n");
644+
/* Container spec. */
645+
write_int_func(interp, writer, st->container_spec != NULL);
646+
if (st->container_spec) {
647+
write_ref_func(interp, writer, st->container_spec->value_slot.class_handle);
648+
write_str_func(interp, writer, st->container_spec->value_slot.attr_name);
649+
write_int_func(interp, writer, st->container_spec->value_slot.hint);
650+
write_ref_func(interp, writer, st->container_spec->fetch_method);
651+
}
646652

647653
/* If the REPR has a function to serialize representation data, call it. */
648654
if (st->REPR->serialize_repr_data)
@@ -1365,6 +1371,15 @@ static void deserialize_stable(PARROT_INTERP, SerializationReader *reader, INTVA
13651371
st->boolification_spec->method = read_ref_func(interp, reader);
13661372
}
13671373

1374+
/* Container spec. */
1375+
if (read_int_func(interp, reader)) {
1376+
st->container_spec = mem_sys_allocate(sizeof(ContainerSpec));
1377+
st->container_spec->value_slot.class_handle = read_ref_func(interp, reader);
1378+
st->container_spec->value_slot.attr_name = read_str_func(interp, reader);
1379+
st->container_spec->value_slot.hint = read_int_func(interp, reader);
1380+
st->container_spec->fetch_method = read_ref_func(interp, reader);
1381+
}
1382+
13681383
/* XXX More to do here. */
13691384
printf("WARNING: STable deserialization not yet fully implemented\n");
13701385

0 commit comments

Comments
 (0)