Skip to content

Commit a001847

Browse files
authored
Compiler: Fix pre-compilation as separate package (#57650)
As spotted by @Keno in #57530 (comment)
1 parent 3d62893 commit a001847

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Compiler/src/Compiler.jl

+13-14
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,22 @@ end
193193
module IRShow end # relies on string and IO operations defined in Base
194194
baremodule TrimVerifier end # relies on IRShow, so define this afterwards
195195

196-
function load_irshow!()
197-
if isdefined(Base, :end_base_include)
198-
# This code path is exclusively for Revise, which may want to re-run this
199-
# after bootstrap.
200-
Compilerdir = Base.dirname(Base.String(@__SOURCE_FILE__))
201-
include(IRShow, Base.joinpath(Compilerdir, "ssair/show.jl"))
202-
include(TrimVerifier, Base.joinpath(Compilerdir, "verifytrim.jl"))
203-
else
196+
if isdefined(Base, :end_base_include)
197+
# When this module is loaded as the standard library, include these files as usual
198+
include(IRShow, "ssair/show.jl")
199+
include(TrimVerifier, "verifytrim.jl")
200+
else
201+
function load_irshow!()
202+
Base.delete_method(Base.which(verify_typeinf_trim, (IO, Vector{Any}, Bool)),)
204203
include(IRShow, "ssair/show.jl")
205204
include(TrimVerifier, "verifytrim.jl")
206205
end
207-
end
208-
if !isdefined(Base, :end_base_include)
209-
# During bootstrap, skip including this file and defer it to base/show.jl to include later
210-
else
211-
# When this module is loaded as the standard library, include this file as usual
212-
load_irshow!()
206+
function verify_typeinf_trim(io::IO, codeinfos::Vector{Any}, onlywarn::Bool)
207+
# stub implementation
208+
msg = "--trim verifier not defined"
209+
onlywarn ? println(io, msg) : error(msg)
210+
end
211+
# During bootstrap, skip including these files and defer to base/show.jl to include it later
213212
end
214213

215214
end # baremodule Compiler

Compiler/src/typeinfer.jl

-1
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,6 @@ function typeinf_ext_toplevel(methods::Vector{Any}, worlds::Vector{UInt}, trim_m
13801380
return codeinfos
13811381
end
13821382

1383-
verify_typeinf_trim(io::IO, codeinfos::Vector{Any}, onlywarn::Bool) = (msg = "--trim verifier not defined"; onlywarn ? println(io, msg) : error(msg))
13841383
verify_typeinf_trim(codeinfos::Vector{Any}, onlywarn::Bool) = invokelatest(verify_typeinf_trim, stdout, codeinfos, onlywarn)
13851384

13861385
function return_type(@nospecialize(f), t::DataType) # this method has a special tfunc

Compiler/src/verifytrim.jl

-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ end
310310
# driver / verifier implemented by juliac-buildscript.jl for the purpose of extensibility.
311311
# For now, it is part of Base.Compiler, but executed with invokelatest so that packages
312312
# could provide hooks to change, customize, or tweak its behavior and heuristics.
313-
Base.delete_method(Base.which(verify_typeinf_trim, (IO, Vector{Any}, Bool)),)
314313
function verify_typeinf_trim(io::IO, codeinfos::Vector{Any}, onlywarn::Bool)
315314
errors, parents = get_verify_typeinf_trim(codeinfos)
316315

0 commit comments

Comments
 (0)