diff --git a/.github/workflows/statuses.yml b/.github/workflows/statuses.yml index 16c07f0f040cc..36a694a7c6d20 100644 --- a/.github/workflows/statuses.yml +++ b/.github/workflows/statuses.yml @@ -48,7 +48,6 @@ jobs: - run: | declare -a CONTEXT_LIST=( "buildbot/tester_freebsd64" - "buildbot/tester_macos64" "buildbot/tester_win32" "buildbot/tester_win64" ) diff --git a/base/array.jl b/base/array.jl index baef032f96b3f..be9eda37a2396 100644 --- a/base/array.jl +++ b/base/array.jl @@ -2308,7 +2308,7 @@ findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p # Broadcasting is much faster for small testf, and computing # integer indices from logical index using findall has a negligible cost -findall(testf::Function, A::AbstractArray) = findall(testf.(A)) +findall(testf::F, A::AbstractArray) where {F<:Function} = findall(testf.(A)) """ findall(A) diff --git a/base/binaryplatforms.jl b/base/binaryplatforms.jl index e2dda00bf58e7..d70cca9c48e39 100644 --- a/base/binaryplatforms.jl +++ b/base/binaryplatforms.jl @@ -1027,7 +1027,7 @@ function platforms_match(a::AbstractPlatform, b::AbstractPlatform) # Call the comparator, passing in which objects requested this comparison (one, the other, or both) # For some comparators this doesn't matter, but for non-symmetrical comparisons, it does. - if !comparator(ak, bk, a_comp == comparator, b_comp == comparator) + if !(comparator(ak, bk, a_comp == comparator, b_comp == comparator)::Bool) return false end end diff --git a/base/compiler/abstractinterpretation.jl b/base/compiler/abstractinterpretation.jl index 98bcfa4f18661..fae3def38c34d 100644 --- a/base/compiler/abstractinterpretation.jl +++ b/base/compiler/abstractinterpretation.jl @@ -111,7 +111,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f), result = abstract_call_method(interp, method, sig_n, svec(), multiple_matches, sv) rt = result.rt edge = result.edge - edge !== nothing && push!(edges, edge) + edge === nothing || push!(edges, edge) this_argtypes = isa(matches, MethodMatches) ? argtypes : matches.applicable_argtypes[i] this_arginfo = ArgInfo(fargs, this_argtypes) const_call_result = abstract_call_method_with_const_args(interp, result, @@ -136,25 +136,11 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f), this_conditional = ignorelimited(this_rt) this_rt = widenwrappedconditional(this_rt) else - if infer_compilation_signature(interp) - # Also infer the compilation signature for this method, so it's available - # to the compiler in case it ends up needing it (which is likely). - csig = get_compileable_sig(method, sig, match.sparams) - if csig !== nothing && csig !== sig - # The result of this inference is not directly used, so temporarily empty - # the use set for the current SSA value. - saved_uses = sv.ssavalue_uses[sv.currpc] - sv.ssavalue_uses[sv.currpc] = empty_bitset - abstract_call_method(interp, method, csig, match.sparams, multiple_matches, sv) - sv.ssavalue_uses[sv.currpc] = saved_uses - end - end - result = abstract_call_method(interp, method, sig, match.sparams, multiple_matches, sv) this_conditional = ignorelimited(result.rt) this_rt = widenwrappedconditional(result.rt) edge = result.edge - edge !== nothing && push!(edges, edge) + edge === nothing || push!(edges, edge) # try constant propagation with argtypes for this match # this is in preparation for inlining, or improving the return result this_argtypes = isa(matches, MethodMatches) ? argtypes : matches.applicable_argtypes[i] @@ -214,6 +200,26 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f), rettype = from_interprocedural!(rettype, sv, arginfo, conditionals) + # Also considering inferring the compilation signature for this method, so + # it is available to the compiler in case it ends up needing it. + if infer_compilation_signature(interp) && 1 == seen == napplicable && rettype !== Any && rettype !== Union{} && !is_removable_if_unused(all_effects) + match = applicable[1]::MethodMatch + method = match.method + sig = match.spec_types + mi = specialize_method(match; preexisting=true) + if mi !== nothing && !const_prop_methodinstance_heuristic(interp, match, mi::MethodInstance, arginfo, sv) + csig = get_compileable_sig(method, sig, match.sparams) + if csig !== nothing && csig !== sig + # The result of this inference is not directly used, so temporarily empty + # the use set for the current SSA value. + saved_uses = sv.ssavalue_uses[sv.currpc] + sv.ssavalue_uses[sv.currpc] = empty_bitset + abstract_call_method(interp, method, csig, match.sparams, multiple_matches, sv) + sv.ssavalue_uses[sv.currpc] = saved_uses + end + end + end + if call_result_unused(sv) && !(rettype === Bottom) add_remark!(interp, sv, "Call result type was widened because the return value is unused") # We're mainly only here because the optimizer might want this code, @@ -765,13 +771,25 @@ function collect_const_args((; argtypes)::ArgInfo) isa(a, Const) ? a.val : isconstType(a) ? (a::DataType).parameters[1] : (a::DataType).instance - end for i in 2:length(argtypes) ] + end for i = 2:length(argtypes) ] +end + +struct InvokeCall + types # ::Type + lookupsig # ::Type + InvokeCall(@nospecialize(types), @nospecialize(lookupsig)) = new(types, lookupsig) end function concrete_eval_call(interp::AbstractInterpreter, - @nospecialize(f), result::MethodCallResult, arginfo::ArgInfo, sv::InferenceState) + @nospecialize(f), result::MethodCallResult, arginfo::ArgInfo, sv::InferenceState, + invokecall::Union{Nothing,InvokeCall}=nothing) concrete_eval_eligible(interp, f, result, arginfo, sv) || return nothing args = collect_const_args(arginfo) + if invokecall !== nothing + # this call should be `invoke`d, rewrite `args` back now + pushfirst!(args, f, invokecall.types) + f = invoke + end world = get_world_counter(interp) value = try Core._call_in_world_total(world, f, args...) @@ -811,13 +829,13 @@ struct ConstCallResults new(rt, const_result, effects) end -function abstract_call_method_with_const_args(interp::AbstractInterpreter, result::MethodCallResult, - @nospecialize(f), arginfo::ArgInfo, match::MethodMatch, - sv::InferenceState) +function abstract_call_method_with_const_args(interp::AbstractInterpreter, + result::MethodCallResult, @nospecialize(f), arginfo::ArgInfo, match::MethodMatch, + sv::InferenceState, invokecall::Union{Nothing,InvokeCall}=nothing) if !const_prop_enabled(interp, sv, match) return nothing end - val = concrete_eval_call(interp, f, result, arginfo, sv) + val = concrete_eval_call(interp, f, result, arginfo, sv, invokecall) if val !== nothing add_backedge!(result.edge, sv) return val @@ -1547,10 +1565,10 @@ function abstract_invoke(interp::AbstractInterpreter, (; fargs, argtypes)::ArgIn nargtype isa DataType || return CallMeta(Any, Effects(), false) # other cases are not implemented below isdispatchelem(ft) || return CallMeta(Any, Effects(), false) # check that we might not have a subtype of `ft` at runtime, before doing supertype lookup below ft = ft::DataType - types = rewrap_unionall(Tuple{ft, unwrap_unionall(types).parameters...}, types)::Type + lookupsig = rewrap_unionall(Tuple{ft, unwrap_unionall(types).parameters...}, types)::Type nargtype = Tuple{ft, nargtype.parameters...} argtype = Tuple{ft, argtype.parameters...} - match, valid_worlds, overlayed = findsup(types, method_table(interp)) + match, valid_worlds, overlayed = findsup(lookupsig, method_table(interp)) match === nothing && return CallMeta(Any, Effects(), false) update_valid_age!(sv, valid_worlds) method = match.method @@ -1569,8 +1587,10 @@ function abstract_invoke(interp::AbstractInterpreter, (; fargs, argtypes)::ArgIn # t, a = ti.parameters[i], argtypes′[i] # argtypes′[i] = t ⊑ a ? t : a # end - const_call_result = abstract_call_method_with_const_args(interp, result, - overlayed ? nothing : singleton_type(ft′), arginfo, match, sv) + f = overlayed ? nothing : singleton_type(ft′) + invokecall = InvokeCall(types, lookupsig) + const_call_result = abstract_call_method_with_const_args(interp, + result, f, arginfo, match, sv, invokecall) const_result = nothing if const_call_result !== nothing if const_call_result.rt ⊑ rt diff --git a/base/compiler/methodtable.jl b/base/compiler/methodtable.jl index 8b3968332e2e8..705db11b33f8a 100644 --- a/base/compiler/methodtable.jl +++ b/base/compiler/methodtable.jl @@ -44,6 +44,12 @@ struct OverlayMethodTable <: MethodTableView mt::Core.MethodTable end +struct MethodMatchKey + sig # ::Type + limit::Int + MethodMatchKey(@nospecialize(sig), limit::Int) = new(sig, limit) +end + """ struct CachedMethodTable <: MethodTableView @@ -51,10 +57,10 @@ Overlays another method table view with an additional local fast path cache that can respond to repeated, identical queries faster than the original method table. """ struct CachedMethodTable{T} <: MethodTableView - cache::IdDict{Any, Union{Missing, MethodMatchResult}} + cache::IdDict{MethodMatchKey, Union{Missing,MethodMatchResult}} table::T end -CachedMethodTable(table::T) where T = CachedMethodTable{T}(IdDict{Any, Union{Missing, MethodMatchResult}}(), table) +CachedMethodTable(table::T) where T = CachedMethodTable{T}(IdDict{MethodMatchKey, Union{Missing,MethodMatchResult}}(), table) """ findall(sig::Type, view::MethodTableView; limit::Int=typemax(Int)) -> @@ -109,9 +115,11 @@ function findall(@nospecialize(sig::Type), table::CachedMethodTable; limit::Int= # as for concrete types, we cache result at on the next level return findall(sig, table.table; limit) end - box = Core.Box(sig) - return get!(table.cache, sig) do - findall(box.contents, table.table; limit) + key = MethodMatchKey(sig, limit) + if haskey(table.cache, key) + return table.cache[key] + else + return table.cache[key] = findall(sig, table.table; limit) end end diff --git a/base/compiler/ssair/inlining.jl b/base/compiler/ssair/inlining.jl index e51581e62569d..70e7038bbb8cc 100644 --- a/base/compiler/ssair/inlining.jl +++ b/base/compiler/ssair/inlining.jl @@ -1066,6 +1066,11 @@ function inline_invoke!( return nothing end +function invoke_signature(invokesig::Vector{Any}) + ft, argtyps = widenconst(invokesig[2]), instanceof_tfunc(widenconst(invokesig[3]))[1] + return rewrap_unionall(Tuple{ft, unwrap_unionall(argtyps).parameters...}, argtyps) +end + function narrow_opaque_closure!(ir::IRCode, stmt::Expr, @nospecialize(info), state::InliningState) if isa(info, OpaqueClosureCreateInfo) lbt = argextype(stmt.args[2], ir) diff --git a/base/gmp.jl b/base/gmp.jl index 435a0a0954ce9..59ab162429e87 100644 --- a/base/gmp.jl +++ b/base/gmp.jl @@ -667,8 +667,12 @@ function prod(arr::AbstractArray{BigInt}) # to account for the rounding to limbs in MPZ.mul! # (BITS_PER_LIMB-1 would typically be enough, to which we add # 1 for the initial multiplication by init=1 in foldl) - nbits = GC.@preserve arr sum(arr; init=BITS_PER_LIMB) do x - abs(x.size) * BITS_PER_LIMB - leading_zeros(unsafe_load(x.d)) + nbits = BITS_PER_LIMB + for x in arr + iszero(x) && return zero(BigInt) + xsize = abs(x.size) + lz = GC.@preserve x leading_zeros(unsafe_load(x.d, xsize)) + nbits += xsize * BITS_PER_LIMB - lz end init = BigInt(; nbits) MPZ.set_si!(init, 1) diff --git a/base/loading.jl b/base/loading.jl index 71e464f49eda5..8625db41df0a2 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1587,12 +1587,14 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, concrete_d deps_eltype = sprint(show, eltype(concrete_deps); context = :module=>nothing) deps = deps_eltype * "[" * join(deps_strs, ",") * "]" trace = isassigned(PRECOMPILE_TRACE_COMPILE) ? `--trace-compile=$(PRECOMPILE_TRACE_COMPILE[])` : `` - io = open(pipeline(`$(julia_cmd()::Cmd) -O0 - --output-ji $output --output-incremental=yes - --startup-file=no --history-file=no --warn-overwrite=yes - --color=$(have_color === nothing ? "auto" : have_color ? "yes" : "no") - $trace - -`, stderr = internal_stderr, stdout = internal_stdout), + io = open(pipeline(addenv(`$(julia_cmd()::Cmd) -O0 + --output-ji $output --output-incremental=yes + --startup-file=no --history-file=no --warn-overwrite=yes + --color=$(have_color === nothing ? "auto" : have_color ? "yes" : "no") + $trace + -`, + "OPENBLAS_NUM_THREADS" => 1), + stderr = internal_stderr, stdout = internal_stdout), "w", stdout) # write data over stdin to avoid the (unlikely) case of exceeding max command line size write(io.in, """ diff --git a/base/namedtuple.jl b/base/namedtuple.jl index 050d460f24724..2157975ba30d1 100644 --- a/base/namedtuple.jl +++ b/base/namedtuple.jl @@ -111,7 +111,8 @@ function NamedTuple{names}(nt::NamedTuple) where {names} types = Tuple{(fieldtype(nt, idx[n]) for n in 1:length(idx))...} Expr(:new, :(NamedTuple{names, $types}), Any[ :(getfield(nt, $(idx[n]))) for n in 1:length(idx) ]...) else - types = Tuple{(fieldtype(typeof(nt), names[n]) for n in 1:length(names))...} + length_names = length(names)::Integer + types = Tuple{(fieldtype(typeof(nt), names[n]) for n in 1:length_names)...} NamedTuple{names, types}(map(Fix1(getfield, nt), names)) end end @@ -318,8 +319,8 @@ values(nt::NamedTuple) = Tuple(nt) haskey(nt::NamedTuple, key::Union{Integer, Symbol}) = isdefined(nt, key) get(nt::NamedTuple, key::Union{Integer, Symbol}, default) = haskey(nt, key) ? getfield(nt, key) : default get(f::Callable, nt::NamedTuple, key::Union{Integer, Symbol}) = haskey(nt, key) ? getfield(nt, key) : f() -tail(t::NamedTuple{names}) where names = NamedTuple{tail(names)}(t) -front(t::NamedTuple{names}) where names = NamedTuple{front(names)}(t) +tail(t::NamedTuple{names}) where names = NamedTuple{tail(names::Tuple)}(t) +front(t::NamedTuple{names}) where names = NamedTuple{front(names::Tuple)}(t) @pure function diff_names(an::Tuple{Vararg{Symbol}}, bn::Tuple{Vararg{Symbol}}) @nospecialize an bn diff --git a/base/ordering.jl b/base/ordering.jl index e49102159c962..d0c9cb99f9c72 100644 --- a/base/ordering.jl +++ b/base/ordering.jl @@ -122,7 +122,7 @@ lt(o::Lt, a, b) = o.lt(a,b) @propagate_inbounds function lt(p::Perm, a::Integer, b::Integer) da = p.data[a] db = p.data[b] - lt(p.order, da, db) | (!lt(p.order, db, da) & (a < b)) + (lt(p.order, da, db)::Bool) | (!(lt(p.order, db, da)::Bool) & (a < b)) end _ord(lt::typeof(isless), by::typeof(identity), order::Ordering) = order diff --git a/base/permuteddimsarray.jl b/base/permuteddimsarray.jl index ea966c44efc38..1c524449850b8 100644 --- a/base/permuteddimsarray.jl +++ b/base/permuteddimsarray.jl @@ -263,11 +263,21 @@ end P end -function Base._mapreduce_dim(f, op, init::Base._InitialValue, A::PermutedDimsArray, dims::Colon) +const CommutativeOps = Union{typeof(+),typeof(Base.add_sum),typeof(min),typeof(max),typeof(Base._extrema_rf),typeof(|),typeof(&)} + +function Base._mapreduce_dim(f, op::CommutativeOps, init::Base._InitialValue, A::PermutedDimsArray, dims::Colon) + Base._mapreduce_dim(f, op, init, parent(A), dims) +end +function Base._mapreduce_dim(f::typeof(identity), op::Union{typeof(Base.mul_prod),typeof(*)}, init::Base._InitialValue, A::PermutedDimsArray{<:Union{Real,Complex}}, dims::Colon) Base._mapreduce_dim(f, op, init, parent(A), dims) end -function Base.mapreducedim!(f, op, B::AbstractArray{T,N}, A::PermutedDimsArray{T,N,perm,iperm}) where {T,N,perm,iperm} +function Base.mapreducedim!(f, op::CommutativeOps, B::AbstractArray{T,N}, A::PermutedDimsArray{S,N,perm,iperm}) where {T,S,N,perm,iperm} + C = PermutedDimsArray{T,N,iperm,perm,typeof(B)}(B) # make the inverse permutation for the output + Base.mapreducedim!(f, op, C, parent(A)) + B +end +function Base.mapreducedim!(f::typeof(identity), op::Union{typeof(Base.mul_prod),typeof(*)}, B::AbstractArray{T,N}, A::PermutedDimsArray{<:Union{Real,Complex},N,perm,iperm}) where {T,N,perm,iperm} C = PermutedDimsArray{T,N,iperm,perm,typeof(B)}(B) # make the inverse permutation for the output Base.mapreducedim!(f, op, C, parent(A)) B diff --git a/base/process.jl b/base/process.jl index 016c495a76a8b..719d1d5436ada 100644 --- a/base/process.jl +++ b/base/process.jl @@ -430,7 +430,7 @@ function open(f::Function, cmds::AbstractCmd, args...; kwargs...) rethrow() end close(P.in) - if !eof(P.out) + if !(eof(P.out)::Bool) waitkill(P) throw(_UVError("open(do)", UV_EPIPE)) end diff --git a/base/sort.jl b/base/sort.jl index b9c22e396db2c..b538428a8c424 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -496,7 +496,8 @@ const SMALL_ALGORITHM = InsertionSort const SMALL_THRESHOLD = 20 function sort!(v::AbstractVector, lo::Integer, hi::Integer, ::InsertionSortAlg, o::Ordering) - @inbounds for i = lo+1:hi + lo_plus_1 = (lo + 1)::Integer + @inbounds for i = lo_plus_1:hi j = i x = v[i] while j > lo diff --git a/base/special/exp.jl b/base/special/exp.jl index e955d182f29d3..cc4c8eee3323d 100644 --- a/base/special/exp.jl +++ b/base/special/exp.jl @@ -177,7 +177,7 @@ const J_TABLE = (0x0000000000000000, 0xaac00b1afa5abcbe, 0x9b60163da9fb3335, 0xa # XXX we want to mark :consistent-cy here so that this function can be concrete-folded, # because the effect analysis currently can't prove it in the presence of `@inbounds` or # `:boundscheck`, but still the access to `J_TABLE` is really safe here -@noinline Base.@assume_effects :consistent @inline function table_unpack(ind::Int32) +Base.@assume_effects :consistent function table_unpack(ind::Int32) ind = ind & 255 + 1 # 255 == length(J_TABLE) - 1 j = @inbounds J_TABLE[ind] jU = reinterpret(Float64, JU_CONST | (j&JU_MASK)) diff --git a/base/stream.jl b/base/stream.jl index cee4894b28c3c..b93e17707f6a6 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -409,7 +409,7 @@ function wait_readnb(x::LibuvStream, nb::Int) while bytesavailable(x.buffer) < nb x.readerror === nothing || throw(x.readerror) isopen(x) || break - x.status != StatusEOF || break + x.status == StatusEOF && break x.throttle = max(nb, x.throttle) start_reading(x) # ensure we are reading iolock_end() @@ -662,9 +662,11 @@ function uv_readcb(handle::Ptr{Cvoid}, nread::Cssize_t, buf::Ptr{Cvoid}) elseif nread == UV_EOF # libuv called uv_stop_reading already if stream.status != StatusClosing stream.status = StatusEOF - if stream isa TTY # TODO: || ccall(:uv_is_writable, Cint, (Ptr{Cvoid},), stream.handle) != 0 - # stream can still be used either by reseteof # TODO: or write - notify(stream.cond) + notify(stream.cond) + if stream isa TTY + # stream can still be used by reseteof (or possibly write) + elseif !(stream isa PipeEndpoint) && ccall(:uv_is_writable, Cint, (Ptr{Cvoid},), stream.handle) != 0 + # stream can still be used by write else # underlying stream is no longer useful: begin finalization ccall(:jl_close_uv, Cvoid, (Ptr{Cvoid},), stream.handle) @@ -673,6 +675,7 @@ function uv_readcb(handle::Ptr{Cvoid}, nread::Cssize_t, buf::Ptr{Cvoid}) end else stream.readerror = _UVError("read", nread) + notify(stream.cond) # This is a fatal connection error ccall(:jl_close_uv, Cvoid, (Ptr{Cvoid},), stream.handle) stream.status = StatusClosing diff --git a/base/sysinfo.jl b/base/sysinfo.jl index f0852f32fc17d..62241457f8954 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -20,6 +20,8 @@ export BINDIR, loadavg, free_memory, total_memory, + physical_free_memory, + physical_total_memory, isapple, isbsd, isdragonfly, @@ -246,19 +248,44 @@ function loadavg() return loadavg_ end +""" + Sys.free_physical_memory() + +Get the free memory of the system in bytes. The entire amount may not be available to the +current process; use `Sys.free_memory()` for the actually available amount. +""" +free_physical_memory() = ccall(:uv_get_free_memory, UInt64, ()) + +""" + Sys.total_physical_memory() + +Get the total memory in RAM (including that which is currently used) in bytes. The entire +amount may not be available to the current process; see `Sys.total_memory()`. +""" +total_physical_memory() = ccall(:uv_get_total_memory, UInt64, ()) + """ Sys.free_memory() Get the total free memory in RAM in bytes. """ -free_memory() = ccall(:uv_get_free_memory, UInt64, ()) +free_memory() = ccall(:uv_get_available_memory, UInt64, ()) """ Sys.total_memory() Get the total memory in RAM (including that which is currently used) in bytes. +This amount may be constrained, e.g., by Linux control groups. For the unconstrained +amount, see `Sys.physical_memory()`. """ -total_memory() = ccall(:uv_get_total_memory, UInt64, ()) +function total_memory() + memory = ccall(:uv_get_constrained_memory, UInt64, ()) + if memory == 0 + return total_physical_memory() + else + return memory + end +end """ Sys.get_process_title() diff --git a/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/md5 b/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/md5 new file mode 100644 index 0000000000000..23240c5a01673 --- /dev/null +++ b/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/md5 @@ -0,0 +1 @@ +8bd9c967dc50430afdd890b967b2d776 diff --git a/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/sha512 b/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/sha512 new file mode 100644 index 0000000000000..a808d9ea4410b --- /dev/null +++ b/deps/checksums/Pkg-0027cb18c39dfa2f0bf649fda654315e11be7bc3.tar.gz/sha512 @@ -0,0 +1 @@ +f6ada1d6bd99b25edd4411100cb8adb2918c2e58b4e33d2623c1044009f815f2addeeab3f519cf0e60d0eabaf66f1c8d45c6bd45a86837c9f3377b808483e849 diff --git a/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/md5 b/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/md5 deleted file mode 100644 index 5d95a7b01b6c7..0000000000000 --- a/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -682606d3308f82eaca8c33fe1f0bd083 diff --git a/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/sha512 b/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/sha512 deleted file mode 100644 index c4f3205f38150..0000000000000 --- a/deps/checksums/Pkg-03e3bad8ef894f5a8b0edcfb00e4025173652b2b.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -9de41dced83f007cc425acde3ca1a8646d30dceb8f071381820fac0f5bf57ed58fe1aed0be09317084c5b8abb7a415921f2f22c9517dd610748de53cd5046baa diff --git a/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/md5 b/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/md5 deleted file mode 100644 index 60ff3e45e5336..0000000000000 --- a/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -faf67b4fe8308fc6f9d7ed9bfbd855a9 diff --git a/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/sha512 b/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/sha512 deleted file mode 100644 index b2e786c204e70..0000000000000 --- a/deps/checksums/Tar-0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -d97bd68d6d651ec13f399f9124cc0abba7092532b467fdcbb9c886f5f3d121e79392bfce7c6e631178ff175131360415a98645661da0f9c83f27db50691ce133 diff --git a/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/md5 b/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/md5 new file mode 100644 index 0000000000000..bddd86b3a714c --- /dev/null +++ b/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/md5 @@ -0,0 +1 @@ +47f02b8f77000fc3aa53c48fadc07f58 diff --git a/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/sha512 b/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/sha512 new file mode 100644 index 0000000000000..bc3e07d23b5a9 --- /dev/null +++ b/deps/checksums/Tar-c9e71856688bffacda56e1e2926a741bbb6e4784.tar.gz/sha512 @@ -0,0 +1 @@ +0aa074c752083c7c1357060c34e161356fcbe9bc27a2dd9bf1c5f0f51fe7bf2ea1b6dc2227c873a2605fa28332e98ff1fb1077f7870dc3e944590e47e38b7f6b diff --git a/deps/checksums/libuv b/deps/checksums/libuv index 6c90c1b2115c7..844b063287c6d 100644 --- a/deps/checksums/libuv +++ b/deps/checksums/libuv @@ -1,34 +1,34 @@ -LibUV.v2.0.1+5.aarch64-apple-darwin.tar.gz/md5/54a94c839c561f5b74601d6d2bd5bf1e -LibUV.v2.0.1+5.aarch64-apple-darwin.tar.gz/sha512/bba06826461a4f35abbe54ba5266d9bf354d22e1f33d75f4273a917ce92437432d8b2cc9d4b4670164c14542e896ee97396a1c34ce0f653d6a2787ab4b6160bb -LibUV.v2.0.1+5.aarch64-linux-gnu.tar.gz/md5/b2680a3cebeb850bfec0df820e27072c -LibUV.v2.0.1+5.aarch64-linux-gnu.tar.gz/sha512/9c5611ae653642ef0060c46235fa2d2e0e4094804fb52629456ae4e5deed7e5fcc88640537799d11d824b6c0c00e75fa2bbddc0206e69c587ae3a77b68e11366 -LibUV.v2.0.1+5.aarch64-linux-musl.tar.gz/md5/a50cea6c75ea4093851cd7420168a59e -LibUV.v2.0.1+5.aarch64-linux-musl.tar.gz/sha512/51ed9be7dec0546cba4822eb116188c15c464ef155df03f0d5d8e9431ba8fe4c23dffde33c3331ef6e7ef3f8135b025fe26b01f036ab193aa340020f9d3bcb6e -LibUV.v2.0.1+5.armv6l-linux-gnueabihf.tar.gz/md5/1b6750b5c85c5f456a448325a77bee06 -LibUV.v2.0.1+5.armv6l-linux-gnueabihf.tar.gz/sha512/06decd104aad78de07101576fab5c0200867c332d12f1cb0cbe8c558c0c2c84c918e5772fbfc62f6ce80437ad68ae97e3d180c97dd40383c80d5e81fee96ecd7 -LibUV.v2.0.1+5.armv6l-linux-musleabihf.tar.gz/md5/54e9820e027e97af7f324d7b5c12fee1 -LibUV.v2.0.1+5.armv6l-linux-musleabihf.tar.gz/sha512/a30353cbf74bf698e38fd357e57fec03345a4ce71e971d9eb034aa211b536dc83b994da533df914a65ba3f5babc7ab66423ed12da665b67c050a8e799cdeada6 -LibUV.v2.0.1+5.armv7l-linux-gnueabihf.tar.gz/md5/252f5fc6d094edea5faef71630f4ba83 -LibUV.v2.0.1+5.armv7l-linux-gnueabihf.tar.gz/sha512/79ebe1e57cefa243219525fdebad35765736534a4b036f2487d6dfa0376a685c8e9f16259bbce83155baebe5ceeeff2592933b597ceafa724060ffd4dd63b0c4 -LibUV.v2.0.1+5.armv7l-linux-musleabihf.tar.gz/md5/39bc81ad36519ee9261a662d444c13b4 -LibUV.v2.0.1+5.armv7l-linux-musleabihf.tar.gz/sha512/97a312f2a42a2377458ff5d5356905fb469c9c30f9ae3fa7d091c7e2cdab3a7ea813e1142fb7d08f2e0000a3d8388fb5fe0d82d3ff646310924439ba99f02903 -LibUV.v2.0.1+5.i686-linux-gnu.tar.gz/md5/ca4b4a317b62cd48f4277bba5ebb9b80 -LibUV.v2.0.1+5.i686-linux-gnu.tar.gz/sha512/2cf17359c976b10a2e0e08d92b43ef2d113a0071748209ad6b2896d9578cb3e96b55f7c72a7c7243ded244b95945c67ea3aa248c1513b5fd37ea714154e04c2d -LibUV.v2.0.1+5.i686-linux-musl.tar.gz/md5/7f088f43c6ae4029e9d90c2881cf2509 -LibUV.v2.0.1+5.i686-linux-musl.tar.gz/sha512/b3653bd4cd95b2d4247b4b83215bfb756e211a3cc02e7e7ca1887e820cb1a7d461397d7259057b63e51825dc344e2f20e904d17defeba59584ddc54df94f1ccc -LibUV.v2.0.1+5.i686-w64-mingw32.tar.gz/md5/8ec8f225a708ebb95fd6dbe6039c386d -LibUV.v2.0.1+5.i686-w64-mingw32.tar.gz/sha512/fd9575300a65af9b7c3a59451646a5f617fd9df0fcae21db02f0f1e9c689605b1e75d12f0ee46654cb8d2b44ac044d2b44b34f9c6d008c19d41b001a69e40c6e -LibUV.v2.0.1+5.powerpc64le-linux-gnu.tar.gz/md5/54c51f81a0b69687f0cbfce63b530991 -LibUV.v2.0.1+5.powerpc64le-linux-gnu.tar.gz/sha512/79a9daa826432da8f389bbb6788720f0bdf0e6a09a16b8296f0ead8e0eae175a72a0690e4ffa5e5d8169e22f596a8ad41607eb836d3f55b217bcf74885e707e0 -LibUV.v2.0.1+5.x86_64-apple-darwin.tar.gz/md5/9ea7e5bf6107f0773e7cdb875d831939 -LibUV.v2.0.1+5.x86_64-apple-darwin.tar.gz/sha512/07b5137c94adaf1c024373b27c2a2a0e77b20cc87f536551e6080b59bd47f65d6ccaaf40ec14068e9e24140c07ad518ef749c09d93fcc36b0507c4ed6acc7032 -LibUV.v2.0.1+5.x86_64-linux-gnu.tar.gz/md5/c4feae1cb61b43ab38b8adb80f8cb46f -LibUV.v2.0.1+5.x86_64-linux-gnu.tar.gz/sha512/cef015385abca586215796c7d2420a4b2496b8a50a62bd9c483d76bb00adb4e3decefe17ba8398353166818bb23b758d3bdb311965849ea68f8b68377c1b08bc -LibUV.v2.0.1+5.x86_64-linux-musl.tar.gz/md5/47f23d12e6c2094604f168c6c40ca131 -LibUV.v2.0.1+5.x86_64-linux-musl.tar.gz/sha512/abe0d74ceabc2d7efc80c1e8d0a6938205bea883257c43a637fc739c82a7085d4f0109c22d0f67e332aa14bed60433dd739676e0237fd28aba6a15c82d3e41f4 -LibUV.v2.0.1+5.x86_64-unknown-freebsd.tar.gz/md5/6a6eeb9108db8a30f776685d4f98a853 -LibUV.v2.0.1+5.x86_64-unknown-freebsd.tar.gz/sha512/e08961cfeb904145b67c2833e6ea3f91b90bc9c8948cfd61399c7d10b1a9cffe17728a6c906a9d791b71da406d8012014b7dcde70ed445084d21e99563cdd377 -LibUV.v2.0.1+5.x86_64-w64-mingw32.tar.gz/md5/7d592fefa8b295e09b4640bd999aa358 -LibUV.v2.0.1+5.x86_64-w64-mingw32.tar.gz/sha512/b4e738c5d86ad27171289f284e35124c6bcf94fc55512622563c6be75027de5033672100008e283aced530c71a6bb1da038872719e1073566d5979278ea76e0b -libuv-3a63bf71de62c64097989254e4f03212e3bf5fc8.tar.gz/md5/a385b594c170085018bc954e50cb42cc -libuv-3a63bf71de62c64097989254e4f03212e3bf5fc8.tar.gz/sha512/5415e992a20498ae29c09bfdb4819857d15be83367488e9fbd8c5f6a460da4cd2d0dff7eaa6087a4bcf6dee6d1c873acbe5751f5594851c978456665d6a21cf9 +LibUV.v2.0.1+11.aarch64-apple-darwin.tar.gz/md5/60c0a26acbd9c6d35743c19ac917f9b9 +LibUV.v2.0.1+11.aarch64-apple-darwin.tar.gz/sha512/4f62658c10486040ffe04e8e694fbcdb2a07340d8f1d18b703598141f5b377c421e06b7896dc0be8472c6c9f748ff44be109db99304b0442f10eb878bf2af1df +LibUV.v2.0.1+11.aarch64-linux-gnu.tar.gz/md5/215a204f1fb13a8d1fc9b26106814bee +LibUV.v2.0.1+11.aarch64-linux-gnu.tar.gz/sha512/3f20dc865a1ebae98ac75581585c5057b6c27bbfe084580274089f3103b4ad5fceee7dd5822b6f1cee4dfdfe027a379ea5116e37ca331845108380d6c2ecf63f +LibUV.v2.0.1+11.aarch64-linux-musl.tar.gz/md5/b618837c1c2ff1e64578ae043c0a00c3 +LibUV.v2.0.1+11.aarch64-linux-musl.tar.gz/sha512/7a82709a183977237f76cc0048034522466843d583519cec95fc7dd39cab1891b397052c6deb69b8d6fab6d0f57c91b642431b579bfb6c790881509b8daaa24c +LibUV.v2.0.1+11.armv6l-linux-gnueabihf.tar.gz/md5/f09464b716b779b6cccc8e8103313acb +LibUV.v2.0.1+11.armv6l-linux-gnueabihf.tar.gz/sha512/7c39685bbb9beb39670c94a3dea0cfac8685c9ff1116026784e68610d9314c281690f87bba918dfcc60f39e3f5c54ce432ab7365f785510be4108fa2454905dc +LibUV.v2.0.1+11.armv6l-linux-musleabihf.tar.gz/md5/6a483f49e053a1d796c2280a165e5cdd +LibUV.v2.0.1+11.armv6l-linux-musleabihf.tar.gz/sha512/16d6ade651018b20e2b465ee9beab6d6442a8d3942249a90def2797ac2b2c0376173eb9411f26cdd3f82ae9798640f819e139dd3cd70ce7e4684f6154f68fbfa +LibUV.v2.0.1+11.armv7l-linux-gnueabihf.tar.gz/md5/d3c6110ba03be6136d0c0a3740b2bc21 +LibUV.v2.0.1+11.armv7l-linux-gnueabihf.tar.gz/sha512/a41c26cd52c82804bf14d783965ebf4893db0cae7319d9840777485a328237e9f7c54aa3c2dc9a0ee39f98db430b8616de6f60906fbd00771f9a50e989e68fde +LibUV.v2.0.1+11.armv7l-linux-musleabihf.tar.gz/md5/a302e22ac3bc6d0909cd1b2a90c712ac +LibUV.v2.0.1+11.armv7l-linux-musleabihf.tar.gz/sha512/dd0291b86e11dbf7a8cf5b22f862bb0a93dcfd0d5ae009fe0c53f569d012bc2ea4895976c699aabd79ce05f4ae6161ce56263859c1994ea696e50f918fc2f51b +LibUV.v2.0.1+11.i686-linux-gnu.tar.gz/md5/d3b8cfaee74da3f4ba58c6845345ebfe +LibUV.v2.0.1+11.i686-linux-gnu.tar.gz/sha512/9623b84f6411f9b7c5a67f5e346d6661f00103a8417e22018b513efa3b8904268c57c7de21cc2f66a55727060436159f70727beed49b7efc882befd4d399332d +LibUV.v2.0.1+11.i686-linux-musl.tar.gz/md5/0e04697b85d2798c19f56e437eb55e56 +LibUV.v2.0.1+11.i686-linux-musl.tar.gz/sha512/75373bb5a5e3dd8f3fa4a85664bcfa0c651a793d8b104264eafa9626520cfb936025d4b1540c8e6d16a73468b7a1068a5ab4fb3b37762404d1ef7225a85e1664 +LibUV.v2.0.1+11.i686-w64-mingw32.tar.gz/md5/617dfd4290517837ad4c709dc4301733 +LibUV.v2.0.1+11.i686-w64-mingw32.tar.gz/sha512/7069f8bbb876ab5e2a7f0d79f4a297cd7984e1a83eadb1f91f5de86afc951b38e5bf2641883a4b7f327eabbc2f25434453b855ff7d537d30cc5ae6c8a00341d4 +LibUV.v2.0.1+11.powerpc64le-linux-gnu.tar.gz/md5/70f16a63097a353fa45971d3e4313da4 +LibUV.v2.0.1+11.powerpc64le-linux-gnu.tar.gz/sha512/ecc9f39fef7e9917dbadf4a7fd7966d06fb240f73cc2df021d9b8fa1951655d078782f17948abbfb5a21f2b7fcd9c7390af0a05610a9b952d55d53b6826ec312 +LibUV.v2.0.1+11.x86_64-apple-darwin.tar.gz/md5/17fee1aaeb6947614705120a62a21fa4 +LibUV.v2.0.1+11.x86_64-apple-darwin.tar.gz/sha512/cf4c80e797e3d68f54916bae6163d948f0a300f201f2b8209310970751d68eef6c29da571721aa98794c9ae30f7dc655385a5091c716e0402d3241342a1d9544 +LibUV.v2.0.1+11.x86_64-linux-gnu.tar.gz/md5/7e2cfbd1d4cdf2afec2ab18f0f75e812 +LibUV.v2.0.1+11.x86_64-linux-gnu.tar.gz/sha512/8551dbaf242c859010481e12864d75e8df01c69a90b94293402881b50e32105add7f7fdae455144076a2169f37e5796eb528d8ef6fc02226fbbb9d0f1bc6f6d3 +LibUV.v2.0.1+11.x86_64-linux-musl.tar.gz/md5/3879f86977865ceac0ea36e3f563be73 +LibUV.v2.0.1+11.x86_64-linux-musl.tar.gz/sha512/0831c0606e9bed4f819cb8f2abba464c9e0034533abdb5bf6e6e92b9f37644103c39adc4498db5128395dc65da28c93d7cd01bfc474985fa5dd660b04ca14cc1 +LibUV.v2.0.1+11.x86_64-unknown-freebsd.tar.gz/md5/288d9ab3dd95028568880838462c1f35 +LibUV.v2.0.1+11.x86_64-unknown-freebsd.tar.gz/sha512/ac0366d8eb4d0908d5ea55105dc608418455bc601fc22058512e228225cbd1ad2c778f7838b9d2374a6f1661e386f4121bae0f4cecaa18a4ba70a3a743318e24 +LibUV.v2.0.1+11.x86_64-w64-mingw32.tar.gz/md5/2b390151d13474968444b0f07adc92c0 +LibUV.v2.0.1+11.x86_64-w64-mingw32.tar.gz/sha512/6c56a7ab3e28ebcc7e55917b5ba051b4725ca77752b5206f865b306e905d119170cd0bb4e117c7352a95aa13b814ec5e15547ec3904615b561775a17e6993741 +libuv-e6f0e4900e195c8352f821abe2b3cffc3089547b.tar.gz/md5/c4465d7bff6610761cf37a1e8e3da08c +libuv-e6f0e4900e195c8352f821abe2b3cffc3089547b.tar.gz/sha512/3347668b2b377704f3188e8901b130e891d19ac944ab3b7c1f4939d7afa119afff7dc10feaa2a518ec4122968147e31eb8932c6dfc1142a58a4828488f343191 diff --git a/deps/libuv.version b/deps/libuv.version index 7339533223083..c8a705608fdff 100644 --- a/deps/libuv.version +++ b/deps/libuv.version @@ -1,2 +1,2 @@ -LIBUV_BRANCH=julia-uv2-1.42.0 -LIBUV_SHA1=3a63bf71de62c64097989254e4f03212e3bf5fc8 +LIBUV_BRANCH=julia-uv2-1.44.2 +LIBUV_SHA1=e6f0e4900e195c8352f821abe2b3cffc3089547b diff --git a/doc/make.jl b/doc/make.jl index 1094736fffd02..9cc463f5a84e4 100644 --- a/doc/make.jl +++ b/doc/make.jl @@ -343,7 +343,11 @@ struct BuildBotConfig <: Documenter.DeployConfig end Documenter.authentication_method(::BuildBotConfig) = Documenter.HTTPS Documenter.authenticated_repo_url(::BuildBotConfig) = "https://github.com/JuliaLang/docs.julialang.org.git" function Documenter.deploy_folder(::BuildBotConfig; devurl, repo, branch, kwargs...) - haskey(ENV, "DOCUMENTER_KEY") || return Documenter.DeployDecision(; all_ok=false) + if !haskey(ENV, "DOCUMENTER_KEY") + @info "Unable to deploy the documentation: DOCUMENTER_KEY missing" + return Documenter.DeployDecision(; all_ok=false) + end + release = match(r"^release-([0-9]+\.[0-9]+)$", Base.GIT_VERSION_INFO.branch) if Base.GIT_VERSION_INFO.tagged_commit # Strip extra pre-release info (1.5.0-rc2.0 -> 1.5.0-rc2) ver = VersionNumber(VERSION.major, VERSION.minor, VERSION.patch, @@ -352,7 +356,16 @@ function Documenter.deploy_folder(::BuildBotConfig; devurl, repo, branch, kwargs return Documenter.DeployDecision(; all_ok=true, repo, branch, subfolder) elseif Base.GIT_VERSION_INFO.branch == "master" return Documenter.DeployDecision(; all_ok=true, repo, branch, subfolder=devurl) + elseif !isnothing(release) + # If this is a non-tag build from a release-* branch, we deploy them as dev docs into the + # appropriate vX.Y-dev subdirectory. + return Documenter.DeployDecision(; all_ok=true, repo, branch, subfolder="v$(release[1])-dev") end + @info """ + Unable to deploy the documentation: invalid GIT_VERSION_INFO + GIT_VERSION_INFO.tagged_commit: $(Base.GIT_VERSION_INFO.tagged_commit) + GIT_VERSION_INFO.branch: $(Base.GIT_VERSION_INFO.branch) + """ return Documenter.DeployDecision(; all_ok=false) end @@ -380,12 +393,16 @@ function Documenter.Writers.HTMLWriter.expand_versions(dir::String, v::Versions) return Documenter.Writers.HTMLWriter.expand_versions(dir, v.versions) end -deploydocs( - repo = "github.com/JuliaLang/docs.julialang.org.git", - deploy_config = BuildBotConfig(), - target = joinpath(buildroot, "doc", "_build", "html", "en"), - dirname = "en", - devurl = devurl, - versions = Versions(["v#.#", devurl => devurl]), - archive = get(ENV, "DOCUMENTER_ARCHIVE", nothing), -) +if "deploy" in ARGS + deploydocs( + repo = "github.com/JuliaLang/docs.julialang.org.git", + deploy_config = BuildBotConfig(), + target = joinpath(buildroot, "doc", "_build", "html", "en"), + dirname = "en", + devurl = devurl, + versions = Versions(["v#.#", devurl => devurl]), + archive = get(ENV, "DOCUMENTER_ARCHIVE", nothing), + ) +else + @info "Skipping deployment ('deploy' not passed)" +end diff --git a/doc/src/base/base.md b/doc/src/base/base.md index 93d0547098706..9b9d14bbffbd0 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -344,6 +344,8 @@ Base.Sys.iswindows Base.Sys.windows_version Base.Sys.free_memory Base.Sys.total_memory +Base.Sys.free_physical_memory +Base.Sys.total_physical_memory Base.@static ``` diff --git a/src/ccall.cpp b/src/ccall.cpp index 17f75dfefbc2e..4742130f66629 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -1380,7 +1380,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) return jl_cgval_t(ctx.builder.getContext()); } if (rt != args[2] && rt != (jl_value_t*)jl_any_type) - jl_add_method_root(ctx, rt); + rt = jl_ensure_rooted(ctx, rt); function_sig_t sig("ccall", lrt, rt, retboxed, (jl_svec_t*)at, unionall, nreqargs, cc, llvmcall, &ctx.emission_context); @@ -1837,7 +1837,7 @@ jl_cgval_t function_sig_t::emit_a_ccall( jl_svec_len(ctx.linfo->sparam_vals) > 0) { jargty_in_env = jl_instantiate_type_in_env(jargty_in_env, unionall_env, jl_svec_data(ctx.linfo->sparam_vals)); if (jargty_in_env != jargty) - jl_add_method_root(ctx, jargty_in_env); + jargty_in_env = jl_ensure_rooted(ctx, jargty_in_env); } Value *v; diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 7eb2fa11d209d..8f3a4caf7b906 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -2814,7 +2814,7 @@ static Value *call_with_attrs(jl_codectx_t &ctx, JuliaFunction *intr, Value *v) return Call; } -static void jl_add_method_root(jl_codectx_t &ctx, jl_value_t *val); +static jl_value_t *jl_ensure_rooted(jl_codectx_t &ctx, jl_value_t *val); static Value *as_value(jl_codectx_t &ctx, Type *to, const jl_cgval_t &v) { @@ -2847,7 +2847,7 @@ static Value *_boxed_special(jl_codectx_t &ctx, const jl_cgval_t &vinfo, Type *t if (Constant *c = dyn_cast(vinfo.V)) { jl_value_t *s = static_constant_instance(jl_Module->getDataLayout(), c, jt); if (s) { - jl_add_method_root(ctx, s); + s = jl_ensure_rooted(ctx, s); return track_pjlvalue(ctx, literal_pointer_val(ctx, s)); } } diff --git a/src/codegen.cpp b/src/codegen.cpp index 79b40513f453c..c7aba9a4942cd 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1271,7 +1271,6 @@ class jl_codectx_t { jl_code_info_t *source = NULL; jl_array_t *code = NULL; size_t world = 0; - jl_array_t *roots = NULL; const char *name = NULL; StringRef file{}; ssize_t *line = NULL; @@ -1313,10 +1312,6 @@ class jl_codectx_t { tbaa_cache.initialize(builder.getContext()); return tbaa_cache; } - - ~jl_codectx_t() { - assert(this->roots == NULL); - } }; GlobalVariable *JuliaVariable::realize(jl_codectx_t &ctx) { @@ -2371,27 +2366,27 @@ static void simple_use_analysis(jl_codectx_t &ctx, jl_value_t *expr) // ---- Get Element Pointer (GEP) instructions within the GC frame ---- -static void jl_add_method_root(jl_codectx_t &ctx, jl_value_t *val) +static jl_value_t *jl_ensure_rooted(jl_codectx_t &ctx, jl_value_t *val) { - if (jl_is_concrete_type(val) || jl_is_bool(val) || jl_is_symbol(val) || val == jl_nothing || - val == (jl_value_t*)jl_any_type || val == (jl_value_t*)jl_bottom_type || val == (jl_value_t*)jl_core_module) - return; - JL_GC_PUSH1(&val); - if (ctx.roots == NULL) { - ctx.roots = jl_alloc_vec_any(1); - jl_array_ptr_set(ctx.roots, 0, val); - } - else { - size_t rlen = jl_array_dim0(ctx.roots); - for (size_t i = 0; i < rlen; i++) { - if (jl_array_ptr_ref(ctx.roots,i) == val) { - JL_GC_POP(); - return; + if (jl_is_globally_rooted(val)) + return val; + jl_method_t *m = ctx.linfo->def.method; + if (jl_is_method(m)) { + // the method might have a root for this already; use it if so + JL_LOCK(&m->writelock); + if (m->roots) { + size_t i, len = jl_array_dim0(m->roots); + for (i = 0; i < len; i++) { + jl_value_t *mval = jl_array_ptr_ref(m->roots, i); + if (mval == val || jl_egal(mval, val)) { + JL_UNLOCK(&m->writelock); + return mval; + } } } - jl_array_ptr_1d_push(ctx.roots, val); + JL_UNLOCK(&m->writelock); } - JL_GC_POP(); + return jl_as_global_root(val); } // --- generating function calls --- @@ -3375,7 +3370,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f, // don't bother codegen constant-folding for toplevel. jl_value_t *ty = static_apply_type(ctx, argv, nargs + 1); if (ty != NULL) { - jl_add_method_root(ctx, ty); + ty = jl_ensure_rooted(ctx, ty); *ret = mark_julia_const(ctx, ty); return true; } @@ -4664,35 +4659,12 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaval) return convert_julia_type(ctx, emit_expr(ctx, jl_fieldref_noalloc(expr, 0)), jl_fieldref_noalloc(expr, 1), &skip); } if (!jl_is_expr(expr)) { - int needroot = true; - if (jl_is_quotenode(expr)) { - expr = jl_fieldref_noalloc(expr,0); - } - // numeric literals - if (jl_is_int32(expr)) { - int32_t val = jl_unbox_int32(expr); - if ((uint32_t)(val+512) < 1024) { - // this can be gotten from the box cache - needroot = false; - expr = jl_box_int32(val); - } - } - else if (jl_is_int64(expr)) { - uint64_t val = jl_unbox_uint64(expr); - if ((uint64_t)(val+512) < 1024) { - // this can be gotten from the box cache - needroot = false; - expr = jl_box_int64(val); - } - } - else if (jl_is_uint8(expr)) { - expr = jl_box_uint8(jl_unbox_uint8(expr)); - needroot = false; - } - if (needroot && jl_is_method(ctx.linfo->def.method)) { // toplevel exprs and some integers are already rooted - jl_add_method_root(ctx, expr); - } - return mark_julia_const(ctx, expr); + jl_value_t *val = expr; + if (jl_is_quotenode(expr)) + val = jl_fieldref_noalloc(expr, 0); + if (jl_is_method(ctx.linfo->def.method)) // toplevel exprs are already rooted + val = jl_ensure_rooted(ctx, val); + return mark_julia_const(ctx, val); } jl_expr_t *ex = (jl_expr_t*)expr; @@ -5827,7 +5799,7 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con return jl_cgval_t(ctx.builder.getContext()); } if (rt != declrt && rt != (jl_value_t*)jl_any_type) - jl_add_method_root(ctx, rt); + rt = jl_ensure_rooted(ctx, rt); function_sig_t sig("cfunction", lrt, rt, retboxed, argt, unionall_env, false, CallingConv::C, false, &ctx.emission_context); assert(sig.fargt.size() + sig.sret == sig.fargt_sig.size()); @@ -5900,7 +5872,7 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con for (size_t i = 0; i < n; i++) { jl_svecset(fill, i, jl_array_ptr_ref(closure_types, i)); } - jl_add_method_root(ctx, (jl_value_t*)fill); + fill = (jl_svec_t*)jl_ensure_rooted(ctx, (jl_value_t*)fill); } Type *T_htable = ArrayType::get(getSizeTy(ctx.builder.getContext()), sizeof(htable_t) / sizeof(void*)); Value *cache = new GlobalVariable(*jl_Module, T_htable, false, @@ -6119,7 +6091,6 @@ static Function *gen_invoke_wrapper(jl_method_instance_t *lam, jl_value_t *jlret } } ctx.builder.CreateRet(boxed(ctx, retval)); - assert(!ctx.roots); return w; } @@ -6293,7 +6264,7 @@ static std::pair, jl_llvm_functions_t> // step 1. unpack AST and allocate codegen context for this function jl_llvm_functions_t declarations; jl_codectx_t ctx(ctxt, params); - JL_GC_PUSH2(&ctx.code, &ctx.roots); + JL_GC_PUSH1(&ctx.code); ctx.code = src->code; std::map labels; @@ -7700,33 +7671,6 @@ static std::pair, jl_llvm_functions_t> } } - // copy ctx.roots into m->roots - // if we created any new roots during codegen - if (ctx.roots) { - jl_method_t *m = lam->def.method; - JL_LOCK(&m->writelock); - if (m->roots == NULL) { - m->roots = ctx.roots; - jl_gc_wb(m, m->roots); - } - else { - size_t i, ilen = jl_array_dim0(ctx.roots); - size_t j, jlen = jl_array_dim0(m->roots); - for (i = 0; i < ilen; i++) { - jl_value_t *ival = jl_array_ptr_ref(ctx.roots, i); - for (j = 0; j < jlen; j++) { - jl_value_t *jval = jl_array_ptr_ref(m->roots, j); - if (ival == jval) - break; - } - if (j == jlen) // not found - add to array - jl_add_method_root(m, jl_precompile_toplevel_module, ival); - } - } - ctx.roots = NULL; - JL_UNLOCK(&m->writelock); - } - // link the dependent llvmcall modules, but switch their function's linkage to internal // so that they don't conflict when they show up in the execution engine. for (auto &Mod : ctx.llvmcall_modules) { diff --git a/src/gc.c b/src/gc.c index 90db3dea5eabd..b60cc4ff7e8d6 100644 --- a/src/gc.c +++ b/src/gc.c @@ -2877,6 +2877,7 @@ static void mark_roots(jl_gc_mark_cache_t *gc_cache, jl_gc_mark_sp_t *sp) gc_mark_queue_obj(gc_cache, sp, jl_emptytuple_type); if (cmpswap_names != NULL) gc_mark_queue_obj(gc_cache, sp, cmpswap_names); + gc_mark_queue_obj(gc_cache, sp, jl_global_roots_table); } // find unmarked objects that need to be finalized from the finalizer list "list". @@ -3431,7 +3432,7 @@ void jl_gc_init(void) // on a big memory machine, set max_collect_interval to totalmem / nthreads / 2 uint64_t total_mem = uv_get_total_memory(); uint64_t constrained_mem = uv_get_constrained_memory(); - if (constrained_mem > 0 && constrained_mem < total_mem) + if (constrained_mem != 0) total_mem = constrained_mem; size_t maxmem = total_mem / jl_n_threads / 2; if (maxmem > max_collect_interval) diff --git a/src/iddict.c b/src/iddict.c index e6c9eee44b980..617d2d16176d1 100644 --- a/src/iddict.c +++ b/src/iddict.c @@ -159,6 +159,12 @@ jl_value_t *jl_eqtable_get(jl_array_t *h, jl_value_t *key, jl_value_t *deflt) JL return (bp == NULL) ? deflt : jl_atomic_load_relaxed(bp); } +jl_value_t *jl_eqtable_getkey(jl_array_t *h, jl_value_t *key, jl_value_t *deflt) JL_NOTSAFEPOINT +{ + _Atomic(jl_value_t*) *bp = jl_table_peek_bp(h, key); + return (bp == NULL) ? deflt : jl_atomic_load_relaxed(bp - 1); +} + JL_DLLEXPORT jl_value_t *jl_eqtable_pop(jl_array_t *h, jl_value_t *key, jl_value_t *deflt, int *found) { diff --git a/src/init.c b/src/init.c index 3ea8456479c3e..ab2e0aa1c4123 100644 --- a/src/init.c +++ b/src/init.c @@ -713,6 +713,7 @@ static NOINLINE void _finish_julia_init(JL_IMAGE_SEARCH rel, jl_ptls_t ptls, jl_ jl_restore_system_image(jl_options.image_file); } else { jl_init_types(); + jl_global_roots_table = jl_alloc_vec_any(16); jl_init_codegen(); } diff --git a/src/ircode.c b/src/ircode.c index 73e99f2281491..46056114a1c8d 100644 --- a/src/ircode.c +++ b/src/ircode.c @@ -71,10 +71,31 @@ static void jl_encode_int32(jl_ircode_state *s, int32_t x) } } +static void jl_encode_as_indexed_root(jl_ircode_state *s, jl_value_t *v) +{ + rle_reference rr; + + literal_val_id(&rr, s, v); + int id = rr.index; + assert(id >= 0); + if (rr.key) { + write_uint8(s->s, TAG_RELOC_METHODROOT); + write_int64(s->s, rr.key); + } + if (id < 256) { + write_uint8(s->s, TAG_METHODROOT); + write_uint8(s->s, id); + } + else { + assert(id <= UINT16_MAX); + write_uint8(s->s, TAG_LONG_METHODROOT); + write_uint16(s->s, id); + } +} + static void jl_encode_value_(jl_ircode_state *s, jl_value_t *v, int as_literal) JL_GC_DISABLED { size_t i; - rle_reference rr; if (v == NULL) { write_uint8(s->s, TAG_NULL); @@ -240,6 +261,16 @@ static void jl_encode_value_(jl_ircode_state *s, jl_value_t *v, int as_literal) write_uint8(s->s, TAG_RETURNNODE); jl_encode_value(s, jl_get_nth_field(v, 0)); } + else if (jl_is_quotenode(v)) { + write_uint8(s->s, TAG_QUOTENODE); + jl_value_t *inner = jl_quotenode_value(v); + // we might need to return this exact object at run time, therefore codegen might + // need to reference it as well, so it is more likely useful to give it a root + if (jl_is_expr(inner) || jl_is_phinode(inner) || jl_is_phicnode(inner)) + jl_encode_as_indexed_root(s, inner); + else + jl_encode_value(s, inner); + } else if (jl_typeis(v, jl_int64_type)) { void *data = jl_data_ptr(v); if (*(int64_t*)data >= INT16_MIN && *(int64_t*)data <= INT16_MAX) { @@ -325,28 +356,9 @@ static void jl_encode_value_(jl_ircode_state *s, jl_value_t *v, int as_literal) ios_write(s->s, jl_array_typetagdata(ar), l); } } - else { - if (!as_literal && !(jl_is_uniontype(v) || jl_is_newvarnode(v) || jl_is_tuple(v) || - jl_is_linenode(v) || jl_is_upsilonnode(v) || jl_is_pinode(v) || - jl_is_slot(v) || jl_is_ssavalue(v))) { - literal_val_id(&rr, s, v); - int id = rr.index; - assert(id >= 0); - if (rr.key) { - write_uint8(s->s, TAG_RELOC_METHODROOT); - write_int64(s->s, rr.key); - } - if (id < 256) { - write_uint8(s->s, TAG_METHODROOT); - write_uint8(s->s, id); - } - else { - assert(id <= UINT16_MAX); - write_uint8(s->s, TAG_LONG_METHODROOT); - write_uint16(s->s, id); - } - return; - } + else if (as_literal || jl_is_uniontype(v) || jl_is_newvarnode(v) || jl_is_linenode(v) || + jl_is_upsilonnode(v) || jl_is_pinode(v) || jl_is_slot(v) || jl_is_ssavalue(v) || + (jl_isbits(jl_typeof(v)) && jl_datatype_size(jl_typeof(v)) <= 64)) { jl_datatype_t *t = (jl_datatype_t*)jl_typeof(v); if (t->size <= 255) { write_uint8(s->s, TAG_SHORT_GENERAL); @@ -388,6 +400,9 @@ static void jl_encode_value_(jl_ircode_state *s, jl_value_t *v, int as_literal) if (ptr > last) ios_write(s->s, last, ptr - last); } + else { + jl_encode_as_indexed_root(s, v); + } } static jl_code_info_flags_t code_info_flags(uint8_t pure, uint8_t propagate_inbounds, uint8_t inlineable, uint8_t inferred, uint8_t constprop) diff --git a/src/julia.h b/src/julia.h index 48f89ec7661e3..9cdf124fccaa7 100644 --- a/src/julia.h +++ b/src/julia.h @@ -1270,7 +1270,7 @@ STATIC_INLINE int jl_is_structtype(void *v) JL_NOTSAFEPOINT !jl_is_primitivetype(v)); } -STATIC_INLINE int jl_isbits(void *t) JL_NOTSAFEPOINT // corresponding to isbits() in julia +STATIC_INLINE int jl_isbits(void *t) JL_NOTSAFEPOINT // corresponding to isbitstype() in julia { return (jl_is_datatype(t) && ((jl_datatype_t*)t)->isbitstype); } @@ -1635,6 +1635,7 @@ STATIC_INLINE jl_function_t *jl_get_function(jl_module_t *m, const char *name) // eq hash tables JL_DLLEXPORT jl_array_t *jl_eqtable_put(jl_array_t *h, jl_value_t *key, jl_value_t *val, int *inserted); JL_DLLEXPORT jl_value_t *jl_eqtable_get(jl_array_t *h, jl_value_t *key, jl_value_t *deflt) JL_NOTSAFEPOINT; +jl_value_t *jl_eqtable_getkey(jl_array_t *h, jl_value_t *key, jl_value_t *deflt) JL_NOTSAFEPOINT; // system information JL_DLLEXPORT int jl_errno(void) JL_NOTSAFEPOINT; diff --git a/src/julia_internal.h b/src/julia_internal.h index 98ef613e3be9a..a7e9c0af2ad3d 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -664,6 +664,9 @@ JL_DLLEXPORT void jl_binding_deprecation_warning(jl_module_t *m, jl_binding_t *b extern jl_array_t *jl_module_init_order JL_GLOBALLY_ROOTED; extern htable_t jl_current_modules JL_GLOBALLY_ROOTED; extern JL_DLLEXPORT jl_module_t *jl_precompile_toplevel_module JL_GLOBALLY_ROOTED; +extern jl_array_t *jl_global_roots_table JL_GLOBALLY_ROOTED; +JL_DLLEXPORT int jl_is_globally_rooted(jl_value_t *val JL_MAYBE_UNROOTED) JL_NOTSAFEPOINT; +JL_DLLEXPORT jl_value_t *jl_as_global_root(jl_value_t *val JL_MAYBE_UNROOTED); int jl_compile_extern_c(void *llvmmod, void *params, void *sysimg, jl_value_t *declrt, jl_value_t *sigt); jl_opaque_closure_t *jl_new_opaque_closure(jl_tupletype_t *argt, jl_value_t *rt_lb, jl_value_t *rt_ub, diff --git a/src/method.c b/src/method.c index 7325670bd76a4..6cb6e9114b04d 100644 --- a/src/method.c +++ b/src/method.c @@ -906,12 +906,6 @@ JL_DLLEXPORT jl_method_t* jl_method_def(jl_svec_t *argdata, size_t i, na = jl_svec_len(atypes); argtype = (jl_value_t*)jl_apply_tuple_type(atypes); - for (i = jl_svec_len(tvars); i > 0; i--) { - jl_value_t *tv = jl_svecref(tvars, i - 1); - if (!jl_is_typevar(tv)) - jl_type_error("method signature", (jl_value_t*)jl_tvar_type, tv); - argtype = jl_new_struct(jl_unionall_type, tv, argtype); - } jl_methtable_t *external_mt = mt; if (!mt) @@ -921,6 +915,12 @@ JL_DLLEXPORT jl_method_t* jl_method_def(jl_svec_t *argdata, if (mt->frozen) jl_error("cannot add methods to a builtin function"); + assert(jl_is_linenode(functionloc)); + jl_sym_t *file = (jl_sym_t*)jl_linenode_file(functionloc); + if (!jl_is_symbol(file)) + file = jl_empty_sym; + int32_t line = jl_linenode_line(functionloc); + // TODO: derive our debug name from the syntax instead of the type name = mt->name; if (mt == jl_type_type_mt || mt == jl_nonfunction_mt || external_mt) { @@ -937,6 +937,29 @@ JL_DLLEXPORT jl_method_t* jl_method_def(jl_svec_t *argdata, } } } + + for (i = jl_svec_len(tvars); i > 0; i--) { + jl_value_t *tv = jl_svecref(tvars, i - 1); + if (!jl_is_typevar(tv)) + jl_type_error("method signature", (jl_value_t*)jl_tvar_type, tv); + if (!jl_has_typevar(argtype, (jl_tvar_t*)tv)) // deprecate this to an error in v2 + jl_printf(JL_STDERR, + "WARNING: method definition for %s at %s:%d declares type variable %s but does not use it.\n", + jl_symbol_name(name), + jl_symbol_name(file), + line, + jl_symbol_name(((jl_tvar_t*)tv)->name)); + argtype = jl_new_struct(jl_unionall_type, tv, argtype); + } + if (jl_has_free_typevars(argtype)) { + jl_exceptionf(jl_argumenterror_type, + "method definition for %s at %s:%d has free type variables", + jl_symbol_name(name), + jl_symbol_name(file), + line); + } + + if (!jl_is_code_info(f)) { // this occurs when there is a closure being added to an out-of-scope function // the user should only do this at the toplevel @@ -951,20 +974,10 @@ JL_DLLEXPORT jl_method_t* jl_method_def(jl_svec_t *argdata, m->name = name; m->isva = isva; m->nargs = nargs; - assert(jl_is_linenode(functionloc)); - jl_value_t *file = jl_linenode_file(functionloc); - m->file = jl_is_symbol(file) ? (jl_sym_t*)file : jl_empty_sym; - m->line = jl_linenode_line(functionloc); + m->file = file; + m->line = line; jl_method_set_source(m, f); - if (jl_has_free_typevars(argtype)) { - jl_exceptionf(jl_argumenterror_type, - "method definition for %s at %s:%d has free type variables", - jl_symbol_name(name), - jl_symbol_name(m->file), - m->line); - } - for (i = 0; i < na; i++) { jl_value_t *elt = jl_svecref(atypes, i); if (!jl_is_type(elt) && !jl_is_typevar(elt) && !jl_is_vararg(elt)) { @@ -974,22 +987,22 @@ JL_DLLEXPORT jl_method_t* jl_method_def(jl_svec_t *argdata, "invalid type for argument number %d in method definition for %s at %s:%d", i, jl_symbol_name(name), - jl_symbol_name(m->file), - m->line); + jl_symbol_name(file), + line); else jl_exceptionf(jl_argumenterror_type, "invalid type for argument %s in method definition for %s at %s:%d", jl_symbol_name(argname), jl_symbol_name(name), - jl_symbol_name(m->file), - m->line); + jl_symbol_name(file), + line); } if (jl_is_vararg(elt) && i < na-1) jl_exceptionf(jl_argumenterror_type, "Vararg on non-final argument in method definition for %s at %s:%d", jl_symbol_name(name), - jl_symbol_name(m->file), - m->line); + jl_symbol_name(file), + line); } #ifdef RECORD_METHOD_ORDER diff --git a/src/partr.c b/src/partr.c index ddba203b92b1d..5d50546440849 100644 --- a/src/partr.c +++ b/src/partr.c @@ -312,8 +312,10 @@ JL_DLLEXPORT int jl_enqueue_task(jl_task_t *task) char failed; if (multiq_insert(task, task->prio) == -1) failed = 1; - failed = 0; - JL_PROBE_RT_TASKQ_INSERT(jl_current_task->ptls, task); + else { + failed = 0; + JL_PROBE_RT_TASKQ_INSERT(jl_current_task->ptls, task); + } return failed; } diff --git a/src/staticdata.c b/src/staticdata.c index 28a21e9ea7c2b..1b98601026d49 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -59,6 +59,7 @@ done by `get_item_for_reloc`. #include #include #include // printf +#include // PRIxPTR #include "julia.h" #include "julia_internal.h" @@ -1812,6 +1813,49 @@ static void jl_set_nroots_sysimg(void) static void jl_init_serializer2(int); static void jl_cleanup_serializer2(void); +jl_array_t *jl_global_roots_table; +static jl_mutex_t global_roots_lock; + +JL_DLLEXPORT int jl_is_globally_rooted(jl_value_t *val JL_MAYBE_UNROOTED) JL_NOTSAFEPOINT +{ + if (jl_is_concrete_type(val) || jl_is_bool(val) || jl_is_symbol(val) || + val == (jl_value_t*)jl_any_type || val == (jl_value_t*)jl_bottom_type || val == (jl_value_t*)jl_core_module) + return 1; + if (val == ((jl_datatype_t*)jl_typeof(val))->instance) + return 1; + return 0; +} + +JL_DLLEXPORT jl_value_t *jl_as_global_root(jl_value_t *val JL_MAYBE_UNROOTED) +{ + if (jl_is_globally_rooted(val)) + return val; + if (jl_is_uint8(val)) + return jl_box_uint8(jl_unbox_uint8(val)); + if (jl_is_int32(val)) { + int32_t n = jl_unbox_int32(val); + if ((uint32_t)(n+512) < 1024) + return jl_box_int32(n); + } + else if (jl_is_int64(val)) { + uint64_t n = jl_unbox_uint64(val); + if ((uint64_t)(n+512) < 1024) + return jl_box_int64(n); + } + JL_GC_PUSH1(&val); + JL_LOCK(&global_roots_lock); + jl_value_t *rval = jl_eqtable_getkey(jl_global_roots_table, val, NULL); + if (rval) { + val = rval; + } + else { + jl_global_roots_table = jl_eqtable_put(jl_global_roots_table, val, jl_nothing, NULL); + } + JL_UNLOCK(&global_roots_lock); + JL_GC_POP(); + return val; +} + static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED { jl_gc_collect(JL_GC_FULL); @@ -1878,6 +1922,7 @@ static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED jl_value_t *tag = *tags[i]; jl_serialize_value(&s, tag); } + jl_serialize_value(&s, jl_global_roots_table); jl_serialize_reachable(&s); // step 1.1: check for values only found in the generated code arraylist_t typenames; @@ -1912,9 +1957,22 @@ static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED jl_write_gv_tagrefs(&s); } - if (sysimg.size > ((uintptr_t)1 << RELOC_TAG_OFFSET) || - const_data.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)) { - jl_printf(JL_STDERR, "ERROR: system image too large\n"); + if (sysimg.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)) { + jl_printf( + JL_STDERR, + "ERROR: system image too large: sysimg.size is %jd but the limit is %" PRIxPTR "\n", + (intmax_t)sysimg.size, + ((uintptr_t)1 << RELOC_TAG_OFFSET) + ); + jl_exit(1); + } + if (const_data.size > ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*)) { + jl_printf( + JL_STDERR, + "ERROR: system image too large: const_data.size is %jd but the limit is %" PRIxPTR "\n", + (intmax_t)const_data.size, + ((uintptr_t)1 << RELOC_TAG_OFFSET)*sizeof(void*) + ); jl_exit(1); } @@ -1958,6 +2016,7 @@ static void jl_save_system_image_to_stream(ios_t *f) JL_GC_DISABLED jl_value_t *tag = *tags[i]; jl_write_value(&s, tag); } + jl_write_value(&s, jl_global_roots_table); jl_write_value(&s, s.ptls->root_task->tls); write_uint32(f, jl_get_gs_ctr()); write_uint32(f, jl_atomic_load_acquire(&jl_world_counter)); @@ -2084,6 +2143,7 @@ static void jl_restore_system_image_from_stream(ios_t *f) JL_GC_DISABLED jl_value_t **tag = tags[i]; *tag = jl_read_value(&s); } + jl_global_roots_table = (jl_array_t*)jl_read_value(&s); // set typeof extra-special values now that we have the type set by tags above jl_astaggedvalue(jl_current_task)->header = (uintptr_t)jl_task_type | jl_astaggedvalue(jl_current_task)->header; jl_astaggedvalue(jl_nothing)->header = (uintptr_t)jl_nothing_type | jl_astaggedvalue(jl_nothing)->header; diff --git a/src/subtype.c b/src/subtype.c index c01ee54e683be..1213cd53af2f6 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -3176,18 +3176,15 @@ static int merge_env(jl_stenv_t *e, jl_value_t **root, jl_savedenv_t *se, int co } int n = 0; jl_varbinding_t *v = e->vars; - jl_value_t *ub = NULL, *vub = NULL; - JL_GC_PUSH2(&ub, &vub); + jl_value_t *b1 = NULL, *b2 = NULL; + JL_GC_PUSH2(&b1, &b2); while (v != NULL) { - if (v->ub != v->var->ub || v->lb != v->var->lb) { - jl_value_t *lb = jl_svecref(*root, n); - if (v->lb != lb) - jl_svecset(*root, n, lb ? jl_bottom_type : v->lb); - ub = jl_svecref(*root, n+1); - vub = v->ub; - if (vub != ub) - jl_svecset(*root, n+1, ub ? simple_join(ub, vub) : vub); - } + b1 = jl_svecref(*root, n); + b2 = v->lb; + jl_svecset(*root, n, simple_meet(b1, b2)); + b1 = jl_svecref(*root, n+1); + b2 = v->ub; + jl_svecset(*root, n+1, simple_join(b1, b2)); n = n + 3; v = v->prev; } diff --git a/stdlib/Artifacts/src/Artifacts.jl b/stdlib/Artifacts/src/Artifacts.jl index 724bda22ae531..25d8b254c7cfc 100644 --- a/stdlib/Artifacts/src/Artifacts.jl +++ b/stdlib/Artifacts/src/Artifacts.jl @@ -325,7 +325,7 @@ function process_overrides(artifact_dict::Dict, pkg_uuid::Base.UUID) # override for this UUID, and inserting new overrides for those hashes. overrides = load_overrides() if haskey(overrides[:UUID], pkg_uuid) - pkg_overrides = overrides[:UUID][pkg_uuid] + pkg_overrides = overrides[:UUID][pkg_uuid]::Dict{String, <:Any} for name in keys(artifact_dict) # Skip names that we're not overriding diff --git a/stdlib/InteractiveUtils/src/macros.jl b/stdlib/InteractiveUtils/src/macros.jl index 7c4ce6f0dd588..d9dcff57257c9 100644 --- a/stdlib/InteractiveUtils/src/macros.jl +++ b/stdlib/InteractiveUtils/src/macros.jl @@ -24,7 +24,8 @@ function recursive_dotcalls!(ex, args, i=1) end end (start, branches) = ex.head === :. ? (1, ex.args[2].args) : (2, ex.args) - for j in start:length(branches) + length_branches = length(branches)::Integer + for j in start:length_branches branch, i = recursive_dotcalls!(branches[j], args, i) branches[j] = branch end diff --git a/stdlib/LibGit2/src/consts.jl b/stdlib/LibGit2/src/consts.jl index 2bc9edaf8950b..55887ebe2a8ab 100644 --- a/stdlib/LibGit2/src/consts.jl +++ b/stdlib/LibGit2/src/consts.jl @@ -247,6 +247,11 @@ const RESET_HARD = Cint(3) # MIXED plus changes in working tree discarded REBASE_OPERATION_FIXUP = Cint(4), REBASE_OPERATION_EXEC = Cint(5)) +# git_remote_redirect_t +const GIT_REMOTE_REDIRECT_NONE = Cint(0) +const GIT_REMOTE_REDIRECT_INITIAL = Cint(1) +const GIT_REMOTE_REDIRECT_ALL = Cint(2) + # fetch_prune const FETCH_PRUNE_UNSPECIFIED = Cint(0) const FETCH_PRUNE = Cint(1) diff --git a/stdlib/LibGit2/src/gitcredential.jl b/stdlib/LibGit2/src/gitcredential.jl index 1b97c29cd933e..acfde02578523 100644 --- a/stdlib/LibGit2/src/gitcredential.jl +++ b/stdlib/LibGit2/src/gitcredential.jl @@ -219,7 +219,7 @@ function credential_helpers(cfg::GitConfig, cred::GitCredential) helpers = GitCredentialHelper[] # https://git-scm.com/docs/gitcredentials#gitcredentials-helper - for entry in GitConfigIter(cfg, r"credential.*\.helper") + for entry in GitConfigIter(cfg, r"credential.*\.helper$") section, url, name, value = split_cfg_entry(entry) @assert name == "helper" diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl index 2d95596cb276d..211bb4c08ad26 100644 --- a/stdlib/LibGit2/src/types.jl +++ b/stdlib/LibGit2/src/types.jl @@ -346,6 +346,9 @@ The fields represent: @static if LibGit2.VERSION >= v"0.25.0" proxy_opts::ProxyOptions = ProxyOptions() end + @static if LibGit2.VERSION >= v"1.4.0" + follow_redirects::Cint = Consts.GIT_REMOTE_REDIRECT_INITIAL + end @static if LibGit2.VERSION >= v"0.24.0" custom_headers::StrArrayStruct = StrArrayStruct() end @@ -677,6 +680,9 @@ The fields represent: @static if LibGit2.VERSION >= v"0.25.0" proxy_opts::ProxyOptions = ProxyOptions() end + @static if LibGit2.VERSION >= v"1.4.0" + follow_redirects::Cint = Consts.GIT_REMOTE_REDIRECT_INITIAL + end @static if LibGit2.VERSION >= v"0.24.0" custom_headers::StrArrayStruct = StrArrayStruct() end diff --git a/stdlib/LibGit2/test/libgit2.jl b/stdlib/LibGit2/test/libgit2.jl index 2a74ed4908dfc..74e23be3afc2b 100644 --- a/stdlib/LibGit2/test/libgit2.jl +++ b/stdlib/LibGit2/test/libgit2.jl @@ -1985,7 +1985,7 @@ mktempdir() do dir @test parse(GitCredentialHelper, "store") == GitCredentialHelper(`git credential-store`) end - @testset "empty helper" begin + @testset "credential helpers" begin config_path = joinpath(dir, config_file) # Note: LibGit2.set! doesn't allow us to set duplicates or ordering @@ -1998,16 +1998,14 @@ mktempdir() do dir [credential] helper = !echo second """) + # Git for Windows uses this config (see issue #45693) + write(fp,""" + [credential "helperselector"] + selected = manager-core + """) end LibGit2.with(LibGit2.GitConfig(config_path, LibGit2.Consts.CONFIG_LEVEL_APP)) do cfg - iter = LibGit2.GitConfigIter(cfg, r"credential.*\.helper") - @test LibGit2.split_cfg_entry.(iter) == [ - ("credential", "", "helper", "!echo first"), - ("credential", "https://mygithost", "helper", ""), - ("credential", "", "helper", "!echo second"), - ] - expected = [ GitCredentialHelper(`echo first`), GitCredentialHelper(`echo second`), diff --git a/stdlib/LibUV_jll/Project.toml b/stdlib/LibUV_jll/Project.toml index ec084417b7744..6f68176fc97e7 100644 --- a/stdlib/LibUV_jll/Project.toml +++ b/stdlib/LibUV_jll/Project.toml @@ -1,6 +1,6 @@ name = "LibUV_jll" uuid = "183b4373-6708-53ba-ad28-60e28bb38547" -version = "2.0.1+5" +version = "2.0.1+11" [deps] Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" diff --git a/stdlib/LinearAlgebra/src/LinearAlgebra.jl b/stdlib/LinearAlgebra/src/LinearAlgebra.jl index 9e1e75126274b..58f87f246a93d 100644 --- a/stdlib/LinearAlgebra/src/LinearAlgebra.jl +++ b/stdlib/LinearAlgebra/src/LinearAlgebra.jl @@ -19,6 +19,8 @@ using Base: IndexLinear, promote_eltype, promote_op, promote_typeof, @propagate_inbounds, @pure, reduce, typed_hvcat, typed_vcat, require_one_based_indexing, splat using Base.Broadcast: Broadcasted, broadcasted +using Base.PermutedDimsArrays: CommutativeOps + import Libdl export diff --git a/stdlib/LinearAlgebra/src/adjtrans.jl b/stdlib/LinearAlgebra/src/adjtrans.jl index b6a4548833eac..fdca270e28aee 100644 --- a/stdlib/LinearAlgebra/src/adjtrans.jl +++ b/stdlib/LinearAlgebra/src/adjtrans.jl @@ -255,22 +255,36 @@ Broadcast.broadcast_preserving_zero_d(f, tvs::Union{Number,TransposeAbsVec}...) ### reductions -# faster to sum the Array than to work through the wrapper -Base._mapreduce_dim(f, op, init::Base._InitialValue, A::Transpose, dims::Colon) = - transpose(Base._mapreduce_dim(_sandwich(transpose, f), _sandwich(transpose, op), init, parent(A), dims)) -Base._mapreduce_dim(f, op, init::Base._InitialValue, A::Adjoint, dims::Colon) = - adjoint(Base._mapreduce_dim(_sandwich(adjoint, f), _sandwich(adjoint, op), init, parent(A), dims)) +# faster to sum the Array than to work through the wrapper (but only in commutative reduction ops as in Base/permuteddimsarray.jl) +Base._mapreduce_dim(f, op::CommutativeOps, init::Base._InitialValue, A::Transpose, dims::Colon) = + Base._mapreduce_dim(f∘transpose, op, init, parent(A), dims) +Base._mapreduce_dim(f, op::CommutativeOps, init::Base._InitialValue, A::Adjoint, dims::Colon) = + Base._mapreduce_dim(f∘adjoint, op, init, parent(A), dims) +# in prod, use fast path only in the commutative case to avoid surprises +Base._mapreduce_dim(f::typeof(identity), op::Union{typeof(*),typeof(Base.mul_prod)}, init::Base._InitialValue, A::Transpose{<:Union{Real,Complex}}, dims::Colon) = + Base._mapreduce_dim(f∘transpose, op, init, parent(A), dims) +Base._mapreduce_dim(f::typeof(identity), op::Union{typeof(*),typeof(Base.mul_prod)}, init::Base._InitialValue, A::Adjoint{<:Union{Real,Complex}}, dims::Colon) = + Base._mapreduce_dim(f∘adjoint, op, init, parent(A), dims) +# count allows for optimization only if the parent array has Bool eltype +Base._count(::typeof(identity), A::Transpose{Bool}, ::Colon, init) = Base._count(identity, parent(A), :, init) +Base._count(::typeof(identity), A::Adjoint{Bool}, ::Colon, init) = Base._count(identity, parent(A), :, init) +Base._any(f, A::Transpose, ::Colon) = Base._any(f∘transpose, parent(A), :) +Base._any(f, A::Adjoint, ::Colon) = Base._any(f∘adjoint, parent(A), :) +Base._all(f, A::Transpose, ::Colon) = Base._all(f∘transpose, parent(A), :) +Base._all(f, A::Adjoint, ::Colon) = Base._all(f∘adjoint, parent(A), :) # sum(A'; dims) -Base.mapreducedim!(f, op, B::AbstractArray, A::TransposeAbsMat) = - transpose(Base.mapreducedim!(_sandwich(transpose, f), _sandwich(transpose, op), transpose(B), parent(A))) -Base.mapreducedim!(f, op, B::AbstractArray, A::AdjointAbsMat) = - adjoint(Base.mapreducedim!(_sandwich(adjoint, f), _sandwich(adjoint, op), adjoint(B), parent(A))) - -_sandwich(adj::Function, fun) = (xs...,) -> adj(fun(map(adj, xs)...)) -for fun in [:identity, :add_sum, :mul_prod] #, :max, :min] - @eval _sandwich(::Function, ::typeof(Base.$fun)) = Base.$fun -end - +Base.mapreducedim!(f, op::CommutativeOps, B::AbstractArray, A::TransposeAbsMat) = + (Base.mapreducedim!(f∘transpose, op, switch_dim12(B), parent(A)); B) +Base.mapreducedim!(f, op::CommutativeOps, B::AbstractArray, A::AdjointAbsMat) = + (Base.mapreducedim!(f∘adjoint, op, switch_dim12(B), parent(A)); B) +Base.mapreducedim!(f::typeof(identity), op::Union{typeof(*),typeof(Base.mul_prod)}, B::AbstractArray, A::TransposeAbsMat{<:Union{Real,Complex}}) = + (Base.mapreducedim!(f∘transpose, op, switch_dim12(B), parent(A)); B) +Base.mapreducedim!(f::typeof(identity), op::Union{typeof(*),typeof(Base.mul_prod)}, B::AbstractArray, A::AdjointAbsMat{<:Union{Real,Complex}}) = + (Base.mapreducedim!(f∘adjoint, op, switch_dim12(B), parent(A)); B) + +switch_dim12(B::AbstractVector) = permutedims(B) +switch_dim12(B::AbstractArray{<:Any,0}) = B +switch_dim12(B::AbstractArray) = PermutedDimsArray(B, (2, 1, ntuple(Base.Fix1(+,2), ndims(B) - 2)...)) ### linear algebra diff --git a/stdlib/LinearAlgebra/src/bunchkaufman.jl b/stdlib/LinearAlgebra/src/bunchkaufman.jl index 8de71109082d0..0bfa42ab483eb 100644 --- a/stdlib/LinearAlgebra/src/bunchkaufman.jl +++ b/stdlib/LinearAlgebra/src/bunchkaufman.jl @@ -80,7 +80,7 @@ BunchKaufman(A::AbstractMatrix{T}, ipiv::AbstractVector{<:Integer}, uplo::Abstra symmetric::Bool, rook::Bool, info::BlasInt) where {T} = BunchKaufman{T,typeof(A),typeof(ipiv)}(A, ipiv, uplo, symmetric, rook, info) # backwards-compatible constructors (remove with Julia 2.0) -@deprecate(BunchKaufman(LD, ipiv, uplo, symmetric, rook, info) where {T,S}, +@deprecate(BunchKaufman{T,S}(LD, ipiv, uplo, symmetric, rook, info) where {T,S}, BunchKaufman{T,S,typeof(ipiv)}(LD, ipiv, uplo, symmetric, rook, info), false) # iteration for destructuring into components diff --git a/stdlib/LinearAlgebra/test/adjtrans.jl b/stdlib/LinearAlgebra/test/adjtrans.jl index 7b782d463768d..e96ea28531d37 100644 --- a/stdlib/LinearAlgebra/test/adjtrans.jl +++ b/stdlib/LinearAlgebra/test/adjtrans.jl @@ -588,24 +588,52 @@ end @test transpose(Int[]) * Int[] == 0 end -@testset "reductions: $adjtrans" for adjtrans in [transpose, adjoint] - mat = rand(ComplexF64, 3,5) - @test sum(adjtrans(mat)) ≈ sum(collect(adjtrans(mat))) - @test sum(adjtrans(mat), dims=1) ≈ sum(collect(adjtrans(mat)), dims=1) - @test sum(adjtrans(mat), dims=(1,2)) ≈ sum(collect(adjtrans(mat)), dims=(1,2)) - - @test sum(imag, adjtrans(mat)) ≈ sum(imag, collect(adjtrans(mat))) - @test sum(imag, adjtrans(mat), dims=1) ≈ sum(imag, collect(adjtrans(mat)), dims=1) - - mat = [rand(ComplexF64,2,2) for _ in 1:3, _ in 1:5] - @test sum(adjtrans(mat)) ≈ sum(collect(adjtrans(mat))) - @test sum(adjtrans(mat), dims=1) ≈ sum(collect(adjtrans(mat)), dims=1) - @test sum(adjtrans(mat), dims=(1,2)) ≈ sum(collect(adjtrans(mat)), dims=(1,2)) - - @test sum(imag, adjtrans(mat)) ≈ sum(imag, collect(adjtrans(mat))) - @test sum(x -> x[1,2], adjtrans(mat)) ≈ sum(x -> x[1,2], collect(adjtrans(mat))) - @test sum(imag, adjtrans(mat), dims=1) ≈ sum(imag, collect(adjtrans(mat)), dims=1) - @test sum(x -> x[1,2], adjtrans(mat), dims=1) ≈ sum(x -> x[1,2], collect(adjtrans(mat)), dims=1) +@testset "reductions: $adjtrans" for adjtrans in (transpose, adjoint) + for (reduction, reduction!, op) in ((sum, sum!, +), (prod, prod!, *), (minimum, minimum!, min), (maximum, maximum!, max)) + T = op in (max, min) ? Float64 : ComplexF64 + mat = rand(T, 3,5) + rd1 = zeros(T, 1, 3) + rd2 = zeros(T, 5, 1) + rd3 = zeros(T, 1, 1) + @test reduction(adjtrans(mat)) ≈ reduction(copy(adjtrans(mat))) + @test reduction(adjtrans(mat), dims=1) ≈ reduction(copy(adjtrans(mat)), dims=1) + @test reduction(adjtrans(mat), dims=2) ≈ reduction(copy(adjtrans(mat)), dims=2) + @test reduction(adjtrans(mat), dims=(1,2)) ≈ reduction(copy(adjtrans(mat)), dims=(1,2)) + + @test reduction!(rd1, adjtrans(mat)) ≈ reduction!(rd1, copy(adjtrans(mat))) + @test reduction!(rd2, adjtrans(mat)) ≈ reduction!(rd2, copy(adjtrans(mat))) + @test reduction!(rd3, adjtrans(mat)) ≈ reduction!(rd3, copy(adjtrans(mat))) + + @test reduction(imag, adjtrans(mat)) ≈ reduction(imag, copy(adjtrans(mat))) + @test reduction(imag, adjtrans(mat), dims=1) ≈ reduction(imag, copy(adjtrans(mat)), dims=1) + @test reduction(imag, adjtrans(mat), dims=2) ≈ reduction(imag, copy(adjtrans(mat)), dims=2) + @test reduction(imag, adjtrans(mat), dims=(1,2)) ≈ reduction(imag, copy(adjtrans(mat)), dims=(1,2)) + + @test Base.mapreducedim!(imag, op, rd1, adjtrans(mat)) ≈ Base.mapreducedim!(imag, op, rd1, copy(adjtrans(mat))) + @test Base.mapreducedim!(imag, op, rd2, adjtrans(mat)) ≈ Base.mapreducedim!(imag, op, rd2, copy(adjtrans(mat))) + @test Base.mapreducedim!(imag, op, rd3, adjtrans(mat)) ≈ Base.mapreducedim!(imag, op, rd3, copy(adjtrans(mat))) + + op in (max, min) && continue + mat = [rand(T,2,2) for _ in 1:3, _ in 1:5] + rd1 = fill(zeros(T, 2, 2), 1, 3) + rd2 = fill(zeros(T, 2, 2), 5, 1) + rd3 = fill(zeros(T, 2, 2), 1, 1) + @test reduction(adjtrans(mat)) ≈ reduction(copy(adjtrans(mat))) + @test reduction(adjtrans(mat), dims=1) ≈ reduction(copy(adjtrans(mat)), dims=1) + @test reduction(adjtrans(mat), dims=2) ≈ reduction(copy(adjtrans(mat)), dims=2) + @test reduction(adjtrans(mat), dims=(1,2)) ≈ reduction(copy(adjtrans(mat)), dims=(1,2)) + + @test reduction(imag, adjtrans(mat)) ≈ reduction(imag, copy(adjtrans(mat))) + @test reduction(x -> x[1,2], adjtrans(mat)) ≈ reduction(x -> x[1,2], copy(adjtrans(mat))) + @test reduction(imag, adjtrans(mat), dims=1) ≈ reduction(imag, copy(adjtrans(mat)), dims=1) + @test reduction(x -> x[1,2], adjtrans(mat), dims=1) ≈ reduction(x -> x[1,2], copy(adjtrans(mat)), dims=1) + end + # see #46605 + Ac = [1 2; 3 4]' + @test mapreduce(identity, (x, y) -> 10x+y, copy(Ac)) == mapreduce(identity, (x, y) -> 10x+y, Ac) == 1234 + @test extrema([3,7,4]') == (3, 7) + @test mapreduce(x -> [x;;;], +, [1, 2, 3]') == sum(x -> [x;;;], [1, 2, 3]') == [6;;;] + @test mapreduce(string, *, [1 2; 3 4]') == mapreduce(string, *, copy([1 2; 3 4]')) == "1234" end end # module TestAdjointTranspose diff --git a/stdlib/Pkg.version b/stdlib/Pkg.version index cba86fbb03674..f97004e4bc79a 100644 --- a/stdlib/Pkg.version +++ b/stdlib/Pkg.version @@ -1,4 +1,4 @@ PKG_BRANCH = release-1.8 -PKG_SHA1 = 03e3bad8ef894f5a8b0edcfb00e4025173652b2b +PKG_SHA1 = 0027cb18c39dfa2f0bf649fda654315e11be7bc3 PKG_GIT_URL := https://github.com/JuliaLang/Pkg.jl.git PKG_TAR_URL = https://api.github.com/repos/JuliaLang/Pkg.jl/tarball/$1 diff --git a/stdlib/Printf/src/Printf.jl b/stdlib/Printf/src/Printf.jl index 05e1621dcb795..78381cef59cb2 100644 --- a/stdlib/Printf/src/Printf.jl +++ b/stdlib/Printf/src/Printf.jl @@ -242,7 +242,7 @@ end @inline function fmt(buf, pos, arg, spec::Spec{T}) where {T <: Strings} leftalign, hash, width, prec = spec.leftalign, spec.hash, spec.width, spec.precision str = string(arg) - slen = textwidth(str) + (hash ? arg isa AbstractString ? 2 : 1 : 0) + slen = textwidth(str)::Int + (hash ? arg isa AbstractString ? 2 : 1 : 0) op = p = prec == -1 ? slen : min(slen, prec) if !leftalign && width > p for _ = 1:(width - p) diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index a8beb58b4eb92..3854a81ee0bcb 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -1598,7 +1598,7 @@ end function getEntry(keymap::Dict{Char,Any},key::Union{String,Char}) v = keymap for c in key - if !haskey(v,c) + if !(haskey(v,c)::Bool) return nothing end v = v[c] diff --git a/stdlib/Tar.version b/stdlib/Tar.version index b7ee00e5a2666..6039b8428736e 100644 --- a/stdlib/Tar.version +++ b/stdlib/Tar.version @@ -1,4 +1,4 @@ -TAR_BRANCH = master -TAR_SHA1 = 0f8a73d5cd4b0c8f1f3c36799c96e9515e9dc595 +TAR_BRANCH = release-1.10 +TAR_SHA1 = c9e71856688bffacda56e1e2926a741bbb6e4784 TAR_GIT_URL := https://github.com/JuliaIO/Tar.jl.git TAR_TAR_URL = https://api.github.com/repos/JuliaIO/Tar.jl/tarball/$1 diff --git a/test/arrayops.jl b/test/arrayops.jl index b2badb66ce93d..22d38fddd3636 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -700,7 +700,7 @@ end ap = PermutedDimsArray(Array(a), (2,1,3)) @test strides(ap) == (3,1,12) - for A in [rand(1,2,3,4),rand(2,2,2,2),rand(5,6,5,6),rand(1,1,1,1)] + for A in [rand(1,2,3,4),rand(2,2,2,2),rand(5,6,5,6),rand(1,1,1,1), [rand(ComplexF64, 2,2) for _ in 1:2, _ in 1:3, _ in 1:2, _ in 1:4]] perm = randperm(4) @test isequal(A,permutedims(permutedims(A,perm),invperm(perm))) @test isequal(A,permutedims(permutedims(A,invperm(perm)),perm)) @@ -708,6 +708,10 @@ end @test sum(permutedims(A,perm)) ≈ sum(PermutedDimsArray(A,perm)) @test sum(permutedims(A,perm), dims=2) ≈ sum(PermutedDimsArray(A,perm), dims=2) @test sum(permutedims(A,perm), dims=(2,4)) ≈ sum(PermutedDimsArray(A,perm), dims=(2,4)) + + @test prod(permutedims(A,perm)) ≈ prod(PermutedDimsArray(A,perm)) + @test prod(permutedims(A,perm), dims=2) ≈ prod(PermutedDimsArray(A,perm), dims=2) + @test prod(permutedims(A,perm), dims=(2,4)) ≈ prod(PermutedDimsArray(A,perm), dims=(2,4)) end m = [1 2; 3 4] diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index 70a720e53f209..00470aaccf248 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -4074,3 +4074,24 @@ end)[2] == Union{} @time 1 end end)[2] == Union{} + +invoke_concretized1(a::Int) = a > 0 ? :int : nothing +invoke_concretized1(a::Integer) = a > 0 ? "integer" : nothing +# check if `invoke(invoke_concretized1, Tuple{Integer}, ::Int)` is foldable +@test Base.infer_effects((Int,)) do a + Base.@invoke invoke_concretized1(a::Integer) +end |> Core.Compiler.is_foldable +@test Base.return_types() do + Base.@invoke invoke_concretized1(42::Integer) +end |> only === String + +invoke_concretized2(a::Int) = a > 0 ? :int : nothing +invoke_concretized2(a::Integer) = a > 0 ? :integer : nothing +# check if `invoke(invoke_concretized2, Tuple{Integer}, ::Int)` is foldable +@test Base.infer_effects((Int,)) do a + Base.@invoke invoke_concretized2(a::Integer) +end |> Core.Compiler.is_foldable +@test let + Base.Experimental.@force_compile + Base.@invoke invoke_concretized2(42::Integer) +end === :integer diff --git a/test/gmp.jl b/test/gmp.jl index 2eb1e9faf47da..1d30925071b9a 100644 --- a/test/gmp.jl +++ b/test/gmp.jl @@ -227,6 +227,7 @@ let a, b @test 0 == sum(BigInt[]) isa BigInt @test prod(b) == foldl(*, b) @test 1 == prod(BigInt[]) isa BigInt + @test prod(BigInt[0, 0, 0]) == 0 # issue #46665 end @testset "Iterated arithmetic" begin diff --git a/test/subtype.jl b/test/subtype.jl index 70c8c0cb354b6..5bb2037d7852b 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -2020,3 +2020,14 @@ end #issue #43082 struct X43082{A, I, B<:Union{Ref{I},I}}; end @testintersect(Tuple{X43082{T}, Int} where T, Tuple{X43082{Int}, Any}, Tuple{X43082{Int}, Int}) + +#issue #46735 +T46735{B<:Real} = Pair{<:Union{B, Val{<:B}}, <:Union{AbstractMatrix{B}, AbstractMatrix{Vector{B}}}} +@testintersect(T46735{B} where {B}, T46735, !Union{}) +@testintersect(T46735{B} where {B<:Integer}, T46735, !Union{}) +S46735{B<:Val, M<:AbstractMatrix} = Tuple{<:Union{B, <:Val{<:B}},M,<:(Union{AbstractMatrix{B}, AbstractMatrix{<:Vector{<:B}}})} +@testintersect(S46735{B} where {B}, S46735, !Union{}) +@testintersect(S46735{B, M} where {B, M}, S46735, !Union{}) +A46735{B<:Val, M<:AbstractMatrix} = Tuple{<:Union{B, <:Val{<:B}},M,Union{AbstractMatrix{B}, AbstractMatrix{<:Vector{<:B}}}} +@testintersect(A46735{B} where {B}, A46735, !Union{}) +@testintersect(A46735{B, M} where {B, M}, A46735, !Union{})