Skip to content

Commit 495cc72

Browse files
authored
Merge branch 'JuliaLang:master' into N5N3flatten
2 parents 992d2d4 + cc345f6 commit 495cc72

File tree

137 files changed

+1574
-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.

137 files changed

+1574
-1031
lines changed

.buildkite/pipelines/main/misc/whitespace.yml

-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@ steps:
1717
workspaces:
1818
- "/cache/repos:/cache/repos"
1919
timeout_in_minutes: 10
20-
notify:
21-
- github_commit_status:
22-
context: "whitespace"
2320
commands: |
2421
make --output-sync -j$${JULIA_CPU_THREADS:?} check-whitespace

.buildkite/pipelines/main/platforms/tester_linux.arches

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PLATFORM LABEL GROUP ALLOW_FAIL ARCH ARCH_ROOTFS MAKE_FLAGS TIMEOUT_BK TIMEOUT_RR RETRIES IS_RR IS_ST IS_MT ROOTFS_TAG ROOTFS_HASH
2-
linux 32_g1 g1 . 32 i686 . . . . . . . v4.8 b6dffc772ab4c2cd7fd4f83459308f6f0d89b957
2+
linux 32_g1 g1 . 32 i686 . 120 . . . . . v4.8 b6dffc772ab4c2cd7fd4f83459308f6f0d89b957
33
linux 32_g2 g2 . 32 i686 . . . 3 . . . v4.8 b6dffc772ab4c2cd7fd4f83459308f6f0d89b957
44

55
linux 64_g1_mt g1 . 64 x86_64 . . . . . . yes v4.8 2a058481b567f0e91b9aa3ce4ad4f09e6419355a

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUI
4848

