Skip to content

Commit 2aed549

Browse files
authored
Merge branch 'master' into DateTime_subtraction
2 parents af657a3 + 85f19de commit 2aed549

File tree

302 files changed

+8333
-4256
lines changed

Some content is hidden

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

302 files changed

+8333
-4256
lines changed

.mailmap

+12
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,15 @@ Daniel Karrasch <[email protected]> <[email protected]>
283283

284284
285285
286+
287+
Frames Catherine White <[email protected]> <[email protected]>
288+
Frames Catherine White <[email protected]> <[email protected]>
289+
Frames Catherine White <[email protected]> <[email protected]>
290+
291+
292+
293+
Jishnu Bhattacharya <[email protected]> <[email protected]>
294+
Jishnu Bhattacharya <[email protected]> <[email protected]>
295+
296+
297+

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ please remove the `backport-X.Y` tag from the originating pull request for the c
325325
- use lower case with underscores for method names
326326
- it is generally preferred to use ASCII operators and identifiers over
327327
Unicode equivalents whenever possible
328-
- in docstring refer to the language as "Julia" and the executable as "`julia`"
328+
- in docstrings refer to the language as "Julia" and the executable as "`julia`"
329329

330330
#### General Formatting Guidelines For C code contributions
331331

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2009-2022: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
3+
Copyright (c) 2009-2023: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

Make.inc

+43-19
Original file line numberDiff line numberDiff line change
@@ -486,37 +486,61 @@ MACOSX_VERSION_MIN := 11.0
486486
endif
487487
endif
488488

489-
ifeq ($(USEGCC),1)
490-
CC := $(CROSS_COMPILE)gcc
491-
CXX := $(CROSS_COMPILE)g++
492-
JCFLAGS := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
489+
JCFLAGS_COMMON := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
490+
JCFLAGS_CLANG := $(JCFLAGS_COMMON)
491+
JCFLAGS_GCC := $(JCFLAGS_COMMON)
492+
493493
# AArch64 needs this flag to generate the .eh_frame used by libunwind
494-
JCPPFLAGS := -fasynchronous-unwind-tables
495-
JCXXFLAGS := -pipe $(fPIC) -fno-rtti -std=c++14
494+
JCPPFLAGS_COMMON := -fasynchronous-unwind-tables
495+
JCPPFLAGS_CLANG := $(JCPPFLAGS_COMMON)
496+
JCPPFLAGS_GCC := $(JCPPFLAGS_COMMON)
497+
498+
JCXXFLAGS_COMMON := -pipe $(fPIC) -fno-rtti -std=c++14
499+
JCXXFLAGS_CLANG := $(JCXXFLAGS_COMMON) -pedantic
500+
JCXXFLAGS_GCC := $(JCXXFLAGS_COMMON)
501+
502+
DEBUGFLAGS_COMMON := -O0 -DJL_DEBUG_BUILD -fstack-protector
503+
DEBUGFLAGS_CLANG := $(DEBUGFLAGS_COMMON) -g
504+
DEBUGFLAGS_GCC := $(DEBUGFLAGS_COMMON) -ggdb2
505+
506+
SHIPFLAGS_COMMON := -O3
507+
SHIPFLAGS_CLANG := $(SHIPFLAGS_COMMON) -g
508+
SHIPFLAGS_GCC := $(SHIPFLAGS_COMMON) -ggdb2 -falign-functions
509+
510+
ifeq ($(OS), Darwin)
511+
JCPPFLAGS_CLANG += -D_LARGEFILE_SOURCE -D_DARWIN_USE_64_BIT_INODE=1
512+
endif
513+
496514
ifneq ($(OS), WINNT)
497515
# Do not enable on windows to avoid warnings from libuv.
498-
JCXXFLAGS += -pedantic
516+
JCXXFLAGS_GCC += -pedantic
499517
endif
500-
DEBUGFLAGS := -O0 -ggdb2 -DJL_DEBUG_BUILD -fstack-protector
501-
SHIPFLAGS := -O3 -ggdb2 -falign-functions
518+
519+
ifeq ($(USEGCC),1)
520+
CC := $(CROSS_COMPILE)gcc
521+
CXX := $(CROSS_COMPILE)g++
522+
JCFLAGS := $(JCFLAGS_GCC)
523+
JCPPFLAGS := $(JCPPFLAGS_GCC)
524+
JCXXFLAGS := $(JCXXFLAGS_GCC)
525+
DEBUGFLAGS := $(DEBUGFLAGS_GCC)
526+
SHIPFLAGS := $(SHIPFLAGS_GCC)
502527
endif
503528

