Skip to content
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

Backports for 1.11.0-beta2 #54112

Merged
merged 75 commits into from
May 28, 2024
Merged
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
690acfd
LinearAlgebra: LazyString in interpolated error messages (#53976)
jishnub Apr 9, 2024
31129c3
make `view(::Memory, ::Colon)` produce a Vector (#54005)
LilithHafner Apr 9, 2024
35faa79
Overload `Base.literal_pow` for `AbstractQ` (#54010)
dkarrasch Apr 13, 2024
c6dacd4
Allow PrecompileTools to see MI's inferred by foreign abstract interp…
vchuravy Apr 15, 2024
557268d
inference correctness: fields and globals can revert to undef (#53750)
vtjnash Apr 16, 2024
bf4e638
Profile: fix heap snapshot is valid char check (#53984)
IanButterworth Apr 16, 2024
bdc7fb7
Explicitly compute stride in unaliascopy for SubArray (#54102)
jishnub Apr 16, 2024
30c6e25
use afoldl instead of tail recursion for tuples (#53665)
vtjnash Mar 12, 2024
814a04a
inference: handle `LimitedAccuracy` in `handle_global_assignment!` (#…
aviatesk Apr 18, 2024
fcad4b9
Allow for querying of build_id from objects (#53943)
vchuravy Apr 13, 2024
bc927d3
🤖 [backports-release-1.11] Bump the StyledStrings stdlib from e0ca0f8…
DilumAluthgeBot Apr 23, 2024
eb9c9b8
Fix handling of virtual exit node in `PostDomTree` (#53739)
topolarity Mar 19, 2024
678fe46
post-opt: add more test cases for `visit_conditional_successors` (#53…
aviatesk Mar 19, 2024
6522986
post-opt: taint :consistent when statement may raise inconsistently (…
aviatesk Apr 24, 2024
74615de
Fix integer overflow in `skip(s::IOBuffer, typemax(Int64))` (#54070)
nhz2 Apr 17, 2024
a3277ab
Support case-changes to Annotated{String,Char}s (#54013)
tecosaur Apr 18, 2024
d166d2c
Fix writing of AnnotatedChars to AnnotatedIOBuffer (#53941)
tecosaur Apr 18, 2024
08c7f9d
Fix typo in docs for `partialsortperm` (#54137)
lgoettgens Apr 18, 2024
9b5f3c9
use correct size when creating output data from an IOBuffer (#54129)
KristofferC Apr 20, 2024
7e13db3
Fixup IdSet docstring (#54153)
jakobnissen Apr 20, 2024
ba23f85
Fix `make install` from tarballs (#54143)
nalimilan Apr 22, 2024
618bee4
LinearAlgebra: Correct zero element in `_generic_matvecmul!` for bloc…
jishnub Apr 23, 2024
c98867b
Add `public` statement to `Base.GC` (#54213)
lgoettgens Apr 24, 2024
06134f6
Utilize correct tbaa when emitting stores of unions. (#54222)
gbaraldi Apr 25, 2024
6792cb4
set MAX_OS_WRITE on unix (#54233)
vtjnash Apr 25, 2024
92db099
fix `_checked_mul_dims` in the presence of 0s and overflow. (#54255)
oscardssmith Apr 26, 2024
a91655b
Fix typo in `readuntil` (#54259)
nhz2 Apr 26, 2024
99340fa
fix typo in gc_mark_memory8 when chunking a large array (#54251)
d-netto Apr 26, 2024
1c25c49
Fix solve for complex `Hermitian` with non-vanishing imaginary part …
dkarrasch Apr 27, 2024
6fc6eb0
ensure package callbacks are invoked when no valid precompile file ex…
KristofferC Apr 29, 2024
38e42d9
Implement eval-able AnnotatedString 2-arg show (#54308)
tecosaur Apr 30, 2024
d5237bf
Specialised substring equality for annotated strs (#54302)
tecosaur May 2, 2024
6d84a37
prevent `package_callbacks` to run multiple time for a single package…
KristofferC May 2, 2024
5326a2c
add a precompile signature to Artifacts code that is used by JLLs (#5…
KristofferC May 4, 2024
6ca5297
correctly track freed bytes in jl_genericmemory_to_string (#54331)
d-netto May 6, 2024
bb57f82
Make sure `fieldcount` constant-folds for `Tuple{...}` (#54239)
Keno Apr 25, 2024
97387cc
backport: define entry point as main(args) instead of main(ARGS)
KristofferC May 6, 2024
dccf8a2
revert moving "creating packages" from Pkg.jl (#53509)
KristofferC Apr 10, 2024
c7bfbec
When accessing the data pointer for an array, first decay it to a Der…
gbaraldi May 3, 2024
bc9c928
LinearAlgebra: Type-stability in broadcasting numbers over Bidiagonal…
jishnub May 2, 2024
05e685e
Rework annotation ordering/optimisations (#54289)
tecosaur Apr 30, 2024
6609f7d
Add specialised AnnotatedString pipe read/writes (#53715)
tecosaur May 2, 2024
2ec00d0
Revert "add unsetindex support to more copyto methods (#51760)"
KristofferC May 2, 2024
d4578a8
Revert "Add `_unsetindex!` methods for `SubArray`s and `CartesianInde…
KristofferC May 6, 2024
c0735fe
Fix an off-by-one error in interpreter's `do_invoke` (#54443)
fatteneder May 17, 2024
d4e097b
REPL: fix hinting without expanding user (#54311)
IanButterworth May 6, 2024
ad785dd
typeintersect: fix another stack overflow caused by circular constrai…
N5N3 May 7, 2024
945f77a
Revert "Move profiling manual section to a new tutorials toplevel hea…
KristofferC May 7, 2024
4d665a9
LinearAlgebra: improve type-inference in Symmetric/Hermitian matmul (…
jishnub May 7, 2024
7e5a37d
Artfifacts: track Artifacts.toml by hash instead of mtime (#54426)
jonathan-conder-sm May 10, 2024
0f010f0
Make Memory{T} respect the max alignment of the heap (#53748)
gbaraldi May 10, 2024
1b53dde
comment out an assertion that fires when loading Parquet2 (#54408)
KristofferC May 13, 2024
3c2894d
Fix bug when rounding large numbers to floating point types (#54314)
LilithHafner May 16, 2024
2b6f488
Make `deepcopy_internal` infer for locks and conditions (#54506)
LilithHafner May 17, 2024
6079f14
Make `deepcopy_internal` inferrable for BigInt and BigFloat (#54496)
lgoettgens May 18, 2024
8d5b3b6
bump Pkg to latest 1.11
May 22, 2024
431dfdc
[OpenBLAS_jll] Update to v0.3.27 (#54237)
giordano Apr 25, 2024
babf0f8
create phantom task for GC threads (#53815)
d-netto Mar 25, 2024
d186d8a
Make all command-line options documented in all related files (#53826)
prbzrg Apr 4, 2024
480dfab
Move ConsoleLogging.jl into Base (#54428)
KristofferC May 13, 2024
db69ac5
typeintersect: fix potential free `TypeVar` caused by chained inner v…
N5N3 Mar 13, 2024
b9504be
typeintersect: conservative typevar subtitution during `finish_uniona…
N5N3 May 16, 2024
4f1ba1d
typeintersect: followup cleanup for the nothrow path of type instanti…
N5N3 May 19, 2024
5b15ed7
add StyledStrings to annotated test
May 23, 2024
3d6a5af
Revert "Allow for querying of build_id from objects (#53943)"
May 27, 2024
a6796b9
make `@doc x` work without REPL loaded (#54499)
JeffBezanson May 27, 2024
af49d9f
Use Base.require() to load Distributed internally (#54571)
JamesWrigley May 24, 2024
394f0af
account for extensions indirectly depending on each other in parallel…
KristofferC May 9, 2024
e53c9c0
Make TestLogger thread-safe (introduce a lock) (#54497)
NHDaly May 22, 2024
242229b
Make some more deepcopy_internal methods type stable (#54562)
lgoettgens May 23, 2024
28b94ea
Pkg REPL: cache `pkg_mode` lookup (#54359)
IanButterworth May 23, 2024
5102454
Add a missing doc (#53796)
putianyi889 May 24, 2024
3dbc785
attach finalizer in `mmap` to the correct object (#54210)
KristofferC May 27, 2024
4caa877
clamp: Turn `ifelse` into ternary (#54038)
barucden Apr 13, 2024
4592b4b
add back a function people tend to use in the logging code
May 28, 2024
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
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -61,6 +61,10 @@ $(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$$(bu
julia_flisp.boot.inc.phony: julia-deps
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony

# Build the HTML docs (skipped if already exists, notably in tarballs)
$(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps -o -name *_constants.jl -o -name *_h.jl -o -name version_git.jl \) -prune -o -type f -print)
@$(MAKE) docs

julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
ifeq ($(OS),WINNT)
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
@@ -272,7 +276,7 @@ define stringreplace
endef


install: $(build_depsbindir)/stringreplace docs
install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
mkdir -p $(DESTDIR)$$subdir; \
@@ -530,7 +534,7 @@ app:
darwinframework:
$(MAKE) -C $(JULIAHOME)/contrib/mac/framework

light-source-dist.tmp: docs
light-source-dist.tmp: $(BUILDROOT)/doc/_build/html/en/index.html
ifneq ($(BUILDROOT),$(JULIAHOME))
$(error make light-source-dist does not work in out-of-tree builds)
endif
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ Compiler/Runtime improvements
Command-line option changes
---------------------------

* The entry point for Julia has been standardized to `Main.main(ARGS)`. This must be explicitly opted into using the `@main` macro
* The entry point for Julia has been standardized to `Main.main(args)`. This must be explicitly opted into using the `@main` macro
(see the docstring for further details). When opted-in, and `julia` is invoked to run a script or expression
(i.e. using `julia script.jl` or `julia -e expr`), `julia` will subsequently run the `Main.main` function automatically.
This is intended to unify script and compilation workflows, where code loading may happen
10 changes: 6 additions & 4 deletions base/Base.jl
Original file line number Diff line number Diff line change
@@ -401,8 +401,11 @@ include("weakkeydict.jl")
include("scopedvalues.jl")
using .ScopedValues

# metaprogramming
include("meta.jl")

# Logging
include("logging.jl")
include("logging/logging.jl")
using .CoreLogging

include("env.jl")
@@ -494,9 +497,6 @@ include("irrationals.jl")
include("mathconstants.jl")
using .MathConstants: ℯ, π, pi

# metaprogramming
include("meta.jl")

# Stack frames and traces
include("stacktraces.jl")
using .StackTraces
@@ -633,6 +633,8 @@ function __init__()
if get_bool_env("JULIA_USE_FLISP_PARSER", false) === false
JuliaSyntax.enable_in_core!()
end

CoreLogging.global_logger(CoreLogging.ConsoleLogger())
nothing
end

60 changes: 14 additions & 46 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
@@ -1078,45 +1078,28 @@ function copyto_unaliased!(deststyle::IndexStyle, dest::AbstractArray, srcstyle:
if srcstyle isa IndexLinear
# Single-index implementation
@inbounds for i in srcinds
if isassigned(src, i)
dest[i + Δi] = src[i]
else
_unsetindex!(dest, i + Δi)
end
dest[i + Δi] = src[i]
end
else
# Dual-index implementation
i = idf - 1
@inbounds for a in eachindex(src)
i += 1
if isassigned(src, a)
dest[i] = src[a]
else
_unsetindex!(dest, i)
end
@inbounds for a in src
dest[i+=1] = a
end
end
else
iterdest, itersrc = eachindex(dest), eachindex(src)
if iterdest == itersrc
# Shared-iterator implementation
@inbounds for I in iterdest
if isassigned(src, I)
dest[I] = src[I]
else
_unsetindex!(dest, I)
end
for I in iterdest
@inbounds dest[I] = src[I]
end
else
# Dual-iterator implementation
ret = iterate(iterdest)
@inbounds for a in itersrc
@inbounds for a in src
idx, state = ret::NTuple{2,Any}
if isassigned(src, a)
dest[idx] = src[a]
else
_unsetindex!(dest, idx)
end
dest[idx] = a
ret = iterate(iterdest, state)
end
end
@@ -1145,11 +1128,7 @@ function copyto!(dest::AbstractArray, dstart::Integer,
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
src′ = unalias(dest, src)
@inbounds for i = 0:n-1
if isassigned(src′, sstart+i)
dest[dstart+i] = src′[sstart+i]
else
_unsetindex!(dest, dstart+i)
end
dest[dstart+i] = src′[sstart+i]
end
return dest
end
@@ -1160,7 +1139,7 @@ function copy(a::AbstractArray)
end

function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::AbstractRange{Int},
A::AbstractVecOrMat{S}, ir_src::AbstractRange{Int}, jr_src::AbstractRange{Int}) where {R,S}
A::AbstractVecOrMat{S}, ir_src::AbstractRange{Int}, jr_src::AbstractRange{Int}) where {R,S}
if length(ir_dest) != length(ir_src)
throw(ArgumentError(LazyString("source and destination must have same size (got ",
length(ir_src)," and ",length(ir_dest),")")))
@@ -1473,20 +1452,7 @@ function _setindex!(::IndexCartesian, A::AbstractArray, v, I::Vararg{Int,M}) whe
r
end

function _unsetindex!(A::AbstractArray, i::Integer...)
@_propagate_inbounds_meta
_unsetindex!(A, map(to_index, i)...)
end

function _unsetindex!(A::AbstractArray{T}, i::Int...) where T
# this provides a fallback method which is a no-op if the element is already unassigned
# such that copying into an uninitialized object generally always will work,
# even if the specific custom array type has not implemented `_unsetindex!`
@inline
@boundscheck checkbounds(A, i...)
allocatedinline(T) || @inbounds(!isassigned(A, i...)) || throw(MethodError(_unsetindex!, (A, i...)))
return A
end
_unsetindex!(A::AbstractArray, i::Integer) = _unsetindex!(A, to_index(i))

"""
parent(A)
@@ -1650,13 +1616,15 @@ eltypeof(x::AbstractArray) = eltype(x)

promote_eltypeof() = error()
promote_eltypeof(v1) = eltypeof(v1)
promote_eltypeof(v1, vs...) = promote_type(eltypeof(v1), promote_eltypeof(vs...))
promote_eltypeof(v1, v2) = promote_type(eltypeof(v1), eltypeof(v2))
promote_eltypeof(v1, v2, vs...) = (@inline; afoldl(((::Type{T}, y) where {T}) -> promote_type(T, eltypeof(y)), promote_eltypeof(v1, v2), vs...))
promote_eltypeof(v1::T, vs::T...) where {T} = eltypeof(v1)
promote_eltypeof(v1::AbstractArray{T}, vs::AbstractArray{T}...) where {T} = T

promote_eltype() = error()
promote_eltype(v1) = eltype(v1)
promote_eltype(v1, vs...) = promote_type(eltype(v1), promote_eltype(vs...))
promote_eltype(v1, v2) = promote_type(eltype(v1), eltype(v2))
promote_eltype(v1, v2, vs...) = (@inline; afoldl(((::Type{T}, y) where {T}) -> promote_type(T, eltype(y)), promote_eltype(v1, v2), vs...))
promote_eltype(v1::T, vs::T...) where {T} = eltype(T)
promote_eltype(v1::AbstractArray{T}, vs::AbstractArray{T}...) where {T} = T

7 changes: 1 addition & 6 deletions base/array.jl
Original file line number Diff line number Diff line change
@@ -219,12 +219,7 @@ function _unsetindex!(A::Array, i::Int)
@inbounds _unsetindex!(GenericMemoryRef(A.ref, i))
return A
end
function _unsetindex!(A::Array, i::Int...)
@inline
@boundscheck checkbounds(A, i...)
@inbounds _unsetindex!(A, _to_linear_index(A, i...))
return A
end


# TODO: deprecate this (aligned_sizeof and/or elsize and/or sizeof(Some{T}) are more correct)
elsize(::Type{A}) where {T,A<:Array{T}} = aligned_sizeof(T)
27 changes: 15 additions & 12 deletions base/boot.jl
Original file line number Diff line number Diff line change
@@ -547,19 +547,22 @@ function _checked_mul_dims(m::Int, n::Int)
return a, ovflw
end
function _checked_mul_dims(m::Int, d::Int...)
@_foldable_meta # the compiler needs to know this loop terminates
a = m
i = 1
ovflw = false
while Intrinsics.sle_int(i, nfields(d))
di = getfield(d, i)
b = Intrinsics.checked_smul_int(a, di)
ovflw = Intrinsics.or_int(ovflw, getfield(b, 2))
ovflw = Intrinsics.or_int(ovflw, Intrinsics.ule_int(typemax_Int, di))
a = getfield(b, 1)
i = Intrinsics.add_int(i, 1)
@_foldable_meta # the compiler needs to know this loop terminates
a = m
i = 1
ovflw = false
neg = Intrinsics.ule_int(typemax_Int, m)
zero = false # if m==0 we won't have overflow since we go left to right
while Intrinsics.sle_int(i, nfields(d))
di = getfield(d, i)
b = Intrinsics.checked_smul_int(a, di)
zero = Intrinsics.or_int(zero, di === 0)
ovflw = Intrinsics.or_int(ovflw, getfield(b, 2))
neg = Intrinsics.or_int(neg, Intrinsics.ule_int(typemax_Int, di))
a = getfield(b, 1)
i = Intrinsics.add_int(i, 1)
end
return a, ovflw
return a, Intrinsics.or_int(neg, Intrinsics.and_int(ovflw, Intrinsics.not_int(zero)))
end

# convert a set of dims to a length, with overflow checking
8 changes: 4 additions & 4 deletions base/client.jl
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ function exec_options(opts)
# Load Distributed module only if any of the Distributed options have been specified.
distributed_mode = (opts.worker == 1) || (opts.nprocs > 0) || (opts.machine_file != C_NULL)
if distributed_mode
let Distributed = require_stdlib(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
let Distributed = require(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
Core.eval(MainInclude, :(const Distributed = $Distributed))
Core.eval(Main, :(using Base.MainInclude.Distributed))
end
@@ -575,7 +575,7 @@ The `@main` macro may be used standalone or as part of the function definition,
case, parentheses are required. In particular, the following are equivalent:

```
function (@main)(ARGS)
function (@main)(args)
println("Hello World")
end
```
@@ -594,7 +594,7 @@ imported into `Main`, it will be treated as an entrypoint in `Main`:
```
module MyApp
export main
(@main)(ARGS) = println("Hello World")
(@main)(args) = println("Hello World")
end
using .MyApp
# `julia` Will execute MyApp.main at the conclusion of script execution
@@ -604,7 +604,7 @@ Note that in particular, the semantics do not attach to the method
or the name:
```
module MyApp
(@main)(ARGS) = println("Hello World")
(@main)(args) = println("Hello World")
end
const main = MyApp.main
# `julia` Will *NOT* execute MyApp.main unless there is a separate `@main` annotation in `Main`
31 changes: 14 additions & 17 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
@@ -2574,26 +2574,19 @@ function abstract_eval_statement_expr(interp::AbstractInterpreter, e::Expr, vtyp
t = Bool
effects = EFFECTS_TOTAL
exct = Union{}
isa(sym, Symbol) && (sym = GlobalRef(frame_module(sv), sym))
if isa(sym, SlotNumber) && vtypes !== nothing
vtyp = vtypes[slot_id(sym)]
if vtyp.typ === Bottom
t = Const(false) # never assigned previously
elseif !vtyp.undef
t = Const(true) # definitely assigned previously
end
elseif isa(sym, Symbol)
if isdefined(frame_module(sv), sym)
t = Const(true)
elseif InferenceParams(interp).assume_bindings_static
t = Const(false)
else
effects = Effects(EFFECTS_TOTAL; consistent=ALWAYS_FALSE)
end
elseif isa(sym, GlobalRef)
if isdefined(sym.mod, sym.name)
if InferenceParams(interp).assume_bindings_static
t = Const(isdefined_globalref(sym))
elseif isdefinedconst_globalref(sym)
t = Const(true)
elseif InferenceParams(interp).assume_bindings_static
t = Const(false)
else
effects = Effects(EFFECTS_TOTAL; consistent=ALWAYS_FALSE)
end
@@ -2782,9 +2775,10 @@ function override_effects(effects::Effects, override::EffectsOverride)
end

isdefined_globalref(g::GlobalRef) = !iszero(ccall(:jl_globalref_boundp, Cint, (Any,), g))
isdefinedconst_globalref(g::GlobalRef) = isconst(g) && isdefined_globalref(g)

function abstract_eval_globalref_type(g::GlobalRef)
if isdefined_globalref(g) && isconst(g)
if isdefinedconst_globalref(g)
return Const(ccall(:jl_get_globalref_value, Any, (Any,), g))
end
ty = ccall(:jl_get_binding_type, Any, (Any, Any), g.mod, g.name)
@@ -2803,18 +2797,22 @@ function abstract_eval_globalref(interp::AbstractInterpreter, g::GlobalRef, sv::
if is_mutation_free_argtype(rt)
inaccessiblememonly = ALWAYS_TRUE
end
elseif isdefined_globalref(g)
nothrow = true
elseif InferenceParams(interp).assume_bindings_static
consistent = inaccessiblememonly = ALWAYS_TRUE
rt = Union{}
if isdefined_globalref(g)
nothrow = true
else
rt = Union{}
end
elseif isdefinedconst_globalref(g)
nothrow = true
end
return RTEffects(rt, nothrow ? Union{} : UndefVarError, Effects(EFFECTS_TOTAL; consistent, nothrow, inaccessiblememonly))
end

function handle_global_assignment!(interp::AbstractInterpreter, frame::InferenceState, lhs::GlobalRef, @nospecialize(newty))
effect_free = ALWAYS_FALSE
nothrow = global_assignment_nothrow(lhs.mod, lhs.name, newty)
nothrow = global_assignment_nothrow(lhs.mod, lhs.name, ignorelimited(newty))
inaccessiblememonly = ALWAYS_FALSE
if !nothrow
sub_curr_ssaflag!(frame, IR_FLAG_NOTHROW)
@@ -3019,7 +3017,6 @@ end
return BasicStmtChange(nothing, rt, exct)
end
changes = nothing
stmt = stmt::Expr
hd = stmt.head
if hd === :(=)
(; rt, exct) = abstract_eval_statement(interp, stmt.args[2], pc_vartable, frame)
Loading