Skip to content

Commit 150b895

Browse files
authored
Backports for 1.11.0-alpha2 (#53543)
Backported PRs: - [x] #39071 <!-- Add a lazy `logrange` function and `LogRange` type --> - [x] #51802 <!-- Allow AnnotatedStrings in log messages --> - [x] #53369 <!-- Orthogonalize re-indexing for FastSubArrays --> - [x] #48050 <!-- improve `--heap-size-hint` arg handling --> - [x] #53482 <!-- add IR encoding for EnterNode --> - [x] #53499 <!-- Avoid compiler warning about redefining jl_globalref_t --> - [x] #53507 <!-- update staled `Core.Compiler.Effects` documentation --> - [x] #53408 <!-- task splitting: change additive accumulation to multiplicative --> - [x] #53523 <!-- add back an alias for `check_top_bit` --> - [x] #53377 <!-- add _readdirx for returning more object info gathered during dir scan --> - [x] #53525 <!-- fix InteractiveUtils call in Base.runtests on failure --> - [x] #53540 <!-- use more efficient `_readdirx` for tab completion --> - [x] #53545 <!-- use `_readdirx` for `walkdir` --> - [x] #53551 <!-- revert "Add @create_log_macro for making custom styled logging macros (#52196)" --> - [x] #53554 <!-- Always return a value in 1-d circshift! of abstractarray.jl --> - [x] #53424 <!-- yet more atomics & cache-line fixes on work-stealing queue --> - [x] #53571 <!-- Update Documenter to v1.3 for inventory writing --> - [x] #53403 <!-- Move parallel precompilation to Base --> - [x] #53589 <!-- add back `unsafe_convert` to pointer for arrays --> - [x] #53596 <!-- build: remove extra .a file --> - [x] #53606 <!-- fix error path in `precompilepkgs` --> - [x] #53004 <!-- Unexport with, at_with, and ScopedValue from Base --> - [x] #53629 <!-- typo fix in scoped values docs --> - [x] #53630 <!-- sroa: Fix incorrect scope counting --> - [x] #53598 <!-- Use Base parallel precompilation to build stdlibs --> - [x] #53649 <!-- precompilepkgs: package in boths deps and weakdeps are in fact only weak --> - [x] #53671 <!-- Fix bootstrap Base precompile in cross compile configuration --> - [x] #52125 <!-- Load Pkg if not already to reinstate missing package add prompt --> - [x] #53602 <!-- Handle zero on arrays of unions of number types and missings --> - [x] #53516 <!-- permit NamedTuple{<:Any, Union{}} to be created --> - [x] #53643 <!-- Bump CSL to 1.1.1 to fix libgomp bug --> - [x] #53679 <!-- move precompile workload back from Base --> - [x] #53663 <!-- add isassigned methods for reinterpretarray --> - [x] #53662 <!-- [REPL] fix incorrectly cleared line after completions accepted --> - [x] #53611 <!-- Linalg: matprod_dest for Diagonal and adjvec --> - [x] #53659 <!-- fix #52025, re-allow all implicit pointer casts in cconvert for Array --> - [x] #53631 <!-- LAPACK: validate input parameters to throw informative errors --> - [x] #53628 <!-- Make some improvements to the Scoped Values documentation. --> - [x] #53655 <!-- Change tbaa of ptr_phi to tbaa_value --> - [x] #53391 <!-- Default to the medium code model in x86 linux --> - [x] #53699 <!-- Move `isexecutable, isreadable, iswritable` to `filesystem.jl` --> - [x] #41232 <!-- Fix linear indexing for ReshapedArray if the parent has offset axes --> - [x] #53527 <!-- Enable analyzegc checks for try catch and fix found issues --> - [x] #52092 - [x] #53682 <!-- Increase build precompilation --> - [x] #53720 - [x] #53553 <!-- typeintersect: fix `UnionAll` unaliasing bug caused by innervars. --> Contains multiple commits, manual intervention needed: - [ ] #53305 <!-- Propagate inbounds in isassigned with CartesianIndex indices --> Non-merged PRs with backport label: - [ ] #53736 <!-- fix literal-pow to return the right type when the base is -1 --> - [ ] #53707 <!-- Make ScopedValue public --> - [ ] #53696 <!-- add invokelatest to on_done callback in bracketed paste --> - [ ] #53660 <!-- put Logging back in default sysimage --> - [ ] #53509 <!-- revert moving "creating packages" from Pkg.jl --> - [ ] #53452 <!-- RFC: allow Tuple{Union{}}, returning Union{} --> - [ ] #53402 <!-- Add `jl_getaffinity` and `jl_setaffinity` --> - [ ] #52694 <!-- Reinstate similar for AbstractQ for backward compatibility --> - [ ] #51928 <!-- Styled markdown, with a few tweaks --> - [ ] #51816 <!-- User-themable stacktraces --> - [ ] #51811 <!-- Make banner size depend on terminal size --> - [ ] #51479 <!-- prevent code loading from lookin in the versioned environment when building Julia -->
2 parents 915d62e + d6d84ed commit 150b895

File tree

142 files changed

+3631
-1370
lines changed

Some content is hidden

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

142 files changed

+3631
-1370
lines changed

Make.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ endif
14871487
CLANGSA_FLAGS :=
14881488
CLANGSA_CXXFLAGS :=
14891489
ifeq ($(OS), Darwin) # on new XCode, the files are hidden
1490-
CLANGSA_FLAGS += -isysroot $(shell xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
1490+
CLANGSA_FLAGS += -isysroot $(shell xcrun --show-sdk-path -sdk macosx)
14911491
endif
14921492
ifeq ($(USEGCC),1)
14931493
# try to help clang find the c++ files for CC by guessing the value for --prefix

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ julia-debug julia-release : julia-% : julia-sysimg-% julia-src-% julia-symlink j
112112
julia-libccalllazyfoo julia-libccalllazybar julia-libllvmcalltest julia-base-cache
113113

114114
stdlibs-cache-release stdlibs-cache-debug : stdlibs-cache-% : julia-%
115-
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f pkgimage.mk all-$*
115+
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f pkgimage.mk $*
116116

117117
debug release : % : julia-% stdlibs-cache-%
118118

@@ -289,6 +289,7 @@ else ifeq ($(JULIA_BUILD_MODE),debug)
289289
-$(INSTALL_M) $(build_libdir)/libjulia-internal-debug.dll.a $(DESTDIR)$(libdir)/
290290
endif
291291
-$(INSTALL_M) $(wildcard $(build_private_libdir)/*.a) $(DESTDIR)$(private_libdir)/
292+
-rm -f $(DESTDIR)$(private_libdir)/sys-o.a
292293

293294
# We have a single exception; we want 7z.dll to live in private_libexecdir,
294295
# not bindir, so that 7z.exe can find it.
@@ -587,6 +588,7 @@ clean: | $(CLEAN_TARGETS)
587588
@-$(MAKE) -C $(BUILDROOT)/cli clean
588589
@-$(MAKE) -C $(BUILDROOT)/test clean
589590
@-$(MAKE) -C $(BUILDROOT)/stdlib clean
591+
@-$(MAKE) -C $(BUILDROOT) -f pkgimage.mk clean
590592
-rm -f $(BUILDROOT)/julia
591593
-rm -f $(BUILDROOT)/*.tar.gz
592594
-rm -f $(build_depsbindir)/stringreplace \

NEWS.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ New library functions
7979
annotated and unannotated content.
8080
* `in!(x, s::AbstractSet)` will return whether `x` is in `s`, and insert `x` in `s` if not ([#45156], [#51636]).
8181
* The new `Libc.mkfifo` function wraps the `mkfifo` C function on Unix platforms ([#34587]).
82+
* `logrange(start, stop; length)` makes a range of constant ratio, instead of constant step ([#39071])
8283
* `copyuntil(out, io, delim)` and `copyline(out, io)` copy data into an `out::IO` stream ([#48273]).
8384
* `eachrsplit(string, pattern)` iterates split substrings right to left ([#51646]).
8485
* `Sys.username()` can be used to return the current user's username ([#51897]).
@@ -157,12 +158,6 @@ Standard library changes
157158
* Packages that specialize matrix-matrix `mul!` with a method signature of the form `mul!(::AbstractMatrix, ::MyMatrix, ::AbstractMatrix, ::Number, ::Number)` no longer encounter method ambiguities when interacting with `LinearAlgebra`. Previously, ambiguities used to arise when multiplying a `MyMatrix` with a structured matrix type provided by LinearAlgebra, such as `AbstractTriangular`, which used to necessitate additional methods to resolve such ambiguities. Similar sources of ambiguities have also been removed for matrix-vector `mul!` operations ([#52837]).
158159
* `lu` and `issuccess(::LU)` now accept an `allowsingular` keyword argument. When set to `true`, a valid factorization with rank-deficient U factor will be treated as success instead of throwing an error. Such factorizations are now shown by printing the factors together with a "rank-deficient" note rather than printing a "Failed Factorization" message ([#52957]).
159160

160-
#### Logging
161-
162-
* New `@create_log_macro` macro for creating new log macros like `@info`, `@warn` etc. For instance
163-
`@create_log_macro MyLog 1500 :magenta` will create `@mylog` to be used like `@mylog "hello"` which
164-
will show as `┌ MyLog: hello` etc. ([#52196]).
165-
166161
#### Random
167162

168163
* `rand` now supports sampling over `Tuple` types ([#35856], [#50251]).

base/Base.jl

+2-55
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ if isdefined(Core, :Compiler) && is_primary_base_module
542542
Docs.loaddocs(Core.Compiler.CoreDocs.DOCS)
543543
end
544544

545+
include("precompilation.jl")
546+
545547
# finally, now make `include` point to the full version
546548
for m in methods(include)
547549
delete_method(m)
@@ -565,61 +567,6 @@ end_base_include = time_ns()
565567
const _sysimage_modules = PkgId[]
566568
in_sysimage(pkgid::PkgId) = pkgid in _sysimage_modules
567569

568-
# Precompiles for Revise and other packages
569-
# TODO: move these to contrib/generate_precompile.jl
570-
# The problem is they don't work there
571-
for match = _methods(+, (Int, Int), -1, get_world_counter())
572-
m = match.method
573-
delete!(push!(Set{Method}(), m), m)
574-
copy(Core.Compiler.retrieve_code_info(Core.Compiler.specialize_method(match), typemax(UInt)))
575-
576-
empty!(Set())
577-
push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))
578-
(setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]
579-
(setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]
580-
(setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]
581-
(setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]
582-
(setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]
583-
Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]
584-
Dict(Base => [:(1+1)])[Base]
585-
Dict(:one => [1])[:one]
586-
Dict("abc" => Set())["abc"]
587-
pushfirst!([], sum)
588-
get(Base.pkgorigins, Base.PkgId(Base), nothing)
589-
sort!([1,2,3])
590-
unique!([1,2,3])
591-
cumsum([1,2,3])
592-
append!(Int[], BitSet())
593-
isempty(BitSet())
594-
delete!(BitSet([1,2]), 3)
595-
deleteat!(Int32[1,2,3], [1,3])
596-
deleteat!(Any[1,2,3], [1,3])
597-
Core.svec(1, 2) == Core.svec(3, 4)
598-
any(t->t[1].line > 1, [(LineNumberNode(2,:none), :(1+1))])
599-
600-
# Code loading uses this
601-
sortperm(mtime.(readdir(".")), rev=true)
602-
# JLLWrappers uses these
603-
Dict{UUID,Set{String}}()[UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210")] = Set{String}()
604-
get!(Set{String}, Dict{UUID,Set{String}}(), UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210"))
605-
eachindex(IndexLinear(), Expr[])
606-
push!(Expr[], Expr(:return, false))
607-
vcat(String[], String[])
608-
k, v = (:hello => nothing)
609-
precompile(indexed_iterate, (Pair{Symbol, Union{Nothing, String}}, Int))
610-
precompile(indexed_iterate, (Pair{Symbol, Union{Nothing, String}}, Int, Int))
611-
# Preferences uses these
612-
precompile(get_preferences, (UUID,))
613-
precompile(record_compiletime_preference, (UUID, String))
614-
get(Dict{String,Any}(), "missing", nothing)
615-
delete!(Dict{String,Any}(), "missing")
616-
for (k, v) in Dict{String,Any}()
617-
println(k)
618-
end
619-
620-
break # only actually need to do this once
621-
end
622-
623570
if is_primary_base_module
624571

625572
# Profiling helper

base/abstractarray.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,7 @@ end
12181218
copymutable(itr) = collect(itr)
12191219

12201220
zero(x::AbstractArray{T}) where {T<:Number} = fill!(similar(x, typeof(zero(T))), zero(T))
1221+
zero(x::AbstractArray{S}) where {S<:Union{Missing, Number}} = fill!(similar(x, typeof(zero(S))), zero(S))
12211222
zero(x::AbstractArray) = map(zero, x)
12221223

12231224
## iteration support for arrays by iterating over `eachindex` in the array ##
@@ -3643,9 +3644,9 @@ end
36433644
## 1-d circshift ##
36443645
function circshift!(a::AbstractVector, shift::Integer)
36453646
n = length(a)
3646-
n == 0 && return
3647+
n == 0 && return a
36473648
shift = mod(shift, n)
3648-
shift == 0 && return
3649+
shift == 0 && return a
36493650
l = lastindex(a)
36503651
reverse!(a, firstindex(a), l-shift)
36513652
reverse!(a, l-shift+1, lastindex(a))

base/boot.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ eval(Core, :(NamedTuple{names}(args::Tuple) where {names} =
727727

728728
using .Intrinsics: sle_int, add_int
729729

730-
eval(Core, :(NamedTuple{names,T}(args::T) where {names, T <: Tuple} =
731-
$(Expr(:splatnew, :(NamedTuple{names,T}), :args))))
730+
eval(Core, :((NT::Type{NamedTuple{names,T}})(args::T) where {names, T <: Tuple} =
731+
$(Expr(:splatnew, :NT, :args))))
732732

733733
# constructors for built-in types
734734

@@ -969,6 +969,7 @@ arrayset(inbounds::Bool, A::Array{T}, x::Any, i::Int...) where {T} = Main.Base.s
969969
arraysize(a::Array) = a.size
970970
arraysize(a::Array, i::Int) = sle_int(i, nfields(a.size)) ? getfield(a.size, i) : 1
971971
export arrayref, arrayset, arraysize, const_arrayref
972+
const check_top_bit = check_sign_bit
972973

973974
# For convenience
974975
EnterNode(old::EnterNode, new_dest::Int) = isdefined(old, :scope) ?

base/compiler/abstractinterpretation.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2686,7 +2686,7 @@ function refine_partial_type(@nospecialize t)
26862686
# if the first/second parameter of `NamedTuple` is known to be empty,
26872687
# the second/first argument should also be empty tuple type,
26882688
# so refine it here
2689-
return Const(NamedTuple())
2689+
return Const((;))
26902690
end
26912691
return t
26922692
end

base/compiler/effects.jl

+6-7
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ following meanings:
4343
except that it may access or modify mutable memory pointed to by its call arguments.
4444
This may later be refined to `ALWAYS_TRUE` in a case when call arguments are known to be immutable.
4545
This state corresponds to LLVM's `inaccessiblemem_or_argmemonly` function attribute.
46-
- `noub::Bool`: indicates that the method will not execute any undefined behavior (for any input).
46+
- `noub::UInt8`: indicates that the method will not execute any undefined behavior (for any input).
4747
Note that undefined behavior may technically cause the method to violate any other effect
4848
assertions (such as `:consistent` or `:effect_free`) as well, but we do not model this,
4949
and they assume the absence of undefined behavior.
50+
* `ALWAYS_TRUE`: this method is guaranteed to not execute any undefined behavior.
51+
* `ALWAYS_FALSE`: this method may execute undefined behavior.
52+
* `NOUB_IF_NOINBOUNDS`: this method is guaranteed to not execute any undefined behavior
53+
if the caller does not set nor propagate the `@inbounds` context.
5054
- `nonoverlayed::Bool`: indicates that any methods that may be called within this method
5155
are not defined in an [overlayed method table](@ref OverlayMethodTable).
52-
- `noinbounds::Bool`: If set, indicates that this method does not read the parent's `:inbounds`
53-
state. In particular, it does not have any reached `:boundscheck` exprs, not propagates inbounds
54-
to any children that do.
5556
5657
Note that the representations above are just internal implementation details and thus likely
5758
to change in the future. See [`Base.@assume_effects`](@ref) for more detailed explanation
@@ -92,9 +93,7 @@ The output represents the state of different effect properties in the following
9293
7. `noub` (`u`):
9394
- `+u` (green): `true`
9495
- `-u` (red): `false`
95-
8. `noinbounds` (`i`):
96-
- `+i` (green): `true`
97-
- `-i` (red): `false`
96+
- `?u` (yellow): `NOUB_IF_NOINBOUNDS`
9897
9998
Additionally, if the `nonoverlayed` property is false, a red prime symbol (′) is displayed after the tuple.
10099
"""

base/compiler/inferencestate.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mutable struct LazyCFGReachability
177177
end
178178
function get!(x::LazyCFGReachability)
179179
isdefined(x, :reachability) && return x.reachability
180-
domtree = construct_domtree(x.ir.cfg.blocks)
180+
domtree = construct_domtree(x.ir)
181181
return x.reachability = CFGReachability(x.ir.cfg, domtree)
182182
end
183183

@@ -189,8 +189,8 @@ end
189189
function get!(x::LazyGenericDomtree{IsPostDom}) where {IsPostDom}
190190
isdefined(x, :domtree) && return x.domtree
191191
return @timeit "domtree 2" x.domtree = IsPostDom ?
192-
construct_postdomtree(x.ir.cfg.blocks) :
193-
construct_domtree(x.ir.cfg.blocks)
192+
construct_postdomtree(x.ir) :
193+
construct_domtree(x.ir)
194194
end
195195

196196
const LazyDomtree = LazyGenericDomtree{false}

base/compiler/optimize.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ function get!(lazyagdomtree::LazyAugmentedDomtree)
578578
cfg_insert_edge!(cfg, bb, length(cfg.blocks))
579579
end
580580
end
581-
domtree = construct_domtree(cfg.blocks)
581+
domtree = construct_domtree(cfg)
582582
return lazyagdomtree.agdomtree = AugmentedDomtree(cfg, domtree)
583583
end
584584

@@ -1187,7 +1187,7 @@ function slot2reg(ir::IRCode, ci::CodeInfo, sv::OptimizationState)
11871187
# need `ci` for the slot metadata, IR for the code
11881188
svdef = sv.linfo.def
11891189
nargs = isa(svdef, Method) ? Int(svdef.nargs) : 0
1190-
@timeit "domtree 1" domtree = construct_domtree(ir.cfg.blocks)
1190+
@timeit "domtree 1" domtree = construct_domtree(ir)
11911191
defuse_insts = scan_slot_def_use(nargs, ci, ir.stmts.stmt)
11921192
𝕃ₒ = optimizer_lattice(sv.inlining.interp)
11931193
@timeit "construct_ssa" ir = construct_ssa!(ci, ir, sv, domtree, defuse_insts, 𝕃ₒ) # consumes `ir`

0 commit comments

Comments
 (0)