@@ -2243,6 +2243,7 @@ static void jl_prepare_serialization_data(jl_array_t *mod_array, jl_array_t *new
22432243 }
22442244
22452245 if (edges ) {
2246+ size_t world = jl_atomic_load_acquire (& jl_world_counter );
22462247 jl_collect_missing_backedges (jl_type_type_mt );
22472248 jl_collect_missing_backedges (jl_nonfunction_mt );
22482249 // jl_collect_extext_methods_from_mod and jl_collect_missing_backedges also accumulate data in callers_with_edges.
@@ -2252,7 +2253,7 @@ static void jl_prepare_serialization_data(jl_array_t *mod_array, jl_array_t *new
22522253 * method_roots_list = jl_alloc_vec_any (0 );
22532254 // Collect the new method roots
22542255 jl_collect_new_roots (* method_roots_list , * new_specializations , worklist_key );
2255- jl_collect_edges (* edges , * ext_targets , * new_specializations );
2256+ jl_collect_edges (* edges , * ext_targets , * new_specializations , world );
22562257 }
22572258 assert (edges_map == NULL ); // jl_collect_edges clears this when done
22582259
@@ -3270,7 +3271,8 @@ static jl_value_t *jl_restore_package_image_from_stream(ios_t *f, jl_image_t *im
32703271 // Add roots to methods
32713272 jl_copy_roots (method_roots_list , jl_worklist_key ((jl_array_t * )restored ));
32723273 // Handle edges
3273- jl_insert_backedges ((jl_array_t * )edges , (jl_array_t * )ext_targets , (jl_array_t * )new_specializations ); // restore external backedges (needs to be last)
3274+ size_t world = jl_atomic_load_acquire (& jl_world_counter );
3275+ jl_insert_backedges ((jl_array_t * )edges , (jl_array_t * )ext_targets , (jl_array_t * )new_specializations , world ); // restore external backedges (needs to be last)
32743276 // reinit ccallables
32753277 jl_reinit_ccallable (& ccallable_list , base , NULL );
32763278 arraylist_free (& ccallable_list );
0 commit comments