1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Cache references when marshalling abstract types.

This commit is contained in:
Calvin Rose 2023-07-01 18:02:56 -05:00
parent edf263bcb5
commit db0abfde72

View File

@ -422,7 +422,7 @@ static void marshal_one_abstract(MarshalState *st, Janet x, int flags) {
marshal_one(st, janet_csymbolv(at->name), flags + 1); marshal_one(st, janet_csymbolv(at->name), flags + 1);
JanetMarshalContext context = {st, NULL, flags, NULL, at}; JanetMarshalContext context = {st, NULL, flags, NULL, at};
at->marshal(abstract, &context); at->marshal(abstract, &context);
//MARK_SEEN(); MARK_SEEN();
} else { } else {
janet_panicf("cannot marshal %p", x); janet_panicf("cannot marshal %p", x);
} }
@ -1233,6 +1233,7 @@ static const uint8_t *unmarshal_one_abstract(UnmarshalState *st, const uint8_t *
if (context.at != NULL) { if (context.at != NULL) {
janet_panic("janet_unmarshal_abstract not called"); janet_panic("janet_unmarshal_abstract not called");
} }
janet_v_push(st->lookup, *out);
return context.data; return context.data;
} }
janet_panic("invalid abstract type - no unmarshal function pointer"); janet_panic("invalid abstract type - no unmarshal function pointer");