Fix package precompilation (PrecompileTools)#57828
Conversation
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside `PrecompileTools.@compile_workload` blocks. This adds a simple mechanism modeled after `@trace_compile` that switching to tagging MethodInstances in `jl_push_newly_inferred`. JuliaLang/PrecompileTools.jl#47 contains the corresponding changes to PrecompileTools.jl.
|
Will Pkg's internalized https://github.com/JuliaLang/Pkg.jl/blob/master/src/precompile.jl#L217-L244 |
|
Yes, I'll push a very simple test in the next commit. (PrecompileTools is a test of sorts, but good to have one here too.) |
|
Corresponding changes in JuliaLang/PrecompileTools.jl#47 are now up too |
|
I just noticed that #54899 deleted the corresponding internalized Shall we make a barebones version for Base so that we're not duplicating code between Pkg and REPL and any other stdlibs that want to benefit? |
|
I deleted it there because I noticed it seemed to be making the quality of the REPL script worse not better |
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside `PrecompileTools.@compile_workload` blocks. This adds a simple mechanism modeled after `@trace_compile` that switches to tagging MethodInstances in `jl_push_newly_inferred`. JuliaLang/PrecompileTools.jl#47 contains (or will contain) the corresponding changes to PrecompileTools.jl. (cherry picked from commit c89b1ff)
| // Mutex for newly_inferred | ||
| jl_mutex_t newly_inferred_mutex; | ||
| extern jl_mutex_t world_counter_lock; | ||
| static _Atomic(uint8_t) jl_tag_newly_inferred_enabled = 0; |
There was a problem hiding this comment.
This could just be a UInt64 since we are using a whole cache line anyways
REPL precompile scripts runs a workload and might thus encounter code in other standard libraries that needs to be precompiled. Before #54899 we had a bespoke variant of PrecompileTools.jl. PrecompileTools was fixed with #57828 so we can now re-instate the support in REPL. Noticed by @tecosaur, while looking at #51811
REPL precompile scripts runs a workload and might thus encounter code in other standard libraries that needs to be precompiled. Before #54899 we had a bespoke variant of PrecompileTools.jl. PrecompileTools was fixed with #57828 so we can now re-instate the support in REPL. Noticed by @tecosaur, while looking at #51811 (cherry picked from commit ecfec85)
With the "classic" inference timing disabled, PrecompileTools and SnoopCompile are non-functional on 1.12 & master. #57074 added timing data to the CodeInstances themselves, which should help restore SnoopCompile. However, without the tree structure provided by the old inference timing system, we still need a way to tag MethodInstances that get inferred inside
PrecompileTools.@compile_workloadblocks.This adds a simple mechanism modeled after
@trace_compilethat switches to tagging MethodInstances injl_push_newly_inferred. JuliaLang/PrecompileTools.jl#47 contains (or will contain) the corresponding changes to PrecompileTools.jl.