Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit 6398baa

Browse files
Update precompile_*.jl file (#117)
Co-authored-by: BeastyBlacksmith <[email protected]>
1 parent 7f1fb53 commit 6398baa

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

deps/SnoopCompile/precompile/1.7/precompile_RecipesPipeline.jl

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,57 @@ macro warnpcfail(ex::Expr)
1313
end
1414

1515

16+
const __bodyfunction__ = Dict{Method,Any}()
17+
18+
# Find keyword "body functions" (the function that contains the body
19+
# as written by the developer, called after all missing keyword-arguments
20+
# have been assigned values), in a manner that doesn't depend on
21+
# gensymmed names.
22+
# `mnokw` is the method that gets called when you invoke it without
23+
# supplying any keywords.
24+
function __lookup_kwbody__(mnokw::Method)
25+
function getsym(arg)
26+
isa(arg, Symbol) && return arg
27+
@assert isa(arg, GlobalRef)
28+
return arg.name
29+
end
30+
31+
f = get(__bodyfunction__, mnokw, nothing)
32+
if f === nothing
33+
fmod = mnokw.module
34+
# The lowered code for `mnokw` should look like
35+
# %1 = mkw(kwvalues..., #self#, args...)
36+
# return %1
37+
# where `mkw` is the name of the "active" keyword body-function.
38+
ast = Base.uncompressed_ast(mnokw)
39+
if isa(ast, Core.CodeInfo) && length(ast.code) >= 2
40+
callexpr = ast.code[end-1]
41+
if isa(callexpr, Expr) && callexpr.head == :call
42+
fsym = callexpr.args[1]
43+
if isa(fsym, Symbol)
44+
f = getfield(fmod, fsym)
45+
elseif isa(fsym, GlobalRef)
46+
if fsym.mod === Core && fsym.name === :_apply
47+
f = getfield(mnokw.module, getsym(callexpr.args[2]))
48+
elseif fsym.mod === Core && fsym.name === :_apply_iterate
49+
f = getfield(mnokw.module, getsym(callexpr.args[3]))
50+
else
51+
f = getfield(fsym.mod, fsym.name)
52+
end
53+
else
54+
f = missing
55+
end
56+
else
57+
f = missing
58+
end
59+
else
60+
f = missing
61+
end
62+
__bodyfunction__[mnokw] = f
63+
end
64+
return f
65+
end
66+
1667
function _precompile_()
1768
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
1869
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},AbstractMatrix})
@@ -22,12 +73,13 @@ function _precompile_()
2273
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},GroupBy,Any,Any})
2374
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},GroupBy,Any})
2475
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{SliceIt},Any,Any,Any})
25-
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{typeof(sin)},typeof(sin)})
2676
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Vector{Function},Number,Number})
2777
Base.precompile(Tuple{typeof(_apply_type_recipe),Any,AbstractArray,Any})
2878
Base.precompile(Tuple{typeof(_apply_type_recipe),Any,Surface,Any})
2979
Base.precompile(Tuple{typeof(_compute_xyz),Vector{Float64},Function,Nothing,Bool})
80+
Base.precompile(Tuple{typeof(_compute_xyz),Vector{String},Vector{String},Nothing,Bool})
3081
Base.precompile(Tuple{typeof(_extract_group_attributes),Vector{String}})
82+
Base.precompile(Tuple{typeof(_prepare_series_data),Matrix{Union{Missing, Float64}}})
3183
Base.precompile(Tuple{typeof(_process_seriesrecipe),Any,Any})
3284
Base.precompile(Tuple{typeof(_process_seriesrecipes!),Any,Any})
3385
Base.precompile(Tuple{typeof(_scaled_adapted_grid),Function,Symbol,Symbol,Float64,Irrational{}})
@@ -48,4 +100,9 @@ function _precompile_()
48100
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Int64, Real}}})
49101
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Vector{Float64}, Vector{Float64}}}})
50102
isdefined(RecipesPipeline, Symbol("#11#12")) && Base.precompile(Tuple{getfield(RecipesPipeline, Symbol("#11#12")),Int64})
103+
let fbody = try __lookup_kwbody__(which(_extract_group_attributes, (Vector{String},Vector{Float64},))) catch missing end
104+
if !ismissing(fbody)
105+
precompile(fbody, (Function,typeof(_extract_group_attributes),Vector{String},Vector{Float64},))
106+
end
107+
end
51108
end

0 commit comments

Comments
 (0)