Skip to content

Commit 0a8ad1f

Browse files
authored
Backports for 1.11.3 (#56741)
2 parents 5e9a32e + 343c6ee commit 0a8ad1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+468
-204
lines changed

base/abstractdict.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Return an iterator over all keys in a dictionary.
8888
When the keys are stored internally in a hash table,
8989
as is the case for `Dict`,
9090
the order in which they are returned may vary.
91-
But `keys(a)` and `values(a)` both iterate `a` and
92-
return the elements in the same order.
91+
But `keys(a)`, `values(a)` and `pairs(a)` all iterate `a`
92+
and return the elements in the same order.
9393
9494
# Examples
9595
```jldoctest
@@ -114,8 +114,8 @@ Return an iterator over all values in a collection.
114114
When the values are stored internally in a hash table,
115115
as is the case for `Dict`,
116116
the order in which they are returned may vary.
117-
But `keys(a)` and `values(a)` both iterate `a` and
118-
return the elements in the same order.
117+
But `keys(a)`, `values(a)` and `pairs(a)` all iterate `a`
118+
and return the elements in the same order.
119119
120120
# Examples
121121
```jldoctest
@@ -138,6 +138,10 @@ values(a::AbstractDict) = ValueIterator(a)
138138
Return an iterator over `key => value` pairs for any
139139
collection that maps a set of keys to a set of values.
140140
This includes arrays, where the keys are the array indices.
141+
When the entries are stored internally in a hash table,
142+
as is the case for `Dict`, the order in which they are returned may vary.
143+
But `keys(a)`, `values(a)` and `pairs(a)` all iterate `a`
144+
and return the elements in the same order.
141145
142146
# Examples
143147
```jldoctest

base/binaryplatforms.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ const arch_mapping = Dict(
591591
"armv7l" => "arm(v7l)?", # if we just see `arm-linux-gnueabihf`, we assume it's `armv7l`
592592
"armv6l" => "armv6l",
593593
"powerpc64le" => "p(ower)?pc64le",
594+
"riscv64" => "(rv64|riscv64)",
594595
)
595596
# Keep this in sync with `CPUID.ISAs_by_family`
596597
# These are the CPUID side of the microarchitectures targeted by GCC flags in BinaryBuilder.jl

base/broadcast.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,14 @@ Base.@propagate_inbounds function Base.iterate(bc::Broadcasted, s)
274274
end
275275

276276
Base.IteratorSize(::Type{T}) where {T<:Broadcasted} = Base.HasShape{ndims(T)}()
277-
Base.ndims(BC::Type{<:Broadcasted{<:Any,Nothing}}) = _maxndims(fieldtype(BC, :args))
278-
Base.ndims(::Type{<:Broadcasted{<:AbstractArrayStyle{N},Nothing}}) where {N<:Integer} = N
277+
Base.ndims(BC::Type{<:Broadcasted{<:Any,Nothing}}) = _maxndims_broadcasted(BC)
278+
# the `AbstractArrayStyle` type parameter is required to be either equal to `Any` or be an `Int` value
279+
Base.ndims(BC::Type{<:Broadcasted{<:AbstractArrayStyle{Any},Nothing}}) = _maxndims_broadcasted(BC)
280+
Base.ndims(::Type{<:Broadcasted{<:AbstractArrayStyle{N},Nothing}}) where {N} = N::Int
279281

282+
function _maxndims_broadcasted(BC::Type{<:Broadcasted})
283+
_maxndims(fieldtype(BC, :args))
284+
end
280285
_maxndims(::Type{T}) where {T<:Tuple} = reduce(max, ntuple(n -> (F = fieldtype(T, n); F <: Tuple ? 1 : ndims(F)), Base._counttuple(T)))
281286
_maxndims(::Type{<:Tuple{T}}) where {T} = T <: Tuple ? 1 : ndims(T)
282287
function _maxndims(::Type{<:Tuple{T, S}}) where {T, S}

base/compiler/effects.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ is_inaccessiblemem_or_argmemonly(effects::Effects) = effects.inaccessiblememonly
329329

330330
is_consistent_overlay(effects::Effects) = effects.nonoverlayed === CONSISTENT_OVERLAY
331331

332+
# (sync this with codegen.cpp and staticdata.c effects_foldable functions)
332333
function encode_effects(e::Effects)
333334
return ((e.consistent % UInt32) << 0) |
334335
((e.effect_free % UInt32) << 3) |

base/compiler/ssair/passes.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,18 +2075,19 @@ function adce_pass!(ir::IRCode, inlining::Union{Nothing,InliningState}=nothing)
20752075
unionphi = unionphis[i]
20762076
phi = unionphi[1]
20772077
t = unionphi[2]
2078+
inst = compact.result[phi]
20782079
if t === Union{}
2079-
stmt = compact[SSAValue(phi)][:stmt]::PhiNode
2080+
stmt = inst[:stmt]::PhiNode
20802081
kill_phi!(compact, phi_uses, 1:length(stmt.values), SSAValue(phi), stmt, true)
20812082
made_changes = true
20822083
continue
20832084
elseif t === Any
20842085
continue
2085-
elseif (𝕃ₒ, compact.result[phi][:type], t)
2086-
continue
20872086
end
2087+
= strictpartialorder(𝕃ₒ)
2088+
t inst[:type] || continue
20882089
to_drop = Int[]
2089-
stmt = compact[SSAValue(phi)][:stmt]
2090+
stmt = inst[:stmt]
20902091
stmt === nothing && continue
20912092
stmt = stmt::PhiNode
20922093
for i = 1:length(stmt.values)
@@ -2098,7 +2099,8 @@ function adce_pass!(ir::IRCode, inlining::Union{Nothing,InliningState}=nothing)
20982099
push!(to_drop, i)
20992100
end
21002101
end
2101-
compact.result[phi][:type] = t
2102+
inst[:type] = t
2103+
add_flag!(inst, IR_FLAG_REFINED) # t ⊏ inst[:type]
21022104
kill_phi!(compact, phi_uses, to_drop, SSAValue(phi), stmt, false)
21032105
made_changes = true
21042106
end

base/compiler/tfuncs.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,16 @@ add_tfunc(svec, 0, INT_INF, @nospecs((𝕃::AbstractLattice, args...)->SimpleVec
587587
return TypeVar
588588
end
589589
end
590-
tv = TypeVar(nval, lb, ub)
591-
return PartialTypeVar(tv, lb_certain, ub_certain)
590+
lb_valid = lb isa Type || lb isa TypeVar
591+
ub_valid = ub isa Type || ub isa TypeVar
592+
if lb_valid && ub_valid
593+
tv = TypeVar(nval, lb, ub)
594+
return PartialTypeVar(tv, lb_certain, ub_certain)
595+
elseif !lb_valid && lb_certain
596+
return Union{}
597+
elseif !ub_valid && ub_certain
598+
return Union{}
599+
end
592600
end
593601
return TypeVar
594602
end

base/deepcopy.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ function _deepcopy_memory_t(@nospecialize(x::Memory), T, stackdict::IdDict)
120120
end
121121
return dest
122122
end
123-
@eval function deepcopy_internal(x::Array{T, N}, stackdict::IdDict) where {T, N}
123+
function deepcopy_internal(x::Array{T, N}, stackdict::IdDict) where {T, N}
124124
if haskey(stackdict, x)
125125
return stackdict[x]::typeof(x)
126126
end
127-
stackdict[x] = $(Expr(:new, :(Array{T, N}), :(deepcopy_internal(x.ref, stackdict)), :(x.size)))
127+
y = stackdict[x] = Array{T, N}(undef, ntuple(Returns(0), Val{N}()))
128+
setfield!(y, :ref, deepcopy_internal(x.ref, stackdict))
129+
setfield!(y, :size, x.size)
130+
y
128131
end
129132
function deepcopy_internal(x::GenericMemoryRef, stackdict::IdDict)
130133
if haskey(stackdict, x)

base/docs/basedocs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ kw"new"
14601460
"""
14611461
where
14621462
1463-
The `where` keyword creates a type that is an iterated union of other types, over all
1463+
The `where` keyword creates a [`UnionAll`](@ref) type, which may be thought of as an iterated union of other types, over all
14641464
values of some variable. For example `Vector{T} where T<:Real` includes all [`Vector`](@ref)s
14651465
where the element type is some kind of `Real` number.
14661466

base/loading.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ function compilecache_path(pkg::PkgId;
17821782
path = nothing
17831783
isnothing(sourcepath) && error("Cannot locate source for $(repr("text/plain", pkg))")
17841784
for path_to_try in cachepaths
1785-
staledeps = stale_cachefile(sourcepath, path_to_try, ignore_loaded = true, requested_flags=flags)
1785+
staledeps = stale_cachefile(sourcepath, path_to_try; ignore_loaded, requested_flags=flags)
17861786
if staledeps === true
17871787
continue
17881788
end
@@ -2555,7 +2555,7 @@ function _require(pkg::PkgId, env=nothing)
25552555
parallel_precompile_attempted = true
25562556
unlock(require_lock)
25572557
try
2558-
Precompilation.precompilepkgs([pkg.name]; _from_loading=true)
2558+
Precompilation.precompilepkgs([pkg.name]; _from_loading=true, ignore_loaded=false)
25592559
finally
25602560
lock(require_lock)
25612561
end

base/mathconstants.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929
Base.@assume_effects :foldable function (::Type{T})(x::_KnownIrrational, r::RoundingMode) where {T<:Union{Float32,Float64}}
3030
Base._irrational_to_float(T, x, r)
3131
end
32-
Base.@assume_effects :foldable function rationalize(::Type{T}, x::_KnownIrrational; tol::Real=0) where {T<:Integer}
32+
Base.@assume_effects :foldable function Base.rationalize(::Type{T}, x::_KnownIrrational; tol::Real=0) where {T<:Integer}
3333
Base._rationalize_irrational(T, x, tol)
3434
end
3535
Base.@assume_effects :foldable function Base.lessrational(rx::Rational, x::_KnownIrrational)

0 commit comments

Comments
 (0)