Skip to content

Commit 9a48815

Browse files
IanButterworthKristofferC
authored andcommitted
Fix generate_precompile statement grouping & avoid defining new func (#56317)
(cherry picked from commit 582585b)
1 parent a788519 commit 9a48815

File tree

1 file changed

+48
-52
lines changed

1 file changed

+48
-52
lines changed

contrib/generate_precompile.jl

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -131,60 +131,56 @@ for match = Base._methods(+, (Int, Int), -1, Base.get_world_counter())
131131
m = match.method
132132
delete!(push!(Set{Method}(), m), m)
133133
copy(Core.Compiler.retrieve_code_info(Core.Compiler.specialize_method(match), typemax(UInt)))
134-
135-
empty!(Set())
136-
push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))
137-
(setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]
138-
(setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]
139-
(setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]
140-
(setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]
141-
(setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]
142-
Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]
143-
Dict(Base => [:(1+1)])[Base]
144-
Dict(:one => [1])[:one]
145-
Dict("abc" => Set())["abc"]
146-
pushfirst!([], sum)
147-
get(Base.pkgorigins, Base.PkgId(Base), nothing)
148-
sort!([1,2,3])
149-
unique!([1,2,3])
150-
cumsum([1,2,3])
151-
append!(Int[], BitSet())
152-
isempty(BitSet())
153-
delete!(BitSet([1,2]), 3)
154-
deleteat!(Int32[1,2,3], [1,3])
155-
deleteat!(Any[1,2,3], [1,3])
156-
Core.svec(1, 2) == Core.svec(3, 4)
157-
any(t->t[1].line > 1, [(LineNumberNode(2,:none), :(1+1))])
158-
159-
# Code loading uses this
160-
sortperm(mtime.(readdir(".")), rev=true)
161-
# JLLWrappers uses these
162-
Dict{Base.UUID,Set{String}}()[Base.UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210")] = Set{String}()
163-
get!(Set{String}, Dict{Base.UUID,Set{String}}(), Base.UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210"))
164-
eachindex(IndexLinear(), Expr[])
165-
push!(Expr[], Expr(:return, false))
166-
vcat(String[], String[])
167-
k, v = (:hello => nothing)
168-
Base.print_time_imports_report(Base)
169-
Base.print_time_imports_report_init(Base)
170-
171-
# Preferences uses these
172-
get(Dict{String,Any}(), "missing", nothing)
173-
delete!(Dict{String,Any}(), "missing")
174-
for (k, v) in Dict{String,Any}()
175-
println(k)
176-
end
177-
178-
# interactive startup uses this
179-
write(IOBuffer(), "")
180-
181-
# Not critical, but helps hide unrelated compilation from @time when using --trace-compile.
182-
f55729() = Base.Experimental.@force_compile
183-
@time @eval f55729()
184-
@time @eval f55729()
185-
186134
break # only actually need to do this once
187135
end
136+
empty!(Set())
137+
push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))
138+
(setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]
139+
(setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]
140+
(setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]
141+
(setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]
142+
(setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]
143+
Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]
144+
Dict(Base => [:(1+1)])[Base]
145+
Dict(:one => [1])[:one]
146+
Dict("abc" => Set())["abc"]
147+
pushfirst!([], sum)
148+
get(Base.pkgorigins, Base.PkgId(Base), nothing)
149+
sort!([1,2,3])
150+
unique!([1,2,3])
151+
cumsum([1,2,3])
152+
append!(Int[], BitSet())
153+
isempty(BitSet())
154+
delete!(BitSet([1,2]), 3)
155+
deleteat!(Int32[1,2,3], [1,3])
156+
deleteat!(Any[1,2,3], [1,3])
157+
Core.svec(1, 2) == Core.svec(3, 4)
158+
any(t->t[1].line > 1, [(LineNumberNode(2,:none), :(1+1))])
159+
160+
# Code loading uses this
161+
sortperm(mtime.(readdir(".")), rev=true)
162+
# JLLWrappers uses these
163+
Dict{Base.UUID,Set{String}}()[Base.UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210")] = Set{String}()
164+
get!(Set{String}, Dict{Base.UUID,Set{String}}(), Base.UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210"))
165+
eachindex(IndexLinear(), Expr[])
166+
push!(Expr[], Expr(:return, false))
167+
vcat(String[], String[])
168+
k, v = (:hello => nothing)
169+
Base.print_time_imports_report(Base)
170+
Base.print_time_imports_report_init(Base)
171+
172+
# Preferences uses these
173+
get(Dict{String,Any}(), "missing", nothing)
174+
delete!(Dict{String,Any}(), "missing")
175+
for (k, v) in Dict{String,Any}()
176+
println(k)
177+
end
178+
179+
# interactive startup uses this
180+
write(IOBuffer(), "")
181+
182+
# precompile @time report generation and printing
183+
@time @eval Base.Experimental.@force_compile
188184
"""
189185

190186
julia_exepath() = joinpath(Sys.BINDIR, Base.julia_exename())

0 commit comments

Comments
 (0)