Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use PrecompileTools mechanics to compile REPL #55782

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions stdlib/REPL/src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ finally
Base._track_dependencies[] = true
end

let
function repl_workload()
# these are intentionally triggered
allowed_errors = [
"BoundsError: attempt to access 0-element Vector{Any} at index [1]",
Expand Down Expand Up @@ -175,9 +175,38 @@ let
nothing
end

precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
precompile(Tuple{typeof(Base.:(==)), Char, String})
precompile(Tuple{typeof(Base.reseteof), Base.TTY})
# Copied from PrecompileTools.jl
let
function check_edges(node)
parentmi = node.mi_info.mi
for child in node.children
childmi = child.mi_info.mi
if !(isdefined(childmi, :backedges) && parentmi ∈ childmi.backedges)
precompile(childmi.specTypes)
end
check_edges(child)
end
end

if Base.generating_output() && Base.JLOptions().use_pkgimages != 0
Core.Compiler.Timings.reset_timings()
Core.Compiler.__set_measure_typeinf(true)
try
repl_workload()
finally
Core.Compiler.__set_measure_typeinf(false)
Core.Compiler.Timings.close_current_timer()
end
roots = Core.Compiler.Timings._timings[1].children
for child in roots
precompile(child.mi_info.mi.specTypes)
check_edges(child)
end
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
precompile(Tuple{typeof(Base.:(==)), Char, String})
precompile(Tuple{typeof(Base.reseteof), Base.TTY})
end
end

end # Precompile