Skip to content

Commit 58803fe

Browse files
authored
Merge pull request #32973 from JuliaLang/backports-release-1.3
WIP: Backports for 1.3-RC2
2 parents 768b25f + e69ce0f commit 58803fe

File tree

210 files changed

+468
-1871
lines changed

Some content is hidden

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

210 files changed

+468
-1871
lines changed

Make.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ USE_BINARYBUILDER ?= 0
10051005
endif
10061006

10071007
# This is the set of projects that BinaryBuilder dependencies are hooked up for.
1008-
BB_PROJECTS := OPENBLAS LLVM SUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV
1008+
BB_PROJECTS := OPENBLAS LLVM SUITESPARSE OPENLIBM MBEDTLS LIBSSH2 CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV
10091009
define SET_BB_DEFAULT
10101010
# First, check to see if BB is disabled on a global setting
10111011
ifeq ($$(USE_BINARYBUILDER),0)
@@ -1022,6 +1022,9 @@ endef
10221022
$(foreach proj,$(BB_PROJECTS),$(eval $(call SET_BB_DEFAULT,$(proj))))
10231023

10241024

1025+
# GMP and MPFR have serious performance regressions for now
1026+
USE_BINARYBUILDER_GMP ?= 0
1027+
USE_BINARYBUILDER_MPFR ?= 0
10251028

10261029
# Use the Assertions build
10271030
BINARYBUILDER_LLVM_ASSERTS ?= 0

NEWS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ Standard library changes
9494
#### Dates
9595

