Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set method.nroots_sysimg in jl_write_values #48875

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,8 @@ static void jl_write_values(jl_serializer_state *s) JL_GC_DISABLED
else
arraylist_push(&s->fixup_objs, (void*)reloc_offset);
newm->primary_world = ~(size_t)0;
} else {
newm->nroots_sysimg = m->roots ? jl_array_len(m->roots) : 0;
}
if (m->ccallable)
arraylist_push(&s->ccallable_list, (void*)reloc_offset);
Expand Down Expand Up @@ -2146,28 +2148,6 @@ static void jl_strip_all_codeinfos(void)
jl_foreach_reachable_mtable(strip_all_codeinfos_, NULL);
}

// Method roots created during sysimg construction are exempted from
// triggering non-relocatability of compressed CodeInfos.
// Set the number of such roots in each method when the sysimg is
// serialized.
// TODO: move this to `jl_write_values`
static int set_nroots_sysimg__(jl_typemap_entry_t *def, void *_env)
{
jl_method_t *m = def->func.method;
m->nroots_sysimg = m->roots ? jl_array_len(m->roots) : 0;
return 1;
}

static int set_nroots_sysimg_(jl_methtable_t *mt, void *_env)
{
return jl_typemap_visitor(mt->defs, set_nroots_sysimg__, NULL);
}

static void jl_set_nroots_sysimg(void)
{
jl_foreach_reachable_mtable(set_nroots_sysimg_, NULL);
}

// --- entry points ---

jl_array_t *jl_global_roots_table;
Expand Down Expand Up @@ -2271,8 +2251,6 @@ static void jl_save_system_image_to_stream(ios_t *f, jl_array_t *mod_array,
// strip metadata and IR when requested
if (jl_options.strip_metadata || jl_options.strip_ir)
jl_strip_all_codeinfos();
if (worklist == NULL)
jl_set_nroots_sysimg();

int en = jl_gc_enable(0);
nsym_tag = 0;
Expand Down