Skip to content

Commit 5c66152

Browse files
committed
staticdata: do not serialize backedges for MethodInstance / MethodTable
These are restored in their entirety by staticdata.jl, so there's no need to serialize them. Dropping them has the additional advantage of making it unnecessary to de-duplicate edges in `gf.c`
1 parent 366a224 commit 5c66152

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/staticdata.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,12 @@ static void jl_insert_into_serialization_queue(jl_serializer_state *s, jl_value_
785785
}
786786
goto done_fields; // for now
787787
}
788+
if (s->incremental && jl_is_mtable(v)) {
789+
jl_methtable_t *mt = (jl_methtable_t *)v;
790+
// Any back-edges will be re-validated and added by staticdata.jl, so
791+
// drop them from the image here
792+
record_field_change((jl_value_t**)&mt->backedges, NULL);
793+
}
788794
if (jl_is_method_instance(v)) {
789795
jl_method_instance_t *mi = (jl_method_instance_t*)v;
790796
if (s->incremental) {
@@ -800,12 +806,14 @@ static void jl_insert_into_serialization_queue(jl_serializer_state *s, jl_value_
800806
// we only need 3 specific fields of this (the rest are restored afterward, if valid)
801807
// in particular, cache is repopulated by jl_mi_cache_insert for all foreign function,
802808
// so must not be present here
803-
record_field_change((jl_value_t**)&mi->backedges, NULL);
804809
record_field_change((jl_value_t**)&mi->cache, NULL);
805810
}
806811
else {
807812
assert(!needs_recaching(v, s->query_cache));
808813
}
814+
// Any back-edges will be re-validated and added by staticdata.jl, so
815+
// drop them from the image here
816+
record_field_change((jl_value_t**)&mi->backedges, NULL);
809817
// n.b. opaque closures cannot be inspected and relied upon like a
810818
// normal method since they can get improperly introduced by generated
811819
// functions, so if they appeared at all, we will probably serialize

0 commit comments

Comments
 (0)