Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generalize insert-backedges to insert in any world
Browse files Browse the repository at this point in the history
Rather than a binary valid/not-valid, we track the exact later world
that deleted it, relative to when we first assumed it may be valid.
vtjnash committed Feb 25, 2023
1 parent f0eadd0 commit 43dabee
Showing 2 changed files with 133 additions and 123 deletions.
6 changes: 4 additions & 2 deletions src/staticdata.c
Original file line number Diff line number Diff line change
@@ -2243,6 +2243,7 @@ static void jl_prepare_serialization_data(jl_array_t *mod_array, jl_array_t *new
}

if (edges) {
size_t world = jl_atomic_load_acquire(&jl_world_counter);
jl_collect_missing_backedges(jl_type_type_mt);
jl_collect_missing_backedges(jl_nonfunction_mt);
// 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
*method_roots_list = jl_alloc_vec_any(0);
// Collect the new method roots
jl_collect_new_roots(*method_roots_list, *new_specializations, worklist_key);
jl_collect_edges(*edges, *ext_targets, *new_specializations);
jl_collect_edges(*edges, *ext_targets, *new_specializations, world);
}
assert(edges_map == NULL); // jl_collect_edges clears this when done

@@ -3270,7 +3271,8 @@ static jl_value_t *jl_restore_package_image_from_stream(ios_t *f, jl_image_t *im
// Add roots to methods
jl_copy_roots(method_roots_list, jl_worklist_key((jl_array_t*)restored));
// Handle edges
jl_insert_backedges((jl_array_t*)edges, (jl_array_t*)ext_targets, (jl_array_t*)new_specializations); // restore external backedges (needs to be last)
size_t world = jl_atomic_load_acquire(&jl_world_counter);
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)
// reinit ccallables
jl_reinit_ccallable(&ccallable_list, base, NULL);
arraylist_free(&ccallable_list);
Loading

0 comments on commit 43dabee

Please sign in to comment.