Skip to content

Commit

Permalink
include ssair/show.jl in the context of Compiler
Browse files Browse the repository at this point in the history
To ensure that stale precompilation caches aren't used.
  • Loading branch information
aviatesk committed Nov 14, 2024
1 parent a465cff commit a1edc3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Compiler/src/Compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ include("optimize.jl")
include("bootstrap.jl")
include("reflection_interface.jl")

if isdefined(Base, :end_base_include)
@eval module IRShow
using ..Compiler: Compiler
# During bootstrap, Base will later include this into its own "IRShow module"
Compiler.include(IRShow, "ssair/show.jl")
end
module IRShow end
if !isdefined(Base, :end_base_include)
# During bootstrap, skip including this file and defer it to base/show.jl to include later
else
# When this module is loaded as the standard library, include this file as usual
include(IRShow, "ssair/show.jl")
end

end # baremodule Compiler
Expand Down
5 changes: 3 additions & 2 deletions Compiler/src/ssair/show.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# This file is not loaded into `Core.Compiler` but rather loaded into the context of
# `Base.IRShow` and thus does not participate in bootstrapping.
# This file does not participate in bootstrapping, but is included in the system image by
# being loaded from `base/show.jl`. Compiler.jl as the standard library will simply include
# this file in the context of `Compiler.IRShow`.

using Base, Core.IR

Expand Down
6 changes: 2 additions & 4 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2821,10 +2821,8 @@ function show(io::IO, vm::Core.TypeofVararg)
end
end

module IRShow
using ..Compiler: Compiler
Base.include(IRShow, Base.strcat(Base.BUILDROOT, "../usr/share/julia/Compiler/src/ssair/show.jl"))
end
@eval Compiler include(IRShow, "ssair/show.jl") # define `show` for the compiler types
const IRShow = Compiler.IRShow # an alias for compatibility

function show(io::IO, src::CodeInfo; debuginfo::Symbol=:source)
# Fix slot names and types in function body
Expand Down

0 comments on commit a1edc3f

Please sign in to comment.