Skip to content

Commit

Permalink
precompile: compile inlinable methods that were inferred
Browse files Browse the repository at this point in the history
The code generation policy here previously assumes that inlinable code
almost never ends up being `invoke`d, but it has the unfortunate side
effect that making more code inline-eligible means fewer entry points
to your code end up compiled.

Intuitively I think users expect function calls that ran during
pre-compilation to be compiled and available (regardless of the context
they are called from), which requires us to pre-compile these

This change may not be viable due to the increase in code size, but I
wanted to open it to see what the effects are.
  • Loading branch information
topolarity committed Oct 14, 2024
1 parent 80e60c8 commit f311c6a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/precompile_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ static int precompile_enq_specialization_(jl_method_instance_t *mi, void *closur
}
else if (jl_atomic_load_relaxed(&codeinst->invoke) != jl_fptr_const_return) {
jl_value_t *inferred = jl_atomic_load_relaxed(&codeinst->inferred);
if (inferred &&
inferred != jl_nothing &&
(jl_options.compile_enabled != JL_OPTIONS_COMPILE_ALL && jl_ir_inlining_cost(inferred) == UINT16_MAX)) {
if (inferred && inferred != jl_nothing && jl_options.compile_enabled != JL_OPTIONS_COMPILE_ALL &&
(jl_options.trim == JL_TRIM_NO || jl_ir_inlining_cost(inferred) == UINT16_MAX)) {
do_compile = 1;
}
else if (jl_atomic_load_relaxed(&codeinst->invoke) != NULL || jl_atomic_load_relaxed(&codeinst->precompile)) {
Expand Down

0 comments on commit f311c6a

Please sign in to comment.