504529
ifeq ($(USECLANG),1)
505-
CC := $(CROSS_COMPILE)clang
506-
CXX := $(CROSS_COMPILE)clang++
507-
JCFLAGS := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
508-
# AArch64 needs this flag to generate the .eh_frame used by libunwind
509-
JCPPFLAGS := -fasynchronous-unwind-tables
510-
JCXXFLAGS := -pipe $(fPIC) -fno-rtti -pedantic -std=c++14
511-
DEBUGFLAGS := -O0 -g -DJL_DEBUG_BUILD -fstack-protector
512-
SHIPFLAGS := -O3 -g
530+
CC := $(CROSS_COMPILE)clang
531+
CXX := $(CROSS_COMPILE)clang++
532+
JCFLAGS := $(JCFLAGS_CLANG)
533+
JCPPFLAGS := $(JCPPFLAGS_CLANG)
534+
JCXXFLAGS := $(JCXXFLAGS_CLANG)
535+
DEBUGFLAGS := $(DEBUGFLAGS_CLANG)
536+
SHIPFLAGS := $(SHIPFLAGS_CLANG)
537+
513538
ifeq ($(OS), Darwin)
514539
CC += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
515540
CXX += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
516541
FC += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
517542
# export MACOSX_DEPLOYMENT_TARGET so that ld picks it up, especially for deps
518543
export MACOSX_DEPLOYMENT_TARGET=$(MACOSX_VERSION_MIN)
519-
JCPPFLAGS += -D_LARGEFILE_SOURCE -D_DARWIN_USE_64_BIT_INODE=1
520544
endif
521545
endif
522546

