Repository navigation
Conversation
The precompile workload ran directly at the top level of `src/packagedef.jl`, guarded by `jl_generating_output`. Its variables, such as `frame` and `edges`, were left as globals of LoweredCodeUtils and saved in the package image. Code that the workload inferred for methods of other modules through runtime dispatch was not cached, since no backedge chain connects it to LoweredCodeUtils, and the workload could not be skipped. This change moves the workload to `src/precompile.jl` and runs it with PrecompileTools. The workload lowers its input code in `@setup_workload` and calls the LoweredCodeUtils APIs in `@compile_workload`, which also caches the code inferred through runtime dispatch. Both blocks are `let` blocks so that their variables stay local, and users can skip the workload with the `precompile_workload` preference. As in JuliaInterpreter, `src/precompile.jl` is included from `src/LoweredCodeUtils.jl`, so `src/packagedef.jl` still loads without PrecompileTools. The compat bound of PrecompileTools is 1.2.1, since PrecompileTools 1.3 and later require Julia 1.12 while LoweredCodeUtils supports Julia 1.10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The precompile workload ran directly at the top level of
src/packagedef.jl, guarded byjl_generating_output. Its variables, such asframeandedges, were left as globals of LoweredCodeUtils and saved in the package image. Code that the workload inferred for methods of other modules through runtime dispatch was not cached, since no backedge chain connects it to LoweredCodeUtils, and the workload could not be skipped.This change moves the workload to
src/precompile.jland runs it with PrecompileTools. The workload lowers its input code in@setup_workloadand calls the LoweredCodeUtils APIs in@compile_workload, which also caches the code inferred through runtime dispatch. Both blocks areletblocks so that their variables stay local, and users can skip the workload with theprecompile_workloadpreference. As in JuliaInterpreter,src/precompile.jlis included fromsrc/LoweredCodeUtils.jl, sosrc/packagedef.jlstill loads without PrecompileTools.The compat bound of PrecompileTools is 1.2.1, since PrecompileTools 1.3 and later require Julia 1.12 while LoweredCodeUtils supports Julia 1.10.