Created
February 20, 2021 21:17
-
-
Save niner/df18be7b31e3b9f93be31515c2bf987e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/6model/serialization.c b/src/6model/serialization.c | |
index 2ca9df617..e61c4f274 100644 | |
--- a/src/6model/serialization.c | |
+++ b/src/6model/serialization.c | |
@@ -2714,11 +2714,17 @@ static void deserialize_stable(MVMThreadContext *tc, MVMSerializationReader *rea | |
deserialize_method_cache_lazy(tc, st, reader); | |
/* Type check cache. */ | |
- st->type_check_cache_length = MVM_serialization_read_int(tc, reader); | |
- if (st->type_check_cache_length > 0) { | |
- st->type_check_cache = (MVMObject **)MVM_malloc(st->type_check_cache_length * sizeof(MVMObject *)); | |
- for (i = 0; i < st->type_check_cache_length; i++) | |
+ MVMuint16 type_check_cache_length = MVM_serialization_read_int(tc, reader); | |
+ st->type_check_cache_length = 0; | |
+ if (type_check_cache_length > 0) { | |
+ st->type_check_cache = (MVMObject **)MVM_malloc(type_check_cache_length * sizeof(MVMObject *)); | |
+ for (i = 0; i < type_check_cache_length; i++) { | |
MVM_ASSIGN_REF(tc, &(st->header), st->type_check_cache[i], MVM_serialization_read_ref(tc, reader)); | |
+ /* deserializing an object may trigger GC, so make sure a gc_mark | |
+ * of the half-deserialized stable only sees the already | |
+ * deserialized objects */ | |
+ st->type_check_cache_length = i + 1; | |
+ } | |
} | |
/* Mode flags. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment