Skip to content

Commit 1a2105c

Browse files
KristofferCinkydragonvchuravygbaraldibarucden
authored
Backports for 1.10.10 (#57715)
Co-authored-by: CY Han <git@wo-class.cn> Co-authored-by: Valentin Churavy <vchuravy@users.noreply.github.com> Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com> Co-authored-by: Denis Barucic <barucden@fel.cvut.cz> Co-authored-by: Neven Sajko <4944410+nsajko@users.noreply.github.com> Co-authored-by: N5N3 <2642243996@qq.com> Co-authored-by: Oscar Smith <oscardssmith@gmail.com> Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com> Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com> Co-authored-by: Jishnu Bhattacharya <jishnub.github@gmail.com> Co-authored-by: Alex Arslan <ararslan@comcast.net> Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com> Co-authored-by: Martijn Visser <mgvisser@gmail.com> Co-authored-by: adienes <51664769+adienes@users.noreply.github.com> Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com> Co-authored-by: Stefan Karpinski <stefan@karpinski.org> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> Co-authored-by: Sam Schweigel <33556084+xal-0@users.noreply.github.com> Co-authored-by: Klaus Crusius <KlausC@users.noreply.github.com> Co-authored-by: Tim Besard <tim.besard@gmail.com> Co-authored-by: Matt Bauman <mbauman@juliahub.com>
2 parents ceca0c5 + fab3a82 commit 1a2105c

Some content is hidden

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

94 files changed

+1336
-473
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ and installing Julia, below.
4343
## Resources
4444

4545
- **Homepage:** <https://julialang.org>
46-
- **Binaries:** <https://julialang.org/downloads/>
46+
- **Install:** <https://julialang.org/install/>
4747
- **Source code:** <https://github.com/JuliaLang/julia>
4848
- **Documentation:** <https://docs.julialang.org>
4949
- **Packages:** <https://julialang.org/packages/>
@@ -64,17 +64,22 @@ helpful to start contributing to the Julia codebase.
6464

6565
## Binary Installation
6666

67-
If you would rather not compile the latest Julia from source,
68-
platform-specific tarballs with pre-compiled binaries are also
69-
[available for download](https://julialang.org/downloads/). The
70-
downloads page also provides details on the
71-
[different tiers of support](https://julialang.org/downloads/#supported_platforms)
72-
for OS and platform combinations.
73-
74-
If everything works correctly, you will see a Julia banner and an
75-
interactive prompt into which you can enter expressions for
76-
evaluation. You can read about [getting
77-
started](https://docs.julialang.org/en/v1/manual/getting-started/) in the manual.
67+
The recommended way of installing Julia is to use `juliaup` which will install
68+
the latest stable `julia` for you and help keep it up to date. It can also let
69+
you install and run different Julia versions simultaneously. Instructions for
70+
this can be find [here](https://julialang.org/install/). If you want to manually
71+
download specific Julia binaries, you can find those on the [downloads
72+
page](https://julialang.org/downloads/). The downloads page also provides
73+
details on the [different tiers of
74+
support](https://julialang.org/downloads/#supported_platforms) for OS and
75+
platform combinations.
76+
77+
If everything works correctly, you will get a `julia` program and when you run
78+
it in a terminal or command prompt, you will see a Julia banner and an
79+
interactive prompt into which you can enter expressions for evaluation. You can
80+
read about [getting
81+
started](https://docs.julialang.org/en/v1/manual/getting-started/) in the
82+
manual.
7883

7984
**Note**: Although some system package managers provide Julia, such
8085
installations are neither maintained nor endorsed by the Julia

THIRDPARTY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ for exceptions.
66
- [crc32c.c](https://stackoverflow.com/questions/17645167/implementing-sse-4-2s-crc32c-in-software) (CRC-32c checksum code by Mark Adler) [[ZLib](https://opensource.org/licenses/Zlib)].
77
- [LDC](https://github.com/ldc-developers/ldc/blob/master/LICENSE) (for ccall/cfunction ABI definitions) [BSD-3]. The portion of code that Julia uses from LDC is [BSD-3] licensed.
88
- [LLVM](https://releases.llvm.org/3.9.0/LICENSE.TXT) (for parts of src/disasm.cpp) [UIUC]
9-
- [MINGW](https://sourceforge.net/p/mingw/mingw-org-wsl/ci/legacy/tree/mingwrt/mingwex/dirname.c) (for dirname implementation on Windows) [MIT]
109
- [NetBSD](https://www.netbsd.org/about/redistribution.html) (for setjmp, longjmp, and strptime implementations on Windows) [BSD-3]
1110
- [Python](https://docs.python.org/3/license.html) (for strtod implementation on Windows) [PSF]
1211
- [FEMTOLISP](https://github.com/JeffBezanson/femtolisp) [BSD-3]

base/Base.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,6 @@ using .Libc: getpid, gethostname, time, memcpy, memset, memmove, memcmp
330330
const libblas_name = "libblastrampoline" * (Sys.iswindows() ? "-5" : "")
331331
const liblapack_name = libblas_name
332332

333-
# Logging
334-
include("logging.jl")
335-
using .CoreLogging
336-
337333
# Concurrency
338334
include("linked_list.jl")
339335
include("condition.jl")
@@ -345,6 +341,10 @@ include("task.jl")
345341
include("threads_overloads.jl")
346342
include("weakkeydict.jl")
347343

344+
# Logging
345+
include("logging.jl")
346+
using .CoreLogging
347+
348348
include("env.jl")
349349

350350
# functions defined in Random

base/abstractarray.jl

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,12 +3335,19 @@ function ith_all(i, as)
33353335
end
33363336

33373337
function map_n!(f::F, dest::AbstractArray, As) where F
3338-
idxs1 = LinearIndices(As[1])
3339-
@boundscheck LinearIndices(dest) == idxs1 && all(x -> LinearIndices(x) == idxs1, As)
3340-
for i = idxs1
3341-
@inbounds I = ith_all(i, As)
3342-
val = f(I...)
3343-
@inbounds dest[i] = val
3338+
idxs = LinearIndices(dest)
3339+
if all(x -> LinearIndices(x) == idxs, As)
3340+
for i in idxs
3341+
@inbounds as = ith_all(i, As)
3342+
val = f(as...)
3343+
@inbounds dest[i] = val
3344+
end
3345+
else
3346+
for (i, Is...) in zip(eachindex(dest), map(eachindex, As)...)
3347+
as = ntuple(j->getindex(As[j], Is[j]), length(As))
3348+
val = f(as...)
3349+
dest[i] = val
3350+
end
33443351
end
33453352
return dest
33463353
end
@@ -3536,7 +3543,31 @@ function _keepat!(a::AbstractVector, m::AbstractVector{Bool})
35363543
deleteat!(a, j:lastindex(a))
35373544
end
35383545

3539-
## 1-d circshift ##
3546+
"""
3547+
circshift!(a::AbstractVector, shift::Integer)
3548+
3549+
Circularly shift, or rotate, the data in vector `a` by `shift` positions.
3550+
3551+
# Examples
3552+
3553+
```jldoctest
3554+
julia> circshift!([1, 2, 3, 4, 5], 2)
3555+
5-element Vector{Int64}:
3556+
4
3557+
5
3558+
1
3559+
2
3560+
3
3561+
3562+
julia> circshift!([1, 2, 3, 4, 5], -2)
3563+
5-element Vector{Int64}:
3564+
3
3565+
4
3566+
5
3567+
1
3568+
2
3569+
```
3570+
"""
35403571
function circshift!(a::AbstractVector, shift::Integer)
35413572
n = length(a)
35423573
n == 0 && return

base/accumulate.jl

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
# it does double the number of operations compared to accumulate,
66
# though for cheap operations like + this does not have much impact (20%)
77
function _accumulate_pairwise!(op::Op, c::AbstractVector{T}, v::AbstractVector, s, i1, n)::T where {T,Op}
8-
@inbounds if n < 128
9-
s_ = v[i1]
10-
c[i1] = op(s, s_)
8+
if n < 128
9+
@inbounds s_ = v[i1]
10+
ci1 = op(s, s_)
11+
@inbounds c[i1] = ci1
1112
for i = i1+1:i1+n-1
12-
s_ = op(s_, v[i])
13-
c[i] = op(s, s_)
13+
s_ = op(s_, @inbounds(v[i]))
14+
ci = op(s, s_)
15+
@inbounds c[i] = ci
1416
end
1517
else
1618
n2 = n >> 1
@@ -26,7 +28,8 @@ function accumulate_pairwise!(op::Op, result::AbstractVector, v::AbstractVector)
2628
n = length(li)
2729
n == 0 && return result
2830
i1 = first(li)
29-
@inbounds result[i1] = v1 = reduce_first(op,v[i1])
31+
v1 = reduce_first(op, @inbounds(v[i1]))
32+
@inbounds result[i1] = v1
3033
n == 1 && return result
3134
_accumulate_pairwise!(op, result, v, v1, i1+1, n-1)
3235
return result
@@ -379,16 +382,16 @@ function _accumulate!(op, B, A, dims::Integer, init::Union{Nothing, Some})
379382
# We can accumulate to a temporary variable, which allows
380383
# register usage and will be slightly faster
381384
ind1 = inds_t[1]
382-
@inbounds for I in CartesianIndices(tail(inds_t))
385+
for I in CartesianIndices(tail(inds_t))
383386
if init === nothing
384-
tmp = reduce_first(op, A[first(ind1), I])
387+
tmp = reduce_first(op, @inbounds(A[first(ind1), I]))
385388
else
386-
tmp = op(something(init), A[first(ind1), I])
389+
tmp = op(something(init), @inbounds(A[first(ind1), I]))
387390
end
388-
B[first(ind1), I] = tmp
391+
@inbounds B[first(ind1), I] = tmp
389392
for i_1 = first(ind1)+1:last(ind1)
390-
tmp = op(tmp, A[i_1, I])
391-
B[i_1, I] = tmp
393+
tmp = op(tmp, @inbounds(A[i_1, I]))
394+
@inbounds B[i_1, I] = tmp
392395
end
393396
end
394397
else
@@ -402,25 +405,31 @@ end
402405
@noinline function _accumulaten!(op, B, A, R1, ind, R2, init::Nothing)
403406
# Copy the initial element in each 1d vector along dimension `dim`
404407
ii = first(ind)
405-
@inbounds for J in R2, I in R1
406-
B[I, ii, J] = reduce_first(op, A[I, ii, J])
408+
for J in R2, I in R1
409+
tmp = reduce_first(op, @inbounds(A[I, ii, J]))
410+
@inbounds B[I, ii, J] = tmp
407411
end
408412
# Accumulate
409-
@inbounds for J in R2, i in first(ind)+1:last(ind), I in R1
410-
B[I, i, J] = op(B[I, i-1, J], A[I, i, J])
413+
for J in R2, i in first(ind)+1:last(ind), I in R1
414+
@inbounds Bv, Av = B[I, i-1, J], A[I, i, J]
415+
tmp = op(Bv, Av)
416+
@inbounds B[I, i, J] = tmp
411417
end
412418
B
413419
end
414420

415421
@noinline function _accumulaten!(op, B, A, R1, ind, R2, init::Some)
416422
# Copy the initial element in each 1d vector along dimension `dim`
417423
ii = first(ind)
418-
@inbounds for J in R2, I in R1
419-
B[I, ii, J] = op(something(init), A[I, ii, J])
424+
for J in R2, I in R1
425+
tmp = op(something(init), @inbounds(A[I, ii, J]))
426+
@inbounds B[I, ii, J] = tmp
420427
end
421428
# Accumulate
422-
@inbounds for J in R2, i in first(ind)+1:last(ind), I in R1
423-
B[I, i, J] = op(B[I, i-1, J], A[I, i, J])
429+
for J in R2, i in first(ind)+1:last(ind), I in R1
430+
@inbounds Bv, Av = B[I, i-1, J], A[I, i, J]
431+
tmp = op(Bv, Av)
432+
@inbounds B[I, i, J] = tmp
424433
end
425434
B
426435
end
@@ -434,10 +443,10 @@ function _accumulate1!(op, B, v1, A::AbstractVector, dim::Integer)
434443
cur_val = v1
435444
B[i1] = cur_val
436445
next = iterate(inds, state)
437-
@inbounds while next !== nothing
446+
while next !== nothing
438447
(i, state) = next
439-
cur_val = op(cur_val, A[i])
440-
B[i] = cur_val
448+
cur_val = op(cur_val, @inbounds(A[i]))
449+
@inbounds B[i] = cur_val
441450
next = iterate(inds, state)
442451
end
443452
return B

base/arraymath.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ _reverse!(A::AbstractArray{<:Any,N}, ::Colon) where {N} = _reverse!(A, ntuple(id
7272
_reverse!(A, dim::Integer) = _reverse!(A, (Int(dim),))
7373
_reverse!(A, dims::NTuple{M,Integer}) where {M} = _reverse!(A, Int.(dims))
7474
function _reverse!(A::AbstractArray{<:Any,N}, dims::NTuple{M,Int}) where {N,M}
75+
dims === () && return A # nothing to reverse
7576
dimrev = ntuple(k -> k in dims, Val{N}()) # boolean tuple indicating reversed dims
7677

7778
if N < M || M != sum(dimrev)
7879
throw(ArgumentError("invalid dimensions $dims in reverse!"))
7980
end
80-
M == 0 && return A # nothing to reverse
8181

8282
# swapping loop only needs to traverse ≈half of the array
8383
halfsz = ntuple(k -> k == dims[1] ? size(A,k) ÷ 2 : size(A,k), Val{N}())

base/channels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Channel(sz=0) = Channel{Any}(sz)
6161
"""
6262
Channel{T=Any}(func::Function, size=0; taskref=nothing, spawn=false, threadpool=nothing)
6363
64-
Create a new task from `func`, bind it to a new channel of type
64+
Create a new task from `func`, [`bind`](@ref) it to a new channel of type
6565
`T` and size `size`, and schedule the task, all in a single call.
6666
The channel is automatically closed when the task terminates.
6767

base/cmd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ julia> run(cm)
497497
Process(`echo 1`, ProcessExited(0))
498498
```
499499
"""
500-
macro cmd(str)
500+
macro cmd(str::String)
501501
cmd_ex = shell_parse(str, special=shell_special, filename=String(__source__.file))[1]
502502
return :(cmd_gen($(esc(cmd_ex))))
503503
end

base/compiler/abstractinterpretation.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3065,7 +3065,7 @@ function typeinf_local(interp::AbstractInterpreter, frame::InferenceState)
30653065
rt = abstract_eval_value(interp, stmt.val, currstate, frame)
30663066
rt = widenreturn(rt, BestguessInfo(interp, bestguess, nargs, slottypes, currstate))
30673067
# narrow representation of bestguess slightly to prepare for tmerge with rt
3068-
if rt isa InterConditional && bestguess isa Const
3068+
if rt isa InterConditional && bestguess isa Const && bestguess.val isa Bool
30693069
let slot_id = rt.slot
30703070
old_id_type = slottypes[slot_id]
30713071
if bestguess.val === true && rt.elsetype !== Bottom
@@ -3074,6 +3074,15 @@ function typeinf_local(interp::AbstractInterpreter, frame::InferenceState)
30743074
bestguess = InterConditional(slot_id, Bottom, old_id_type)
30753075
end
30763076
end
3077+
# or narrow representation of rt slightly to prepare for tmerge with bestguess
3078+
elseif bestguess isa InterConditional && rt isa Const && rt.val isa Bool
3079+
slot_id = bestguess.slot
3080+
old_id_type = widenconditional(slottypes[slot_id])
3081+
if rt.val === true && bestguess.elsetype !== Bottom
3082+
rt = InterConditional(slot_id, old_id_type, Bottom)
3083+
elseif rt.val === false && bestguess.thentype !== Bottom
3084+
rt = InterConditional(slot_id, Bottom, old_id_type)
3085+
end
30773086
end
30783087
# copy limitations to return value
30793088
if !isempty(frame.pclimitations)

base/compiler/typeinfer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ function cache_result!(interp::AbstractInterpreter, result::InferenceResult)
406406
code_cache(interp)[linfo] = ci = CodeInstance(interp, result, inferred_result, valid_worlds)
407407
if track_newly_inferred[]
408408
m = linfo.def
409-
if isa(m, Method) && m.module != Core
409+
if isa(m, Method)
410410
ccall(:jl_push_newly_inferred, Cvoid, (Any,), ci)
411411
end
412412
end

0 commit comments

Comments
 (0)