Skip to content

Commit 42e1176

Browse files
authored
Merge pull request #39160 from JuliaLang/backports-release-1.6
Backports 1.6-rc1
2 parents 8240225 + 0e90f6c commit 42e1176

File tree

118 files changed

+4141
-1031
lines changed

Some content is hidden

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

118 files changed

+4141
-1031
lines changed

Make.inc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,6 @@ CXX_DISABLE_ASSERTION := -DJL_NDEBUG
454454
DISABLE_ASSERTIONS := -DNDEBUG -DJL_NDEBUG
455455
endif
456456

457-
ifeq ($(LLVM_ASSERTIONS),0)
458-
CXX_DISABLE_ASSERTION += -DNDEBUG
459-
endif
460-
461457
# Compiler specific stuff
462458

463459
ifeq ($(USEMSVC), 1)
@@ -1043,7 +1039,7 @@ endif # SYSTEM_LLVM
10431039
# Windows builds need a little help finding the LLVM libraries for llvm-config
10441040
LLVM_CONFIG_PATH_FIX :=
10451041
ifeq ($(OS),WINNT)
1046-
LLVM_CONFIG_PATH_FIX := PATH="$(PATH):$(build_bindir)"
1042+
LLVM_CONFIG_PATH_FIX := PATH="$(build_bindir):$(PATH)"
10471043
endif
10481044

10491045
ifeq ($(BUILD_OS),$(OS))
@@ -1200,12 +1196,6 @@ endef
12001196
$(foreach proj,$(BB_PROJECTS),$(eval $(call SET_BB_DEFAULT,$(proj))))
12011197

12021198

1203-
1204-
# Use the Assertions build
1205-
BINARYBUILDER_LLVM_ASSERTS ?= 0
1206-
1207-
1208-
12091199
# OS specific stuff
12101200

12111201
# install_name_tool

base/Base.jl

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -394,37 +394,36 @@ in_sysimage(pkgid::PkgId) = pkgid in _sysimage_modules
394394
# Precompiles for Revise
395395
# TODO: move these to contrib/generate_precompile.jl
396396
# The problem is they don't work there
397-
let m = which(+, (Int, Int))
398-
while true # defeat interpreter heuristic to force compilation
399-
delete!(push!(Set{Method}(), m), m)
400-
copy(Core.Compiler.retrieve_code_info(Core.Compiler.specialize_method(m, [Int, Int], Core.svec())))
401-
402-
empty!(Set())
403-
push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))
404-
(setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]
405-
(setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]
406-
(setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]
407-
(setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]
408-
(setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]
409-
Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]
410-
Dict(Base => [:(1+1)])[Base]
411-
Dict(:one => [1])[:one]
412-
Dict("abc" => Set())["abc"]
413-
pushfirst!([], sum)
414-
get(Base.pkgorigins, Base.PkgId(Base), nothing)
415-
sort!([1,2,3])
416-
unique!([1,2,3])
417-
cumsum([1,2,3])
418-
append!(Int[], BitSet())
419-
isempty(BitSet())
420-
delete!(BitSet([1,2]), 3)
421-
deleteat!(Int32[1,2,3], [1,3])
422-
deleteat!(Any[1,2,3], [1,3])
423-
Core.svec(1, 2) == Core.svec(3, 4)
424-
any(t->t[1].line > 1, [(LineNumberNode(2,:none), :(1+1))])
425-
426-
break # end defeat interpreter heuristic
427-
end
397+
for match = _methods(+, (Int, Int), -1, get_world_counter())
398+
m = match.method
399+
delete!(push!(Set{Method}(), m), m)
400+
copy(Core.Compiler.retrieve_code_info(Core.Compiler.specialize_method(match)))
401+
402+
empty!(Set())
403+
push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))
404+
(setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]
405+
(setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]
406+
(setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]
407+
(setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]
408+
(setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]
409+
Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]
410+
Dict(Base => [:(1+1)])[Base]
411+
Dict(:one => [1])[:one]
412+
Dict("abc" => Set())["abc"]
413+
pushfirst!([], sum)
414+
get(Base.pkgorigins, Base.PkgId(Base), nothing)
415+
sort!([1,2,3])
416+
unique!([1,2,3])
417+
cumsum([1,2,3])
418+
append!(Int[], BitSet())
419+
isempty(BitSet())
420+
delete!(BitSet([1,2]), 3)
421+
deleteat!(Int32[1,2,3], [1,3])
422+
deleteat!(Any[1,2,3], [1,3])
423+
Core.svec(1, 2) == Core.svec(3, 4)
424+
any(t->t[1].line > 1, [(LineNumberNode(2,:none), :(1+1))])
425+
426+
break # only actually need to do this once
428427
end
429428

430429
if is_primary_base_module

base/abstractarray.jl

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ function _getindex(::IndexLinear, A::AbstractArray, I::Vararg{Int,M}) where M
11931193
end
11941194
_to_linear_index(A::AbstractArray, i::Integer) = i
11951195
_to_linear_index(A::AbstractVector, i::Integer, I::Integer...) = i
1196-
_to_linear_index(A::AbstractArray) = 1
1196+
_to_linear_index(A::AbstractArray) = first(LinearIndices(A))
11971197
_to_linear_index(A::AbstractArray, I::Integer...) = (@_inline_meta; _sub2ind(A, I...))
11981198

11991199
## IndexCartesian Scalar indexing: Canonical method is full dimensionality of Ints
@@ -1481,7 +1481,7 @@ vcat(V::AbstractVector{T}...) where {T} = typed_vcat(T, V...)
14811481
# but that solution currently fails (see #27188 and #27224)
14821482
AbstractVecOrTuple{T} = Union{AbstractVector{<:T}, Tuple{Vararg{T}}}
14831483

1484-
_typed_vcat_similar(V, T, n) = similar(V[1], T, n)
1484+
_typed_vcat_similar(V, ::Type{T}, n) where T = similar(V[1], T, n)
14851485
_typed_vcat(::Type{T}, V::AbstractVecOrTuple{AbstractVector}) where T =
14861486
_typed_vcat!(_typed_vcat_similar(V, T, mapreduce(length, +, V)), V)
14871487

@@ -1577,9 +1577,10 @@ cat_size(A::AbstractArray, d) = size(A, d)
15771577
cat_indices(A, d) = OneTo(1)
15781578
cat_indices(A::AbstractArray, d) = axes(A, d)
15791579

1580-
cat_similar(A, T, shape) = Array{T}(undef, shape)
1581-
cat_similar(A::AbstractArray, T, shape) = similar(A, T, shape)
1580+
cat_similar(A, ::Type{T}, shape) where T = Array{T}(undef, shape)
1581+
cat_similar(A::AbstractArray, ::Type{T}, shape) where T = similar(A, T, shape)
15821582

1583+
# These are for backwards compatibility (even though internal)
15831584
cat_shape(dims, shape::Tuple{Vararg{Int}}) = shape
15841585
function cat_shape(dims, shapes::Tuple)
15851586
out_shape = ()
@@ -1588,6 +1589,11 @@ function cat_shape(dims, shapes::Tuple)
15881589
end
15891590
return out_shape
15901591
end
1592+
# The new way to compute the shape (more inferrable than combining cat_size & cat_shape, due to Varargs + issue#36454)
1593+
cat_size_shape(dims) = ntuple(zero, Val(length(dims)))
1594+
@inline cat_size_shape(dims, X, tail...) = _cat_size_shape(dims, _cshp(1, dims, (), cat_size(X)), tail...)
1595+
_cat_size_shape(dims, shape) = shape
1596+
@inline _cat_size_shape(dims, shape, X, tail...) = _cat_size_shape(dims, _cshp(1, dims, shape, cat_size(X)), tail...)
15911597

15921598
_cshp(ndim::Int, ::Tuple{}, ::Tuple{}, ::Tuple{}) = ()
15931599
_cshp(ndim::Int, ::Tuple{}, ::Tuple{}, nshape) = nshape
@@ -1631,36 +1637,37 @@ _cat(dims, X...) = cat_t(promote_eltypeof(X...), X...; dims=dims)
16311637
@inline cat_t(::Type{T}, X...; dims) where {T} = _cat_t(dims, T, X...)
16321638
@inline function _cat_t(dims, ::Type{T}, X...) where {T}
16331639
catdims = dims2cat(dims)
1634-
shape = cat_shape(catdims, map(cat_size, X))
1640+
shape = cat_size_shape(catdims, X...)
16351641
A = cat_similar(X[1], T, shape)
16361642
if count(!iszero, catdims)::Int > 1
16371643
fill!(A, zero(T))
16381644
end
16391645
return __cat(A, shape, catdims, X...)
16401646
end
16411647

