Skip to content

Commit

Permalink
Backports release 1.10.5 (#54851)
Browse files Browse the repository at this point in the history
Backported PRs:
- [x] #51351 <!-- Remove boxing in pinv -->
- [x] #52678 <!-- Profile: Improve module docstring -->
- [x] #54201 <!-- Fix generic triangular solves with empty matrices -->
- [x] #54605 <!-- Allow libquadmath to also fail as it is not available
on all systems -->
- [x] #54634 <!-- Fix trampoline assembly for build on clang 18 on apple
silicon -->
- [x] #54635 <!-- Aggressive constprop in trevc! to stabilize triangular
eigvec -->
- [x] #54645 <!-- ensure we set the right value to gc_first_tid -->
- [x] #54671 <!-- Add boundscheck in bindingkey_eq to avoid OOB access
due to data race -->
- [x] #54672 <!-- make: Fix `sed` command for LLVM libraries with no
symbol versioning -->
- [x] #54704 <!-- LazyString in reinterpretarray error messages -->
- [x] #54713 <!-- make: use `readelf` for LLVM symbol version detection
-->
- [x] #54781 <!-- [LinearAlgebra] Improve resilience to unknown
libblastrampoline flags -->
- [x] #54837 <!-- Do not add type tag size to the `alloc_typed` lowering
for GC allocations -->
- [x] #54815 <!-- add sticky task warning to `@task` and `schedule` -->
- [x] #55141 <!-- Update the aarch64 devdocs to reflect the current
state of its support -->
- [x] #55178 <!-- Compat for `Base.@nospecializeinfer` -->
- [x] #55197 <!-- compat notice for a[begin] indexing -->
- [x] #55209 <!-- correction to compat notice for a[begin] -->
- [x] #55203 <!-- document mutable struct const fields -->
- [x] #54769 <!-- add missing compat entry to edit -->
- [x] #54791 <!-- Bump libblastrampoline to v5.10.1 -->
- [x] #55070 <!-- LinearAlgebra: LazyString in error messages for
Diagonal/Bidiagonal -->
- [x] #54624 <!-- more precise aliasing checks for SubArray -->
- [x] #54690 <!-- Fix assertion/crash when optimizing function with dead
basic block -->
- [x] #55084 <!-- Use triple quotes in TOML.print when string contains
newline -->


Need manual backport:
- [ ] #52505 <!-- fix alignment of emit_unbox_store copy -->
- [ ] #53373 <!-- fix sysimage-native-code=no option with pkgimages -->
- [ ] #53984 <!-- Profile: fix heap snapshot is valid char check -->
- [ ] #54276 <!-- Fix solve for complex `Hermitian` with non-vanishing
imaginary part on diagonal -->
- [ ] #54669 <!-- Improve error message in inplace transpose -->
- [ ] #54871 <!-- Make warn missed transformations pass optional -->

Contains multiple commits, manual intervention needed:
- [ ] #52854 <!-- Change to streaming out the heap snapshot data -->
- [ ] #53218 <!-- Fix interpreter_exec.jl test -->
- [ ] #53833 <!-- Profile: make heap snapshots viewable in vscode viewer
-->
- [ ] #54303 <!-- LinearAlgebra: improve type-inference in
Symmetric/Hermitian matmul -->
- [ ] #52694 <!-- Reinstate similar for AbstractQ for backward
compatibility -->
- [ ] #54737 <!-- LazyString in interpolated error messages involving
types -->
- [ ] #54738 <!-- serialization: fix relocatability bug -->
- [ ] #55052 <!-- Fix `(l/r)mul!` with `Diagonal`/`Bidiagonal` -->

Non-merged PRs with backport label:
- [ ] #55220 <!-- `isfile_casesensitive` fixes on Windows -->
- [ ] #55169 <!-- `propertynames` for SVD respects private argument -->
- [ ] #55013 <!-- [docs] change docstring to match code -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
- [ ] #50813 <!-- More doctests for Sockets and capitalization fix -->
- [ ] #50157 <!-- improve docs for `@inbounds` and
`Base.@propagate_inbounds` -->
- [ ] #41244 <!-- Fix shell `cd` error when working dir has been deleted
-->
  • Loading branch information
KristofferC authored Aug 13, 2024
2 parents 4954197 + 5b677f9 commit 6f77e2a
Show file tree
Hide file tree
Showing 64 changed files with 530 additions and 245 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ win-extras:
ifeq ($(USE_SYSTEM_LLVM), 1)
LLVM_SIZE := llvm-size$(EXE)
else
LLVM_SIZE := $(build_depsbindir)/llvm-size$(EXE)
LLVM_SIZE := PATH=$(build_bindir):$$PATH; $(build_depsbindir)/llvm-size$(EXE)
endif
build-stats:
ifeq ($(USE_BINARYBUILDER_LLVM),1)
Expand Down
4 changes: 2 additions & 2 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ endif
ifneq (,$(LIBGFORTRAN_VERSION))
$(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION)))
endif
$(eval $(call symlink_system_library,CSL,libquadmath,0))
$(eval $(call symlink_system_library,CSL,libstdc++,6))
# We allow libssp, libatomic and libgomp to fail as they are not available on all systems
# We allow libssp, libatomic, libgomp and libquadmath to fail as they are not available on all systems
$(eval $(call symlink_system_library,CSL,libssp,0,ALLOW_FAILURE))
$(eval $(call symlink_system_library,CSL,libatomic,1,ALLOW_FAILURE))
$(eval $(call symlink_system_library,CSL,libgomp,1,ALLOW_FAILURE))
$(eval $(call symlink_system_library,CSL,libquadmath,0,ALLOW_FAILURE))
$(eval $(call symlink_system_library,PCRE,libpcre2-8))
$(eval $(call symlink_system_library,DSFMT,libdSFMT))
$(eval $(call symlink_system_library,LIBBLASTRAMPOLINE,libblastrampoline))
Expand Down
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ end
@inline function _stack_size_check(x, ax1::Tuple)
if _iterator_axes(x) != ax1
uax1 = map(UnitRange, ax1)
uaxN = map(UnitRange, axes(x))
uaxN = map(UnitRange, _iterator_axes(x))
throw(DimensionMismatch(
LazyString("stack expects uniform slices, got axes(x) == ", uaxN, " while first had ", uax1)))
end
Expand Down
25 changes: 21 additions & 4 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,11 @@ Usually `begin` will not be necessary, since keywords such as [`function`](@ref)
implicitly begin blocks of code. See also [`;`](@ref).
`begin` may also be used when indexing to represent the first index of a
collection or the first index of a dimension of an array.
collection or the first index of a dimension of an array. For example,
`a[begin]` is the first element of an array `a`.
!!! compat "Julia 1.4"
Use of `begin` as an index requires Julia 1.4 or later.
# Examples
```jldoctest
Expand Down Expand Up @@ -1396,8 +1400,20 @@ kw"struct"
mutable struct
`mutable struct` is similar to [`struct`](@ref), but additionally allows the
fields of the type to be set after construction. See the manual section on
[Composite Types](@ref) for more information.
fields of the type to be set after construction.
Individual fields of a mutable struct can be marked as `const` to make them immutable:
```julia
mutable struct Baz
a::Int
const b::Float64
end
```
!!! compat "Julia 1.8"
The `const` keyword for fields of mutable structs requires at least Julia 1.8.
See the manual section on [Composite Types](@ref) for more information.
"""
kw"mutable struct"

Expand Down Expand Up @@ -1747,7 +1763,8 @@ The task will run in the "world age" from the parent at construction when [`sche
!!! warning
By default tasks will have the sticky bit set to true `t.sticky`. This models the
historic default for [`@async`](@ref). Sticky tasks can only be run on the worker thread
they are first scheduled on. To obtain the behavior of [`Threads.@spawn`](@ref) set the sticky
they are first scheduled on, and when scheduled will make the task that they were scheduled
from sticky. To obtain the behavior of [`Threads.@spawn`](@ref) set the sticky
bit manually to `false`.
# Examples
Expand Down
3 changes: 3 additions & 0 deletions base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,9 @@ while it can not infer the concrete return type of it.
Without the `@nospecializeinfer`, `f([1.0])` would infer the return type of `g` as `Float64`,
indicating that inference ran for `g(::Vector{Float64})` despite the prohibition on
specialized code generation.
!!! compat "Julia 1.10"
Using `Base.@nospecializeinfer` requires Julia version 1.10.
"""
macro nospecializeinfer(ex)
esc(isa(ex, Expr) ? pushmeta!(ex, :nospecializeinfer) : ex)
Expand Down
8 changes: 7 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3005,7 +3005,13 @@ end
return stale_cachefile(PkgId(""), UInt128(0), modpath, cachefile; ignore_loaded)
end
@constprop :none function stale_cachefile(modkey::PkgId, build_id::UInt128, modpath::String, cachefile::String; ignore_loaded::Bool = false)
io = open(cachefile, "r")
io = try
open(cachefile, "r")
catch ex
ex isa IOError || ex isa SystemError || rethrow()
@debug "Rejecting cache file $cachefile for $modkey because it could not be opened" isfile(cachefile)
return true
end
try
checksum = isvalid_cache_header(io)
if iszero(checksum)
Expand Down
41 changes: 25 additions & 16 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1025,25 +1025,34 @@ end

### from abstractarray.jl

# In the common case where we have two views into the same parent, aliasing checks
# are _much_ easier and more important to get right
function mightalias(A::SubArray{T,<:Any,P}, B::SubArray{T,<:Any,P}) where {T,P}
if !_parentsmatch(A.parent, B.parent)
# We cannot do any better than the usual dataids check
return !_isdisjoint(dataids(A), dataids(B))
end
# Now we know that A.parent === B.parent. This means that the indices of A
# and B are the same length and indexing into the same dimensions. We can
# just walk through them and check for overlaps: O(ndims(A)). We must finally
# ensure that the indices don't alias with either parent
return _indicesmightoverlap(A.indices, B.indices) ||
!_isdisjoint(dataids(A.parent), _splatmap(dataids, B.indices)) ||
!_isdisjoint(dataids(B.parent), _splatmap(dataids, A.indices))
function mightalias(A::SubArray, B::SubArray)
# There are three ways that SubArrays might _problematically_ alias one another:
# 1. The parents are the same we can conservatively check if the indices might overlap OR
# 2. The parents alias eachother in a more complicated manner (and we can't trace indices) OR
# 3. One's parent is used in the other's indices
# Note that it's ok for just the indices to alias each other as those should not be mutated,
# so we can always do better than the default !_isdisjoint(dataids(A), dataids(B))
if isbits(A.parent) || isbits(B.parent)
return false # Quick out for immutables
elseif _parentsmatch(A.parent, B.parent)
# Each SubArray unaliases its own parent from its own indices upon construction, so if
# the two parents are the same, then by construction one cannot alias the other's indices
# and therefore this is the only test we need to perform:
return _indicesmightoverlap(A.indices, B.indices)
else
A_parent_ids = dataids(A.parent)
B_parent_ids = dataids(B.parent)
return !_isdisjoint(A_parent_ids, B_parent_ids) ||
!_isdisjoint(A_parent_ids, _splatmap(dataids, B.indices)) ||
!_isdisjoint(B_parent_ids, _splatmap(dataids, A.indices))
end
end
# Test if two arrays are backed by exactly the same memory in exactly the same order
_parentsmatch(A::AbstractArray, B::AbstractArray) = A === B
# Two reshape(::Array)s of the same size aren't `===` because they have different headers
_parentsmatch(A::Array, B::Array) = pointer(A) == pointer(B) && size(A) == size(B)
_parentsmatch(A::DenseArray, B::DenseArray) = elsize(A) == elsize(B) && pointer(A) == pointer(B) && size(A) == size(B)
_parentsmatch(A::StridedArray, B::StridedArray) = elsize(A) == elsize(B) && pointer(A) == pointer(B) && strides(A) == strides(B)

# Given two SubArrays with the same parent, check if the indices might overlap (returning true if unsure)
_indicesmightoverlap(A::Tuple{}, B::Tuple{}) = true
_indicesmightoverlap(A::Tuple{}, B::Tuple) = error("malformed subarray")
_indicesmightoverlap(A::Tuple, B::Tuple{}) = error("malformed subarray")
Expand Down
31 changes: 18 additions & 13 deletions base/reinterpretarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S},IsReshaped} <: AbstractArray{T

function throwbits(S::Type, T::Type, U::Type)
@noinline
throw(ArgumentError("cannot reinterpret `$(S)` as `$(T)`, type `$(U)` is not a bits type"))
throw(ArgumentError(LazyString("cannot reinterpret `", S, "` as `", T, "`, type `", U, "` is not a bits type")))
end
function throwsize0(S::Type, T::Type, msg)
@noinline
throw(ArgumentError("cannot reinterpret a zero-dimensional `$(S)` array to `$(T)` which is of a $msg size"))
throw(ArgumentError(LazyString("cannot reinterpret a zero-dimensional `", S, "` array to `", T,
"` which is of a ", msg, " size")))
end
function throwsingleton(S::Type, T::Type)
@noinline
throw(ArgumentError("cannot reinterpret a `$(S)` array to `$(T)` which is a singleton type"))
throw(ArgumentError(LazyString("cannot reinterpret a `", S, "` array to `", T, "` which is a singleton type")))
end

global reinterpret
Expand Down Expand Up @@ -50,14 +51,14 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S},IsReshaped} <: AbstractArray{T
function reinterpret(::Type{T}, a::A) where {T,N,S,A<:AbstractArray{S, N}}
function thrownonint(S::Type, T::Type, dim)
@noinline
throw(ArgumentError("""
cannot reinterpret an `$(S)` array to `$(T)` whose first dimension has size `$(dim)`.
The resulting array would have non-integral first dimension.
"""))
throw(ArgumentError(LazyString(
"cannot reinterpret an `", S, "` array to `", T, "` whose first dimension has size `", dim,
"`. The resulting array would have a non-integral first dimension.")))
end
function throwaxes1(S::Type, T::Type, ax1)
@noinline
throw(ArgumentError("cannot reinterpret a `$(S)` array to `$(T)` when the first axis is $ax1. Try reshaping first."))
throw(ArgumentError(LazyString("cannot reinterpret a `", S, "` array to `", T,
"` when the first axis is ", ax1, ". Try reshaping first.")))
end
isbitstype(T) || throwbits(S, T, T)
isbitstype(S) || throwbits(S, T, S)
Expand All @@ -82,15 +83,19 @@ struct ReinterpretArray{T,N,S,A<:AbstractArray{S},IsReshaped} <: AbstractArray{T
function reinterpret(::typeof(reshape), ::Type{T}, a::A) where {T,S,A<:AbstractArray{S}}
function throwintmult(S::Type, T::Type)
@noinline
throw(ArgumentError("`reinterpret(reshape, T, a)` requires that one of `sizeof(T)` (got $(sizeof(T))) and `sizeof(eltype(a))` (got $(sizeof(S))) be an integer multiple of the other"))
throw(ArgumentError(LazyString("`reinterpret(reshape, T, a)` requires that one of `sizeof(T)` (got ",
sizeof(T), ") and `sizeof(eltype(a))` (got ", sizeof(S), ") be an integer multiple of the other")))
end
function throwsize1(a::AbstractArray, T::Type)
@noinline
throw(ArgumentError("`reinterpret(reshape, $T, a)` where `eltype(a)` is $(eltype(a)) requires that `axes(a, 1)` (got $(axes(a, 1))) be equal to 1:$(sizeof(T) ÷ sizeof(eltype(a))) (from the ratio of element sizes)"))
throw(ArgumentError(LazyString("`reinterpret(reshape, ", T, ", a)` where `eltype(a)` is ", eltype(a),
" requires that `axes(a, 1)` (got ", axes(a, 1), ") be equal to 1:",
sizeof(T) ÷ sizeof(eltype(a)), " (from the ratio of element sizes)")))
end
function throwfromsingleton(S, T)
@noinline
throw(ArgumentError("`reinterpret(reshape, $T, a)` where `eltype(a)` is $S requires that $T be a singleton type, since $S is one"))
throw(ArgumentError(LazyString("`reinterpret(reshape, ", T, ", a)` where `eltype(a)` is ", S,
" requires that ", T, " be a singleton type, since ", S, " is one")))
end
isbitstype(T) || throwbits(S, T, T)
isbitstype(S) || throwbits(S, T, S)
Expand Down Expand Up @@ -804,8 +809,8 @@ end
inpackedsize = packedsize(In)
outpackedsize = packedsize(Out)
inpackedsize == outpackedsize ||
throw(ArgumentError("Packed sizes of types $Out and $In do not match; got $outpackedsize \
and $inpackedsize, respectively."))
throw(ArgumentError(LazyString("Packed sizes of types ", Out, " and ", In,
" do not match; got ", outpackedsize, " and ", inpackedsize, ", respectively.")))
in = Ref{In}(x)
out = Ref{Out}()
if struct_subpadding(Out, In)
Expand Down
14 changes: 14 additions & 0 deletions base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ end
Wrap an expression in a [`Task`](@ref) without executing it, and return the [`Task`](@ref). This only
creates a task, and does not run it.
!!! warning
By default tasks will have the sticky bit set to true `t.sticky`. This models the
historic default for [`@async`](@ref). Sticky tasks can only be run on the worker thread
they are first scheduled on, and when scheduled will make the task that they were scheduled
from sticky. To obtain the behavior of [`Threads.@spawn`](@ref) set the sticky
bit manually to `false`.
# Examples
```jldoctest
julia> a1() = sum(i for i in 1:1000);
Expand Down Expand Up @@ -826,6 +833,13 @@ the woken task.
It is incorrect to use `schedule` on an arbitrary `Task` that has already been started.
See [the API reference](@ref low-level-schedule-wait) for more information.
!!! warning
By default tasks will have the sticky bit set to true `t.sticky`. This models the
historic default for [`@async`](@ref). Sticky tasks can only be run on the worker thread
they are first scheduled on, and when scheduled will make the task that they were scheduled
from sticky. To obtain the behavior of [`Threads.@spawn`](@ref) set the sticky
bit manually to `false`.
# Examples
```jldoctest
julia> a5() = sum(i for i in 1:1000);
Expand Down
2 changes: 1 addition & 1 deletion cli/trampolines/trampolines_aarch64.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

#define XX(name) \
.global CNAME(name) SEP \
CNAME(name)##: SEP \
.cfi_startproc SEP \
.p2align 2 SEP \
CNAME(name)##: SEP \
adrp x16, PAGE(CNAME(name##_addr)) SEP \
ldr x16, [x16, PAGEOFF(CNAME(name##_addr))] SEP \
br x16 SEP \
Expand Down
6 changes: 3 additions & 3 deletions deps/blastrampoline.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
BLASTRAMPOLINE_JLL_NAME := libblastrampoline

## source build
BLASTRAMPOLINE_VER := 5.8.0
BLASTRAMPOLINE_BRANCH=v5.8.0
BLASTRAMPOLINE_SHA1=81316155d4838392e8462a92bcac3eebe9acd0c7
BLASTRAMPOLINE_VER := 5.11.0
BLASTRAMPOLINE_BRANCH=v5.11.0
BLASTRAMPOLINE_SHA1=05083d50611b5538df69706f0a952d8e642b0b4b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0a9d28868d4ed82d053a586d398ed0ed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8c8bc23cfe2b181cfe37a715057e03dc3d8c811e0480586c6e557a2d9e3fb0f1fef93eef4abc94354e6436ac837bcee8414a5c988a00cba5fe822da9aafcd45f

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6f77e2a

Please sign in to comment.