From db0abfde72fc3b718001208bb3784ddf292ab4c2 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 1 Jul 2023 18:02:56 -0500 Subject: [PATCH] Cache references when marshalling abstract types. --- src/core/marsh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/marsh.c b/src/core/marsh.c index 32aaaa1a..2d58844a 100644 --- a/src/core/marsh.c +++ b/src/core/marsh.c @@ -422,7 +422,7 @@ static void marshal_one_abstract(MarshalState *st, Janet x, int flags) { marshal_one(st, janet_csymbolv(at->name), flags + 1); JanetMarshalContext context = {st, NULL, flags, NULL, at}; at->marshal(abstract, &context); - //MARK_SEEN(); + MARK_SEEN(); } else { 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) { janet_panic("janet_unmarshal_abstract not called"); } + janet_v_push(st->lookup, *out); return context.data; } janet_panic("invalid abstract type - no unmarshal function pointer");