Skip to content

Commit dadc31b

Browse files
authored
Merge branch 'master' into kp/add-gc-ttsp
2 parents ebb9407 + 162b9e9 commit dadc31b

37 files changed

+452
-101
lines changed

Make.inc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ WITH_GC_DEBUG_ENV := 0
8989
# Enable DTrace support
9090
WITH_DTRACE := 0
9191

92+
# Enable Tracy support
93+
WITH_TRACY := 0
94+
9295
# Prevent picking up $ARCH from the environment variables
9396
ARCH:=
9497

@@ -719,7 +722,12 @@ ifeq ($(WITH_DTRACE), 1)
719722
JCXXFLAGS += -DUSE_DTRACE
720723
JCFLAGS += -DUSE_DTRACE
721724
DTRACE := dtrace
722-
else
725+
endif
726+
727+
ifeq ($(WITH_TRACY), 1)
728+
JCXXFLAGS += -DUSE_TRACY -DTRACY_ENABLE
729+
JCFLAGS += -DUSE_TRACY -DTRACY_ENABLE
730+
LIBTRACYCLIENT:=-lTracyClient
723731
endif
724732

725733
# ===========================================================================
@@ -1173,7 +1181,7 @@ CSL_NEXT_GLIBCXX_VERSION=GLIBCXX_3\.4\.31|GLIBCXX_3\.5\.|GLIBCXX_4\.
11731181
# Note: we explicitly _do not_ define `CSL` here, since it requires some more
11741182
# advanced techniques to decide whether it should be installed from a BB source
11751183
# or not. See `deps/csl.mk` for more detail.
1176-
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD
1184+
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD LIBTRACYCLIENT
11771185
define SET_BB_DEFAULT
11781186
# First, check to see if BB is disabled on a global setting
11791187
ifeq ($$(USE_BINARYBUILDER),0)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Build system changes
2727
New library functions
2828
---------------------
2929
* `tanpi` is now defined. It computes tan(πx) more accurately than `tan(pi*x)` ([#48575]).
30+
* `fourthroot(x)` is now defined in `Base.Math` and can be used to compute the fourth root of `x`.
31+
It can also be accessed using the unicode character ``, which can be typed by `\fourthroot<tab>` ([#48899]).
3032

3133
New library features
3234
--------------------
@@ -40,6 +42,7 @@ Standard library changes
4042
------------------------
4143

4244
* `startswith` now supports seekable `IO` streams ([#43055])
45+
* printing integral `Rational`s will skip the denominator in `Rational`-typed IO context (e.g. in `Arrays`) ([#45396])
4346

4447
#### Package Manager
4548

base/Base.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ include("math.jl")
342342
using .Math
343343
const ()=sqrt
344344
const ()=cbrt
345+
const ()=fourthroot
345346

346347
# now switch to a simple, race-y TLS, relative include for the rest of Base
347348
delete_method(which(include, (Module, String)))

base/abstractarray.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,12 +1985,16 @@ julia> cat(1, [2], [3;;]; dims=Val(2))
19851985

19861986
# The specializations for 1 and 2 inputs are important
19871987
# especially when running with --inline=no, see #11158
1988+
# The specializations for Union{AbstractVecOrMat,Number} are necessary
1989+
# to have more specialized methods here than in LinearAlgebra/uniformscaling.jl
19881990
vcat(A::AbstractArray) = cat(A; dims=Val(1))
19891991
vcat(A::AbstractArray, B::AbstractArray) = cat(A, B; dims=Val(1))
19901992
vcat(A::AbstractArray...) = cat(A...; dims=Val(1))
1993+
vcat(A::Union{AbstractVecOrMat,Number}...) = cat(A...; dims=Val(1))
19911994
hcat(A::AbstractArray) = cat(A; dims=Val(2))
19921995
hcat(A::AbstractArray, B::AbstractArray) = cat(A, B; dims=Val(2))
19931996
hcat(A::AbstractArray...) = cat(A...; dims=Val(2))
1997+
hcat(A::Union{AbstractVecOrMat,Number}...) = cat(A...; dims=Val(2))
19941998

19951999
typed_vcat(T::Type, A::AbstractArray) = _cat_t(Val(1), T, A)
19962000
typed_vcat(T::Type, A::AbstractArray, B::AbstractArray) = _cat_t(Val(1), T, A, B)
@@ -2140,6 +2144,8 @@ end
21402144

21412145
hvcat(rows::Tuple{Vararg{Int}}, xs::Number...) = typed_hvcat(promote_typeof(xs...), rows, xs...)
21422146
hvcat(rows::Tuple{Vararg{Int}}, xs...) = typed_hvcat(promote_eltypeof(xs...), rows, xs...)
2147+
# the following method is needed to provide a more specific one compared to LinearAlgebra/uniformscaling.jl
2148+
hvcat(rows::Tuple{Vararg{Int}}, xs::Union{AbstractVecOrMat,Number}...) = typed_hvcat(promote_eltypeof(xs...), rows, xs...)
21432149

21442150
function typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, xs::Number...) where T
21452151
nr = length(rows)

base/array.jl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ function reverse!(v::AbstractVector, start::Integer, stop::Integer=lastindex(v))
19161916
return v
19171917
end
19181918

1919-
# concatenations of homogeneous combinations of vectors, horizontal and vertical
1919+
# concatenations of (in)homogeneous combinations of vectors, horizontal and vertical
19201920

19211921
vcat() = Vector{Any}()
19221922
hcat() = Vector{Any}()
@@ -1930,6 +1930,7 @@ function hcat(V::Vector{T}...) where T
19301930
end
19311931
return [ V[j][i]::T for i=1:length(V[1]), j=1:length(V) ]
19321932
end
1933+
hcat(A::Vector...) = cat(A...; dims=Val(2)) # more special than SparseArrays's hcat
19331934

19341935
function vcat(arrays::Vector{T}...) where T
19351936
n = 0
@@ -1946,6 +1947,19 @@ function vcat(arrays::Vector{T}...) where T
19461947
end
19471948
return arr
19481949
end
1950+
vcat(A::Vector...) = cat(A...; dims=Val(1)) # more special than SparseArrays's vcat
1951+
1952+
# disambiguation with LinAlg/special.jl
1953+
# Union{Number,Vector,Matrix} is for LinearAlgebra._DenseConcatGroup
1954+
# VecOrMat{T} is for LinearAlgebra._TypedDenseConcatGroup
1955+
hcat(A::Union{Number,Vector,Matrix}...) = cat(A...; dims=Val(2))
1956+
hcat(A::VecOrMat{T}...) where {T} = typed_hcat(T, A...)
1957+
vcat(A::Union{Number,Vector,Matrix}...) = cat(A...; dims=Val(1))
1958+
vcat(A::VecOrMat{T}...) where {T} = typed_vcat(T, A...)
1959+
hvcat(rows::Tuple{Vararg{Int}}, xs::Union{Number,Vector,Matrix}...) =
1960+
typed_hvcat(promote_eltypeof(xs...), rows, xs...)
1961+
hvcat(rows::Tuple{Vararg{Int}}, xs::VecOrMat{T}...) where {T} =
1962+
typed_hvcat(T, rows, xs...)
19491963

19501964
_cat(n::Integer, x::Integer...) = reshape([x...], (ntuple(Returns(1), n-1)..., length(x)))
19511965

@@ -2338,7 +2352,11 @@ julia> findall(x -> x >= 0, d)
23382352
23392353
```
23402354
"""
2341-
findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p)))
2355+
function findall(testf::Function, A)
2356+
T = eltype(keys(A))
2357+
gen = (first(p) for p in pairs(A) if testf(last(p)))
2358+
isconcretetype(T) ? collect(T, gen) : collect(gen)
2359+
end
23422360

23432361
# Broadcasting is much faster for small testf, and computing
23442362
# integer indices from logical index using findall has a negligible cost

base/exports.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export
238238
bitrotate,
239239
bswap,
240240
cbrt,
241+
fourthroot,
241242
ceil,
242243
cis,
243244
cispi,
@@ -364,6 +365,7 @@ export
364365
zero,
365366
,
366367
,
368+
,
367369
,
368370
,
369371

base/gcutils.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,23 @@ function disable_finalizers() @inline
162162
ccall(:jl_gc_disable_finalizers_internal, Cvoid, ())
163163
end
164164

165+
"""
166+
GC.in_finalizer()::Bool
167+
168+
Returns `true` if the current task is running a finalizer, returns `false`
169+
otherwise. Will also return `false` within a finalizer which was inlined by the
170+
compiler's eager finalization optimization, or if `finalize` is called on the
171+
finalizer directly.
172+
173+
The result of this function may be useful, for example, when a finalizer must
174+
wait on a resource to become available; instead of polling the resource in a
175+
`yield` loop (which is not legal to execute within a task running finalizers),
176+
busy polling or an `@async` continuation could be used instead.
177+
"""
178+
function in_finalizer() @inline
179+
ccall(:jl_gc_is_in_finalizer, Int8, ()) > 0
180+
end
181+
165182
"""
166183
GC.@preserve x1 x2 ... xn expr
167184

base/initdefs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ end
315315
set_active_project(projfile::Union{AbstractString,Nothing})
316316
317317
Set the active `Project.toml` file to `projfile`. See also [`Base.active_project`](@ref).
318+
319+
!!! compat "Julia 1.8"
320+
This function requires at least Julia 1.8.
318321
"""
319322
function set_active_project(projfile::Union{AbstractString,Nothing})
320323
ACTIVE_PROJECT[] = projfile

base/math.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export sin, cos, sincos, tan, sinh, cosh, tanh, asin, acos, atan,
1010
acosd, acotd, acscd, asecd, asind, atand,
1111
rad2deg, deg2rad,
1212
log, log2, log10, log1p, exponent, exp, exp2, exp10, expm1,
13-
cbrt, sqrt, significand,
13+
cbrt, sqrt, fourthroot, significand,
1414
hypot, max, min, minmax, ldexp, frexp,
1515
clamp, clamp!, modf, ^, mod2pi, rem2pi,
1616
@evalpoly, evalpoly
@@ -715,6 +715,13 @@ julia> .√(1:4)
715715
"""
716716
sqrt(x)
717717

718+
"""
719+
fourthroot(x)
720+
721+
Return the fourth root of `x` by applying `sqrt` twice successively.
722+
"""
723+
fourthroot(x::Number) = sqrt(sqrt(x))
724+
718725
"""
719726
hypot(x, y)
720727
@@ -1537,7 +1544,7 @@ include("special/log.jl")
15371544
# Float16 definitions
15381545

15391546
for func in (:sin,:cos,:tan,:asin,:acos,:atan,:cosh,:tanh,:asinh,:acosh,
1540-
:atanh,:log,:log2,:log10,:sqrt,:log1p)
1547+
:atanh,:log,:log2,:log10,:sqrt,:fourthroot,:log1p)
15411548
@eval begin
15421549
$func(a::Float16) = Float16($func(Float32(a)))
15431550
$func(a::ComplexF16) = ComplexF16($func(ComplexF32(a)))
@@ -1573,5 +1580,6 @@ end
15731580
exp2(x::AbstractFloat) = 2^x
15741581
exp10(x::AbstractFloat) = 10^x
15751582
clamp(::Missing, lo, hi) = missing
1583+
fourthroot(::Missing) = missing
15761584

15771585
end # module

base/rational.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ end
8383

8484
function show(io::IO, x::Rational)
8585
show(io, numerator(x))
86+
87+
if isone(denominator(x)) && get(io, :typeinfo, Any) <: Rational
88+
return
89+
end
90+
8691
print(io, "//")
8792
show(io, denominator(x))
8893
end

0 commit comments

Comments
 (0)