Skip to content

Commit 582585b

Browse files
Fix generate_precompile statement grouping & avoid defining new func (#56317)
1 parent 92d3702 commit 582585b

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

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

0 commit comments

Comments
 (0)