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.
Only update the world age when a new method is loaded
Browse files Browse the repository at this point in the history
Instead of always updating it. This should speed up loading only
method specializations.
kpamnany committed Nov 8, 2024
1 parent 8fe069c commit 5646676
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/staticdata.c
Original file line number Diff line number Diff line change
@@ -2952,7 +2952,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
jl_set_gs_ctr(gs_ctr);
}
else {
jl_atomic_fetch_add(&jl_world_counter, 1);
offset_restored = jl_read_offset(&s);
offset_init_order = jl_read_offset(&s);
offset_extext_methods = jl_read_offset(&s);
@@ -3182,7 +3181,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
jl_cache_type_((jl_datatype_t*)obj);
}
// Perform fixups: things like updating world ages, inserting methods & specializations, etc.
size_t world = jl_atomic_load_acquire(&jl_world_counter);
for (size_t i = 0; i < s.uniquing_objs.len; i++) {
uintptr_t item = (uintptr_t)s.uniquing_objs.items[i];
// check whether this is a gvar index
@@ -3236,6 +3234,16 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
o->bits.in_image = 1;
}
arraylist_free(&cleanup_list);
size_t world = jl_atomic_load_relaxed(&jl_world_counter);
for (size_t i = 0; i < s.fixup_objs.len; i++) {
// decide if we need to allocate a world
uintptr_t item = (uintptr_t)s.fixup_objs.items[i];
jl_value_t *obj = (jl_value_t*)(image_base + item);
if (jl_is_method(obj)) {
world = jl_atomic_fetch_add(&jl_world_counter, 1) + 1;
break;
}
}
for (size_t i = 0; i < s.fixup_objs.len; i++) {
uintptr_t item = (uintptr_t)s.fixup_objs.items[i];
jl_value_t *obj = (jl_value_t*)(image_base + item);
4 changes: 4 additions & 0 deletions src/staticdata_utils.c
Original file line number Diff line number Diff line change
@@ -840,6 +840,10 @@ static jl_array_t *jl_verify_edges(jl_array_t *targets, size_t minworld)
if (ulong_array == NULL)
ulong_array = jl_apply_array_type((jl_value_t*)jl_ulong_type, 1);
jl_array_t *maxvalids = jl_alloc_array_1d(ulong_array, l);
if (minworld == jl_base_module->primary_world) {
memset(jl_array_data(maxvalids), -1, l * sizeof(size_t));
return maxvalids;
}
memset(jl_array_data(maxvalids), 0, l * sizeof(size_t));
jl_value_t *loctag = NULL;
jl_value_t *matches = NULL;

0 comments on commit 5646676

Please sign in to comment.