Skip to content

Commit

Permalink
Merge branch 'master' into pv/fastsysimg
Browse files Browse the repository at this point in the history
  • Loading branch information
petvana authored Aug 6, 2022
2 parents d5ffdd4 + 72473ae commit e1f12fd
Show file tree
Hide file tree
Showing 181 changed files with 4,707 additions and 1,845 deletions.
9 changes: 8 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ Standard library changes

#### InteractiveUtils

* New macro `@time_imports` for reporting any time spent importing packages and their dependencies ([#41612]).
* New macro `@time_imports` for reporting any time spent importing packages and their dependencies, highlighting
compilation and recompilation time as percentages per import ([#41612],[#45064]).

#### LinearAlgebra

Expand Down Expand Up @@ -200,6 +201,11 @@ Standard library changes
definitions, including to other function calls, while recording all intermediate test results ([#42518]).
* `TestLogger` and `LogRecord` are now exported from the Test stdlib ([#44080]).

#### Distributed

* SSHManager now supports workers with csh/tcsh login shell, via `addprocs()` option `shell=:csh` ([#41485]).


Deprecated or removed
---------------------

Expand Down Expand Up @@ -231,6 +237,7 @@ Tooling Improvements
[#41312]: https://github.com/JuliaLang/julia/issues/41312
[#41328]: https://github.com/JuliaLang/julia/issues/41328
[#41449]: https://github.com/JuliaLang/julia/issues/41449
[#41485]: https://github.com/JuliaLang/julia/issues/41485
[#41551]: https://github.com/JuliaLang/julia/issues/41551
[#41576]: https://github.com/JuliaLang/julia/issues/41576
[#41612]: https://github.com/JuliaLang/julia/issues/41612
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ configure-y: | $(BUILDDIRMAKE)
configure:
ifeq ("$(origin O)", "command line")
@if [ "$$(ls '$(BUILDROOT)' 2> /dev/null)" ]; then \
echo 'WARNING: configure called on non-empty directory $(BUILDROOT)'; \
printf $(WARNCOLOR)'WARNING: configure called on non-empty directory'$(ENDCOLOR)' %s\n' '$(BUILDROOT)'; \
read -p "Proceed [y/n]? " answer; \
else \
answer=y;\
fi; \
[ $$answer = 'y' ] && $(MAKE) configure-$$answer
[ "y$$answer" = yy ] && $(MAKE) configure-$$answer
else
$(error "cannot rerun configure from within a build directory")
endif
Expand Down Expand Up @@ -108,7 +108,7 @@ check-whitespace:
ifneq ($(NO_GIT), 1)
@# Append the directory containing the julia we just built to the end of `PATH`,
@# to give us the best chance of being able to run this check.
@PATH=$(PATH):$(dirname $(JULIA_EXECUTABLE)) $(JULIAHOME)/contrib/check-whitespace.jl
@PATH="$(PATH):$(dir $(JULIA_EXECUTABLE))" $(JULIAHOME)/contrib/check-whitespace.jl
else
$(warn "Skipping whitespace check because git is unavailable")
endif
Expand Down
7 changes: 1 addition & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ Language changes
* New builtins `getglobal(::Module, ::Symbol[, order])` and `setglobal!(::Module, ::Symbol, x[, order])`
for reading from and writing to globals. `getglobal` should now be preferred for accessing globals over
`getfield`. ([#44137])
* A few basic operators have been generalized to more naturally support vector space structures:
unary minus falls back to scalar multiplication with -1, `-(x) = Int8(-1)*x`,
binary minus falls back to addition `-(x, y) = x + (-y)`, and, at the most generic level,
left- and right-division fall back to multiplication with the inverse from left and right,
respectively, as stated in the docstring. ([#44564])
* The `@invoke` macro introduced in 1.7 is now exported. Additionally, it now uses `Core.Typeof(x)`
rather than `Any` when a type annotation is omitted for an argument `x` so that types passed
as arguments are handled correctly. ([#45807])
* The `invokelatest` function and `@invokelatest` macro introduced in 1.7 are now exported. ([#45831])

Compiler/Runtime improvements
-----------------------------
Expand Down Expand Up @@ -84,7 +80,6 @@ Library changes
* `RoundFromZero` now works for non-`BigFloat` types ([#41246]).
* `Dict` can be now shrunk manually by `sizehint!` ([#45004]).
* `@time` now separates out % time spent recompiling invalidated methods ([#45015]).
* `@time_imports` now shows any compilation and recompilation time percentages per import ([#45064]).
* `eachslice` now works over multiple dimensions; `eachslice`, `eachrow` and `eachcol` return
a `Slices` object, which allows dispatching to provide more efficient methods ([#32310]).

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ are included in the [build documentation](https://github.com/JuliaLang/julia/blo

### Uninstalling Julia

Julia does not install anything outside the directory it was cloned
into. Julia can be completely uninstalled by deleting this
directory. Julia packages are installed in `~/.julia` by default, and
can be uninstalled by deleting `~/.julia`.
By default, Julia does not install anything outside the directory it was cloned
into and `~/.julia`. Julia and the vast majority of Julia packages can be
completely uninstalled by deleting these two directories.

## Source Code Organization

Expand Down
34 changes: 19 additions & 15 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -891,13 +891,12 @@ See also [`copyto!`](@ref).
is available from the `Future` standard library as `Future.copy!`.
"""
function copy!(dst::AbstractVector, src::AbstractVector)
firstindex(dst) == firstindex(src) || throw(ArgumentError(
"vectors must have the same offset for copy! (consider using `copyto!`)"))
if length(dst) != length(src)
resize!(dst, length(src))
end
for i in eachindex(dst, src)
@inbounds dst[i] = src[i]
end
dst
copyto!(dst, src)
end

function copy!(dst::AbstractArray, src::AbstractArray)
Expand Down Expand Up @@ -1035,6 +1034,10 @@ julia> y
"""
function copyto!(dest::AbstractArray, src::AbstractArray)
isempty(src) && return dest
if dest isa BitArray
# avoid ambiguities with other copyto!(::AbstractArray, ::SourceArray) methods
return _copyto_bitarray!(dest, src)
end
src′ = unalias(dest, src)
copyto_unaliased!(IndexStyle(dest), dest, IndexStyle(src′), src′)
end
Expand Down Expand Up @@ -1104,8 +1107,9 @@ function copyto!(dest::AbstractArray, dstart::Integer,
destinds, srcinds = LinearIndices(dest), LinearIndices(src)
(checkbounds(Bool, destinds, dstart) && checkbounds(Bool, destinds, dstart+n-1)) || throw(BoundsError(dest, dstart:dstart+n-1))
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
@inbounds for i = 0:(n-1)
dest[dstart+i] = src[sstart+i]
src′ = unalias(dest, src)
@inbounds for i = 0:n-1
dest[dstart+i] = src′[sstart+i]
end
return dest
end
Expand All @@ -1127,22 +1131,23 @@ function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::A
end
@boundscheck checkbounds(B, ir_dest, jr_dest)
@boundscheck checkbounds(A, ir_src, jr_src)
A′ = unalias(B, A)
jdest = first(jr_dest)
for jsrc in jr_src
idest = first(ir_dest)
for isrc in ir_src
@inbounds B[idest,jdest] = A[isrc,jsrc]
@inbounds B[idest,jdest] = A[isrc,jsrc]
idest += step(ir_dest)
end
jdest += step(jr_dest)
end
return B
end

function copyto_axcheck!(dest, src)
@noinline checkaxs(axd, axs) = axd == axs || throw(DimensionMismatch("axes must agree, got $axd and $axs"))
@noinline _checkaxs(axd, axs) = axd == axs || throw(DimensionMismatch("axes must agree, got $axd and $axs"))

checkaxs(axes(dest), axes(src))
function copyto_axcheck!(dest, src)
_checkaxs(axes(dest), axes(src))
copyto!(dest, src)
end

Expand Down Expand Up @@ -2183,14 +2188,13 @@ julia> hvncat(((3, 3), (3, 3), (6,)), true, a, b, c, d, e, f)
4 5 6
```
# Examples for construction of the arguments:
```julia
# Examples for construction of the arguments
```
[a b c ; d e f ;;;
g h i ; j k l ;;;
m n o ; p q r ;;;
s t u ; v w x]
=> dims = (2, 3, 4)
dims = (2, 3, 4)
[a b ; c ;;; d ;;;;]
___ _ _
Expand All @@ -2201,7 +2205,7 @@ julia> hvncat(((3, 3), (3, 3), (6,)), true, a, b, c, d, e, f)
4 = elements in each 3d slice (4,)
_____________
4 = elements in each 4d slice (4,)
=> shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `rowfirst` = true
shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `row_first` = true
```
"""
hvncat(dimsshape::Tuple, row_first::Bool, xs...) = _hvncat(dimsshape, row_first, xs...)
Expand Down
10 changes: 4 additions & 6 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,8 @@ end
function _copyto_impl!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
n == 0 && return dest
n > 0 || _throw_argerror()
if soffs < 1 || doffs < 1 || soffs+n-1 > length(src) || doffs+n-1 > length(dest)
throw(BoundsError())
end
@boundscheck checkbounds(dest, doffs:doffs+n-1)
@boundscheck checkbounds(src, soffs:soffs+n-1)
unsafe_copyto!(dest, doffs, src, soffs, n)
return dest
end
Expand Down Expand Up @@ -359,7 +358,7 @@ Create a shallow copy of `x`: the outer structure is copied, but not all interna
For example, copying an array produces a new array with identically-same elements as the
original.
See also [`copy!`](@ref Base.copy!), [`copyto!`](@ref).
See also [`copy!`](@ref Base.copy!), [`copyto!`](@ref), [`deepcopy`](@ref).
"""
copy

Expand Down Expand Up @@ -612,7 +611,6 @@ oneunit(x::AbstractMatrix{T}) where {T} = _one(oneunit(T), x)
## Conversions ##

convert(::Type{T}, a::AbstractArray) where {T<:Array} = a isa T ? a : T(a)
convert(::Type{Union{}}, a::AbstractArray) = throw(MethodError(convert, (Union{}, a)))

promote_rule(a::Type{Array{T,n}}, b::Type{Array{S,n}}) where {T,n,S} = el_same(promote_type(T,S), a, b)

Expand Down Expand Up @@ -1488,7 +1486,7 @@ end
Remove the item at the given `i` and return the modified `a`. Subsequent items
are shifted to fill the resulting gap.
See also: [`delete!`](@ref), [`popat!`](@ref), [`splice!`](@ref).
See also: [`keepat!`](@ref), [`delete!`](@ref), [`popat!`](@ref), [`splice!`](@ref).
# Examples
```jldoctest
Expand Down
58 changes: 31 additions & 27 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,11 @@ function unsafe_copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Arra
return dest
end

copyto!(dest::BitArray, doffs::Integer, src::Array, soffs::Integer, n::Integer) =
copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Array}, soffs::Integer, n::Integer) =
_copyto_int!(dest, Int(doffs), src, Int(soffs), Int(n))
function _copyto_int!(dest::BitArray, doffs::Int, src::Array, soffs::Int, n::Int)
function _copyto_int!(dest::BitArray, doffs::Int, src::Union{BitArray,Array}, soffs::Int, n::Int)
n == 0 && return dest
n < 0 && throw(ArgumentError("Number of elements to copy must be nonnegative."))
soffs < 1 && throw(BoundsError(src, soffs))
doffs < 1 && throw(BoundsError(dest, doffs))
soffs+n-1 > length(src) && throw(BoundsError(src, length(src)+1))
Expand Down Expand Up @@ -501,40 +502,42 @@ function Array{T,N}(B::BitArray{N}) where {T,N}
end

BitArray(A::AbstractArray{<:Any,N}) where {N} = BitArray{N}(A)

function BitArray{N}(A::AbstractArray{T,N}) where N where T
B = BitArray(undef, convert(Dims{N}, size(A)::Dims{N}))
Bc = B.chunks
l = length(B)
_checkaxs(axes(B), axes(A))
_copyto_bitarray!(B, A)
return B::BitArray{N}
end

function _copyto_bitarray!(B::BitArray, A::AbstractArray)
l = length(A)
l == 0 && return B
ind = 1
l > length(B) && throw(BoundsError(B, length(B)+1))
Bc = B.chunks
nc = num_bit_chunks(l)
Ai = first(eachindex(A))
@inbounds begin
for i = 1:length(Bc)-1
for i = 1:nc-1
c = UInt64(0)
for j = 0:63
c |= (UInt64(convert(Bool, A[ind])::Bool) << j)
ind += 1
c |= (UInt64(convert(Bool, A[Ai])::Bool) << j)
Ai = nextind(A, Ai)
end
Bc[i] = c
end
c = UInt64(0)
for j = 0:_mod64(l-1)
c |= (UInt64(convert(Bool, A[ind])::Bool) << j)
ind += 1
tail = _mod64(l - 1) + 1
for j = 0:tail-1
c |= (UInt64(convert(Bool, A[Ai])::Bool) << j)
Ai = nextind(A, Ai)
end
Bc[end] = c
msk = _msk_end(tail)
Bc[nc] = (c & msk) | (Bc[nc] & ~msk)
end
return B
end

function BitArray{N}(A::Array{Bool,N}) where N
B = BitArray(undef, size(A))
Bc = B.chunks
l = length(B)
l == 0 && return B
copy_to_bitarray_chunks!(Bc, 1, A, 1, l)
return B::BitArray{N}
end

reinterpret(::Type{Bool}, B::BitArray, dims::NTuple{N,Int}) where {N} = reinterpret(B, dims)
reinterpret(B::BitArray, dims::NTuple{N,Int}) where {N} = reshape(B, dims)

Expand Down Expand Up @@ -721,24 +724,25 @@ function _unsafe_setindex!(B::BitArray, X::AbstractArray, I::BitArray)
lx = length(X)
last_chunk_len = _mod64(length(B)-1)+1

c = 1
Xi = first(eachindex(X))
lastXi = last(eachindex(X))
for i = 1:lc
@inbounds Imsk = Ic[i]
@inbounds C = Bc[i]
u = UInt64(1)
for j = 1:(i < lc ? 64 : last_chunk_len)
if Imsk & u != 0
lx < c && throw_setindex_mismatch(X, c)
@inbounds x = convert(Bool, X[c])
Xi > lastXi && throw_setindex_mismatch(X, count(I))
@inbounds x = convert(Bool, X[Xi])
C = ifelse(x, C | u, C & ~u)
c += 1
Xi = nextind(X, Xi)
end
u <<= 1
end
@inbounds Bc[i] = C
end
if length(X) != c-1
throw_setindex_mismatch(X, c-1)
if Xi != nextind(X, lastXi)
throw_setindex_mismatch(X, count(I))
end
return B
end
Expand Down
5 changes: 3 additions & 2 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ eval(Core, quote
Const(@nospecialize(v)) = $(Expr(:new, :Const, :v))
# NOTE the main constructor is defined within `Core.Compiler`
_PartialStruct(typ::DataType, fields::Array{Any, 1}) = $(Expr(:new, :PartialStruct, :typ, :fields))
PartialOpaque(@nospecialize(typ), @nospecialize(env), parent::MethodInstance, source::Method) = $(Expr(:new, :PartialOpaque, :typ, :env, :parent, :source))
PartialOpaque(@nospecialize(typ), @nospecialize(env), parent::MethodInstance, source) = $(Expr(:new, :PartialOpaque, :typ, :env, :parent, :source))
InterConditional(slot::Int, @nospecialize(thentype), @nospecialize(elsetype)) = $(Expr(:new, :InterConditional, :slot, :thentype, :elsetype))
MethodMatch(@nospecialize(spec_types), sparams::SimpleVector, method::Method, fully_covers::Bool) = $(Expr(:new, :MethodMatch, :spec_types, :sparams, :method, :fully_covers))
end)
Expand Down Expand Up @@ -462,7 +462,8 @@ macro _foldable_meta()
#=:nothrow=#false,
#=:terminates_globally=#true,
#=:terminates_locally=#false,
#=:notaskstate=#false))
#=:notaskstate=#false,
#=:inaccessiblememonly=#false))
end

const NTuple{N,T} = Tuple{Vararg{T,N}}
Expand Down
Loading

0 comments on commit e1f12fd

Please sign in to comment.