Skip to content

Commit

Permalink
Avoid err for MI roots
Browse files Browse the repository at this point in the history
When a method root is a MethodInstance,
we can't deserialize to NULL.
  • Loading branch information
timholy committed Dec 30, 2021
1 parent ab97079 commit 0e2852c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,16 +1603,19 @@ static jl_value_t *jl_deserialize_value_method_instance(jl_serializer_state *s,
jl_gc_wb(mi, mi->sparam_vals);
if (!internal) {
// non-internal MethodInstances serialize extra Method roots, deserialize them now
int i, nroots = read_int32(s->s);
int i, oldlen, nroots = read_int32(s->s);
if (nroots != 0) {
jl_method_t *m = mi->def.method;
assert(jl_is_method(m));
if (!m->roots) {
m->roots = jl_alloc_vec_any(0);
jl_gc_wb(m, m->roots);
}
oldlen = jl_array_len(m->roots);
jl_array_grow_end(m->roots, nroots);
jl_value_t **rootsdata = (jl_value_t**)jl_array_data(m->roots);
for (i = 0; i < nroots; i++) {
jl_array_ptr_1d_push(m->roots, jl_deserialize_value(s, NULL));
rootsdata[i+oldlen] = jl_deserialize_value(s, &(rootsdata[i+oldlen]));
}
}
}
Expand Down

0 comments on commit 0e2852c

Please sign in to comment.