Skip to content

Commit 2916b51

Browse files
committed
we don't actually need PrecompileTools
1 parent a3e1dbe commit 2916b51

File tree

3 files changed

+35
-148
lines changed

3 files changed

+35
-148
lines changed

stdlib/Client/src/Client.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function exec_options(opts)
2626
repl = !arg_is_program
2727
cmds = Base.unsafe_load_commands(opts.commands)
2828
for (cmd, arg) in cmds
29-
if cmd_suppresses_program(cmd)
29+
if Base.cmd_suppresses_program(cmd)
3030
arg_is_program = false
3131
repl = false
3232
elseif cmd == 'L'
@@ -73,9 +73,9 @@ function exec_options(opts)
7373
# process cmds list
7474
for (cmd, arg) in cmds
7575
if cmd == 'e'
76-
Core.eval(Main, parse_input_line(arg))
76+
Core.eval(Main, Base.parse_input_line(arg))
7777
elseif cmd == 'E'
78-
invokelatest(show, Core.eval(Main, parse_input_line(arg)))
78+
invokelatest(show, Core.eval(Main, Base.parse_input_line(arg)))
7979
println()
8080
elseif cmd == 'L'
8181
# load file immediately on all processors

stdlib/Client/src/invalidations.jl

Lines changed: 0 additions & 119 deletions
This file was deleted.

stdlib/Client/src/precompile.jl

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

33
module Precompile
4+
# Can't use this during incremental: `@eval Module() begin``
45

56
import ..Client
67
import Pkg
78
import REPL
89
import InteractiveUtils
910

10-
# Can't use this during incremental: `@eval Module() begin``
11+
# Since we are not Base we need to import names,
12+
# would be better if we had FQDN
13+
import Pkg: TOML
14+
import Pkg.PlatformEngines: Downloads, SHA, Tar
15+
import Pkg.GitTools: LibGit2, Printf
16+
import Pkg.Types: FileWatching
17+
import Pkg.API: Logging, Dates
18+
import Pkg.PlatformEngines: p7zip_jll
19+
import Pkg.Artifacts: Artifacts
20+
import REPL: Markdown
1121

12-
# using PrecompileTools
13-
include("invalidations.jl")
1422

1523
Base.include(@__MODULE__, joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testhelpers", "FakePTYs.jl"))
1624
import .FakePTYs: open_fake_pty
1725
using Base.Meta
1826

27+
## Debugging options
28+
# Disable parallel precompiles generation by setting `false`
29+
const PARALLEL_PRECOMPILATION = true
30+
1931
# View the code sent to the repl by setting this to `stdout`
2032
const debug_output = devnull # or stdout
2133

@@ -71,10 +83,7 @@ procenv = Dict{String,Any}(
7183
"TERM" => "",
7284
"JULIA_MINIMAL_CLIENT" => "0") # Turn Client.jl on
7385

74-
generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printed
75-
start_time = time_ns()
76-
sysimg = Base.unsafe_string(Base.JLOptions().image_file)
77-
86+
generate_precompile_statements() = try
7887
# Extract the precompile statements from the precompile file
7988
statements_step = Channel{String}(Inf)
8089

@@ -83,7 +92,7 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
8392
touch(precompile_file)
8493
pts, ptm = open_fake_pty()
8594
cmdargs = `-e 'import REPL; REPL.Terminals.is_precompiling[] = true'`
86-
p = run(addenv(addenv(```$(julia_exepath()) -O0 --trace-compile=$precompile_file --sysimage $sysimg
95+
p = run(addenv(addenv(```$(julia_exepath()) -O0 --trace-compile=$precompile_file
8796
--cpu-target=native --startup-file=no --compiled-modules=existing --color=yes -i $cmdargs```, procenv),
8897
"JULIA_PKG_PRECOMPILE_AUTO" => "0"),
8998
pts, pts, pts; wait=false)
@@ -166,6 +175,7 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
166175
close(statements_step)
167176
return :ok
168177
end
178+
!PARALLEL_PRECOMPILATION && wait(step)
169179

170180
# Make statements unique
171181
statements = Set{String}()
@@ -174,23 +184,6 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
174184
# Main should be completely clean
175185
occursin("Main.", statement) && continue
176186
Base.in!(statement, statements) && continue
177-
end
178-
179-
fetch(step) == :ok || throw("Collecting precompiles failed.")
180-
return statements
181-
finally
182-
GC.gc(true); GC.gc(false); # reduce memory footprint
183-
end
184-
185-
statements = generate_precompile_statements()
186-
187-
# As a last step in system image generation,
188-
# remove some references to build time environment for a more reproducible build.
189-
Base.Filesystem.temp_cleanup_purge(force=true)
190-
191-
@compile_workload begin
192-
precompile(Tuple{typeof(getproperty), REPL.REPLBackend, Symbol})
193-
for statement in statements
194187
try
195188
ps = Meta.parse(statement)
196189
if !isexpr(ps, :call)
@@ -211,5 +204,18 @@ Base.Filesystem.temp_cleanup_purge(force=true)
211204
@warn "Failed to precompile expression" form=statement exception=ex _module=nothing _file=nothing _line=0
212205
end
213206
end
214-
end # @compile_workload
207+
208+
fetch(step) == :ok || throw("Collecting precompiles failed.")
209+
return nothing
210+
finally
211+
GC.gc(true); GC.gc(false); # reduce memory footprint
212+
end
213+
214+
generate_precompile_statements()
215+
216+
# As a last step in system image generation,
217+
# remove some references to build time environment for a more reproducible build.
218+
Base.Filesystem.temp_cleanup_purge(force=true)
219+
220+
precompile(Tuple{typeof(getproperty), REPL.REPLBackend, Symbol})
215221
end # Precompile

0 commit comments

Comments
 (0)