Skip to content

Commit

Permalink
Merge branch 'master' into remove-sort-allblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner authored Oct 4, 2022
2 parents b6aefba + c609e9a commit 9eea1b8
Show file tree
Hide file tree
Showing 322 changed files with 6,443 additions and 3,166 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/statuses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- run: |
declare -a CONTEXT_LIST=(
"buildbot/tester_freebsd64"
"buildbot/tester_win32"
"buildbot/tester_win64"
)
for CONTEXT in "${CONTEXT_LIST[@]}"
do
Expand Down
15 changes: 9 additions & 6 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ USE_SYSTEM_PATCHELF:=0
USE_SYSTEM_LIBWHICH:=0
USE_SYSTEM_ZLIB:=0
USE_SYSTEM_P7ZIP:=0
USE_SYSTEM_LLD:=0

# Link to the LLVM shared library
USE_LLVM_SHLIB := 1
Expand Down Expand Up @@ -347,6 +348,7 @@ BUILD_LLVM_CLANG := 0
# see http://lldb.llvm.org/build.html for dependencies
BUILD_LLDB := 0
BUILD_LIBCXX := 0
BUILD_LLD := 1

# Options to enable Polly and its code-generation options
USE_POLLY := 0
Expand Down Expand Up @@ -705,7 +707,7 @@ JLDFLAGS += $(SANITIZE_LDFLAGS)
endif # SANITIZE

TAR := $(shell which gtar 2>/dev/null || which tar 2>/dev/null)
TAR_TEST := $(shell $(TAR) --help 2>&1 | egrep 'bsdtar|strip-components')
TAR_TEST := $(shell $(TAR) --help 2>&1 | grep -E 'bsdtar|strip-components')
ifeq (,$(findstring components,$(TAR_TEST)))
ifneq (bsdtar,$(findstring bsdtar,$(TAR_TEST)))
$(error "please install either GNU tar or bsdtar")
Expand Down Expand Up @@ -772,6 +774,8 @@ else ifeq (cygwin, $(shell $(CC) -dumpmachine | cut -d\- -f3))
$(error "cannot build julia with cygwin-target compilers. set XC_HOST to i686-w64-mingw32 or x86_64-w64-mingw32 for mingw cross-compile")
else ifeq (msys, $(shell $(CC) -dumpmachine | cut -d\- -f3))
$(error "cannot build julia with msys-target compilers. please see the README.windows document for instructions on setting up mingw-w64 compilers")
else ifneq (,$(findstring MSYS,$(shell uname)))
$(error "cannot build julia from a msys shell. please launch a mingw shell instead by setting MSYSTEM=MINGW64")
endif

ifeq ($(BUILD_OS),Darwin)
Expand Down Expand Up @@ -1149,7 +1153,7 @@ LIBGFORTRAN_VERSION := $(subst libgfortran,,$(filter libgfortran%,$(subst -,$(SP
# Note: we explicitly _do not_ define `CSL` here, since it requires some more
# advanced techniques to decide whether it should be installed from a BB source
# or not. See `deps/csl.mk` for more detail.
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD
define SET_BB_DEFAULT
# First, check to see if BB is disabled on a global setting
ifeq ($$(USE_BINARYBUILDER),0)
Expand Down Expand Up @@ -1371,7 +1375,6 @@ CLANGSA_FLAGS :=
CLANGSA_CXXFLAGS :=
ifeq ($(OS), Darwin) # on new XCode, the files are hidden
CLANGSA_FLAGS += -isysroot $(shell xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
CLANGSA_CXXFLAGS += -isystem $(shell xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
endif
ifeq ($(USEGCC),1)
# try to help clang find the c++ files for CC by guessing the value for --prefix
Expand All @@ -1397,13 +1400,13 @@ define symlink_target # (from, to-dir, to-name)
CLEAN_TARGETS += clean-$$(abspath $(2)/$(3))
clean-$$(abspath $(2)/$(3)):
ifeq ($(BUILD_OS), WINNT)
-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&)
-cmd //C rmdir $$(call cygpath_w,$(2)/$(3))
else
rm -rf $$(abspath $(2)/$(3))
endif
$$(abspath $(2)/$(3)): | $$(abspath $(2))
ifeq ($$(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&) $$(call mingw_to_dos,$(1),)
@cmd //C mklink //J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifneq (,$$(findstring CYGWIN,$$(BUILD_OS)))
@cmd /C mklink /J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifdef JULIA_VAGRANT_BUILD
Expand All @@ -1421,7 +1424,7 @@ WINE ?= wine
# many of the following targets must be = not := because the expansion of the makefile functions (and $1) shouldn't happen until later
ifeq ($(BUILD_OS), WINNT) # MSYS
spawn = $(1)
cygpath_w = $(1)
cygpath_w = `cygpath -w $(1)`
else ifneq (,$(findstring CYGWIN,$(BUILD_OS))) # Cygwin
spawn = $(1)
cygpath_w = `cygpath -w $(1)`
Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ endif
endif
endif

# Note that we disable MSYS2's path munging here, as otherwise
# it replaces our `:`-separated list as a `;`-separated one.
define stringreplace
$(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
MSYS2_ARG_CONV_EXCL='*' $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
endef


Expand Down Expand Up @@ -304,6 +306,9 @@ endif
# Install `7z` into libexec/
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(libexecdir)/

# Install `lld` into libexec/
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(libexecdir)/

# Copy public headers
cp -R -L $(build_includedir)/julia/* $(DESTDIR)$(includedir)/julia
# Copy system image
Expand Down Expand Up @@ -428,6 +433,12 @@ ifneq ($(OPENBLAS_DYNAMIC_ARCH),1)
endif
endif
endif

ifeq ($(USE_BINARYBUILDER_OPENBLAS),0)
# https://github.com/JuliaLang/julia/issues/46579
USE_BINARYBUILDER_OBJCONV=0
endif

ifneq ($(prefix),$(abspath julia-$(JULIA_COMMIT)))
$(error prefix must not be set for make binary-dist)
endif
Expand All @@ -451,8 +462,9 @@ endif


exe:
# run Inno Setup to compile installer
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
# run Inno Setup to compile installer.
# Note that we disable MSYS2 path munging, as it interferes with the `/` options:
MSYS2_ARG_CONV_EXCL='*' $(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"

app:
Expand Down Expand Up @@ -577,7 +589,7 @@ win-extras:
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
chmod a+x is.exe && \
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
MSYS2_ARG_CONV_EXCL='*' $(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)

# various statistics about the build that may interest the user
ifeq ($(USE_SYSTEM_LLVM), 1)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Library changes
* `eachslice` now works over multiple dimensions; `eachslice`, `eachrow` and `eachcol` return
a `Slices` object, which allows dispatching to provide more efficient methods ([#32310]).
* `@kwdef` is now exported and added to the public API ([#46273])
* An issue with order of operations in `fld1` is now fixed ([#28973]).

Standard library changes
------------------------
Expand Down Expand Up @@ -129,6 +130,9 @@ Standard library changes
via the `REPL.activate(::Module)` function or via typing the module in the REPL and pressing
the keybinding Alt-m ([#33872]).

* An "IPython mode" which mimics the behaviour of the prompts and storing the evaluated result in `Out` can be
activated with `REPL.ipython_mode!()`. See the manual for how to enable this at startup.

#### SparseArrays

#### Test
Expand Down
13 changes: 9 additions & 4 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if false
end

"""
time_ns()
time_ns() -> UInt64
Get the time in nanoseconds. The time corresponding to 0 is undefined, and wraps every 5.8 years.
"""
Expand All @@ -107,9 +107,6 @@ include("options.jl")
include("promotion.jl")
include("tuple.jl")
include("expr.jl")
Pair{A, B}(@nospecialize(a), @nospecialize(b)) where {A, B} = (@inline; Pair{A, B}(convert(A, a)::A, convert(B, b)::B))
#Pair{Any, B}(@nospecialize(a::Any), b) where {B} = (@inline; Pair{Any, B}(a, Base.convert(B, b)::B))
#Pair{A, Any}(a, @nospecialize(b::Any)) where {A} = (@inline; Pair{A, Any}(Base.convert(A, a)::A, b))
include("pair.jl")
include("traits.jl")
include("range.jl")
Expand All @@ -125,6 +122,13 @@ include("pointer.jl")
include("refvalue.jl")
include("refpointer.jl")

# now replace the Pair constructor (relevant for NamedTuples) with one that calls our Base.convert
delete_method(which(Pair{Any,Any}, (Any, Any)))
@eval function (P::Type{Pair{A, B}})(@nospecialize(a), @nospecialize(b)) where {A, B}
@inline
return $(Expr(:new, :P, :(convert(A, a)), :(convert(B, b))))
end

# The REPL stdlib hooks into Base using this Ref
const REPL_MODULE_REF = Ref{Module}()

Expand Down Expand Up @@ -429,6 +433,7 @@ end
for m in methods(include)
delete_method(m)
end

# These functions are duplicated in client.jl/include(::String) for
# nicer stacktraces. Modifications here have to be backported there
include(mod::Module, _path::AbstractString) = _include(identity, mod, _path)
Expand Down
2 changes: 1 addition & 1 deletion base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract type Enum{T<:Integer} end
basetype(::Type{<:Enum{T}}) where {T<:Integer} = T

(::Type{T})(x::Enum{T2}) where {T<:Integer,T2<:Integer} = T(bitcast(T2, x))::T
Base.cconvert(::Type{T}, x::Enum{T2}) where {T<:Integer,T2<:Integer} = T(x)
Base.cconvert(::Type{T}, x::Enum{T2}) where {T<:Integer,T2<:Integer} = T(x)::T
Base.write(io::IO, x::Enum{T}) where {T<:Integer} = write(io, T(x))
Base.read(io::IO, ::Type{T}) where {T<:Enum} = T(read(io, basetype(T)))

Expand Down
12 changes: 12 additions & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ $(build_bindir)/7z$(EXE):
rm -f "$@" && \
ln -svf "$(7Z_PATH)" "$@"

symlink_lld: $(build_bindir)/lld$(EXE)

ifneq ($(USE_SYSTEM_LLD),0)
SYMLINK_SYSTEM_LIBRARIES += symlink_lld
LLD_PATH := $(shell which lld$(EXE))
endif

$(build_bindir)/lld$(EXE):
[ -e "$(LLD_PATH)" ] && \
rm -f "$@" && \
ln -svf "$(LLD_PATH)" "$@"

# the following excludes: libuv.a, libutf8proc.a

ifneq ($(USE_SYSTEM_LIBM),0)
Expand Down
14 changes: 8 additions & 6 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ See also: [`AbstractVector`](@ref), [`AbstractMatrix`](@ref), [`eltype`](@ref),
AbstractArray

convert(::Type{T}, a::T) where {T<:AbstractArray} = a
convert(::Type{AbstractArray{T}}, a::AbstractArray) where {T} = AbstractArray{T}(a)
convert(::Type{AbstractArray{T,N}}, a::AbstractArray{<:Any,N}) where {T,N} = AbstractArray{T,N}(a)
convert(::Type{AbstractArray{T}}, a::AbstractArray) where {T} = AbstractArray{T}(a)::AbstractArray{T}
convert(::Type{AbstractArray{T,N}}, a::AbstractArray{<:Any,N}) where {T,N} = AbstractArray{T,N}(a)::AbstractArray{T,N}

"""
size(A::AbstractArray, [dim])
Expand Down Expand Up @@ -1282,7 +1282,7 @@ function unsafe_getindex(A::AbstractArray, I...)
r
end

struct CanonicalIndexError
struct CanonicalIndexError <: Exception
func::String
type::Any
CanonicalIndexError(func::String, @nospecialize(type)) = new(func, type)
Expand Down Expand Up @@ -2244,7 +2244,8 @@ _typed_hvncat(::Type, ::Val{0}, ::AbstractArray...) = _typed_hvncat_0d_only_one(
_typed_hvncat_0d_only_one() =
throw(ArgumentError("a 0-dimensional array may only contain exactly one element"))

_typed_hvncat(T::Type, dim::Int, ::Bool, xs...) = _typed_hvncat(T, Val(dim), xs...) # catches from _hvncat type promoters
# `@constprop :aggressive` here to form constant `Val(dim)` type to get type stability
@constprop :aggressive _typed_hvncat(T::Type, dim::Int, ::Bool, xs...) = _typed_hvncat(T, Val(dim), xs...) # catches from _hvncat type promoters

function _typed_hvncat(::Type{T}, ::Val{N}) where {T, N}
N < 0 &&
Expand Down Expand Up @@ -3473,8 +3474,9 @@ function circshift!(a::AbstractVector, shift::Integer)
n == 0 && return
shift = mod(shift, n)
shift == 0 && return
reverse!(a, 1, shift)
reverse!(a, shift+1, length(a))
l = lastindex(a)
reverse!(a, firstindex(a), l-shift)
reverse!(a, l-shift+1, lastindex(a))
reverse!(a)
return a
end
2 changes: 1 addition & 1 deletion base/abstractdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ push!(t::AbstractDict, p::Pair, q::Pair, r::Pair...) = push!(push!(push!(t, p),
convert(::Type{T}, x::T) where {T<:AbstractDict} = x

function convert(::Type{T}, x::AbstractDict) where T<:AbstractDict
h = T(x)
h = T(x)::T
if length(h) != length(x)
error("key collision during dictionary conversion")
end
Expand Down
10 changes: 3 additions & 7 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ end
Construct the symmetric difference of elements in the passed in sets.
When `s` is not an `AbstractSet`, the order is maintained.
Note that in this case the multiplicity of elements matters.
See also [`symdiff!`](@ref), [`setdiff`](@ref), [`union`](@ref) and [`intersect`](@ref).
Expand All @@ -261,11 +260,6 @@ julia> symdiff([1,2,3], [3,4,5], [4,5,6])
6
julia> symdiff([1,2,1], [2, 1, 2])
2-element Vector{Int64}:
1
2
julia> symdiff(unique([1,2,1]), unique([2, 1, 2]))
Int64[]
```
"""
Expand All @@ -286,7 +280,9 @@ function symdiff!(s::AbstractSet, itrs...)
return s
end

function symdiff!(s::AbstractSet, itr)
symdiff!(s::AbstractSet, itr) = symdiff!(s::AbstractSet, Set(itr))

function symdiff!(s::AbstractSet, itr::AbstractSet)
for x in itr
x in s ? delete!(s, x) : push!(s, x)
end
Expand Down
4 changes: 2 additions & 2 deletions base/accumulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function accumulate(op, A; dims::Union{Nothing,Integer}=nothing, kw...)
elseif keys(nt) === (:init,)
out = similar(A, promote_op(op, typeof(nt.init), eltype(A)))
else
throw(ArgumentError("acccumulate does not support the keyword arguments $(setdiff(keys(nt), (:init,)))"))
throw(ArgumentError("accumulate does not support the keyword arguments $(setdiff(keys(nt), (:init,)))"))
end
accumulate!(op, out, A; dims=dims, kw...)
end
Expand Down Expand Up @@ -341,7 +341,7 @@ function accumulate!(op, B, A; dims::Union{Integer, Nothing} = nothing, kw...)
elseif keys(kw) === (:init,)
_accumulate!(op, B, A, dims, Some(nt.init))
else
throw(ArgumentError("acccumulate! does not support the keyword arguments $(setdiff(keys(nt), (:init,)))"))
throw(ArgumentError("accumulate! does not support the keyword arguments $(setdiff(keys(nt), (:init,)))"))
end
end

Expand Down
31 changes: 29 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ 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{T}, a::AbstractArray) where {T<:Array} = a isa T ? a : T(a)::T

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 @@ -2325,7 +2325,7 @@ findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p

# Broadcasting is much faster for small testf, and computing
# integer indices from logical index using findall has a negligible cost
findall(testf::Function, A::AbstractArray) = findall(testf.(A))
findall(testf::F, A::AbstractArray) where {F<:Function} = findall(testf.(A))

"""
findall(A)
Expand Down Expand Up @@ -2633,6 +2633,33 @@ function filter!(f, a::AbstractVector)
return a
end

"""
filter(f)
Create a function that filters its arguments with function `f` using [`filter`](@ref), i.e.
a function equivalent to `x -> filter(f, x)`.
The returned function is of type `Base.Fix1{typeof(filter)}`, which can be
used to implement specialized methods.
# Examples
```jldoctest
julia> (1, 2, Inf, 4, NaN, 6) |> filter(isfinite)
(1, 2, 4, 6)
julia> map(filter(iseven), [1:3, 2:4, 3:5])
3-element Vector{Vector{Int64}}:
[2]
[2, 4]
[4]
```
!!! compat "Julia 1.8"
This method requires at least Julia 1.8.
"""
function filter(f)
Fix1(filter, f)
end

"""
keepat!(a::Vector, inds)
keepat!(a::BitVector, inds)
Expand Down
Loading

0 comments on commit 9eea1b8

Please sign in to comment.