-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Update precompile.jl for 0.7 / 1.0 #24666
Comments
Some specific stuff that I believe should be in here:
More stuff? |
By moving stuff to the stdlib we need to slightly tweak the way the precompilation file is postprocessed. For example, the REPL methods need to go to |
Messed around a bit with this so requesting some feedback here. Currently, I tried the following (one file) approach. Enable the tracing, run julia and output to const HEADER = """
# This file is a part of Julia. License is MIT: https://julialang.org/license
# Steps to regenerate this file:
# 1. Remove all `precompile` calls
# 2. Rebuild system image
# 3. Enable TRACE_COMPILE in options.h and rebuild
# 4. Run `./julia 2> precompiles.txt` and do various things.
# 5. Run `./julia contrib/fixup_precompile.jl precompiles.txt
"""
function fixup_precompile(precompile_file)
precompile_file = joinpath(pwd(), ARGS[1])
precompile_statements = Set{String}()
for line in eachline(precompile_file)
# filter out closures, which might have different generated names in different environments)
contains(line, r"#[0-9]") && continue
# Other stuff than precompile statements might have been written to STDERR
startswith(line, "precompile(Tuple{") || continue
# Ok, add the line
push!(precompile_statements, line)
end
precompilefile_path = joinpath(Sys.BINDIR, "..", "..", "base", "precompile.jl")
open(precompilefile_path, "w") do f
println(f, HEADER)
println(f, "module __precompile_area__")
println(f, """
if !(pkgid.name in ("Main", "Core", "Base"))
@eval $(Symbol(mod)) = $mod
end""")
for statement in sort(collect(precompile_statements))
println(f, statement)
end
println(f, "end # module")
end
println("Wrote a new precompile file to $(abspath(precompilefile_path))")
end
@assert length(ARGS) == 1
fixup_precompile(ARGS[1]) This writes a
This just puts all the precompilation statements into one file. Since I "pseudo-import" all packages that are loaded, everything works nicely. Possible solutions to this are:
|
I'm not sure how that is related, could you elaborate? If you want to run a precompile statement all the types in the statement need to be defined. So we can't put a precompile statement that includes |
For triage it would be good to discuss:
|
I think for expediency in 0.7 and 1.0 we can do the simplest thing and put it in one file. We can do something fancier later. |
Creating this issue with tag so we won't forget.
The text was updated successfully, but these errors were encountered: