Skip to content

Commit dea368c

Browse files
authored
Merge branch 'master' into faster-hashing
2 parents 98c2049 + fe35189 commit dea368c

File tree

515 files changed

+11712
-6913
lines changed

Some content is hidden

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

515 files changed

+11712
-6913
lines changed

HISTORY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Compiler/Runtime improvements
5959
Command-line option changes
6060
---------------------------
6161

62-
* The entry point for Julia has been standardized to `Main.main(ARGS)`. This must be explicitly opted into using the `@main` macro
62+
* The entry point for Julia has been standardized to `Main.main(Base.ARGS)`. This must be explicitly opted into using the `@main` macro
6363
(see the docstring for further details). When opted-in, and julia is invoked to run a script or expression
6464
(i.e. using `julia script.jl` or `julia -e expr`), julia will subsequently run the `Main.main` function automatically.
6565
This is intended to unify script and compilation workflows, where code loading may happen
@@ -68,6 +68,7 @@ difference between defining a `main` function and executing the code directly at
6868
* The `--compiled-modules` and `--pkgimages` flags can now be set to `existing`, which will
6969
cause Julia to consider loading existing cache files, but not to create new ones ([#50586]
7070
and [#52573]).
71+
* The `--project` argument now accepts `@script` to give a path to a directory with a Project.toml relative to the passed script file. `--project=@script/foo` for the `foo` subdirectory. If no path is given after (i.e. `--project=@script`) then (like `--project=@.`) the directory and its parents are searched for a Project.toml ([#50864] and [#53352])
7172

7273
Multi-threading changes
7374
-----------------------
@@ -86,7 +87,6 @@ New library functions
8687
* `copyuntil(out, io, delim)` and `copyline(out, io)` copy data into an `out::IO` stream ([#48273]).
8788
* `eachrsplit(string, pattern)` iterates split substrings right to left.
8889
* `Sys.username()` can be used to return the current user's username ([#51897]).
89-
* `wrap(Array, m::Union{MemoryRef{T}, Memory{T}}, dims)` is the safe counterpart to `unsafe_wrap` ([#52049]).
9090
* `GC.logging_enabled()` can be used to test whether GC logging has been enabled via `GC.enable_logging` ([#51647]).
9191
* `IdSet` is now exported from Base and considered public ([#53262]).
9292

Make.inc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ endif
482482

483483
FC := $(CROSS_COMPILE)gfortran
484484

485-
# Note: Supporting only macOS Yosemite and above
485+
# Note: Supporting only macOS Mojave and above
486486
ifeq ($(OS), Darwin)
487487
APPLE_ARCH := $(shell uname -m)
488488
ifneq ($(APPLE_ARCH),arm64)
@@ -670,7 +670,7 @@ JL_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
670670
endif
671671
endif
672672

673-
ifeq ($(OS), FreeBSD)
673+
ifneq ($(findstring $(OS),FreeBSD OpenBSD),)
674674
LOCALBASE ?= /usr/local
675675
else
676676
LOCALBASE ?= /usr
@@ -726,7 +726,7 @@ SANITIZE_LDFLAGS :=
726726
ifeq ($(SANITIZE_MEMORY),1)
727727
SANITIZE_OPTS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer
728728
SANITIZE_LDFLAGS += $(SANITIZE_OPTS)
729-
ifneq ($(findstring $(OS),Linux FreeBSD),)
729+
ifneq ($(findstring $(OS),Linux FreeBSD OpenBSD),)
730730
SANITIZE_LDFLAGS += -Wl,--warn-unresolved-symbols
731731
endif # OS Linux or FreeBSD
732732
endif # SANITIZE_MEMORY=1
@@ -1069,7 +1069,7 @@ JCFLAGS+=-DSYSTEM_LIBUNWIND
10691069
JCPPFLAGS+=-DSYSTEM_LIBUNWIND
10701070
endif
10711071
else
1072-
ifeq ($(OS),Darwin)
1072+
ifneq ($(findstring $(OS),Darwin OpenBSD),)
10731073
LIBUNWIND:=-lunwind
10741074
JCPPFLAGS+=-DLLVMLIBUNWIND
10751075
else
@@ -1380,6 +1380,19 @@ OSLIBS += -Wl,--export-dynamic -Wl,--version-script=$(BUILDROOT)/src/julia.expma
13801380
$(NO_WHOLE_ARCHIVE)
13811381
endif
13821382

1383+
ifeq ($(OS), OpenBSD)
1384+
JLDFLAGS += -Wl,--Bdynamic
1385+
ifneq ($(SANITIZE),1)
1386+
JLDFLAGS += -Wl,-no-undefined
1387+
endif
1388+
1389+
JLIBLDFLAGS += -Wl,-Bsymbolic-functions
1390+
1391+
OSLIBS += -Wl,--no-as-needed -lpthread -lm -lc++abi -lc
1392+
OSLIBS += -Wl,--whole-archive -lcompiler_rt -Wl,--no-whole-archive
1393+
OSLIBS += -Wl,--export-dynamic,--as-needed,--version-script=$(BUILDROOT)/src/julia.expmap
1394+
endif
1395+
13831396
ifeq ($(OS), Darwin)
13841397
SHLIB_EXT := dylib
13851398
OSLIBS += -framework CoreFoundation
@@ -1393,7 +1406,7 @@ ifeq ($(OS), WINNT)
13931406
HAVE_SSP := 1
13941407
OSLIBS += -Wl,--export-all-symbols -Wl,--version-script=$(BUILDROOT)/src/julia.expmap \
13951408
$(NO_WHOLE_ARCHIVE) -lpsapi -lkernel32 -lws2_32 -liphlpapi -lwinmm -ldbghelp -luserenv -lsecur32 -latomic -lole32
1396-
JLDFLAGS += -Wl,--stack,8388608
1409+
JLDFLAGS += -Wl,--stack,8388608 --disable-auto-import --disable-runtime-pseudo-reloc
13971410
ifeq ($(ARCH),i686)
13981411
JLDFLAGS += -Wl,--large-address-aware
13991412
endif

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ $(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$$(bu
6161
julia_flisp.boot.inc.phony: julia-deps
6262
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony
6363

64+
# Build the HTML docs (skipped if already exists, notably in tarballs)
65+
$(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps -o -name *_constants.jl -o -name *_h.jl -o -name version_git.jl \) -prune -o -type f -print)
66+
@$(MAKE) docs
67+
6468
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
6569
ifeq ($(OS),WINNT)
6670
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
@@ -272,7 +276,7 @@ define stringreplace
272276
endef
273277

274278

275-
install: $(build_depsbindir)/stringreplace docs
279+
install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
276280
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
277281
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
278282
mkdir -p $(DESTDIR)$$subdir; \
@@ -450,7 +454,6 @@ endif
450454
ifeq ($(OS), Linux)
451455
-$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN' $(DESTDIR)$(private_shlibdir)/libLLVM.$(SHLIB_EXT)
452456
endif
453-
454457
ifneq ($(LOADER_BUILD_DEP_LIBS),$(LOADER_INSTALL_DEP_LIBS))
455458
# Next, overwrite relative path to libjulia-internal in our loader if $$(LOADER_BUILD_DEP_LIBS) != $$(LOADER_INSTALL_DEP_LIBS)
456459
ifeq ($(JULIA_BUILD_MODE),release)
@@ -530,7 +533,7 @@ app:
530533
darwinframework:
531534
$(MAKE) -C $(JULIAHOME)/contrib/mac/framework
532535

533-
light-source-dist.tmp: docs
536+
light-source-dist.tmp: $(BUILDROOT)/doc/_build/html/en/index.html
534537
ifneq ($(BUILDROOT),$(JULIAHOME))
535538
$(error make light-source-dist does not work in out-of-tree builds)
536539
endif
@@ -653,7 +656,7 @@ win-extras:
653656
ifeq ($(USE_SYSTEM_LLVM), 1)
654657
LLVM_SIZE := llvm-size$(EXE)
655658
else
656-
LLVM_SIZE := $(build_depsbindir)/llvm-size$(EXE)
659+
LLVM_SIZE := PATH=$(build_bindir):$$PATH; $(build_depsbindir)/llvm-size$(EXE)
657660
endif
658661
build-stats:
659662
ifeq ($(USE_BINARYBUILDER_LLVM),1)

NEWS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ Command-line option changes
3636

3737
* The `-m/--module` flag can be passed to run the `main` function inside a package with a set of arguments.
3838
This `main` function should be declared using `@main` to indicate that it is an entry point.
39+
* Enabling or disabling color text in Julia can now be controlled with the
40+
[`NO_COLOR`](https://no-color.org/) or [`FORCE_COLOR`](https://force-color.org/) environment
41+
variables. ([#53742]).
3942

4043
Multi-threading changes
4144
-----------------------
@@ -77,6 +80,8 @@ New library features
7780
Standard library changes
7881
------------------------
7982

83+
* `gcdx(0, 0)` now returns `(0, 0, 0)` instead of `(0, 1, 0)` ([#40989]).
84+
8085
#### StyledStrings
8186

8287
#### JuliaSyntaxHighlighting
@@ -85,6 +90,11 @@ Standard library changes
8590

8691
#### LinearAlgebra
8792

93+
* `rank` can now take a `QRPivoted` matrix to allow rank estimation via QR factorization ([#54283]).
94+
* Added keyword argument `alg` to `eigen`, `eigen!`, `eigvals` and `eigvals!` for self-adjoint
95+
matrix types (i.e., the type union `RealHermSymComplexHerm`) that allows one to switch
96+
between different eigendecomposition algorithms ([#49355]).
97+
8898
#### Logging
8999

90100
#### Printf

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ and then use the command prompt to change into the resulting julia directory. By
9494
Julia. However, most users should use the [most recent stable version](https://github.com/JuliaLang/julia/releases)
9595
of Julia. You can get this version by running:
9696

97-
git checkout v1.10.0
97+
git checkout v1.10.3
9898

9999
To build the `julia` executable, run `make` from within the julia directory.
100100

base/Base.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,11 @@ include("weakkeydict.jl")
402402
include("scopedvalues.jl")
403403
using .ScopedValues
404404

405+
# metaprogramming
406+
include("meta.jl")
407+
405408
# Logging
406-
include("logging.jl")
409+
include("logging/logging.jl")
407410
using .CoreLogging
408411

409412
include("env.jl")
@@ -495,9 +498,6 @@ include("irrationals.jl")
495498
include("mathconstants.jl")
496499
using .MathConstants: ℯ, π, pi
497500

498-
# metaprogramming
499-
include("meta.jl")
500-
501501
# Stack frames and traces
502502
include("stacktraces.jl")
503503
using .StackTraces
@@ -634,6 +634,8 @@ function __init__()
634634
if get_bool_env("JULIA_USE_FLISP_PARSER", false) === false
635635
JuliaSyntax.enable_in_core!()
636636
end
637+
638+
CoreLogging.global_logger(CoreLogging.ConsoleLogger())
637639
nothing
638640
end
639641

base/abstractarray.jl

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,18 @@ emptymutable(itr, ::Type{U}) where {U} = Vector{U}()
896896
In-place [`copy`](@ref) of `src` into `dst`, discarding any pre-existing
897897
elements in `dst`.
898898
If `dst` and `src` are of the same type, `dst == src` should hold after
899-
the call. If `dst` and `src` are multidimensional arrays, they must have
899+
the call. If `dst` and `src` are vector types, they must have equal
900+
offset. If `dst` and `src` are multidimensional arrays, they must have
900901
equal [`axes`](@ref).
901902
902903
$(_DOCS_ALIASING_WARNING)
903904
904905
See also [`copyto!`](@ref).
905906
907+
!!! note
908+
When operating on vector types, if `dst` and `src` are not of the
909+
same length, `dst` is resized to `length(src)` prior to the `copy`.
910+
906911
!!! compat "Julia 1.1"
907912
This method requires at least Julia 1.1. In Julia 1.0 this method
908913
is available from the `Future` standard library as `Future.copy!`.
@@ -1078,45 +1083,28 @@ function copyto_unaliased!(deststyle::IndexStyle, dest::AbstractArray, srcstyle:
10781083
if srcstyle isa IndexLinear
10791084
# Single-index implementation
10801085
@inbounds for i in srcinds
1081-
if isassigned(src, i)
1082-
dest[i + Δi] = src[i]
1083-
else
1084-
_unsetindex!(dest, i + Δi)
1085-
end
1086+
dest[i + Δi] = src[i]
10861087
end
10871088
else
10881089
# Dual-index implementation
10891090
i = idf - 1
1090-
@inbounds for a in eachindex(src)
1091-
i += 1
1092-
if isassigned(src, a)
1093-
dest[i] = src[a]
1094-
else
1095-
_unsetindex!(dest, i)
1096-
end
1091+
@inbounds for a in src
1092+
dest[i+=1] = a
10971093
end
10981094
end
10991095
else
11001096
iterdest, itersrc = eachindex(dest), eachindex(src)
11011097
if iterdest == itersrc
11021098
# Shared-iterator implementation
1103-
@inbounds for I in iterdest
1104-
if isassigned(src, I)
1105-
dest[I] = src[I]
1106-
else
1107-
_unsetindex!(dest, I)
1108-
end
1099+
for I in iterdest
1100+
@inbounds dest[I] = src[I]
11091101
end
11101102
else
11111103
# Dual-iterator implementation
11121104
ret = iterate(iterdest)
1113-
@inbounds for a in itersrc
1105+
@inbounds for a in src
11141106
idx, state = ret::NTuple{2,Any}
1115-
if isassigned(src, a)
1116-
dest[idx] = src[a]
1117-
else
1118-
_unsetindex!(dest, idx)
1119-
end
1107+
dest[idx] = a
11201108
ret = iterate(iterdest, state)
11211109
end
11221110
end
@@ -1145,11 +1133,7 @@ function copyto!(dest::AbstractArray, dstart::Integer,
11451133
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
11461134
src′ = unalias(dest, src)
11471135
@inbounds for i = 0:n-1
1148-
if isassigned(src′, sstart+i)
1149-
dest[dstart+i] = src′[sstart+i]
1150-
else
1151-
_unsetindex!(dest, dstart+i)
1152-
end
1136+
dest[dstart+i] = src′[sstart+i]
11531137
end
11541138
return dest
11551139
end
@@ -1160,7 +1144,7 @@ function copy(a::AbstractArray)
11601144
end
11611145

11621146
function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::AbstractRange{Int},
1163-
A::AbstractVecOrMat{S}, ir_src::AbstractRange{Int}, jr_src::AbstractRange{Int}) where {R,S}
1147+
A::AbstractVecOrMat{S}, ir_src::AbstractRange{Int}, jr_src::AbstractRange{Int}) where {R,S}
11641148
if length(ir_dest) != length(ir_src)
11651149
throw(ArgumentError(LazyString("source and destination must have same size (got ",
11661150
length(ir_src)," and ",length(ir_dest),")")))
@@ -1221,6 +1205,23 @@ zero(x::AbstractArray{T}) where {T<:Number} = fill!(similar(x, typeof(zero(T))),
12211205
zero(x::AbstractArray{S}) where {S<:Union{Missing, Number}} = fill!(similar(x, typeof(zero(S))), zero(S))
12221206
zero(x::AbstractArray) = map(zero, x)
12231207

1208+
function _one(unit::T, mat::AbstractMatrix) where {T}
1209+
(rows, cols) = axes(mat)
1210+
(length(rows) == length(cols)) ||
1211+
throw(DimensionMismatch("multiplicative identity defined only for square matrices"))
1212+
zer = zero(unit)::T
1213+
require_one_based_indexing(mat)
1214+
I = similar(mat, T)
1215+
fill!(I, zer)
1216+
for i rows
1217+
I[i, i] = unit
1218+
end
1219+
I
1220+
end
1221+
1222+
one(x::AbstractMatrix{T}) where {T} = _one(one(T), x)
1223+
oneunit(x::AbstractMatrix{T}) where {T} = _one(oneunit(T), x)
1224+
12241225
## iteration support for arrays by iterating over `eachindex` in the array ##
12251226
# Allows fast iteration by default for both IndexLinear and IndexCartesian arrays
12261227

@@ -1473,20 +1474,7 @@ function _setindex!(::IndexCartesian, A::AbstractArray, v, I::Vararg{Int,M}) whe
14731474
r
14741475
end
14751476

1476-
function _unsetindex!(A::AbstractArray, i::Integer...)
1477-
@_propagate_inbounds_meta
1478-
_unsetindex!(A, map(to_index, i)...)
1479-
end
1480-
1481-
function _unsetindex!(A::AbstractArray{T}, i::Int...) where T
1482-
# this provides a fallback method which is a no-op if the element is already unassigned
1483-
# such that copying into an uninitialized object generally always will work,
1484-
# even if the specific custom array type has not implemented `_unsetindex!`
1485-
@inline
1486-
@boundscheck checkbounds(A, i...)
1487-
allocatedinline(T) || @inbounds(!isassigned(A, i...)) || throw(MethodError(_unsetindex!, (A, i...)))
1488-
return A
1489-
end
1477+
_unsetindex!(A::AbstractArray, i::Integer) = _unsetindex!(A, to_index(i))
14901478

14911479
"""
14921480
parent(A)

0 commit comments

Comments
 (0)