Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixup of outer context chains on deserialization. Unbusts attribute a…
…ccessor generation, which means that Rakudo's error reporting now works again and various sanity tests now pass again.
  • Loading branch information
jnthn committed Feb 28, 2012
1 parent 3a2f19c commit 629c0b0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/6model/serialization.c
Expand Up @@ -1482,6 +1482,16 @@ static void attach_closure_outer(PARROT_INTERP, SerializationReader *reader, INT
}
}

/* Attaches a context's outer pointer. */
static void attach_context_outer(PARROT_INTERP, SerializationReader *reader, INTVAL i, PMC *context) {
char *row = reader->root.contexts_table + i * CONTEXTS_TABLE_ENTRY_SIZE;
Parrot_Int4 idx = read_int32(row, 12);
if (idx) {
PMC *ctx = VTABLE_get_pmc_keyed_int(interp, reader->contexts_list, idx - 1);
PARROT_CALLCONTEXT(context)->outer_ctx = ctx;
}
}

/* Deserializes a single STable, along with its REPR data. */
static void deserialize_stable(PARROT_INTERP, SerializationReader *reader, INTVAL i, PMC *st_pmc) {
STable *st = STABLE_STRUCT(st_pmc);
Expand Down Expand Up @@ -1735,6 +1745,10 @@ void Serialization_deserialize(PARROT_INTERP, PMC *sc, PMC *string_heap, PMC *st
attach_closure_outer(interp, reader, i,
VTABLE_get_pmc_keyed_int(interp, reader->codes_list, scodes + i));

for (i = 0; i < reader->root.num_contexts; i++)
attach_context_outer(interp, reader, i,
VTABLE_get_pmc_keyed_int(interp, reader->contexts_list, i));

/* Deserialize STables, along with their representation data. */
for (i = 0; i < reader->root.num_stables; i++)
deserialize_stable(interp, reader, i,
Expand Down

0 comments on commit 629c0b0

Please sign in to comment.