|
1 | 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license |
2 | 2 |
|
| 3 | +if isdefined(Base, :end_base_include) && !isdefined(Base, :Compiler) |
| 4 | + |
| 5 | +# Define a dummy `Compiler` module to make it installable even on Julia versions where |
| 6 | +# Compiler.jl is not available as a standard library. |
| 7 | +@eval module Compiler |
| 8 | + function __init__() |
| 9 | + println(""" |
| 10 | + The `Compiler` standard library is not available for this version of Julia. |
| 11 | + Use Julia version `v"1.12.0-DEV.1581"` or later. |
| 12 | + """) |
| 13 | + end |
| 14 | +end |
| 15 | + |
3 | 16 | # When generating an incremental precompile file, we first check whether we |
4 | 17 | # already have a copy of this *exact* code in the system image. If so, we |
5 | 18 | # simply generates a pkgimage that has the dependency edges we recorded in |
6 | 19 | # the system image and simply returns that copy of the compiler. If not, |
7 | 20 | # we proceed to load/precompile this as an ordinary package. |
8 | | -if isdefined(Base, :generating_output) && Base.generating_output(true) && |
| 21 | +elseif (isdefined(Base, :generating_output) && Base.generating_output(true) && |
9 | 22 | Base.samefile(joinpath(Sys.BINDIR, Base.DATAROOTDIR, Base._compiler_require_dependencies[1][2]), @eval @__FILE__) && |
10 | 23 | !Base.any_includes_stale( |
11 | 24 | map(Base.compiler_chi, Base._compiler_require_dependencies), |
12 | | - "sysimg", nothing) |
| 25 | + "sysimg", nothing)) |
13 | 26 |
|
14 | 27 | Base.prepare_compiler_stub_image!() |
15 | 28 | append!(Base._require_dependencies, map(Base.expand_compiler_path, Base._compiler_require_dependencies)) |
@@ -167,12 +180,12 @@ include("optimize.jl") |
167 | 180 | include("bootstrap.jl") |
168 | 181 | include("reflection_interface.jl") |
169 | 182 |
|
170 | | -if isdefined(Base, :IRShow) |
171 | | - @eval module IRShow |
172 | | - using ..Compiler: Compiler |
173 | | - # During bootstrap, Base will later include this into its own "IRShow module" |
174 | | - Compiler.include(IRShow, "ssair/show.jl") |
175 | | - end |
| 183 | +module IRShow end |
| 184 | +if !isdefined(Base, :end_base_include) |
| 185 | + # During bootstrap, skip including this file and defer it to base/show.jl to include later |
| 186 | +else |
| 187 | + # When this module is loaded as the standard library, include this file as usual |
| 188 | + include(IRShow, "ssair/show.jl") |
176 | 189 | end |
177 | 190 |
|
178 | 191 | end # baremodule Compiler |
|
0 commit comments