Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5721fda
Add boundscheck in speccache_eq to avoid OOB access due to data race …
kpamnany Jun 18, 2024
5361f7c
Switch from segfault to `zip` behavior for mismatched indices in `map…
adienes Apr 19, 2025
47d905d
Make late gc lower handle insertelement of alloca use. (#58637)
gbaraldi Jun 4, 2025
47ebf95
Unicode: Force-inline isgraphemebreak! (#58674)
Keno Jun 10, 2025
3b04664
fix null comparisons for non-standard address spaces (#58837)
simeonschaub Jul 1, 2025
01de285
Add a `similar` method for `Type{<:CodeUnits}` (#57826)
ararslan Jul 2, 2025
17c8d96
fix trailing indices stackoverflow in reinterpreted array (#58293)
adienes Jul 3, 2025
fc97893
Pkg: Allow configuring can_fancyprint(io::IO) using IOContext (#58887)
fonsp Jul 4, 2025
69bfb6b
Fix nthreadpools size in JLOptions (#58937)
IanButterworth Jul 9, 2025
8c77017
Fix precompilepkgs warn loaded setting (#58978)
IanButterworth Jul 12, 2025
ecd44ff
Bugfix: Use Base.aligned_sizeof instead of sizeof in Mmap.mmap (#58998)
JonasIsensee Jul 18, 2025
9e77df2
Fix memory order typo in "src/julia_atomics.h" (#59120)
omus Jul 29, 2025
10014c5
Clarify and enhance confusing precompile test (#59170)
IanButterworth Jul 31, 2025
5225013
[backports-release-1.11] Change Distributed branch from `master` to `…
DilumAluthge Aug 25, 2025
a5f88ec
🤖 [backports-release-1.11] Bump the Distributed stdlib from 6c7cdb5 t…
DilumAluthgeBot Aug 25, 2025
9aa9ec6
Revert "Unicode: Force-inline isgraphemebreak! (#58674)"
DilumAluthge Aug 28, 2025
562699a
Merge branch 'release-1.11' into backports-release-1.11
DilumAluthge Aug 28, 2025
ddcbe4d
[`backports-release-1.11`]: Revert "fix null comparisons for non-stan…
DilumAluthge Aug 31, 2025
fb73efe
("remove a testset from MMAP that might cause CI to now fail on Windo…
DilumAluthge Sep 1, 2025
b04078d
Remove failing test
gbaraldi Sep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct JLOptions
commands::Ptr{Ptr{UInt8}} # (e)eval, (E)print, (L)load
image_file::Ptr{UInt8}
cpu_target::Ptr{UInt8}
nthreadpools::Int16
nthreadpools::Int8
nthreads::Int16
nmarkthreads::Int16
nsweepthreads::Int8
Expand Down
4 changes: 2 additions & 2 deletions base/precompilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Base.show(io::IO, err::PkgPrecompileError) = print(io, "PkgPrecompileError: ", e

import Base: StaleCacheKey

can_fancyprint(io::IO) = io isa Base.TTY && (get(ENV, "CI", nothing) != "true")
can_fancyprint(io::IO) = @something(get(io, :force_fancyprint, nothing), (io isa Base.TTY && (get(ENV, "CI", nothing) != "true")))

function printpkgstyle(io, header, msg; color=:light_green)
printstyled(io, header; color, bold=true)
Expand Down Expand Up @@ -892,7 +892,7 @@ function _precompilepkgs(pkgs::Vector{String},
flags, cacheflags = config
task = @async begin
try
loaded = haskey(Base.loaded_modules, pkg)
loaded = warn_loaded && haskey(Base.loaded_modules, pkg)
for dep in deps # wait for deps to finish
wait(was_processed[(dep,config)])
end
Expand Down
8 changes: 4 additions & 4 deletions base/reinterpretarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ end
_maybe_reshape(::IndexSCartesian2, A::ReshapedReinterpretArray, I...) = A

# fallbacks
function _getindex(::IndexSCartesian2, A::AbstractArray{T,N}, I::Vararg{Int, N}) where {T,N}
function _getindex(::IndexSCartesian2, A::AbstractArray, I::Vararg{Int, N}) where {N}
@_propagate_inbounds_meta
getindex(A, I...)
_getindex(IndexCartesian(), A, I...)
end
function _setindex!(::IndexSCartesian2, A::AbstractArray{T,N}, v, I::Vararg{Int, N}) where {T,N}
function _setindex!(::IndexSCartesian2, A::AbstractArray, v, I::Vararg{Int, N}) where {N}
@_propagate_inbounds_meta
setindex!(A, v, I...)
_setindex!(IndexCartesian(), A, v, I...)
end
# fallbacks for array types that use "pass-through" indexing (e.g., `IndexStyle(A) = IndexStyle(parent(A))`)
# but which don't handle SCartesianIndex2
Expand Down
2 changes: 2 additions & 0 deletions base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,8 @@ write(io::IO, s::CodeUnits) = write(io, s.s)
cconvert(::Type{Ptr{T}}, s::CodeUnits{T}) where {T} = cconvert(Ptr{T}, s.s)
cconvert(::Type{Ptr{Int8}}, s::CodeUnits{UInt8}) = cconvert(Ptr{Int8}, s.s)

similar(::Type{<:CodeUnits{T}}, dims::Dims) where {T} = similar(Array{T}, dims)

"""
codeunits(s::AbstractString)

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cf55027baeae7811676fbfde35bb1b02
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5169f15d3e280632dd96206442622bcae49be6f28896a348ab774f62387640c10ce97d782e937dd6386a6d68592d07b238f4ef4c5e87047b5ae5f370a5aa065f
4 changes: 3 additions & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static int8_t jl_cachearg_offset(jl_methtable_t *mt)

static uint_t speccache_hash(size_t idx, jl_value_t *data)
{
jl_method_instance_t *ml = (jl_method_instance_t*)jl_svecref(data, idx);
jl_method_instance_t *ml = (jl_method_instance_t*)jl_svecref(data, idx); // This must always happen inside the lock
jl_value_t *sig = ml->specTypes;
if (jl_is_unionall(sig))
sig = jl_unwrap_unionall(sig);
Expand All @@ -122,6 +122,8 @@ static uint_t speccache_hash(size_t idx, jl_value_t *data)

static int speccache_eq(size_t idx, const void *ty, jl_value_t *data, uint_t hv)
{
if (idx >= jl_svec_len(data))
return 0; // We got a OOB access, probably due to a data race
jl_method_instance_t *ml = (jl_method_instance_t*)jl_svecref(data, idx);
jl_value_t *sig = ml->specTypes;
if (ty == sig)
Expand Down
2 changes: 1 addition & 1 deletion src/julia_atomics.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ T jl_atomic_exchange_explicit(std::atomic<T> *ptr, S desired, std::memory_order
{
return std::atomic_exchange_explicit<T>(ptr, desired, order);
}
#define jl_atomic_exchange_release(ptr, val) jl_atomic_exchange_explicit(ptr, val, memory_order_reease)
#define jl_atomic_exchange_release(ptr, val) jl_atomic_exchange_explicit(ptr, val, memory_order_release)
#define jl_atomic_exchange_relaxed(ptr, val) jl_atomic_exchange_explicit(ptr, val, memory_order_relaxed)
extern "C" {
#else
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ void RecursivelyVisit(callback f, Value *V) {
if (isa<CallInst>(TheUser) || isa<LoadInst>(TheUser) ||
isa<SelectInst>(TheUser) || isa<PHINode>(TheUser) || // TODO: should these be removed from this list?
isa<StoreInst>(TheUser) || isa<PtrToIntInst>(TheUser) ||
isa<ICmpInst>(TheUser) || // ICmpEQ/ICmpNE can be used with ptr types
isa<ICmpInst>(TheUser) || isa<InsertElementInst>(TheUser)|| // ICmpEQ/ICmpNE can be used with ptr types
isa<AtomicCmpXchgInst>(TheUser) || isa<AtomicRMWInst>(TheUser))
continue;
if (isa<GetElementPtrInst>(TheUser) || isa<BitCastInst>(TheUser) || isa<AddrSpaceCastInst>(TheUser)) {
Expand Down
4 changes: 2 additions & 2 deletions stdlib/Distributed.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DISTRIBUTED_BRANCH = master
DISTRIBUTED_SHA1 = 6c7cdb5860fa5cb9ca191ce9c52a3d25a9ab3781
DISTRIBUTED_BRANCH = release-julia-1.11
DISTRIBUTED_SHA1 = e9b902372d509cfc11d3c85344acbb9c9e4fa5fe
DISTRIBUTED_GIT_URL := https://github.com/JuliaLang/Distributed.jl
DISTRIBUTED_TAR_URL = https://api.github.com/repos/JuliaLang/Distributed.jl/tarball/$1
8 changes: 4 additions & 4 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ like HDF5 (which can be used with memory-mapping).
"""
function mmap(io::IO,
::Type{Array{T,N}}=Vector{UInt8},
dims::NTuple{N,Integer}=(div(filesize(io)-position(io),sizeof(T)),),
dims::NTuple{N,Integer}=(div(filesize(io)-position(io),Base.aligned_sizeof(T)),),
offset::Integer=position(io); grow::Bool=true, shared::Bool=true) where {T,N}
# check inputs
isopen(io) || throw(ArgumentError("$io must be open to mmap"))
isbitstype(T) || throw(ArgumentError("unable to mmap $T; must satisfy isbitstype(T) == true"))

len = sizeof(T)
len = Base.aligned_sizeof(T)
for l in dims
len, overflow = Base.Checked.mul_with_overflow(promote(len, l)...)
overflow && throw(ArgumentError("requested size prod($((sizeof(T), dims...))) too large, would overflow typeof(size(T)) == $(typeof(len))"))
overflow && throw(ArgumentError("requested size prod($((len, dims...))) too large, would overflow typeof(size(T)) == $(typeof(len))"))
end
len >= 0 || throw(ArgumentError("requested size must be ≥ 0, got $len"))
len == 0 && return Array{T}(undef, ntuple(x->0,Val(N)))
Expand Down Expand Up @@ -272,7 +272,7 @@ end

mmap(file::AbstractString,
::Type{T}=Vector{UInt8},
dims::NTuple{N,Integer}=(div(filesize(file),sizeof(eltype(T))),),
dims::NTuple{N,Integer}=(div(filesize(file),Base.aligned_sizeof(eltype(T))),),
offset::Integer=Int64(0); grow::Bool=true, shared::Bool=true) where {T<:Array,N} =
open(io->mmap(io, T, dims, offset; grow=grow, shared=shared), file, isfile(file) ? "r" : "w+")::Array{eltype(T),N}

Expand Down
15 changes: 14 additions & 1 deletion stdlib/Mmap/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ s = open(file)
@test length(@inferred mmap(s, Vector{Int8}, 12, 0; grow=false)) == 12
@test length(@inferred mmap(s, Vector{Int8}, 12, 0; shared=false)) == 12
close(s)
@test_throws ErrorException mmap(file, Vector{Ref}) # must be bit-type
@test_throws ArgumentError mmap(file, Vector{Ref}) # must be bit-type
GC.gc(); GC.gc()

s = open(f->f,file,"w")
Expand Down Expand Up @@ -341,6 +341,19 @@ end
GC.gc()
rm(file)

# test for #58982 - mmap with primitive types
file = tempname()
primitive type PrimType9Bytes 9*8 end
arr = Vector{PrimType9Bytes}(undef, 2)
write(file, arr)
m = mmap(file, Vector{PrimType9Bytes})
@test length(m) == 2
@test m[1] == arr[1]
@test m[2] == arr[2]
finalize(m); m = nothing; GC.gc()
rm(file)


@testset "Docstrings" begin
@test isempty(Docs.undocumented_names(Mmap))
end
20 changes: 20 additions & 0 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,26 @@ generic_map_tests(map, map!)
# @test_throws BoundsError map!(+, ones(3), ones(2, 2), ones(2, 2))
end

@testset "#30624" begin
### unstructured
@test map!(+, ones(3), ones(3), ones(3), [1]) == [3, 1, 1]
@test map!(+, ones(3), [1], ones(3), ones(3)) == [3, 1, 1]
@test map!(+, [1], [1], [], []) == [1]
@test map!(+, [[1]], [1], [], []) == [[1]]

# TODO: decide if input axes & lengths should be validated
# @test_throws BoundsError map!(+, ones(1), ones(2))
# @test_throws BoundsError map!(+, ones(1), ones(2, 2))

@test map!(+, ones(3), view(ones(2, 3), 1:2, 2:3), ones(3)) == [2, 2, 2]
@test map!(+, ones(3), ones(2, 2), ones(3)) == [2, 2, 2]

### structured (all mapped arguments are <:AbstractArray equal ndims > 1)
@test map!(+, ones(4), ones(2, 2), ones(2, 2)) == [2, 2, 2, 2]
@test map!(+, ones(4), ones(2, 2), ones(1, 2)) == [2, 2, 1, 1]
# @test_throws BoundsError map!(+, ones(3), ones(2, 2), ones(2, 2))
end

test_UInt_indexing(TestAbstractArray)
test_13315(TestAbstractArray)
test_checksquare()
Expand Down
5 changes: 4 additions & 1 deletion test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,10 @@ precompile_test_harness(false) do dir
error("the \"break me\" test failed")
catch exc
isa(exc, ErrorException) || rethrow()
occursin("ERROR: LoadError: break me", exc.msg) && rethrow()
# The LoadError shouldn't be surfaced but is printed to stderr, hence the `@test_warn` capture tests
occursin("LoadError: break me", exc.msg) && rethrow()
# The actual error that is thrown
occursin("Failed to precompile FooBar2", exc.msg) || rethrow()
end

# Test that trying to eval into closed modules during precompilation is an error
Expand Down
23 changes: 23 additions & 0 deletions test/reinterpretarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,23 @@ test_many_wrappers(fill(1.0, 5, 3), (identity, wrapper)) do a_
@test r[goodinds...] == -5
end
end

let a = rand(ComplexF32, 5)
r = reinterpret(reshape, Float32, a)
ref = Array(r)

@test r[1, :, 1] == ref[1, :]
@test r[1, :, 1, 1, 1] == ref[1, :]
@test r[1, :, UInt8(1)] == ref[1, :]

r[2, :, 1] .= 0f0
ref[2, :] .= 0f0
@test r[2, :, 1] == ref[2, :]

@test r[4] == ref[4]
@test_throws BoundsError r[1, :, 2]
end

let ar = [(1,2), (3,4)]
arr = reinterpret(reshape, Int, ar)
@test @inferred(IndexStyle(arr)) == Base.IndexSCartesian2{2}()
Expand Down Expand Up @@ -607,3 +624,9 @@ let R = reinterpret(reshape, Float32, ComplexF32[1.0f0+2.0f0*im, 4.0f0+3.0f0*im]
@test !isassigned(R, 5)
@test Array(R)::Matrix{Float32} == [1.0f0 4.0f0; 2.0f0 3.0f0]
end

@testset "issue #54623" begin
x = 0xabcdef01234567
@test reinterpret(reshape, UInt8, fill(x)) == [0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab, 0x00]
@test reinterpret(reshape, UInt8, [x]) == [0x67; 0x45; 0x23; 0x01; 0xef; 0xcd; 0xab; 0x00;;]
end
1 change: 1 addition & 0 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ let s = "∀x∃y", u = codeunits(s)
@test_throws Base.CanonicalIndexError (u[1] = 0x00)
@test collect(u) == b"∀x∃y"
@test Base.elsize(u) == Base.elsize(typeof(u)) == 1
@test similar(typeof(u), 3) isa Vector{UInt8}
end

# issue #24388
Expand Down