Libdl: Improve inference for string(::LazyLibraryPath)#57721
Merged
topolarity merged 1 commit intoJuliaLang:masterfrom Mar 11, 2025
Merged
Libdl: Improve inference for string(::LazyLibraryPath)#57721topolarity merged 1 commit intoJuliaLang:masterfrom
string(::LazyLibraryPath)#57721topolarity merged 1 commit intoJuliaLang:masterfrom
Conversation
Make this function `--trim` compatible.
nsajko
reviewed
Mar 11, 2025
| end | ||
| LazyLibraryPath(args...) = LazyLibraryPath(collect(args)) | ||
| Base.string(llp::LazyLibraryPath) = joinpath(string.(llp.pieces)...)::String | ||
| Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces]) |
Member
There was a problem hiding this comment.
Arguably prettier, ignore if you don't agree:
Suggested change
| Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces]) | |
| Base.string(llp::LazyLibraryPath) = joinpath(collect(String, Iterators.map(string, llp.pieces))) |
Member
|
This PR makes the sysimage less vulnerable to invalidation! In particular, comparing with Some of the fixed invalidations{
"method_instance": {
"method": "restart_copyto_nonleaf!(newdest, dest, bc, val, I, iter, state, count) @ Base.Broadcast broadcast.jl:1089",
"method_instance": "MethodInstance for Base.Broadcast.restart_copyto_nonleaf!(::Array, ::BitArray, ::Base.Broadcast.Broadcasted, ::Any, ::Int64, ::Base.OneTo, ::Int64, ::Int64)"
},
"children": [
{
"method_instance": {
"method": "copyto_nonleaf!(dest, bc::Base.Broadcast.Broadcasted, iter, state, count) @ Base.Broadcast broadcast.jl:1098",
"method_instance": "MethodInstance for Base.Broadcast.copyto_nonleaf!(::BitVector, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(string), <:Tuple{Base.Broadcast.Extruded{T, Tuple{Bool}, Tuple{Int64}} where T<:(Vector)}}, ::Base.OneTo{Int64}, ::Int64, ::Int64)"
},
"children": [
{
"method_instance": {
"method": "copy(bc::Base.Broadcast.Broadcasted) @ Base.Broadcast broadcast.jl:915",
"method_instance": "MethodInstance for copy(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(string), <:Tuple{Vector}})"
},
"children": [
{
"method_instance": {
"method": "materialize(bc::Base.Broadcast.Broadcasted) @ Base.Broadcast broadcast.jl:894",
"method_instance": "MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(string), <:Tuple{Vector}})"
},
"children": [
{
"method_instance": {
"method": "string(llp::Base.Libc.Libdl.LazyLibraryPath) @ Base.Libc.Libdl libdl.jl:337",
"method_instance": "MethodInstance for string(::Base.Libc.Libdl.LazyLibraryPath)"
},
"children": [
]
}
]
}
]
},
{
"method_instance": {
"method": "restart_copyto_nonleaf!(newdest, dest, bc, val, I, iter, state, count) @ Base.Broadcast broadcast.jl:1089",
"method_instance": "MethodInstance for Base.Broadcast.restart_copyto_nonleaf!(::BitVector, ::BitVector, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(string), <:Tuple{Base.Broadcast.Extruded{T, Tuple{Bool}, Tuple{Int64}} where T<:(Vector)}}, ::Any, ::Int64, ::Base.OneTo{Int64}, ::Int64, ::Int64)"
},
"children": [
{
"method_instance": {
"method": "copyto_nonleaf!(dest, bc::Base.Broadcast.Broadcasted, iter, state, count) @ Base.Broadcast broadcast.jl:1098",
"method_instance": "MethodInstance for Base.Broadcast.copyto_nonleaf!(::BitVector, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(string), <:Tuple{Base.Broadcast.Extruded{T, Tuple{Bool}, Tuple{Int64}} where T<:(Vector)}}, ::Base.OneTo{Int64}, ::Int64, ::Int64)"
},
"children": [
]
}
]
}
]
}
]
}{
"method_instance": {
"method": "_broadcast_getindex_evalf(f::Tf, args::Vararg{Any, N}) where {Tf, N} @ Base.Broadcast broadcast.jl:699",
"method_instance": "MethodInstance for Base.Broadcast._broadcast_getindex_evalf(::typeof(Base.wrap_string), ::AbstractString, ::UInt32)"
},
"children": [
{
"method_instance": {
"method": "_broadcast_getindex(bc::Base.Broadcast.Broadcasted{<:Any, <:Any, <:Any, <:Any}, I) @ Base.Broadcast broadcast.jl:670",
"method_instance": "MethodInstance for Base.Broadcast._broadcast_getindex(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}}, ::CartesianIndex{0})"
},
"children": [
{
"method_instance": {
"method": "_getindex(::IndexStyle, bc, I) @ Base.Broadcast broadcast.jl:618",
"method_instance": "MethodInstance for Base.Broadcast._getindex(::IndexCartesian, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}}, ::CartesianIndex{0})"
},
"children": [
{
"method_instance": {
"method": "getindex(bc::Base.Broadcast.Broadcasted, Is::Vararg{Union{Integer, CartesianIndex}, N}) where N @ Base.Broadcast broadcast.jl:614",
"method_instance": "MethodInstance for getindex(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}}, ::CartesianIndex{0})"
},
"children": [
{
"method_instance": {
"method": "copy(bc::Base.Broadcast.Broadcasted{<:Base.Broadcast.AbstractArrayStyle{0}}) @ Base.Broadcast broadcast.jl:909",
"method_instance": "MethodInstance for copy(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}})"
},
"children": [
{
"method_instance": {
"method": "materialize(bc::Base.Broadcast.Broadcasted) @ Base.Broadcast broadcast.jl:894",
"method_instance": "MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}})"
},
"children": [
{
"method_instance": {
"method": "*(r1::Union{Regex, AbstractChar, AbstractString}, rs::Union{Regex, AbstractChar, AbstractString}...) @ Base regex.jl:840",
"method_instance": "MethodInstance for *(::Union{Regex, AbstractChar, AbstractString}, ::AbstractString)"
},
"children": [
{
"method_instance": {
"method": "joinpath(paths::Union{Tuple, AbstractVector}) @ Base.Filesystem path.jl:324",
"method_instance": "MethodInstance for joinpath(::Union{Tuple, AbstractVector})"
},
"children": [
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"method_instance": {
"method": "_broadcast_getindex(bc::Base.Broadcast.Broadcasted{<:Any, <:Any, <:Any, <:Any}, I) @ Base.Broadcast broadcast.jl:670",
"method_instance": "MethodInstance for Base.Broadcast._broadcast_getindex(::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}}, ::Int64)"
},
"children": [
{
"method_instance": {
"method": "(::Base.Broadcast.var\"#copy##0#copy##1\")(k) @ Base.Broadcast broadcast.jl:1124",
"method_instance": "MethodInstance for (::Base.Broadcast.var\"#copy##0#copy##1\"{Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}, Nothing, typeof(Base.wrap_string), var\"#s179\"}} where var\"#s179\"<:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}})(::Int64)"
},
"children": [
{
"method_instance": {
"method": "ntuple(f, ::Val{1}) @ Base ntuple.jl:50",
"method_instance": "MethodInstance for ntuple(::Base.Broadcast.var\"#copy##0#copy##1\"{Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}, Nothing, typeof(Base.wrap_string), var\"#s179\"}} where var\"#s179\"<:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}, ::Val{1})"
},
"children": [
{
"method_instance": {
"method": "copy(bc::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}}) @ Base.Broadcast broadcast.jl:1120",
"method_instance": "MethodInstance for copy(::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}})"
},
"children": [
{
"method_instance": {
"method": "materialize(bc::Base.Broadcast.Broadcasted) @ Base.Broadcast broadcast.jl:894",
"method_instance": "MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple}, Nothing, typeof(Base.wrap_string), <:Tuple{Tuple{AbstractString}, Base.RefValue{UInt32}}})"
},
"children": [
{
"method_instance": {
"method": "*(r1::Union{Regex, AbstractChar, AbstractString}, rs::Union{Regex, AbstractChar, AbstractString}...) @ Base regex.jl:840",
"method_instance": "MethodInstance for *(::Union{Regex, AbstractChar, AbstractString}, ::AbstractString)"
},
"children": [
]
}
]
}
]
}
]
}
]
}
]
}
]
} |
Member
|
It'd be nice if this could be backported to v1.11, too, to prevent the invalidation. |
KristofferC
pushed a commit
that referenced
this pull request
Mar 20, 2025
Make this function `--trim` compatible. (cherry picked from commit 8edc2b3)
KristofferC
pushed a commit
that referenced
this pull request
Mar 31, 2025
Make this function `--trim` compatible. (cherry picked from commit 8edc2b3)
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make this function
--trimcompatible.