4949
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
5050
ifeq ($(OS),WINNT)
51-
@echo '@"%~dp0\'"$$(echo $(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE)) | tr / '\\')"\" '%*' > $(BUILDROOT)/julia.bat
51+
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
5252
chmod a+x $(BUILDROOT)/julia.bat
5353
else
5454
ifndef JULIA_VAGRANT_BUILD

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ New language features
1212
to enforce the involved function calls to be (or not to be) inlined. ([#41312])
1313
* The default behavior of observing `@inbounds` declarations is now an option via `auto` in `--check-bounds=yes|no|auto` ([#41551])
1414
* New function `eachsplit(str)` for iteratively performing `split(str)`.
15+
* New function `allequal(itr)` for testing if all elements in an iterator are equal. ([#43354])
1516
* ``, ``, and `` are now allowed as identifier characters ([#42314]).
1617
* Support for Unicode 14.0.0 ([#43443]).
1718
* `try`-blocks can now optionally have an `else`-block which is executed right after the main body only if
@@ -72,6 +73,9 @@ Command-line option changes
7273
Multi-threading changes
7374
-----------------------
7475

76+
* `Threads.@threads` now defaults to a new `:dynamic` schedule option which is similar to the previous behavior except
77+
that iterations will be scheduled dynamically to available worker threads rather than pinned to each thread. This
78+
behavior is more composable with (possibly nested) `@spawn` and `@threads` loops ([#43919], [#44136])
7579

7680
Build system changes
7781
--------------------

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Julia. However, most users should use the [most recent stable version](https://g
9393
of Julia. You can get this version by changing to the Julia directory
9494
and running:
9595

96-
git checkout v1.7.0
96+
git checkout v1.7.2
9797

9898
Now run `make` to build the `julia` executable.
9999

base/Base.jl

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:notatom
5858
(@inline; Core.replacefield!(x, f, expected, convert(fieldtype(typeof(x), f), desired), success_order, fail_order))
5959

6060
convert(::Type{Any}, Core.@nospecialize x) = x
61+
convert(::Type{T}, x::T) where {T} = x
6162
include("coreio.jl")
6263

6364
eval(x) = Core.eval(Base, x)

base/abstractarray.jl

+30-2
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,8 @@ end
17591759
"""
17601760
vcat(A...)
17611761
1762-
Concatenate along dimension 1.
1762+
Concatenate along dimension 1. To efficiently concatenate a large vector of arrays,
1763+
use `reduce(vcat, x)`.
17631764
17641765
# Examples
17651766
```jldoctest
@@ -1785,13 +1786,29 @@ julia> vcat(c...)
17851786
2×3 Matrix{Int64}:
17861787
1 2 3
17871788
4 5 6
1789+
1790+
julia> vs = [[1, 2], [3, 4], [5, 6]]
1791+
3-element Vector{Vector{Int64}}:
1792+
[1, 2]
1793+
[3, 4]
1794+
[5, 6]
1795+
1796+
julia> reduce(vcat, vs)
1797+
6-element Vector{Int64}:
1798+
1
1799+
2
1800+
3
1801+
4
1802+
5
1803+
6
17881804
```
17891805
"""
17901806
vcat(X...) = cat(X...; dims=Val(1))
17911807
"""
17921808
hcat(A...)
17931809
1794-
Concatenate along dimension 2.
1810+
Concatenate along dimension 2. To efficiently concatenate a large vector of arrays,
1811+
use `reduce(hcat, x)`.
17951812
17961813
# Examples
17971814
```jldoctest
@@ -1836,6 +1853,17 @@ julia> hcat(x, [1; 2; 3])
18361853
1
18371854
2
18381855
3
1856+
1857+
julia> vs = [[1, 2], [3, 4], [5, 6]]
1858+
3-element Vector{Vector{Int64}}:
1859+
[1, 2]
1860+
[3, 4]
1861+
[5, 6]
1862+
1863+
julia> reduce(hcat, vs)
1864+
2×3 Matrix{Int64}:
1865+
1 3 5
1866+
2 4 6
18391867
```
18401868
"""
18411869
hcat(X...) = cat(X...; dims=Val(2))

base/array.jl

+2
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,7 @@ end
25862586

25872587
"""
25882588
keepat!(a::Vector, inds)
2589+
keepat!(a::BitVector, inds)
25892590
25902591
Remove the items at all the indices which are not given by `inds`,
25912592
and return the modified `a`.
@@ -2610,6 +2611,7 @@ keepat!(a::Vector, inds) = _keepat!(a, inds)
26102611

26112612
"""
26122613
keepat!(a::Vector, m::AbstractVector{Bool})
2614+
keepat!(a::BitVector, m::AbstractVector{Bool})
26132615
26142616
The in-place version of logical indexing `a = a[m]`. That is, `keepat!(a, m)` on
26152617
vectors of equal length `a` and `m` will remove all elements from `a` for which

base/asyncmap.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ up to 100 tasks will be used for concurrent mapping.
1515
1616
`ntasks` can also be specified as a zero-arg function. In this case, the
1717
number of tasks to run in parallel is checked before processing every element and a new
18-
task started if the value of `ntasks_func` is less than the current number
18+
task started if the value of `ntasks_func` is greater than the current number
1919
of tasks.
2020
2121
If `batch_size` is specified, the collection is processed in batch mode. `f` must

base/channels.jl

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Channel(sz=0) = Channel{Any}(sz)
6363
6464
Create a new task from `func`, bind it to a new channel of type
6565
`T` and size `size`, and schedule the task, all in a single call.
66+
The channel is automatically closed when the task terminates.
6667
6768
`func` must accept the bound channel as its only argument.
6869

base/client.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ end
323323
function _global_julia_startup_file()
324324
# If the user built us with a specific Base.SYSCONFDIR, check that location first for a startup.jl file
325325
# If it is not found, then continue on to the relative path based on Sys.BINDIR
326-
BINDIR = Sys.BINDIR::String
327-
SYSCONFDIR = Base.SYSCONFDIR::String
326+
BINDIR = Sys.BINDIR
327+
SYSCONFDIR = Base.SYSCONFDIR
328328
if !isempty(SYSCONFDIR)
329329
p1 = abspath(BINDIR, SYSCONFDIR, "julia", "startup.jl")
330330
isfile(p1) && return p1

base/compiler/abstractinterpretation.jl

+19-4
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,17 @@ function abstract_call_known(interp::AbstractInterpreter, @nospecialize(f),
14821482
if f === _apply_iterate
14831483
return abstract_apply(interp, argtypes, sv, max_methods)
14841484
elseif f === invoke
1485-
return abstract_invoke(interp, arginfo, sv)
1485+
call = abstract_invoke(interp, arginfo, sv)
1486+
if call.info === false
1487+
if call.rt === Bottom
1488+
tristate_merge!(sv, Effects(EFFECTS_TOTAL, nothrow=ALWAYS_FALSE))
1489+
else
1490+
tristate_merge!(sv, Effects())
1491+
end
1492+
end
1493+
return call
14861494
elseif f === modifyfield!
1495+
tristate_merge!(sv, Effects()) # TODO
14871496
return abstract_modifyfield!(interp, argtypes, sv)
14881497
end
14891498
rt = abstract_call_builtin(interp, f, arginfo, sv, max_methods)
@@ -1622,13 +1631,16 @@ function abstract_call(interp::AbstractInterpreter, arginfo::ArgInfo,
16221631
if isa(ft, PartialOpaque)
16231632
newargtypes = copy(argtypes)
16241633
newargtypes[1] = ft.env
1634+
tristate_merge!(sv, Effects()) # TODO
16251635
return abstract_call_opaque_closure(interp, ft, ArgInfo(arginfo.fargs, newargtypes), sv)
16261636
elseif (uft = unwrap_unionall(widenconst(ft)); isa(uft, DataType) && uft.name === typename(Core.OpaqueClosure))
1637+
tristate_merge!(sv, Effects()) # TODO
16271638
return CallMeta(rewrap_unionall((uft::DataType).parameters[2], widenconst(ft)), false)
16281639
elseif f === nothing
16291640
# non-constant function, but the number of arguments is known
16301641
# and the ft is not a Builtin or IntrinsicFunction
16311642
if hasintersect(widenconst(ft), Union{Builtin, Core.OpaqueClosure})
1643+
tristate_merge!(sv, Effects())
16321644
add_remark!(interp, sv, "Could not identify method table for call")
16331645
return CallMeta(Any, false)
16341646
end
@@ -1866,7 +1878,7 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
18661878
effects.consistent ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
18671879
effects.effect_free ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
18681880
effects.nothrow ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
1869-
effects.terminates ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
1881+
effects.terminates_globally ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
18701882
))
18711883
else
18721884
tristate_merge!(sv, Effects())
@@ -2040,8 +2052,11 @@ end
20402052
function handle_control_backedge!(frame::InferenceState, from::Int, to::Int)
20412053
if from > to
20422054
def = frame.linfo.def
2043-
if isa(def, Method) && decode_effects_override(def.purity).terminates_locally
2044-
return nothing
2055+
if isa(def, Method)
2056+
effects = decode_effects_override(def.purity)
2057+
if effects.terminates_globally || effects.terminates_locally
2058+
return nothing
2059+
end
20452060
end
20462061
tristate_merge!(frame, Effects(EFFECTS_TOTAL, terminates=TRISTATE_UNKNOWN))
20472062
end

base/compiler/compiler.jl

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ macro inline() Expr(:meta, :inline) end
2929
macro noinline() Expr(:meta, :noinline) end
3030

3131
convert(::Type{Any}, Core.@nospecialize x) = x
32+
convert(::Type{T}, x::T) where {T} = x
3233

3334
# essential files and libraries
3435
include("essentials.jl")

base/compiler/ssair/inlining.jl

+4-11
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,6 @@ function analyze_single_call!(
11681168
sig::Signature, state::InliningState, todo::Vector{Pair{Int, Any}})
11691169
argtypes = sig.argtypes
11701170
cases = InliningCase[]
1171-
local signature_union = Bottom
11721171
local only_method = nothing # keep track of whether there is one matching method
11731172
local meth::MethodLookupResult
11741173
local fully_covered = true
@@ -1180,6 +1179,7 @@ function analyze_single_call!(
11801179
return nothing
11811180
elseif length(meth) == 0
11821181
# No applicable methods; try next union split
1182+
fully_covered = false
11831183
continue
11841184
else
11851185
if length(meth) == 1 && only_method !== false
@@ -1193,8 +1193,8 @@ function analyze_single_call!(
11931193
end
11941194
end
11951195
for match in meth
1196-
signature_union = Union{signature_union, match.spec_types}
11971196
fully_covered &= handle_match!(match, argtypes, flag, state, cases)
1197+
fully_covered &= match.fully_covers
11981198
end
11991199
end
12001200

@@ -1214,8 +1214,6 @@ function analyze_single_call!(
12141214
item === nothing && return nothing
12151215
push!(cases, InliningCase(match.spec_types, item))
12161216
fully_covered = match.fully_covers
1217-
else
1218-
fully_covered &= atype <: signature_union
12191217
end
12201218

12211219
handle_cases!(ir, idx, stmt, atype, cases, fully_covered, todo, state.params)
@@ -1230,7 +1228,6 @@ function handle_const_call!(
12301228
infos = isa(call, MethodMatchInfo) ? MethodMatchInfo[call] : call.matches
12311229
cases = InliningCase[]
12321230
local fully_covered = true
1233-
local signature_union = Bottom
12341231
local j = 0
12351232
for i in 1:length(infos)
12361233
meth = infos[i].results
@@ -1240,24 +1237,22 @@ function handle_const_call!(
12401237
return nothing
12411238
elseif length(meth) == 0
12421239
# No applicable methods; try next union split
1240+
fully_covered = false
12431241
continue
12441242
end
12451243
for match in meth
12461244
j += 1
12471245
result = results[j]
12481246
if isa(result, ConstResult)
12491247
case = const_result_item(result, state)
1250-
signature_union = Union{signature_union, result.mi.specTypes}
12511248
push!(cases, InliningCase(result.mi.specTypes, case))
1252-
continue
12531249
elseif isa(result, InferenceResult)
1254-
signature_union = Union{signature_union, result.linfo.specTypes}
12551250
fully_covered &= handle_inf_result!(result, argtypes, flag, state, cases)
12561251
else
12571252
@assert result === nothing
1258-
signature_union = Union{signature_union, match.spec_types}
12591253
fully_covered &= handle_match!(match, argtypes, flag, state, cases)
12601254
end
1255+
fully_covered &= match.fully_covers
12611256
end
12621257
end
12631258

@@ -1271,8 +1266,6 @@ function handle_const_call!(
12711266
item === nothing && return nothing
12721267
push!(cases, InliningCase(mi.specTypes, item))
12731268
fully_covered = atype <: mi.specTypes
1274-
else
1275-
fully_covered &= atype <: signature_union
12761269
end
12771270

12781271
handle_cases!(ir, idx, stmt, atype, cases, fully_covered, todo, state.params)

base/compiler/types.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct EffectsOverride
8989
consistent::Bool
9090
effect_free::Bool
9191
nothrow::Bool
92-
terminates::Bool
92+
terminates_globally::Bool
9393
terminates_locally::Bool
9494
end
9595

@@ -98,7 +98,7 @@ function encode_effects_override(eo::EffectsOverride)
9898
eo.consistent && (e |= 0x01)
9999
eo.effect_free && (e |= 0x02)
100100
eo.nothrow && (e |= 0x04)
101-
eo.terminates && (e |= 0x08)
101+
eo.terminates_globally && (e |= 0x08)
102102
eo.terminates_locally && (e |= 0x10)
103103
e
104104
end

0 commit comments

Comments
 (0)