1642-
function __cat(A, shape::NTuple{M}, catdims, X...) where M
1643-
N = M::Int
1644-
offsets = zeros(Int, N)
1645-
inds = Vector{UnitRange{Int}}(undef, N)
1646-
concat = copyto!(zeros(Bool, N), catdims)
1647-
for x in X
1648-
for i = 1:N
1649-
if concat[i]
1650-
inds[i] = offsets[i] .+ cat_indices(x, i)
1651-
offsets[i] += cat_size(x, i)
1652-
else
1653-
inds[i] = 1:shape[i]
1654-
end
1655-
end
1656-
I::NTuple{N, UnitRange{Int}} = (inds...,)
1657-
if x isa AbstractArray
1658-
A[I...] = x
1659-
else
1660-
fill!(view(A, I...), x)
1661-
end
1648+
# Why isn't this called `__cat!`?
1649+
__cat(A, shape, catdims, X...) = __cat_offset!(A, shape, catdims, ntuple(zero, length(shape)), X...)
1650+
1651+
function __cat_offset!(A, shape, catdims, offsets, x, X...)
1652+
# splitting the "work" on x from X... may reduce latency (fewer costly specializations)
1653+
newoffsets = __cat_offset1!(A, shape, catdims, offsets, x)
1654+
return __cat_offset!(A, shape, catdims, newoffsets, X...)
1655+
end
1656+
__cat_offset!(A, shape, catdims, offsets) = A
1657+
1658+
function __cat_offset1!(A, shape, catdims, offsets, x)
1659+
inds = ntuple(length(offsets)) do i
1660+
(i <= length(catdims) && catdims[i]) ? offsets[i] .+ cat_indices(x, i) : 1:shape[i]
1661+
end
1662+
if x isa AbstractArray
1663+
A[inds...] = x
1664+
else
1665+
fill!(view(A, inds...), x)
1666+
end
1667+
newoffsets = ntuple(length(offsets)) do i
1668+
(i <= length(catdims) && catdims[i]) ? offsets[i] + cat_size(x, i) : offsets[i]
16621669
end
1663-
return A
1670+
return newoffsets
16641671
end
16651672

16661673
"""

base/binaryplatforms.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ only available in macOS `v"10.11"` and later, or an artifact can state that it r
992992
a libstdc++ that is at least `v"3.4.22"`, etc...
993993
"""
994994
function platforms_match(a::AbstractPlatform, b::AbstractPlatform)
995-
for k in union(keys(tags(a)), keys(tags(b)))
995+
for k in union(keys(tags(a)::Dict{String,String}), keys(tags(b)::Dict{String,String}))
996996
ak = get(tags(a), k, nothing)
997997
bk = get(tags(b), k, nothing)
998998

base/bitarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ function bitcount(Bc::Vector{UInt64}; init::T=0) where {T}
13941394
return n
13951395
end
13961396

1397-
count(B::BitArray; init=0) = bitcount(B.chunks; init)
1397+
_count(::typeof(identity), B::BitArray, ::Colon, init) = bitcount(B.chunks; init)
13981398

13991399
function unsafe_bitfindnext(Bc::Vector{UInt64}, start::Int)
14001400
chunk_start = _div64(start-1)+1

base/broadcast.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,10 @@ preprocess_args(dest, args::Tuple{}) = ()
978978
end
979979
end
980980
bc′ = preprocess(dest, bc)
981-
@simd for I in eachindex(bc′)
982-
@inbounds dest[I] = bc′[I]
981+
# Performance may vary depending on whether `@inbounds` is placed outside the
982+
# for loop or not. (cf. https://github.com/JuliaLang/julia/issues/38086)
983+
@inbounds @simd for I in eachindex(bc′)
984+
dest[I] = bc′[I]
983985
end
984986
return dest
985987
end

0 commit comments

Comments
 (0)