9696
* `DateTime` and `Time` formatting/parsing now supports 12-hour clocks with AM/PM via `I` and `p` codes, similar to `strftime` ([#32308]).
97-
* Fixed `repr` such that it displays `Time` as it would be entered in Julia ([#32103]).
9897

9998
#### Statistics
10099

base/abstractdict.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,9 @@ end
579579

580580
function setindex!(d::IdDict{K,V}, @nospecialize(val), @nospecialize(key)) where {K, V}
581581
!isa(key, K) && throw(ArgumentError("$(limitrepr(key)) is not a valid key for type $K"))
582-
val = convert(V, val)
582+
if !(val isa V) # avoid a dynamic call
583+
val = convert(V, val)
584+
end
583585
if d.ndel >= ((3*length(d.ht))>>2)
584586
rehash!(d, max(length(d.ht)>>1, 32))
585587
d.ndel = 0

base/broadcast.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,13 @@ of the `Broadcasted` object empty (populated with [`nothing`](@ref)).
260260
end
261261
return Broadcasted{Style}(bc.f, bc.args, axes)
262262
end
263-
instantiate(bc::Broadcasted{<:Union{AbstractArrayStyle{0}, Style{Tuple}}}) = bc
264-
263+
instantiate(bc::Broadcasted{<:AbstractArrayStyle{0}}) = bc
264+
# Tuples don't need axes, but when they have axes (for .= assignment), we need to check them (#33020)
265+
instantiate(bc::Broadcasted{Style{Tuple}, Nothing}) = bc
266+
function instantiate(bc::Broadcasted{Style{Tuple}})
267+
check_broadcast_axes(bc.axes, bc.args...)
268+
return bc
269+
end
265270
## Flattening
266271

267272
"""
@@ -503,7 +508,7 @@ function check_broadcast_shape(shp, Ashp::Tuple)
503508
_bcsm(shp[1], Ashp[1]) || throw(DimensionMismatch("array could not be broadcast to match destination"))
504509
check_broadcast_shape(tail(shp), tail(Ashp))
505510
end
506-
check_broadcast_axes(shp, A) = check_broadcast_shape(shp, axes(A))
511+
@inline check_broadcast_axes(shp, A) = check_broadcast_shape(shp, axes(A))
507512
# comparing many inputs
508513
@inline function check_broadcast_axes(shp, A, As...)
509514
check_broadcast_axes(shp, A)
@@ -798,13 +803,13 @@ Like [`broadcast`](@ref), except in the case of a 0-dimensional result where it
798803
Broadcast automatically unwraps zero-dimensional results to be just the element itself,
799804
but in some cases it is necessary to always return a container — even in the 0-dimensional case.
800805
"""
801-
function broadcast_preserving_zero_d(f, As...)
806+
@inline function broadcast_preserving_zero_d(f, As...)
802807
bc = broadcasted(f, As...)
803808
r = materialize(bc)
804809
return length(axes(bc)) == 0 ? fill!(similar(bc, typeof(r)), r) : r
805810
end
806-
broadcast_preserving_zero_d(f) = fill(f())
807-
broadcast_preserving_zero_d(f, as::Number...) = fill(f(as...))
811+
@inline broadcast_preserving_zero_d(f) = fill(f())
812+
@inline broadcast_preserving_zero_d(f, as::Number...) = fill(f(as...))
808813

809814
"""
810815
Broadcast.materialize(bc)

base/condition.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function trylock end
2222
function islocked end
2323
unlockall(l::AbstractLock) = unlock(l) # internal function for implementing `wait`
2424
relockall(l::AbstractLock, token::Nothing) = lock(l) # internal function for implementing `wait`
25-
assert_havelock(l::AbstractLock) = assert_havelock(l, Threads.threadid())
2625
assert_havelock(l::AbstractLock, tid::Integer) =
2726
(islocked(l) && tid == Threads.threadid()) ? nothing : concurrency_violation()
2827
assert_havelock(l::AbstractLock, tid::Task) =
@@ -106,7 +105,7 @@ function wait(c::GenericCondition)
106105
try
107106
return wait()
108107
catch
109-
list_deletefirst!(c.waitq, ct)
108+
ct.queue === nothing || list_deletefirst!(ct.queue, ct)
110109
rethrow()
111110
finally
112111
relockall(c.lock, token)

base/file.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ function mktempdir(parent::AbstractString=tempdir();
582582

583583
req = Libc.malloc(_sizeof_uv_fs)
584584
try
585-
ret = ccall(:uv_fs_mkdtemp, Int32,
585+
ret = ccall(:uv_fs_mkdtemp, Cint,
586586
(Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Ptr{Cvoid}),
587587
C_NULL, req, tpath, C_NULL)
588588
if ret < 0

base/float.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function Float16(val::Float32)
196196
# NOTE: we maybe should ignore NaNs here, but the payload is
197197
# getting truncated anyway so "rounding" it might not matter
198198
nextbit = (f >> (sh-1)) & 1
199-
if nextbit != 0
199+
if nextbit != 0 && (h & 0x7C00) != 0x7C00
200200
# Round halfway to even or check lower bits
201201
if h&1 == 1 || (f & ((1<<(sh-1))-1)) != 0
202202
h += UInt16(1)

base/gcutils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ end
2626

2727
function finalizer(f::Ptr{Cvoid}, o::T) where T
2828
@_inline_meta
29-
if isimmutable(T)
30-
error("objects of type ", T, " cannot be finalized")
29+
if isimmutable(o)
30+
error("objects of type ", typeof(o), " cannot be finalized")
3131
end
3232
ccall(:jl_gc_add_ptr_finalizer, Cvoid, (Ptr{Cvoid}, Any, Ptr{Cvoid}),
3333
Core.getptls(), o, f)

base/loading.jl

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,18 @@ function create_expr_cache(input::String, output::String, concrete_deps::typeof(
12201220
return io
12211221
end
12221222

1223+
function compilecache_path(pkg::PkgId)::String
1224+
entrypath, entryfile = cache_file_entry(pkg)
1225+
cachepath = joinpath(DEPOT_PATH[1], entrypath)
1226+
isdir(cachepath) || mkpath(cachepath)
1227+
if pkg.uuid === nothing
1228+
abspath(cachepath, entryfile) * ".ji"
1229+
else
1230+
project_precompile_slug = slug(_crc32c(something(Base.active_project(), "")), 5)
1231+
abspath(cachepath, string(entryfile, "_", project_precompile_slug, ".ji"))
1232+
end
1233+
end
1234+
12231235
"""
12241236
Base.compilecache(module::PkgId)
12251237
@@ -1238,19 +1250,16 @@ const MAX_NUM_PRECOMPILE_FILES = 10
12381250

12391251
function compilecache(pkg::PkgId, path::String)
12401252
# decide where to put the resulting cache file
1241-
entrypath, entryfile = cache_file_entry(pkg)
1242-
cachepath = joinpath(DEPOT_PATH[1], entrypath)
1243-
isdir(cachepath) || mkpath(cachepath)
1244-
if pkg.uuid === nothing
1245-
cachefile = abspath(cachepath, entryfile) * ".ji"
1246-
else
1247-
candidates = filter!(x -> startswith(x, entryfile * "_"), readdir(cachepath))
1248-
if length(candidates) >= MAX_NUM_PRECOMPILE_FILES
1249-
idx = findmin(mtime.(joinpath.(cachepath, candidates)))[2]
1250-
rm(joinpath(cachepath, candidates[idx]))
1253+
cachefile = compilecache_path(pkg)
1254+
# prune the directory with cache files
1255+
if pkg.uuid !== nothing
1256+
cachepath = dirname(cachefile)
1257+
entrypath, entryfile = cache_file_entry(pkg)
1258+
cachefiles = filter!(x -> startswith(x, entryfile * "_"), readdir(cachepath))
1259+
if length(cachefiles) >= MAX_NUM_PRECOMPILE_FILES
1260+
idx = findmin(mtime.(joinpath.(cachepath, cachefiles)))[2]
1261+
rm(joinpath(cachepath, cachefiles[idx]))
12511262
end
1252-
project_precompile_slug = slug(_crc32c(something(Base.active_project(), "")), 5)
1253-
cachefile = abspath(cachepath, string(entryfile, "_", project_precompile_slug, ".ji"))
12541263
end
12551264
# build up the list of modules that we want the precompile process to preserve
12561265
concrete_deps = copy(_concrete_dependencies)

base/lock.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mutable struct ReentrantLock <: AbstractLock
1616
ReentrantLock() = new(nothing, GenericCondition{Threads.SpinLock}(), 0)
1717
end
1818

19+
assert_havelock(l::ReentrantLock) = assert_havelock(l, l.locked_by)
1920

2021
"""
2122
islocked(lock) -> Status (Boolean)

0 commit comments

Comments
 (0)