Skip to content

Commit 665cf7c

Browse files
topolarityKristofferC
authored andcommitted
precompile_utils: Don't auto-enqueue macro methods for pre-compilation (#57833)
Despite disabling these from being compiled in `gf.c` for dynamic invocations, the pre-compilation code was adding `macro` Methods anyway to the workqueue. Replaces #57782 (cherry picked from commit 6ce51d3)
1 parent 5843ac5 commit 665cf7c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: src/precompile_utils.c

+4
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ static void jl_compile_all_defs(jl_array_t *mis, int all)
170170
size_t i, l = jl_array_nrows(allmeths);
171171
for (i = 0; i < l; i++) {
172172
jl_method_t *m = (jl_method_t*)jl_array_ptr_ref(allmeths, i);
173+
int is_macro_method = jl_symbol_name(m->name)[0] == '@';
174+
if (is_macro_method && !all)
175+
continue; // Avoid inference / pre-compilation for macros
176+
173177
if (jl_is_datatype(m->sig) && jl_isa_compileable_sig((jl_tupletype_t*)m->sig, jl_emptysvec, m)) {
174178
// method has a single compilable specialization, e.g. its definition
175179
// signature is concrete. in this case we can just hint it.

Diff for: test/precompile.jl

+5
Original file line numberDiff line numberDiff line change
@@ -2416,4 +2416,9 @@ precompile_test_harness("Package top-level load itself") do load_path
24162416
end
24172417
end
24182418

2419+
# Verify that inference / caching was not performed for any macros in the sysimage
2420+
let m = only(methods(Base.var"@big_str"))
2421+
@test m.specializations === Core.svec() || !isdefined(m.specializations, :cache)
2422+
end
2423+
24192424
finish_precompile_test!()

0 commit comments

Comments
 (0)