@@ -699,7 +723,7 @@ endif # OS Linux or FreeBSD
699723
endif # SANITIZE_MEMORY=1
700724
ifeq ($(SANITIZE_ADDRESS),1)
701725
SANITIZE_OPTS += -fsanitize=address
702-
SANITIZE_LDFLAGS += -fsanitize=address
726+
SANITIZE_LDFLAGS += -fsanitize=address -shared-libasan
703727
endif
704728
ifeq ($(SANITIZE_THREAD),1)
705729
SANITIZE_OPTS += -fsanitize=thread

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ JL_PRIVATE_LIBS-$(USE_SYSTEM_CSL) += libwinpthread
237237
else
238238
JL_PRIVATE_LIBS-$(USE_SYSTEM_CSL) += libpthread
239239
endif
240+
ifeq ($(SANITIZE),1)
241+
ifeq ($(USECLANG),1)
242+
JL_PRIVATE_LIBS-1 += libclang_rt.asan
243+
else
244+
JL_PRIVATE_LIBS-1 += libasan
245+
endif
246+
endif
247+
240248
ifeq ($(WITH_TRACY),1)
241249
JL_PRIVATE_LIBS-0 += libTracyClient
242250
endif
@@ -365,6 +373,10 @@ endif
365373
# Remove various files which should not be installed
366374
-rm -f $(DESTDIR)$(datarootdir)/julia/base/version_git.sh
367375
-rm -f $(DESTDIR)$(datarootdir)/julia/test/Makefile
376+
-rm -f $(DESTDIR)$(datarootdir)/julia/base/*/source-extracted
377+
-rm -f $(DESTDIR)$(datarootdir)/julia/base/*/build-configured
378+
-rm -f $(DESTDIR)$(datarootdir)/julia/base/*/build-compiled
379+
-rm -f $(DESTDIR)$(datarootdir)/julia/base/*/build-checked
368380
-rm -f $(DESTDIR)$(datarootdir)/julia/stdlib/$(VERSDIR)/*/source-extracted
369381
-rm -f $(DESTDIR)$(datarootdir)/julia/stdlib/$(VERSDIR)/*/build-configured
370382
-rm -f $(DESTDIR)$(datarootdir)/julia/stdlib/$(VERSDIR)/*/build-compiled

NEWS.md

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Julia v1.10 Release Notes
44
New language features
55
---------------------
66

7+
* JuliaSyntax.jl is now used as the default parser, providing better diagnostics and faster
8+
parsing. Set environment variable `JULIA_USE_NEW_PARSER` to `0` to switch back to the old
9+
parser if necessary (and if you find this necessary, please file an issue) ([#46372]).
710
* `` (U+297A, `\leftarrowsubset`) and `` (U+2977, `\leftarrowless`)
811
may now be used as binary operators with arrow precedence. ([#45962])
912

@@ -18,12 +21,17 @@ Language changes
1821
that significantly improves load and inference times for heavily overloaded methods that
1922
dispatch on Types (such as traits and constructors).
2023
* The "h bar" `` (`\hslash` U+210F) character is now treated as equivalent to `ħ` (`\hbar` U+0127).
24+
* When a method with keyword arguments is displayed in the stack trace view, the textual
25+
representation of the keyword arguments' types is simplified using the new
26+
`@Kwargs{key1::Type1, ...}` macro syntax ([#49959]).
2127

2228
Compiler/Runtime improvements
2329
-----------------------------
2430

2531
* The `@pure` macro is now deprecated. Use `Base.@assume_effects :foldable` instead ([#48682]).
2632
* The mark phase of the Garbage Collector is now multi-threaded ([#48600]).
33+
* [JITLink](https://llvm.org/docs/JITLink.html) is enabled by default on Linux aarch64 when Julia is linked to LLVM 15 or later versions ([#49745]).
34+
This should resolve many segmentation faults previously observed on this platform.
2735

2836
Command-line option changes
2937
---------------------------
@@ -44,6 +52,7 @@ New library functions
4452
* `tanpi` is now defined. It computes tan(πx) more accurately than `tan(pi*x)` ([#48575]).
4553
* `fourthroot(x)` is now defined in `Base.Math` and can be used to compute the fourth root of `x`.
4654
It can also be accessed using the unicode character ``, which can be typed by `\fourthroot<tab>` ([#48899]).
55+
* `Libc.memmove`, `Libc.memset`, and `Libc.memcpy` are now defined, whose functionality matches that of their respective C calls.
4756

4857
New library features
4958
--------------------
@@ -52,6 +61,7 @@ New library features
5261
* `binomial(x, k)` now supports non-integer `x` ([#48124]).
5362
* A `CartesianIndex` is now treated as a "scalar" for broadcasting ([#47044]).
5463
* `printstyled` now supports italic output ([#45164]).
64+
* `parent` and `parentindices` support `SubString`s
5565

5666
Standard library changes
5767
------------------------
@@ -94,6 +104,8 @@ Standard library changes
94104

95105
#### REPL
96106

107+
* When stack traces are printed, the printed depth of types in function signatures will be limited
108+
to avoid overly verbose output ([#49795]).
97109

98110
#### SuiteSparse
99111

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
<a name="logo"/>
12
<div align="center">
2-
<a href="https://julialang.org/" target="_blank">
3-
<picture>
4-
<source media="(prefers-color-scheme: dark)" srcset="doc/src/assets/julialogoheaderimage_dark.svg">
5-
<img alt="The Julia logo" src="doc/src/assets/julialogoheaderimage_light.svg">
6-
</picture>
7-
</a>
3+
<a href="https://julialang.org/" target="_blank">
4+
<img src="doc/src/assets/logo.svg" alt="Julia Logo" width="210" height="142"></img>
5+
</a>
86
</div>
97

108
<table>

base/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/version_git.jl
99
/version_git.jl.phony
1010
/userimg.jl
11+
/JuliaSyntax

base/Base.jl

+16-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Core.Intrinsics, Core.IR
66

77
# to start, we're going to use a very simple definition of `include`
88
# that doesn't require any function (except what we can get from the `Core` top-module)
9-
const _included_files = Array{Tuple{Module,String},1}()
9+
const _included_files = Array{Tuple{Module,String},1}(Core.undef, 1)
1010
function include(mod::Module, path::String)
1111
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), _included_files, UInt(1))
1212
Core.arrayset(true, _included_files, (mod, ccall(:jl_prepend_cwd, Any, (Any,), path)), arraylen(_included_files))
@@ -163,6 +163,7 @@ include("int.jl")
163163
include("operators.jl")
164164
include("pointer.jl")
165165
include("refvalue.jl")
166+
include("cmem.jl")
166167
include("refpointer.jl")
167168

168169
# now replace the Pair constructor (relevant for NamedTuples) with one that calls our Base.convert
@@ -316,7 +317,7 @@ include("version.jl")
316317
# system & environment
317318
include("sysinfo.jl")
318319
include("libc.jl")
319-
using .Libc: getpid, gethostname, time
320+
using .Libc: getpid, gethostname, time, memcpy, memset, memmove, memcmp
320321

321322
# These used to be in build_h.jl and are retained for backwards compatibility.
322323
# NOTE: keep in sync with `libblastrampoline_jll.libblastrampoline`.
@@ -488,6 +489,10 @@ a_method_to_overwrite_in_test() = inferencebarrier(1)
488489
include(mod::Module, _path::AbstractString) = _include(identity, mod, _path)
489490
include(mapexpr::Function, mod::Module, _path::AbstractString) = _include(mapexpr, mod, _path)
490491

492+
# External libraries vendored into Base
493+
Core.println("JuliaSyntax/src/JuliaSyntax.jl")
494+
include(@__MODULE__, "JuliaSyntax/src/JuliaSyntax.jl")
495+
491496
end_base_include = time_ns()
492497

493498
const _sysimage_modules = PkgId[]
@@ -596,6 +601,12 @@ function __init__()
596601
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
597602
errormonitor(Threads.@spawn(profile_printing_listener()))
598603
end
604+
_require_world_age[] = get_world_counter()
605+
# Prevent spawned Julia process from getting stuck waiting on Tracy to connect.
606+
delete!(ENV, "JULIA_WAIT_FOR_TRACY")
607+
if get_bool_env("JULIA_USE_NEW_PARSER", true) === true
608+
JuliaSyntax.enable_in_core!()
609+
end
599610
nothing
600611
end
601612

@@ -604,5 +615,8 @@ end
604615

605616
end
606617

618+
# Ensure this file is also tracked
619+
@assert !isassigned(_included_files, 1)
620+
_included_files[1] = (parentmodule(Base), abspath(@__FILE__))
607621

608622
end # baremodule Base

base/Enums.jl

+14-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ Base.cconvert(::Type{T}, x::Enum{T2}) where {T<:Integer,T2<:Integer} = T(x)::T
2121
Base.write(io::IO, x::Enum{T}) where {T<:Integer} = write(io, T(x))
2222
Base.read(io::IO, ::Type{T}) where {T<:Enum} = T(read(io, basetype(T)))
2323

24+
"""
25+
_enum_hash(x::Enum, h::UInt)
26+
27+
Compute hash for an enum value `x`. This internal method will be specialized
28+
for every enum type created through [`@enum`](@ref).
29+
"""
30+
_enum_hash(x::Enum, h::UInt) = invoke(hash, Tuple{Any, UInt}, x, h)
31+
Base.hash(x::Enum, h::UInt) = _enum_hash(x, h)
2432
Base.isless(x::T, y::T) where {T<:Enum} = isless(basetype(T)(x), basetype(T)(y))
2533

2634
Base.Symbol(x::Enum) = namemap(typeof(x))[Integer(x)]::Symbol
@@ -206,8 +214,12 @@ macro enum(T::Union{Symbol,Expr}, syms...)
206214
Enums.namemap(::Type{$(esc(typename))}) = $(esc(namemap))
207215
Base.typemin(x::Type{$(esc(typename))}) = $(esc(typename))($lo)
208216
Base.typemax(x::Type{$(esc(typename))}) = $(esc(typename))($hi)
209-
let enum_hash = hash($(esc(typename)))
210-
Base.hash(x::$(esc(typename)), h::UInt) = hash(enum_hash, hash(Integer(x), h))
217+
let type_hash = hash($(esc(typename)))
218+
# Use internal `_enum_hash` to allow users to specialize
219+
# `Base.hash` for their own enum types without overwriting the
220+
# method we would define here. This avoids a warning for
221+
# precompilation.
222+
Enums._enum_hash(x::$(esc(typename)), h::UInt) = hash(type_hash, hash(Integer(x), h))
211223
end
212224
let insts = (Any[ $(esc(typename))(v) for v in $values ]...,)
213225
Base.instances(::Type{$(esc(typename))}) = insts

base/abstractarray.jl

+12-16
Original file line numberDiff line numberDiff line change
@@ -604,20 +604,6 @@ end
604604
size_to_strides(s, d) = (s,)
605605
size_to_strides(s) = ()
606606

607-
608-
function isassigned(a::AbstractArray, i::Integer...)
609-
try
610-
a[i...]
611-
true
612-
catch e
613-
if isa(e, BoundsError) || isa(e, UndefRefError)
614-
return false
615-
else
616-
rethrow()
617-
end
618-
end
619-
end
620-
621607
function isstored(A::AbstractArray{<:Any,N}, I::Vararg{Integer,N}) where {N}
622608
@boundscheck checkbounds(A, I...)
623609
return true
@@ -1442,7 +1428,7 @@ end
14421428
"""
14431429
parent(A)
14441430
1445-
Return the underlying "parent array”. This parent array of objects of types `SubArray`, `ReshapedArray`
1431+
Return the underlying parent object of the view. This parent of objects of types `SubArray`, `SubString`, `ReshapedArray`
14461432
or `LinearAlgebra.Transpose` is what was passed as an argument to `view`, `reshape`, `transpose`, etc.
14471433
during object creation. If the input is not a wrapped object, return the input itself. If the input is
14481434
wrapped multiple times, only the outermost wrapper will be removed.
@@ -1465,6 +1451,8 @@ julia> parent(V)
14651451
3 4
14661452
```
14671453
"""
1454+
function parent end
1455+
14681456
parent(a::AbstractArray) = a
14691457

14701458
## rudimentary aliasing detection ##
@@ -1644,6 +1632,14 @@ end
16441632

16451633
typed_hcat(::Type{T}, A::AbstractVecOrMat...) where {T} = _typed_hcat(T, A)
16461634

1635+
# Catch indexing errors like v[i +1] (instead of v[i+1] or v[i + 1]), where indexing is
1636+
# interpreted as a typed concatenation. (issue #49676)
1637+
typed_hcat(::AbstractArray, other...) = throw(ArgumentError("It is unclear whether you \
1638+
intend to perform an indexing operation or typed concatenation. If you intend to \
1639+
perform indexing (v[1 + 2]), adjust spacing or insert missing operator to clarify. \
1640+
If you intend to perform typed concatenation (T[1 2]), ensure that T is a type."))
1641+
1642+
16471643
hcat(A::AbstractVecOrMat...) = typed_hcat(promote_eltype(A...), A...)
16481644
hcat(A::AbstractVecOrMat{T}...) where {T} = typed_hcat(T, A...)
16491645

@@ -3273,7 +3269,7 @@ mapany(f, itr) = Any[f(x) for x in itr]
32733269
map(f, c...) -> collection
32743270
32753271
Transform collection `c` by applying `f` to each element. For multiple collection arguments,
3276-
apply `f` elementwise, and stop when when any of them is exhausted.
3272+
apply `f` elementwise, and stop when any of them is exhausted.
32773273
32783274
See also [`map!`](@ref), [`foreach`](@ref), [`mapreduce`](@ref), [`mapslices`](@ref), [`zip`](@ref), [`Iterators.map`](@ref).
32793275

0 commit comments

Comments
 (0)