jli  Linuxx86_641.10.3v1.10.30b4590a5507d3f3046e5bafc007cacbbfc9b310b.̞PrecompileSignaturesFTΑT|& )6rJ/opt/julia/packages/PrecompileSignatures/cfiUi/src/PrecompileSignatures.jl6ACoremуJ5Basemу]J5MainmуJ5ArgToolsBń x(mуF K5 Artifactsmr-V3|mу K5Base64UlD*_mу> K5CRC32c\y.jmуj K5 FileWatchingXzsy`{,zmуh& K5LibdluVW59˗,mу-" K5LoggingT{VhUXM=mуrU" K5MmapP~:xg,Omу|' K5NetworkOptionsC0YW,mуʠ, K5SHAQ<$!<%mу1 K5 Serialization [)*k1mу-G K5Sockets1V$ bdސݗmуYBY K5UnicodeP>I>Nrmуeszo K5 LinearAlgebraSm7̏mуuux K5 OpenBLAS_jll[(Śb6EcQ FmуDux K5libblastrampoline_jllLSۆ }lxӠmу^} K5MarkdownZPn7z`smу/Ed~ K5Printfg^cX׸QDmу;h K5Random_ɢ?\Ymу? K5TarOi>աmу!t, K5DatesEY8pj2 mуX K5FuturebS;3{I xVMmуsD K5InteractiveUtilsWL ~@'ZmуVg K5LibGit2Z[&RPTv3EКRmу8J K5 LibGit2_jll YXg}]$mуD K5 MbedTLS_jllAX 3ȡ_mу- K5 LibSSH2_jlloTZk)߆ Set Return multiple `Tuple`s containing only concrete types for each combination of concrete types that can be found. """ function _split_unions(sig::DataType, type_conversions::Dict{DataType,DataType})::Set method, types... = sig.parameters concrete_types = Any[] for type in types unpacked = _unpack_union!(type)::Vector{Any} converted_types = Any[] for type in unpacked converted = _convert_type(type, type_conversions) if isconcretetype(converted) push!(converted_types, converted) end end push!(concrete_types, converted_types) end pairs = _pairs(concrete_types) return _split_unions_barrier(pairs) end const SUBMODULES_DEFAULT = true const SPLIT_UNIONS_DEFAULT = true const TYPE_CONVERSIONS_DEFAULT = Dict{DataType,DataType}( AbstractString => String, IO => IOStream ) """ Config( submodules::Bool=$SUBMODULES_DEFAULT, split_unions::Bool=$SPLIT_UNIONS_DEFAULT, type_conversions::Dict{DataType,DataType}=$TYPE_CONVERSIONS_DEFAULT ) Configuration for generating precompile directives. Keyword arguments: - `split_unions`: Whether to split union types. For example, whether to generate two precompile directives for `f(x::Union{Int,Float64})`. - `abstracttype_conversions`: Mapping of conversions from on type to another. For example, for all method signatures containing and argument of type `AbstractString`, you can decide to add a precompile directive for `String` for that type. """ @Base.kwdef struct Config submodules::Bool=SUBMODULES_DEFAULT split_unions::Bool=SPLIT_UNIONS_DEFAULT type_conversions::Dict{DataType,DataType}=TYPE_CONVERSIONS_DEFAULT end """ Return precompile directives datatypes for signature `sig`. Each returned `DataType` is ready to be passed to `precompile`. """ function _directives_datatypes(sig::DataType, config::Config)::Vector{DataType} method, types... = sig.parameters _all_concrete(types) && return [sig] if config.split_unions concrete_argument_types = _split_unions(sig, config.type_conversions) return DataType[Tuple{method, types...} for types in concrete_argument_types] else return DataType[] end end "Return all method signatures for function `f`." function _signatures(f::Function)::Vector{DataType} out = DataType[] for method in methods(f) sig = method.sig # Ignoring parametric types for now. if !(sig isa UnionAll) push!(out, sig) end end return out end function _all_submodules(M::Vector{Module})::Vector{Module} out = Module[] for m in M S = _submodules(m) for s in S push!(out, s) end end return out end """ precompilables(M::Vector{Module}, config::Config=Config()) -> Vector{DataType} precompilables(M::Module, config::Config=Config()) -> Vector{DataType} Return a vector of precompile directives for module `M`. """ function precompilables(M::Vector{Module}, config::Config=Config())::Vector{DataType} if config.submodules M = _all_submodules(M) end out = DataType[] types = map(M) do mod functions = _module_functions(mod) for func in functions signatures = _signatures(func) for sig in signatures directives_types = _directives_datatypes(sig, config) for datatype in directives_types push!(out, datatype) end end end end return out end function precompilables(M::Module, config::Config=Config())::Vector{DataType} return precompilables([M], config) end """ _precompile_type(argt::Type) Compile the given `argt` such as `Tuple{typeof(sum), Vector{Int}}`. """ function _precompile_type(@nospecialize(argt::Type)) # Not calling `precompile` since that specializes on types before #43990 (Julia < 1.8). ret = ccall(:jl_compile_hint, Int32, (Any,), argt) != 0 return ret end "This function is called from within `@precompile_signatures`." function _precompile_signatures(M::Module, config::Config=Config()) types = precompilables(M, config) for type in types _precompile_type(type) end return nothing end """ @precompile_signatures(M) Precompile the concrete signatures in module `M`. """ macro precompile_signatures(M::Symbol) esc(quote try if ccall(:jl_generating_output, Cint, ()) == 1 $PrecompileSignatures._precompile_signatures($M) end catch e msg = "Generating and including the `precompile` directives failed" @warn msg exception=(e, catch_backtrace()) end end) end # This method is only used by the tests. # The tests check whether this method is precompiled. # It isn't called by anything so if it is precompiled it must be due to the call below. _test_precompiled(x::Int) = 3 # Include generated `precompile` directives for this module. @precompile_signatures(PrecompileSignatures) end # module