Skip to content

Commit

Permalink
Hide IRShow include from Revise
Browse files Browse the repository at this point in the history
Revise in theory wants to re-evaluate this include, but it fails at doing so,
because the include call no longer works after bootstrap. It happens
to work right now on master, because the lowering of `Compiler.include`
happens to hide the include call from Revise, but that's a Revise bug
I'm about to fix. Address this by moving the include call into the
package and using an absolute include if necessary.
  • Loading branch information
Keno committed Dec 5, 2024
1 parent 35976df commit afe76b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Compiler/src/Compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,20 @@ include("reflection_interface.jl")
include("opaque_closure.jl")

module IRShow end
function load_irshow!()
if isdefined(Base, :end_base_include)
# This code path is exclusively for Revise, which may want to re-run this
# after bootstrap.
include(IRShow, Base.joinpath(Base.dirname(@__FILE__), "ssair/show.jl"))
else
include(IRShow, "ssair/show.jl")
end
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")
load_irshow!()
end

end # baremodule Compiler
Expand Down
2 changes: 1 addition & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@ function show(io::IO, vm::Core.TypeofVararg)
end
end

Compiler.include(Compiler.IRShow, "ssair/show.jl") # define `show` for the compiler types
Compiler.load_irshow!()
const IRShow = Compiler.IRShow # an alias for compatibility

function show(io::IO, src::CodeInfo; debuginfo::Symbol=:source)
Expand Down

0 comments on commit afe76b2

Please sign in to comment.