Skip to content

Commit b80489b

Browse files
authored
Merge branch 'master' into vc/excise_random
2 parents 6a8e00b + bb7091c commit b80489b

File tree

183 files changed

+6088
-2124
lines changed

Some content is hidden

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

183 files changed

+6088
-2124
lines changed

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Language changes
2323
allows users to safely tear down background state (such as closing Timers and sending
2424
disconnect notifications to heartbeat tasks) and cleanup other resources when the program
2525
wants to begin exiting.
26+
* Code coverage and malloc tracking is no longer generated during the package precompilation stage.
27+
Further, during these modes pkgimage caches are now used for packages that are not being tracked.
28+
Meaning that coverage testing (the default for `julia-actions/julia-runtest`) will by default use
29+
pkgimage caches for all other packages than the package being tested, likely meaning faster test
30+
execution. ([#52123])
2631

2732
Compiler/Runtime improvements
2833
-----------------------------
@@ -49,6 +54,7 @@ Build system changes
4954
New library functions
5055
---------------------
5156

57+
* `in!(x, s::AbstractSet)` will return whether `x` is in `s`, and insert `x` in `s` if not.
5258
* The new `Libc.mkfifo` function wraps the `mkfifo` C function on Unix platforms ([#34587]).
5359
* `hardlink(src, dst)` can be used to create hard links ([#41639]).
5460
* `diskstat(path=pwd())` can be used to return statistics about the disk ([#42248]).
@@ -58,6 +64,9 @@ New library functions
5864

5965
New library features
6066
--------------------
67+
68+
* `invmod(n, T)` where `T` is a native integer type now computes the modular inverse of `n` in the modular integer ring that `T` defines ([#52180]).
69+
* `invmod(n)` is an abbreviation for `invmod(n, typeof(n))` for native integer types ([#52180]).
6170
* `replace(string, pattern...)` now supports an optional `IO` argument to
6271
write the output to a stream rather than returning a string ([#48625]).
6372
* `sizehint!(s, n)` now supports an optional `shrink` argument to disable shrinking ([#51929]).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ and then use the command prompt to change into the resulting julia directory. By
9393
Julia. However, most users should use the [most recent stable version](https://github.com/JuliaLang/julia/releases)
9494
of Julia. You can get this version by running:
9595

96-
git checkout v1.9.3
96+
git checkout v1.9.4
9797

9898
To build the `julia` executable, run `make` from within the julia directory.
9999

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ julia> firstindex(rand(3,4,5), 2)
446446
firstindex(a::AbstractArray) = (@inline; first(eachindex(IndexLinear(), a)))
447447
firstindex(a, d) = (@inline; first(axes(a, d)))
448448

449-
first(a::AbstractArray) = a[first(eachindex(a))]
449+
@propagate_inbounds first(a::AbstractArray) = a[first(eachindex(a))]
450450

451451
"""
452452
first(coll)

base/array.jl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ const DenseVecOrMat{T} = Union{DenseVector{T}, DenseMatrix{T}}
124124
@_safeindex
125125
126126
This internal macro converts:
127-
- `getindex(xs::Tuple, )` -> `__inbounds_getindex(args...)`
128-
- `setindex!(xs::Vector, args...)` -> `__inbounds_setindex!(xs, args...)`
127+
- `getindex(xs::Tuple, i::Int)` -> `__safe_getindex(xs, i)`
128+
- `setindex!(xs::Vector{T}, x, i::Int)` -> `__safe_setindex!(xs, x, i)`
129129
to tell the compiler that indexing operations within the applied expression are always
130130
inbounds and do not need to taint `:consistent` and `:nothrow`.
131131
"""
@@ -143,10 +143,10 @@ function _safeindex(__module__, ex)
143143
for i = 2:length(lhs.args)
144144
args[i-1] = _safeindex(__module__, lhs.args[i])
145145
end
146-
return Expr(:call, GlobalRef(__module__, :__inbounds_setindex!), xs, _safeindex(__module__, rhs), args...)
146+
return Expr(:call, GlobalRef(__module__, :__safe_setindex!), xs, _safeindex(__module__, rhs), args...)
147147
end
148148
elseif ex.head === :ref # xs[i]
149-
return Expr(:call, GlobalRef(__module__, :__inbounds_getindex), ex.args...)
149+
return Expr(:call, GlobalRef(__module__, :__safe_getindex), ex.args...)
150150
end
151151
args = Vector{Any}(undef, length(ex.args))
152152
for i = 1:length(ex.args)
@@ -236,13 +236,15 @@ sizeof(a::Array) = length(a) * elsize(typeof(a)) # n.b. this ignores bitsunion b
236236

237237
function isassigned(a::Array, i::Int...)
238238
@inline
239+
@_noub_if_noinbounds_meta
239240
@boundscheck checkbounds(Bool, a, i...) || return false
240241
ii = _sub2ind(size(a), i...)
241242
return @inbounds isassigned(memoryref(a.ref, ii, false))
242243
end
243244

244245
function isassigned(a::Vector, i::Int) # slight compiler simplification for the most common case
245246
@inline
247+
@_noub_if_noinbounds_meta
246248
@boundscheck checkbounds(Bool, a, i) || return false
247249
return @inbounds isassigned(memoryref(a.ref, i, false))
248250
end
@@ -962,29 +964,25 @@ Dict{String, Int64} with 2 entries:
962964
function setindex! end
963965

964966
function setindex!(A::Array{T}, x, i::Int) where {T}
967+
@_noub_if_noinbounds_meta
965968
@boundscheck (i - 1)%UInt < length(A)%UInt || throw_boundserror(A, (i,))
966969
memoryrefset!(memoryref(A.ref, i, false), x isa T ? x : convert(T,x)::T, :not_atomic, false)
967970
return A
968971
end
969972
function setindex!(A::Array{T}, x, i1::Int, i2::Int, I::Int...) where {T}
970973
@inline
974+
@_noub_if_noinbounds_meta
971975
@boundscheck checkbounds(A, i1, i2, I...) # generally _to_linear_index requires bounds checking
972976
memoryrefset!(memoryref(A.ref, _to_linear_index(A, i1, i2, I...), false), x isa T ? x : convert(T,x)::T, :not_atomic, false)
973977
return A
974978
end
975979

976-
function __inbounds_setindex!(A::Array{T}, x, i::Int) where {T}
977-
@inline
978-
val = x isa T ? x : convert(T,x)::T
979-
memoryrefset!(memoryref(A.ref, i, false), val, :not_atomic, false)
980-
return A
981-
end
982-
function __inbounds_setindex!(A::Array{T}, x, i1::Int, i2::Int, I::Int...) where {T}
983-
@inline
984-
val = x isa T ? x : convert(T,x)::T
985-
memoryrefset!(memoryref(A.ref, _to_linear_index(A, i1, i2, I...), false), val, :not_atomic, false)
986-
return A
987-
end
980+
__safe_setindex!(A::Vector{Any}, @nospecialize(x), i::Int) = (@inline; @_nothrow_noub_meta;
981+
memoryrefset!(memoryref(A.ref, i, false), x, :not_atomic, false); return A)
982+
__safe_setindex!(A::Vector{T}, x::T, i::Int) where {T} = (@inline; @_nothrow_noub_meta;
983+
memoryrefset!(memoryref(A.ref, i, false), x, :not_atomic, false); return A)
984+
__safe_setindex!(A::Vector{T}, x, i::Int) where {T} = (@inline;
985+
__safe_setindex!(A, convert(T, x)::T, i))
988986

989987
# This is redundant with the abstract fallbacks but needed and helpful for bootstrap
990988
function setindex!(A::Array, X::AbstractArray, I::AbstractVector{Int})

base/boot.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ macro _foldable_meta()
281281
#=:terminates_locally=#false,
282282
#=:notaskstate=#true,
283283
#=:inaccessiblememonly=#true,
284-
#=:noub=#true))
284+
#=:noub=#true,
285+
#=:noub_if_noinbounds=#false))
285286
end
286287

287288
macro inline() Expr(:meta, :inline) end
@@ -412,6 +413,8 @@ struct InitError <: WrappedException
412413
error
413414
end
414415

416+
struct PrecompilableError <: Exception end
417+
415418
String(s::String) = s # no constructor yet
416419

417420
const Cvoid = Nothing
@@ -456,6 +459,7 @@ eval(Core, quote
456459
ReturnNode(@nospecialize val) = $(Expr(:new, :ReturnNode, :val))
457460
ReturnNode() = $(Expr(:new, :ReturnNode)) # unassigned val indicates unreachable
458461
GotoIfNot(@nospecialize(cond), dest::Int) = $(Expr(:new, :GotoIfNot, :cond, :dest))
462+
EnterNode(dest::Int) = $(Expr(:new, :EnterNode, :dest))
459463
LineNumberNode(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))
460464
function LineNumberNode(l::Int, @nospecialize(f))
461465
isa(f, String) && (f = Symbol(f))
@@ -478,14 +482,14 @@ eval(Core, quote
478482
end)
479483

480484
function CodeInstance(
481-
mi::MethodInstance, @nospecialize(rettype), @nospecialize(inferred_const),
485+
mi::MethodInstance, @nospecialize(rettype), @nospecialize(exctype), @nospecialize(inferred_const),
482486
@nospecialize(inferred), const_flags::Int32, min_world::UInt, max_world::UInt,
483-
ipo_effects::UInt32, effects::UInt32, @nospecialize(argescapes#=::Union{Nothing,Vector{ArgEscapeInfo}}=#),
487+
ipo_effects::UInt32, effects::UInt32, @nospecialize(analysis_results),
484488
relocatability::UInt8)
485489
return ccall(:jl_new_codeinst, Ref{CodeInstance},
486-
(Any, Any, Any, Any, Int32, UInt, UInt, UInt32, UInt32, Any, UInt8),
487-
mi, rettype, inferred_const, inferred, const_flags, min_world, max_world,
488-
ipo_effects, effects, argescapes,
490+
(Any, Any, Any, Any, Any, Int32, UInt, UInt, UInt32, UInt32, Any, UInt8),
491+
mi, rettype, exctype, inferred_const, inferred, const_flags, min_world, max_world,
492+
ipo_effects, effects, analysis_results,
489493
relocatability)
490494
end
491495
GlobalRef(m::Module, s::Symbol) = ccall(:jl_module_globalref, Ref{GlobalRef}, (Any, Any), m, s)
@@ -623,12 +627,12 @@ module IR
623627
export CodeInfo, MethodInstance, CodeInstance, GotoNode, GotoIfNot, ReturnNode,
624628
NewvarNode, SSAValue, SlotNumber, Argument,
625629
PiNode, PhiNode, PhiCNode, UpsilonNode, LineInfoNode,
626-
Const, PartialStruct, InterConditional
630+
Const, PartialStruct, InterConditional, EnterNode
627631

628632
using Core: CodeInfo, MethodInstance, CodeInstance, GotoNode, GotoIfNot, ReturnNode,
629633
NewvarNode, SSAValue, SlotNumber, Argument,
630634
PiNode, PhiNode, PhiCNode, UpsilonNode, LineInfoNode,
631-
Const, PartialStruct, InterConditional
635+
Const, PartialStruct, InterConditional, EnterNode
632636

633637
end # module IR
634638

@@ -953,7 +957,6 @@ function _hasmethod(@nospecialize(tt)) # this function has a special tfunc
953957
return Intrinsics.not_int(ccall(:jl_gf_invoke_lookup, Any, (Any, Any, UInt), tt, nothing, world) === nothing)
954958
end
955959

956-
957960
# for backward compat
958961
arrayref(inbounds::Bool, A::Array, i::Int...) = Main.Base.getindex(A, i...)
959962
const_arrayref(inbounds::Bool, A::Array, i::Int...) = Main.Base.getindex(A, i...)
@@ -962,4 +965,9 @@ arraysize(a::Array) = a.size
962965
arraysize(a::Array, i::Int) = sle_int(i, nfields(a.size)) ? getfield(a.size, i) : 1
963966
export arrayref, arrayset, arraysize, const_arrayref
964967

968+
# For convenience
969+
EnterNode(old::EnterNode, new_dest::Int) = EnterNode(new_dest)
970+
971+
include(Core, "optimized_generics.jl")
972+
965973
ccall(:jl_set_istopmod, Cvoid, (Any, Bool), Core, true)

base/c.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,6 @@ macro ccall(expr)
409409
return ccall_macro_lower(:ccall, ccall_macro_parse(expr)...)
410410
end
411411

412-
macro ccall_effects(effects::UInt8, expr)
412+
macro ccall_effects(effects::UInt16, expr)
413413
return ccall_macro_lower((:ccall, effects), ccall_macro_parse(expr)...)
414414
end

0 commit comments

Comments
 (0)