-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit b43e7ad.
- Loading branch information
1 parent
cb6f5e2
commit 31bf0b8
Showing
15 changed files
with
878 additions
and
291 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# This file is a part of Julia. License is MIT: https://julialang.org/license | ||
|
||
function needs_USE_GPL_LIBS(s::String) | ||
occursin("CHOLMOD", s) && return true | ||
return false | ||
end | ||
|
||
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 to overwrite `precompile.jl` | ||
# or ./julia contrib/fixup_precompile.jl --merge precompiles.txt to merge into existing | ||
# `precompile.jl` | ||
""" | ||
|
||
function fixup_precompile(new_precompile_file; merge=false) | ||
old_precompile_file = joinpath(Sys.BINDIR, "..", "..", "base", "precompile.jl") | ||
precompile_statements = Set{String}() | ||
|
||
for file in [new_precompile_file; merge ? old_precompile_file : []] | ||
for line in eachline(file) | ||
line = strip(line) | ||
# filter out closures, which might have different generated names in different environments | ||
occursin(r"#[0-9]", line) && 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 | ||
end | ||
|
||
open(old_precompile_file, "w") do f | ||
println(f, HEADER) | ||
println(f, """ | ||
let | ||
PrecompileStagingArea = Module() | ||
for (_pkgid, _mod) in Base.loaded_modules | ||
if !(_pkgid.name in ("Main", "Core", "Base")) | ||
@eval PrecompileStagingArea \$(Symbol(_mod)) = \$_mod | ||
end | ||
end | ||
@eval PrecompileStagingArea begin""") | ||
for statement in sort(collect(precompile_statements)) | ||
isgpl = needs_USE_GPL_LIBS(statement) | ||
isgpl && print(f, "if Base.USE_GPL_LIBS\n ") | ||
println(f, statement) | ||
isgpl && println(f, "end") | ||
end | ||
println(f, "end\nend") | ||
end | ||
if merge | ||
"Merged $new_precompile_file into $old_precompile_file" | ||
else | ||
"Overwrite $old_precompile_file with $new_precompile_file" | ||
end | ||
end | ||
|
||
if length(ARGS) == 1 | ||
fixup_precompile(joinpath(pwd(), ARGS[1])) | ||
elseif length(ARGS) == 2 | ||
@assert ARGS[1] == "--merge" | ||
fixup_precompile(joinpath(pwd(), ARGS[2]); merge = true) | ||
else | ||
error("invalid arguments") | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.