Skip to content

Backports release 1.11 #57714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
237ad1a
power uses Float64 exponents for integers (#53967)
KlausC Apr 22, 2024
82b3c6d
docs: remove `dirname.c` from THIRDPARTY file (#56413)
inkydragon Nov 1, 2024
9833def
Only strip invariant.load from special pointers (#57386)
vchuravy Feb 18, 2025
c793367
`Base.summarysize` for `Memory` with `Union` (#57508)
PatrickHaecker Feb 23, 2025
0c9ac24
Docs: `circshift!(::AbstractVector, ::Integer)` (#57539)
barucden Feb 27, 2025
738b0ae
`Base.Precompilation.ExplicitEnv`: handle type instability better in …
nsajko Mar 2, 2025
6b4e426
strings: type assert in the generic `nextind`, `prevind` methods (#57…
nsajko Mar 3, 2025
2be5e6d
Add missing arg in TOML `printvalue` (#57584)
qiaojunfeng Mar 5, 2025
8d8f2ee
Intersect: try normal+reverse+existential subtyping during intersecti…
N5N3 Mar 6, 2025
ce2548f
Make sure we don't promise alignments that are larger than the heap a…
gbaraldi Jan 3, 2025
d453372
fix alignment computation for nested objects (#57722)
vtjnash Mar 11, 2025
7c7c325
Don't free regex objects in exit-time finalizer calls (#57834)
IanButterworth Mar 25, 2025
2ccc91a
Add malloc fixes to 1.11 branch (#57880)
gbaraldi Mar 25, 2025
56909d7
[backports-release-1.11] Revert "precompile: don't waste memory on us…
timholy Mar 25, 2025
2e9119d
Clarify disabling of tab-completion hinting in the documentation (#57…
thofma Feb 21, 2025
06c808b
fixup "Don't free regex objects in exit-time finalizer calls (#57834)"
IanButterworth Mar 27, 2025
8ca7e1e
[backports-1.11] Add passes to `-O1` pipeline to reduce allocations i…
gbaraldi Mar 28, 2025
c28dc85
Materialize complex Symmetric matrices in eigen (#55348)
jishnub Mar 28, 2025
dec7072
Optimizer: Update SROA def-uses after DCE (#57201)
serenity4 Feb 3, 2025
358337b
`Base`: `append!`, `resize!`: convert length to `Int` before passing …
nsajko Mar 11, 2025
969bcde
Libdl: Improve inference for `string(::LazyLibraryPath)` (#57721)
topolarity Mar 11, 2025
de8ef46
[docs] Clarify that Float16 is supported natively when possible (#57725)
giordano Mar 15, 2025
ac642ff
fix special function `::Real` fallback stack overflow (#57790)
nsajko Mar 17, 2025
e80ce4b
stackwalk: fix heuristic termination (#57801)
vtjnash Mar 17, 2025
ae9f94c
restrict dispatch of some custrom string macros to `String` (#57781)
nsajko Mar 20, 2025
2a153e8
iobuffer: copyline: type assert `Int` to prevent invalidation (#57848)
nsajko Mar 21, 2025
9b474fa
fix `mod` for mixes of `Signed` and `Unsigned` (#57853)
oscardssmith Mar 23, 2025
bbb2720
REPL: call display on the backend (#57773)
IanButterworth Mar 23, 2025
2dc33ad
`Base`: `PCRE`: `exec`: type assert `String` after construction (#57868)
nsajko Mar 25, 2025
b8c0a89
`Base`: `macro b_str`: restrict argument to `String` (#57863)
nsajko Mar 25, 2025
118bd2d
`Base`: `macro cmd`: restrict argument to `String` (#57862)
nsajko Mar 25, 2025
f661509
only update fragmentation data for pages that are not lazily freed (#…
d-netto Mar 28, 2025
eb3a411
`Random`: `show` method for `MersenneTwister`: invalidation resistanc…
nsajko Mar 28, 2025
aa8ff5d
`Base`: shell escaping: inference improvement to prevent invalidation…
nsajko Mar 30, 2025
b75482b
`_precompilepkgs`: interactive progress display: fix unintended captu…
nsajko Mar 31, 2025
ebdc636
REPL: only load stdlibs during precompilation script (#57940)
IanButterworth Mar 31, 2025
460c78a
lowering: fix has_fcall computation (#57395)
vtjnash Feb 14, 2025
6c509b3
Make `Pairs` public (#56794)
LilithHafner Feb 14, 2025
65d937a
`AnnotatedString`: add concrete type asserts to `isvalid`, `ncodeunit…
nsajko Mar 3, 2025
0819f97
Profile: remove scope from profile macros (#57858)
IanButterworth Mar 25, 2025
a22c32c
Update OpenLibm to 0.8.5 (#56984)
ararslan Jan 8, 2025
618c74e
bump Pkg to latest v1.11
KristofferC Mar 31, 2025
ee1e525
staticdata: Memoize `type_in_worklist` query (#57917)
topolarity Mar 31, 2025
9f0f7f4
Don't error when initializing LibGit2 with CA roots path (#56924)
visr Mar 25, 2025
d4d0876
`append_c_digits`: typeassert `Int` to improve inference (#57950)
nsajko Apr 1, 2025
21e7f7a
fix `nextpow`, `prevpow` for types without `typemax` (#49669)
nsajko Apr 4, 2025
c9a4255
bump Pkg to latest v1.11
KristofferC Apr 5, 2025
b5eaa97
Fix undefined symbol error in version script (#55363)
Zentrik Dec 11, 2024
a71dd05
Revert "Materialize complex Symmetric matrices in eigen (#55348)"
KristofferC Apr 7, 2025
99a18f6
Make llvmpasses test pass in 1.11 backport
gbaraldi Apr 7, 2025
bedac2c
update allocated codegen test from #55223
KristofferC Apr 8, 2025
4991eb8
typeintersect: fix triangular vars handling outside constructor. (#58…
N5N3 Apr 8, 2025
88568a8
bump Pkg to latest v1.11
KristofferC Apr 9, 2025
8979836
Add bfloat LLVM fix to 1.11 (#57874)
gbaraldi Apr 10, 2025
8063884
Revert "power uses Float64 exponents for integers (#53967)"
KristofferC Apr 10, 2025
eccd25a
Revert "fix `mod` for mixes of `Signed` and `Unsigned` (#57853)"
KristofferC Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion THIRDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ for exceptions.
- [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)].
- [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.
- [LLVM](https://releases.llvm.org/3.9.0/LICENSE.TXT) (for parts of src/disasm.cpp) [UIUC]
- [MINGW](https://sourceforge.net/p/mingw/mingw-org-wsl/ci/legacy/tree/mingwrt/mingwex/dirname.c) (for dirname implementation on Windows) [MIT]
- [NetBSD](https://www.netbsd.org/about/redistribution.html) (for setjmp, longjmp, and strptime implementations on Windows) [BSD-3]
- [Python](https://docs.python.org/3/license.html) (for strtod implementation on Windows) [PSF]
- [FEMTOLISP](https://github.com/JeffBezanson/femtolisp) [BSD-3]
Expand Down
26 changes: 25 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,31 @@ function _keepat!(a::AbstractVector, m::AbstractVector{Bool})
deleteat!(a, j:lastindex(a))
end

## 1-d circshift ##
"""
circshift!(a::AbstractVector, shift::Integer)
Circularly shift, or rotate, the data in vector `a` by `shift` positions.
# Examples
```jldoctest
julia> circshift!([1, 2, 3, 4, 5], 2)
5-element Vector{Int64}:
4
5
1
2
3
julia> circshift!([1, 2, 3, 4, 5], -2)
5-element Vector{Int64}:
3
4
5
1
2
```
"""
function circshift!(a::AbstractVector, shift::Integer)
n = length(a)
n == 0 && return a
Expand Down
5 changes: 3 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ function append! end

function append!(a::Vector{T}, items::Union{AbstractVector{<:T},Tuple}) where T
items isa Tuple && (items = map(x -> convert(T, x), items))
n = length(items)
n = Int(length(items))::Int
_growend!(a, n)
copyto!(a, length(a)-n+1, items, firstindex(items), n)
return a
Expand Down Expand Up @@ -1444,7 +1444,8 @@ julia> a[1:6]
1
```
"""
function resize!(a::Vector, nl::Integer)
function resize!(a::Vector, nl_::Integer)
nl = Int(nl_)::Int
l = length(a)
if nl > l
_growend!(a, nl-l)
Expand Down
2 changes: 1 addition & 1 deletion base/cmd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ julia> run(cm)
Process(`echo 1`, ProcessExited(0))
```
"""
macro cmd(str)
macro cmd(str::String)
cmd_ex = shell_parse(str, special=shell_special, filename=String(__source__.file))[1]
return :(cmd_gen($(esc(cmd_ex))))
end
1 change: 0 additions & 1 deletion base/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ is_inaccessiblemem_or_argmemonly(effects::Effects) = effects.inaccessiblememonly

is_consistent_overlay(effects::Effects) = effects.nonoverlayed === CONSISTENT_OVERLAY

# (sync this with codegen.cpp and staticdata.c effects_foldable functions)
function encode_effects(e::Effects)
return ((e.consistent % UInt32) << 0) |
((e.effect_free % UInt32) << 3) |
Expand Down
4 changes: 4 additions & 0 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,10 @@ function sroa_pass!(ir::IRCode, inlining::Union{Nothing,InliningState}=nothing)
used_ssas[x.id] -= 1
end
ir = complete(compact)
# remove any use that has been optimized away by the DCE
for (intermediaries, defuse) in values(defuses)
filter!(x -> ir[SSAValue(x.idx)][:stmt] !== nothing, defuse.uses)
end
sroa_mutables!(ir, defuses, used_ssas, lazydomtree, inlining)
return ir
else
Expand Down
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ public
ImmutableDict,
Lockable,
OneTo,
Pairs,
LogRange,
UUID,

Expand Down
6 changes: 3 additions & 3 deletions base/int.jl
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ ERROR: LoadError: ArgumentError: invalid base 10 digit '.' in "123456789123.4"
[...]
```
"""
macro int128_str(s)
macro int128_str(s::String)
return parse(Int128, s)
end

Expand All @@ -667,7 +667,7 @@ ERROR: LoadError: ArgumentError: invalid base 10 digit '-' in "-123456789123"
[...]
```
"""
macro uint128_str(s)
macro uint128_str(s::String)
return parse(UInt128, s)
end

Expand Down Expand Up @@ -700,7 +700,7 @@ ERROR: ArgumentError: invalid number format _ for BigInt or BigFloat
depends on the value of the precision at the point when the function is
defined, **not** at the precision at the time when the function is called.
"""
macro big_str(s)
macro big_str(s::String)
message = "invalid number format $s for BigInt or BigFloat"
throw_error = :(throw(ArgumentError($message)))
if '_' in s
Expand Down
10 changes: 6 additions & 4 deletions base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ function nextpow(a::Real, x::Real)
n = ceil(Integer,log(a, x))
# round-off error of log can go either direction, so need some checks
p = a^(n-1)
x > typemax(p) && throw(DomainError(x,"argument is beyond the range of type of the base"))
hastypemax(typeof(p)) && x > typemax(p) &&
throw(DomainError(x,"argument is beyond the range of type of the base"))
p >= x && return p
wp = a^n
wp > p || throw(OverflowError("result is beyond the range of type of the base"))
Expand Down Expand Up @@ -567,9 +568,10 @@ function prevpow(a::T, x::Real) where T <: Real
n = floor(Integer,log(a, x))
# round-off error of log can go either direction, so need some checks
p = a^n
x > typemax(p) && throw(DomainError(x,"argument is beyond the range of type of the base"))
hastypemax(typeof(p)) && x > typemax(p) &&
throw(DomainError(x,"argument is beyond the range of type of the base"))
if a isa Integer
wp, overflow = mul_with_overflow(a, p)
wp, overflow = mul_with_overflow(promote(a, p)...)
wp <= x && !overflow && return wp
else
wp = a^(n+1)
Expand Down Expand Up @@ -801,7 +803,7 @@ function append_c_digits(olength::Int, digits::Unsigned, buf, pos::Int)
while i >= 2
d, c = divrem(digits, 0x64)
digits = oftype(digits, d)
@inbounds d100 = _dec_d100[(c % Int) + 1]
@inbounds d100 = _dec_d100[(c % Int)::Int + 1]
@inbounds buf[pos + i - 2] = d100 % UInt8
@inbounds buf[pos + i - 1] = (d100 >> 0x8) % UInt8
i -= 2
Expand Down
2 changes: 1 addition & 1 deletion base/iobuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ function _copyline(out::IO, io::GenericIOBuffer; keep::Bool=false)
data = view(io.data, io.ptr:io.size)
# note: findfirst + copyto! is much faster than a single loop
# except for nout ≲ 20. A single loop is 2x faster for nout=5.
nout = nread = something(findfirst(==(0x0a), data), length(data))
nout = nread = something(findfirst(==(0x0a), data), length(data))::Int
if !keep && nout > 0 && data[nout] == 0x0a
nout -= 1
nout > 0 && data[nout] == 0x0d && (nout -= 1)
Expand Down
2 changes: 1 addition & 1 deletion base/libdl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ struct LazyLibraryPath
LazyLibraryPath(pieces::Vector) = new(pieces)
end
LazyLibraryPath(args...) = LazyLibraryPath(collect(args))
Base.string(llp::LazyLibraryPath) = joinpath(string.(llp.pieces)...)::String
Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces])
Base.cconvert(::Type{Cstring}, llp::LazyLibraryPath) = Base.cconvert(Cstring, string(llp))
# Define `print` so that we can wrap this in a `LazyString`
Base.print(io::IO, llp::LazyLibraryPath) = print(io, string(llp))
Expand Down
2 changes: 1 addition & 1 deletion base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ for f in (:sin, :cos, :tan, :asin, :atan, :acos,
:exponent, :sqrt, :cbrt, :sinpi, :cospi, :sincospi, :tanpi)
@eval function ($f)(x::Real)
xf = float(x)
x === xf && throw(MethodError($f, (x,)))
xf isa typeof(x) && throw(MethodError($f, (x,)))
return ($f)(xf)
end
@eval $(f)(::Missing) = missing
Expand Down
2 changes: 1 addition & 1 deletion base/pcre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ end
exec(re, subject::Union{String,SubString{String}}, offset, options, match_data) =
_exec(re, subject, offset, options, match_data)
exec(re, subject, offset, options, match_data) =
_exec(re, String(subject), offset, options, match_data)
_exec(re, String(subject)::String, offset, options, match_data)

function _exec(re, subject, offset, options, match_data)
rc = ccall((:pcre2_match_8, PCRE_LIB), Cint,
Expand Down
9 changes: 5 additions & 4 deletions base/precompilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,16 @@ function ExplicitEnv(envpath::String=Base.active_project())

# Extensions
deps_pkg = get(Dict{String, Any}, pkg_info, "extensions")::Dict{String, Any}
deps_pkg_concrete = Dict{String, Vector{String}}()
for (ext, triggers) in deps_pkg
if triggers isa String
triggers = [triggers]
else
triggers = triggers::Vector{String}
end
deps_pkg[ext] = triggers
deps_pkg_concrete[ext] = triggers
end
extensions[m_uuid] = deps_pkg
extensions[m_uuid] = deps_pkg_concrete

# Determine strategy to find package
lookup_strat = begin
Expand Down Expand Up @@ -810,8 +811,8 @@ function _precompilepkgs(pkgs::Vector{String},
# window between print cycles
termwidth = displaysize(io)[2] - 4
if !final_loop
str = sprint(io -> show_progress(io, bar; termwidth, carriagereturn=false); context=io)
print(iostr, Base._truncate_at_width_or_chars(true, str, termwidth), "\n")
s = sprint(io -> show_progress(io, bar; termwidth, carriagereturn=false); context=io)
print(iostr, Base._truncate_at_width_or_chars(true, s, termwidth), "\n")
end
for pkg_config in pkg_queue_show
dep, config = pkg_config
Expand Down
8 changes: 7 additions & 1 deletion base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ mutable struct Regex <: AbstractPattern
end
re = compile(new(pattern, compile_options, match_options, C_NULL))
finalizer(re) do re
re.regex == C_NULL || PCRE.free_re(re.regex)
# don't free during exit because tasks may still be running and
# using it. Issue #57817. During sysimage creation _atexit_hooks_finished
# is not defined but threads aren't running so just always run
during_exit = @isdefined(_atexit_hooks_finished) && _atexit_hooks_finished
if re.regex != C_NULL && !during_exit
PCRE.free_re(re.regex)
end
end
re
end
Expand Down
4 changes: 2 additions & 2 deletions base/shell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function shell_escape_csh(io::IO, args::AbstractString...)
end
shell_escape_csh(args::AbstractString...) =
sprint(shell_escape_csh, args...;
sizehint = sum(sizeof.(args)) + length(args) * 3)
sizehint = sum(sizeof, args) + length(args) * 3)

"""
shell_escape_wincmd(s::AbstractString)
Expand Down Expand Up @@ -492,4 +492,4 @@ function escape_microsoft_c_args(io::IO, args::AbstractString...)
end
escape_microsoft_c_args(args::AbstractString...) =
sprint(escape_microsoft_c_args, args...;
sizehint = (sum(sizeof.(args)) + 3*length(args)))
sizehint = (sum(sizeof, args) + 3*length(args)))
4 changes: 2 additions & 2 deletions base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ promote_rule(::Type{<:AnnotatedString}, ::Type{<:AbstractString}) = AnnotatedStr

## AbstractString interface ##

ncodeunits(s::AnnotatedString) = ncodeunits(s.string)
ncodeunits(s::AnnotatedString) = ncodeunits(s.string)::Int
codeunits(s::AnnotatedString) = codeunits(s.string)
codeunit(s::AnnotatedString) = codeunit(s.string)
codeunit(s::AnnotatedString, i::Integer) = codeunit(s.string, i)
isvalid(s::AnnotatedString, i::Integer) = isvalid(s.string, i)
isvalid(s::AnnotatedString, i::Integer) = isvalid(s.string, i)::Bool
@propagate_inbounds iterate(s::AnnotatedString, i::Integer=firstindex(s)) =
if i <= lastindex(s.string); (s[i], nextind(s, i)) end
eltype(::Type{<:AnnotatedString{S}}) where {S} = AnnotatedChar{eltype(S)}
Expand Down
12 changes: 6 additions & 6 deletions base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,11 @@ prevind(s::AbstractString, i::Int) = prevind(s, i, 1)

function prevind(s::AbstractString, i::Int, n::Int)
n < 0 && throw(ArgumentError("n cannot be negative: $n"))
z = ncodeunits(s) + 1
z = ncodeunits(s)::Int + 1
@boundscheck 0 < i ≤ z || throw(BoundsError(s, i))
n == 0 && return thisind(s, i) == i ? i : string_index_err(s, i)
n == 0 && return thisind(s, i)::Int == i ? i : string_index_err(s, i)
while n > 0 && 1 < i
@inbounds n -= isvalid(s, i -= 1)
@inbounds n -= isvalid(s, i -= 1)::Bool
end
return i - n
end
Expand Down Expand Up @@ -571,11 +571,11 @@ nextind(s::AbstractString, i::Int) = nextind(s, i, 1)

function nextind(s::AbstractString, i::Int, n::Int)
n < 0 && throw(ArgumentError("n cannot be negative: $n"))
z = ncodeunits(s)
z = ncodeunits(s)::Int
@boundscheck 0 ≤ i ≤ z || throw(BoundsError(s, i))
n == 0 && return thisind(s, i) == i ? i : string_index_err(s, i)
n == 0 && return thisind(s, i)::Int == i ? i : string_index_err(s, i)
while n > 0 && i < z
@inbounds n -= isvalid(s, i += 1)
@inbounds n -= isvalid(s, i += 1)::Bool
end
return i + n
end
Expand Down
2 changes: 1 addition & 1 deletion base/strings/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ julia> v[2]
0x32
```
"""
macro b_str(s)
macro b_str(s::String)
v = codeunits(unescape_string(s))
QuoteNode(v)
end
Expand Down
7 changes: 1 addition & 6 deletions base/summarysize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,8 @@ function (ss::SummarySize)(obj::GenericMemory)
datakey = unsafe_convert(Ptr{Cvoid}, obj)
if !haskey(ss.seen, datakey)
ss.seen[datakey] = true
dsize = sizeof(obj)
size += sizeof(obj)
T = eltype(obj)
if isbitsunion(T)
# add 1 union selector byte for each element
dsize += length(obj)
end
size += dsize
if !isempty(obj) && T !== Symbol && (!Base.allocatedinline(T) || (T isa DataType && !Base.datatype_pointerfree(T)))
push!(ss.frontier_x, obj)
push!(ss.frontier_i, 1)
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b5b6cc2e7a1b6401d102f51abb4ae4d5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2a58eab12df4070a2a002c6e52fbf49e6c445fb973dc044e30332052cfb6089de12525c8ce2f3f5dd5651e0305477fbbf6b8e063c78a6ddc96c52254f5364c5a
Loading