diff --git a/Compiler/src/ssair/passes.jl b/Compiler/src/ssair/passes.jl index f5a766ae04b0f..76449d2d8f73c 100644 --- a/Compiler/src/ssair/passes.jl +++ b/Compiler/src/ssair/passes.jl @@ -361,20 +361,25 @@ function already_inserted(compact::IncrementalCompact, old::OldSSAValue) already_inserted_ssa(compact, compact.idx-1)(0, old) end -function already_inserted_ssa(compact::IncrementalCompact, processed_idx::Int) - return function did_already_insert(phi_arg::Int, old::OldSSAValue) - id = old.id - if id <= length(compact.ir.stmts) - return id <= processed_idx - end - id -= length(compact.ir.stmts) - if id <= length(compact.ir.new_nodes) - return did_already_insert(phi_arg, OldSSAValue(compact.ir.new_nodes.info[id].pos)) - end - id -= length(compact.ir.new_nodes) - @assert id <= length(compact.pending_nodes) - return !(id in compact.pending_perm) +function _already_inserted_ssa(compact::IncrementalCompact, processed_idx::Int, + phi_arg::Int, old::OldSSAValue) + id = old.id + if id <= length(compact.ir.stmts) + return id <= processed_idx + end + id -= length(compact.ir.stmts) + if id <= length(compact.ir.new_nodes) + return _already_inserted_ssa(compact, processed_idx, phi_arg, + OldSSAValue(compact.ir.new_nodes.info[id].pos)) end + id -= length(compact.ir.new_nodes) + @assert id <= length(compact.pending_nodes) + return !(id in compact.pending_perm) +end + +function already_inserted_ssa(compact::IncrementalCompact, processed_idx::Int) + return (phi_arg::Int, old::OldSSAValue) -> + _already_inserted_ssa(compact, processed_idx, phi_arg, old) end function is_pending(compact::IncrementalCompact, old::OldSSAValue) @@ -1644,6 +1649,25 @@ function reachable_blocks(cfg::CFG, from_bb::Int, to_bb::Int) return visited end +function _update_finalizer_insert!(ir::IRCode, lazypostdomtree::LazyPostDomtree, + finalizer_idx::Int, insert_bb::Int, + insert_idx::Union{Int,Nothing}, x::Union{Int,SSAUse}) + defuse_idx = x isa SSAUse ? x.idx : x + defuse_idx == finalizer_idx && return insert_bb, insert_idx + defuse_bb = block_for_inst(ir, defuse_idx) + new_insert_bb = nearest_common_dominator(get!(lazypostdomtree), + insert_bb, defuse_bb) + if new_insert_bb == insert_bb && insert_idx !== nothing + insert_idx = max(insert_idx::Int, defuse_idx) + elseif new_insert_bb == defuse_bb + insert_idx = defuse_idx + else + insert_idx = nothing + end + insert_bb = new_insert_bb + return insert_bb, insert_idx +end + function try_resolve_finalizer!(ir::IRCode, alloc_idx::Int, finalizer_idx::Int, defuse::SSADefUse, inlining::InliningState, lazydomtree::LazyDomtree, lazypostdomtree::LazyPostDomtree, @nospecialize(info::CallInfo)) @@ -1665,24 +1689,12 @@ function try_resolve_finalizer!(ir::IRCode, alloc_idx::Int, finalizer_idx::Int, # Check #2: The insertion block for the finalizer is the post-dominator of all uses insert_bb::Int = finalizer_bb insert_idx::Union{Int,Nothing} = finalizer_idx - function note_defuse!(x::Union{Int,SSAUse}) - defuse_idx = x isa SSAUse ? x.idx : x - defuse_idx == finalizer_idx && return nothing - defuse_bb = block_for_inst(ir, defuse_idx) - new_insert_bb = nearest_common_dominator(get!(lazypostdomtree), - insert_bb, defuse_bb) - if new_insert_bb == insert_bb && insert_idx !== nothing - insert_idx = max(insert_idx::Int, defuse_idx) - elseif new_insert_bb == defuse_bb - insert_idx = defuse_idx - else - insert_idx = nothing - end - insert_bb = new_insert_bb - nothing + for x in defuse.uses + insert_bb, insert_idx = _update_finalizer_insert!(ir, lazypostdomtree, finalizer_idx, insert_bb, insert_idx, x) + end + for x in defuse.defs + insert_bb, insert_idx = _update_finalizer_insert!(ir, lazypostdomtree, finalizer_idx, insert_bb, insert_idx, x) end - foreach(note_defuse!, defuse.uses) - foreach(note_defuse!, defuse.defs) insert_bb != 0 || return nothing # verify post-dominator of all uses exists if !OptimizationParams(inlining.interp).assume_fatal_throw diff --git a/Compiler/src/ssair/show.jl b/Compiler/src/ssair/show.jl index 3331a0663450e..f7c3ac8888916 100644 --- a/Compiler/src/ssair/show.jl +++ b/Compiler/src/ssair/show.jl @@ -534,37 +534,33 @@ function DILineInfoPrinter(debuginfo, def, showtypes::Bool=false) started::Bool = false if !update_line_only && showtypes && !isa(frame.method, Symbol) && nctx != 1 print(io, linestart) - with_output_color(linecolor, io) do io - print(io, indent("│")) - print(io, "┌ invoke ", frame.method) - println(io) - end + printstyled(io, indent("│"), color=linecolor) + printstyled(io, "┌ invoke ", frame.method, color=linecolor) + println(io) started = true end print(io, linestart) - with_output_color(linecolor, io) do io - print(io, indent("│")) - push!(context, frame) - if update_line_only - update_line_only = false - else - context_depth[] += 1 - nctx != 1 && print(io, started ? "│" : "┌") - end - print(io, " @ ", frame.file) - if frame.line != typemax(frame.line) && frame.line != 0 - print(io, ":", frame.line) - end - print(io, " within `", method_name(frame), "`") - if collapse - method = method_name(frame) - while nctx < nframes - frame = DI[nframes - nctx] - method_name(frame) === method || break - nctx += 1 - push!(context, frame) - print(io, " @ ", frame.file, ":", frame.line) - end + printstyled(io, indent("│"), color=linecolor) + push!(context, frame) + if update_line_only + update_line_only = false + else + context_depth[] += 1 + nctx != 1 && printstyled(io, started ? "│" : "┌", color=linecolor) + end + printstyled(io, " @ ", frame.file, color=linecolor) + if frame.line != typemax(frame.line) && frame.line != 0 + printstyled(io, ":", frame.line, color=linecolor) + end + printstyled(io, " within `", method_name(frame), "`", color=linecolor) + if collapse + method = method_name(frame) + while nctx < nframes + frame = DI[nframes - nctx] + method_name(frame) === method || break + nctx += 1 + push!(context, frame) + printstyled(io, " @ ", frame.file, ":", frame.line, color=linecolor) end end println(io) @@ -681,6 +677,60 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo, IncrementalCompact}, sptypes, used, cfg, bb_idx; pop_new_node!, only_after, config.bb_color, config.label_dynamic_calls) end +function _print_ir_indentation(io::IO, cfg::CFG, bb_idx::Int, max_bb_idx_size::Int, bb_color, + line_info_preprinter, idx::Int, i::Int; final::Bool=true) + # Compute BB guard rail + if bb_idx > length(cfg.blocks) + # If invariants are violated, print a special leader + linestart = " "^(max_bb_idx_size + 2) # not inside a basic block bracket + inlining_indent = line_info_preprinter(io, linestart, i == 1 ? idx : 0) + printstyled(io, "!!! ", "─"^max_bb_idx_size, color=bb_color) + else + bbrange = cfg.blocks[bb_idx].stmts + # Print line info update + linestart = idx == first(bbrange) ? " " : sprint(io -> printstyled(io, "│ ", color=bb_color), context=io) + linestart *= " "^max_bb_idx_size + # idx == 0 means only indentation is printed, so we don't print linfos + # multiple times if the are new nodes + inlining_indent = line_info_preprinter(io, linestart, i == 1 ? idx : 0) + + if i == 1 && idx == first(bbrange) + bb_idx_str = string(bb_idx) + bb_pad = max_bb_idx_size - length(bb_idx_str) + bb_type = length(cfg.blocks[bb_idx].preds) <= 1 ? "─" : "┄" + printstyled(io, bb_idx_str, " ", bb_type, "─"^bb_pad, color=bb_color) + elseif final && idx == last(bbrange) # print separator + printstyled(io, "└", "─"^(1 + max_bb_idx_size), color=bb_color) + else + printstyled(io, "│ ", " "^max_bb_idx_size, color=bb_color) + end + end + print(io, inlining_indent, " ") + return nothing +end + +function _print_ir_new_node(io::IO, node, code, sptypes::Vector{VarState}, used::BitSet, maxlength_idx::Int, + label_dynamic_calls::Bool, line_info_postprinter, cfg::CFG, bb_idx::Int, + max_bb_idx_size::Int, bb_color, line_info_preprinter, idx::Int, i::Int; final::Bool=true) + _print_ir_indentation(io, cfg, bb_idx, max_bb_idx_size, bb_color, line_info_preprinter, idx, i; final) + + node_idx, new_node_inst, new_node_type = node + @assert new_node_inst !== UNDEF # we filtered these out earlier + show_type = should_print_ssa_type(new_node_inst) + with_output_color(:green, io) do io′ + print_stmt(io′, node_idx, new_node_inst, code, sptypes, used, maxlength_idx, false, show_type, label_dynamic_calls) + end + + if new_node_type === UNDEF + # Try to be robust against errors + printstyled(io, "::#UNDEF", color=:red) + else + line_info_postprinter(io; type = new_node_type, used = node_idx in used, show_type, idx = node_idx) + end + println(io) + return nothing +end + function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo, IncrementalCompact}, idx::Int, line_info_preprinter, line_info_postprinter, sptypes::Vector{VarState}, used::BitSet, cfg::CFG, bb_idx::Int; pop_new_node! = Returns(nothing), only_after::Bool=false, bb_color=:light_black, label_dynamic_calls::Bool=true) @@ -703,58 +753,11 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo, IncrementalCompact}, end i = 1 - function print_indentation(final::Bool=true) - # Compute BB guard rail - if bb_idx > length(cfg.blocks) - # If invariants are violated, print a special leader - linestart = " "^(max_bb_idx_size + 2) # not inside a basic block bracket - inlining_indent = line_info_preprinter(io, linestart, i == 1 ? idx : 0) - printstyled(io, "!!! ", "─"^max_bb_idx_size, color=bb_color) - else - bbrange = cfg.blocks[bb_idx].stmts - # Print line info update - linestart = idx == first(bbrange) ? " " : sprint(io -> printstyled(io, "│ ", color=bb_color), context=io) - linestart *= " "^max_bb_idx_size - # idx == 0 means only indentation is printed, so we don't print linfos - # multiple times if the are new nodes - inlining_indent = line_info_preprinter(io, linestart, i == 1 ? idx : 0) - - if i == 1 && idx == first(bbrange) - bb_idx_str = string(bb_idx) - bb_pad = max_bb_idx_size - length(bb_idx_str) - bb_type = length(cfg.blocks[bb_idx].preds) <= 1 ? "─" : "┄" - printstyled(io, bb_idx_str, " ", bb_type, "─"^bb_pad, color=bb_color) - elseif final && idx == last(bbrange) # print separator - printstyled(io, "└", "─"^(1 + max_bb_idx_size), color=bb_color) - else - printstyled(io, "│ ", " "^max_bb_idx_size, color=bb_color) - end - end - print(io, inlining_indent, " ") - end - # first, print new nodes that are to be inserted before the current statement - function print_new_node(node; final::Bool=true) - print_indentation(final) - - node_idx, new_node_inst, new_node_type = node - @assert new_node_inst !== UNDEF # we filtered these out earlier - show_type = should_print_ssa_type(new_node_inst) - let maxlength_idx=maxlength_idx, show_type=show_type - with_output_color(:green, io) do io′ - print_stmt(io′, node_idx, new_node_inst, code, sptypes, used, maxlength_idx, false, show_type, label_dynamic_calls) - end - end - - if new_node_type === UNDEF # try to be robust against errors - printstyled(io, "::#UNDEF", color=:red) - else - line_info_postprinter(io; type = new_node_type, used = node_idx in used, show_type, idx = node_idx) - end - println(io) - end while (next = pop_new_node!(idx)) !== nothing - only_after || print_new_node(next; final=false) + only_after || _print_ir_new_node(io, next, code, sptypes, used, maxlength_idx, label_dynamic_calls, + line_info_postprinter, cfg, bb_idx, max_bb_idx_size, bb_color, + line_info_preprinter, idx, i; final=false) i += 1 end @@ -766,7 +769,7 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo, IncrementalCompact}, # FIXME: `only_after` is hack so that we can call this function to print uncompacted # attach-after nodes when the current node has already been compated already if !only_after - print_indentation(next===nothing) + _print_ir_indentation(io, cfg, bb_idx, max_bb_idx_size, bb_color, line_info_preprinter, idx, i; final=next===nothing) if code isa CodeInfo stmt = statement_indices_to_labels(stmt, cfg) end @@ -786,7 +789,9 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo, IncrementalCompact}, # finally, print new nodes that are to be inserted after the current statement while next !== nothing - print_new_node(next) + _print_ir_new_node(io, next, code, sptypes, used, maxlength_idx, label_dynamic_calls, + line_info_postprinter, cfg, bb_idx, max_bb_idx_size, bb_color, + line_info_preprinter, idx, i) i += 1 next = pop_new_node!(idx; attach_after=true) end diff --git a/base/array.jl b/base/array.jl index 4dcf385c49666..7cefac20fb377 100644 --- a/base/array.jl +++ b/base/array.jl @@ -2949,10 +2949,11 @@ end function indcopy(sz::Dims, I::Tuple{Vararg{RangeIndex}}) n = length(I) - s = sz[n] + _s = sz[n] for i = n+1:length(sz) - s *= sz[i] + _s *= sz[i] end + s = _s dst::typeof(I) = ntuple(i-> _findin(I[i], i < n ? (1:sz[i]) : (1:s)), n)::typeof(I) src::typeof(I) = ntuple(i-> I[i][_findin(I[i], i < n ? (1:sz[i]) : (1:s))], n)::typeof(I) dst, src diff --git a/base/arrayshow.jl b/base/arrayshow.jl index cbdca7b2686c4..903fb4f6b68bc 100644 --- a/base/arrayshow.jl +++ b/base/arrayshow.jl @@ -295,7 +295,14 @@ function _show_nd(io::IO, @nospecialize(a::AbstractArray), print_matrix::Functio ii = idxs[i] ind = tailinds[i] if length(ind) > 10 - if ii == ind[firstindex(ind)+3] && all(d->idxs[d]==first(tailinds[d]),1:i-1) + all_first = true + for d = 1:i-1 + if idxs[d] != first(tailinds[d]) + all_first = false + break + end + end + if ii == ind[firstindex(ind)+3] && all_first for j=i+1:nd szj = length(axs[j+2]) indj = tailinds[j] diff --git a/base/binaryplatforms.jl b/base/binaryplatforms.jl index 76aaf927b60f2..08cd5ce403b85 100644 --- a/base/binaryplatforms.jl +++ b/base/binaryplatforms.jl @@ -872,6 +872,42 @@ function get_csl_member(member::Symbol) return nothing end + +function _get_libgfortran_path() + # If CompilerSupportLibraries_jll is a stdlib, we can just directly ask for + # the path here, without checking `dllist()`: + libgfortran_path = get_csl_member(:libgfortran_path) + if libgfortran_path !== nothing + return libgfortran_path::String + end + + # Otherwise, look for it having already been loaded by something + libgfortran_paths = filter!(x -> occursin("libgfortran", x), Libdl.dllist()) + if !isempty(libgfortran_paths) + return first(libgfortran_paths)::String + end + + # One day, I hope to not be linking against libgfortran in base Julia + return nothing +end + +function _get_libstdcxx_handle() + # If CompilerSupportLibraries_jll is a stdlib, we can just directly open it + libstdcxx = get_csl_member(:libstdcxx) + if libstdcxx !== nothing + return nothing + end + + # Otherwise, look for it having already been loaded by something + libstdcxx_paths = filter!(x -> occursin("libstdc++", x), Libdl.dllist()) + if !isempty(libstdcxx_paths) + return Libdl.dlopen(first(libstdcxx_paths), Libdl.RTLD_NOLOAD)::Ptr{Cvoid} + end + + # One day, I hope to not be linking against libgfortran in base Julia + return nothing +end + """ detect_libgfortran_version() @@ -880,25 +916,7 @@ linked against (if any). Returns `nothing` if no libgfortran version dependence detected. """ function detect_libgfortran_version() - function get_libgfortran_path() - # If CompilerSupportLibraries_jll is a stdlib, we can just directly ask for - # the path here, without checking `dllist()`: - libgfortran_path = get_csl_member(:libgfortran_path) - if libgfortran_path !== nothing - return libgfortran_path::String - end - - # Otherwise, look for it having already been loaded by something - libgfortran_paths = filter!(x -> occursin("libgfortran", x), Libdl.dllist()) - if !isempty(libgfortran_paths) - return first(libgfortran_paths)::String - end - - # One day, I hope to not be linking against libgfortran in base Julia - return nothing - end - - libgfortran_path = get_libgfortran_path() + libgfortran_path = _get_libgfortran_path() name, version = parse_dl_name_version(libgfortran_path, os()) if version === nothing # Even though we complain about this, we allow it to continue in the hopes that @@ -922,25 +940,8 @@ it is linked against (if any). `max_minor_version` is the latest version in the 3.4 series of GLIBCXX where the search is performed. """ function detect_libstdcxx_version(max_minor_version::Int=30) - function get_libstdcxx_handle() - # If CompilerSupportLibraries_jll is a stdlib, we can just directly open it - libstdcxx = get_csl_member(:libstdcxx) - if libstdcxx !== nothing - return nothing - end - - # Otherwise, look for it having already been loaded by something - libstdcxx_paths = filter!(x -> occursin("libstdc++", x), Libdl.dllist()) - if !isempty(libstdcxx_paths) - return Libdl.dlopen(first(libstdcxx_paths), Libdl.RTLD_NOLOAD)::Ptr{Cvoid} - end - - # One day, I hope to not be linking against libgfortran in base Julia - return nothing - end - # Brute-force our way through GLIBCXX_* symbols to discover which version we're linked against - libstdcxx = get_libstdcxx_handle() + libstdcxx = _get_libstdcxx_handle() if libstdcxx !== nothing # Try all GLIBCXX versions down to GCC v4.8: diff --git a/base/errorshow.jl b/base/errorshow.jl index 33edb4cee92a4..69b67bf36953a 100644 --- a/base/errorshow.jl +++ b/base/errorshow.jl @@ -1294,9 +1294,11 @@ function UndefVarError_hint(io::IO, ex::UndefVarError) warned = _UndefVarError_warnfor(io, [Base], var) if !warned - modules_to_check = (m for m in Base.loaded_modules_order - if m !== Core && m !== Base && m !== Main && m !== scope) - warned |= _UndefVarError_warnfor(io, modules_to_check, var) + let scope = scope + modules_to_check = (m for m in Base.loaded_modules_order + if m !== Core && m !== Base && m !== Main && m !== scope) + warned |= _UndefVarError_warnfor(io, modules_to_check, var) + end end warned || _UndefVarError_warnfor(io, [Core, Main], var) diff --git a/base/experimental.jl b/base/experimental.jl index f43bdb2800b75..d4532faec0963 100644 --- a/base/experimental.jl +++ b/base/experimental.jl @@ -655,26 +655,7 @@ function wait_with_timeout(c::GenericCondition; first::Bool=false, timeout::Real timer = Timer(timeout) waiter_left = Threads.Atomic{Bool}(false) # start a task to wait on the timer - t = Task() do - try - wait(timer) - catch e - # if the timer was closed, the waiting task has been scheduled; do nothing - e isa EOFError && return - end - dosched = false - lock(c.lock) - # Confirm that the waiting task is still in the wait queue and remove it. If - # the task is not in the wait queue, it must have been notified already so we - # don't do anything here. - if !waiter_left[] && ct.queue === c.waitq - dosched = true - Base.list_deletefirst!(c.waitq, ct) - end - unlock(c.lock) - # send the waiting task a timeout - dosched && schedule(ct, :timed_out) - end + t = _wait_with_timeout_task(c, ct, timer, waiter_left) t.sticky = false Threads._spawn_set_thrpool(t, :interactive) schedule(t) @@ -695,4 +676,28 @@ function wait_with_timeout(c::GenericCondition; first::Bool=false, timeout::Real end end +function _wait_with_timeout_task(c::GenericCondition, ct::Task, timer::Timer, + waiter_left::Threads.Atomic{Bool}) + return Task() do + try + wait(timer) + catch e + # if the timer was closed, the waiting task has been scheduled; do nothing + e isa EOFError && return + end + dosched = false + lock(c.lock) + # Confirm that the waiting task is still in the wait queue and remove it. If + # the task is not in the wait queue, it must have been notified already so we + # don't do anything here. + if !waiter_left[] && ct.queue === c.waitq + dosched = true + Base.list_deletefirst!(c.waitq, ct) + end + unlock(c.lock) + # send the waiting task a timeout + dosched && schedule(ct, :timed_out) + end +end + end # module diff --git a/base/file.jl b/base/file.jl index 4b0b756a00ae1..f5e0ad2e9dc6f 100644 --- a/base/file.jl +++ b/base/file.jl @@ -666,18 +666,18 @@ function temp_cleanup_purge_prelocked(force::Bool) end function temp_cleanup_purge_all() - may_need_gc = false + may_need_gc = Ref(false) @lock TEMP_CLEANUP_LOCK filter!(TEMP_CLEANUP) do (path, asap) try ispath(path) || return false - may_need_gc = true + may_need_gc[] = true return true catch ex ex isa InterruptException && rethrow() return true end end - if may_need_gc + if may_need_gc[] # this is only usually required on Sys.iswindows(), but may as well do it everywhere GC.gc(true) end @@ -1187,43 +1187,45 @@ julia> (path, dirs, files) = first(itr) ``` """ function walkdir(path = pwd(); topdown=true, follow_symlinks=false, onerror=throw) - function _walkdir(chnl, path) - tryf(f, p) = try - f(p) - catch err - isa(err, IOError) || rethrow() - try - onerror(err) - catch err2 - close(chnl, err2) - end - return - end - entries = tryf(_readdirx, path) - entries === nothing && return - dirs = Vector{String}() - files = Vector{String}() - for entry in entries - # If we're not following symlinks, then treat all symlinks as files - if (!follow_symlinks && something(tryf(islink, entry), true)) || !something(tryf(isdir, entry), false) - push!(files, entry.name) - else - push!(dirs, entry.name) - end - end + return Channel{Tuple{String,Vector{String},Vector{String}}}(chnl -> + _walkdir(chnl, path, topdown, follow_symlinks, onerror)) +end - if topdown - push!(chnl, (path, dirs, files)) - end - for dir in dirs - _walkdir(chnl, joinpath(path, dir)) +function _walkdir(chnl, path, topdown, follow_symlinks, onerror) + tryf(f, p) = try + f(p) + catch err + isa(err, IOError) || rethrow() + try + onerror(err) + catch err2 + close(chnl, err2) + end + return end - if !topdown - push!(chnl, (path, dirs, files)) + entries = tryf(_readdirx, path) + entries === nothing && return + dirs = Vector{String}() + files = Vector{String}() + for entry in entries + # If we're not following symlinks, then treat all symlinks as files + if (!follow_symlinks && something(tryf(islink, entry), true)) || !something(tryf(isdir, entry), false) + push!(files, entry.name) + else + push!(dirs, entry.name) end - nothing end - return Channel{Tuple{String,Vector{String},Vector{String}}}(chnl -> _walkdir(chnl, path)) + + if topdown + push!(chnl, (path, dirs, files)) + end + for dir in dirs + _walkdir(chnl, joinpath(path, dir), topdown, follow_symlinks, onerror) + end + if !topdown + push!(chnl, (path, dirs, files)) + end + nothing end function unlink(p::AbstractString) diff --git a/base/loading.jl b/base/loading.jl index 7c44b68f57413..11b965235f7d0 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -186,7 +186,7 @@ const slug_chars = String(['A':'Z'; 'a':'z'; '0':'9']) function slug(x::UInt32, p::Int) sprint(sizehint=p) do io y = x - n = length(slug_chars) + n = UInt32(length(slug_chars)) for i = 1:p y, d = divrem(y, n) write(io, slug_chars[1+d]) @@ -1555,8 +1555,8 @@ function insert_extension_triggers(env::String, pkg::PkgId)::Union{Nothing,Missi if length(entries) != 1 error("expected a single entry for $(repr(dep_name)) in $(repr(project_file))") end - entry = first(entries)::Dict{String, Any} - uuid = entry["uuid"]::String + local entry = first(entries)::Dict{String, Any} + local uuid = entry["uuid"]::String deps′_expanded[dep_name] = uuid end return deps′_expanded @@ -2696,7 +2696,7 @@ function __require_prelocked(pkg::PkgId, env) end set_pkgorigin_version_path(pkg, path) - parallel_precompile_attempted = false # being safe to avoid getting stuck in a precompilepkgs loop + parallel_precompile_attempted = Ref(false) # being safe to avoid getting stuck in a precompilepkgs loop reasons = Dict{String,Int}() # attempt to load the module file via the precompile cache locations if JLOptions().use_compiled_modules != 0 @@ -2728,19 +2728,19 @@ function __require_prelocked(pkg::PkgId, env) if !generating_output(#=incremental=#false) project = active_project() # spawn off a new incremental pre-compile task for recursive `require` calls - loaded = let path = path, reasons = reasons + loaded = let path = path, reasons = reasons, parallel_precompile_attempted = parallel_precompile_attempted maybe_cachefile_lock(pkg, path) do # double-check the search now that we have lock m = _require_search_from_serialized(pkg, path, UInt128(0), true) m isa Module && return m - verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug + local verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug @logmsg verbosity "Precompiling $(repr("text/plain", pkg))$(list_reasons(reasons))" unlock(require_lock) try - if !generating_output() && !parallel_precompile_attempted && !disable_parallel_precompile && @isdefined(Precompilation) - parallel_precompile_attempted = true + if !generating_output() && !parallel_precompile_attempted[] && !disable_parallel_precompile && @isdefined(Precompilation) + parallel_precompile_attempted[] = true precompiled = Precompilation.precompilepkgs([pkg]; _from_loading=true, ignore_loaded=false) # prcompiled returns either nothing, indicating it needs serial precompile, # or the entry(ies) that it found would be best to load (possibly because it just created it) @@ -2776,7 +2776,7 @@ function __require_prelocked(pkg::PkgId, env) @goto load_from_cache # the new cachefile will have the newest mtime so will come first in the search elseif isa(loaded, Exception) if precompilableerror(loaded) - verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug + local verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug @logmsg verbosity "Skipping precompilation due to precompilable error. Importing $(repr("text/plain", pkg))." exception=loaded else @warn "The call to compilecache failed to create a usable precompiled cache file for $(repr("text/plain", pkg))" exception=loaded @@ -3359,9 +3359,10 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in ocachefile = cache_objects ? ocachefile_from_cachefile(cachefile) : nothing # append checksum for so to the end of the .ji file: - crc_so = UInt32(0) - if cache_objects - crc_so = open(_crc32c, tmppath_so, "r") + crc_so = if cache_objects + open(_crc32c, tmppath_so, "r") + else + UInt32(0) end # append extra crc to the end of the .ji file: diff --git a/base/module.jl b/base/module.jl index c21414179446e..cefd6c9eca2d4 100644 --- a/base/module.jl +++ b/base/module.jl @@ -12,12 +12,12 @@ end function eval_import_path(at::Module, from::Union{Module, Nothing}, path::Expr, keyword::String) isempty(path.args) && error("malformed import statement") - i::Int = 1 + i = RefValue(1) function next!() local v - i <= length(path.args) || error("invalid module path") - v = path.args[i] - i += 1 + i[] <= length(path.args) || error("invalid module path") + v = path.args[i[]] + i[] += 1 v isa Symbol || throw(TypeError(Symbol(keyword), "", Symbol, v)) v end @@ -36,7 +36,7 @@ function eval_import_path(at::Module, from::Union{Module, Nothing}, path::Expr, m = require(at, v) m isa Module || error("failed to load module $v") end - i > lastindex(path.args) && return m, nothing + i[] > lastindex(path.args) && return m, nothing v = next!() else # `.A.B.C`: strip off leading dots by following parent links @@ -48,7 +48,7 @@ function eval_import_path(at::Module, from::Union{Module, Nothing}, path::Expr, while true v === :. && error("invalid $keyword path: \".\" in identifier path") - i > lastindex(path.args) && break + i[] > lastindex(path.args) && break m = getglobal(m, v) m isa Module || error("invalid $keyword path: \"$v\" does not name a module") v = next!() diff --git a/base/precompilation.jl b/base/precompilation.jl index adecc50f6d1e4..f43fee770c94a 100644 --- a/base/precompilation.jl +++ b/base/precompilation.jl @@ -490,6 +490,21 @@ function precompilepkgs(pkgs::Union{Vector{String}, Vector{PkgId}}=String[]; IOContext{IO}(io), fancyprint, manifest, ignore_loaded) end +function _visit_indirect_deps!(direct_deps::Dict{PkgId, Vector{PkgId}}, visited::Set{PkgId}, + node::PkgId, all_deps::Set{PkgId}) + if node in visited + return + end + push!(visited, node) + for dep in get(Set{PkgId}, direct_deps, node) + if !(dep in all_deps) + push!(all_deps, dep) + _visit_indirect_deps!(direct_deps, visited, dep, all_deps) + end + end + return +end + function _precompilepkgs(pkgs::Union{Vector{String}, Vector{PkgId}}, internal_call::Bool, strict::Bool, @@ -626,25 +641,12 @@ function _precompilepkgs(pkgs::Union{Vector{String}, Vector{PkgId}}, # A package depends on an extension if it (indirectly) depends on all extension triggers function expand_indirect_dependencies(direct_deps) - function visit!(visited, node, all_deps) - if node in visited - return - end - push!(visited, node) - for dep in get(Set{Base.PkgId}, direct_deps, node) - if !(dep in all_deps) - push!(all_deps, dep) - visit!(visited, dep, all_deps) - end - end - end - local indirect_deps = Dict{Base.PkgId, Set{Base.PkgId}}() for package in keys(direct_deps) # Initialize a set to keep track of all dependencies for 'package' all_deps = Set{Base.PkgId}() visited = Set{Base.PkgId}() - visit!(visited, package, all_deps) + _visit_indirect_deps!(direct_deps, visited, package, all_deps) # Update direct_deps with the complete set of dependencies for 'package' indirect_deps[package] = all_deps end diff --git a/base/runtime_internals.jl b/base/runtime_internals.jl index 08e3337a915dd..4553ba0546db9 100644 --- a/base/runtime_internals.jl +++ b/base/runtime_internals.jl @@ -1874,11 +1874,11 @@ end length(specs::MethodSpecializations) = count(Returns(true), specs) function length(mt::Core.MethodTable) - n = 0 + n = Ref(0) visit(mt) do m - n += 1 + n[] += 1 end - return n::Int + return n[] end isempty(mt::Core.MethodTable) = (mt.defs === nothing) diff --git a/base/shell.jl b/base/shell.jl index 68925cbd5d5af..09b91918f2634 100644 --- a/base/shell.jl +++ b/base/shell.jl @@ -244,34 +244,40 @@ function print_shell_escaped_posixly(io::IO, args::AbstractString...) first || print(io, ' ') # avoid printing quotes around simple enough strings # that any (reasonable) shell will definitely never consider them to be special - have_single::Bool = false - have_double::Bool = false - function isword(c::AbstractChar) - if '0' <= c <= '9' || 'a' <= c <= 'z' || 'A' <= c <= 'Z' - # word characters - elseif c == '_' || c == '/' || c == '+' || c == '-' || c == '.' - # other common characters - elseif c == '\'' - have_single = true - elseif c == '"' - have_double && return false # switch to single quoting - have_double = true - elseif !first && c == '=' - # equals is special if it is first (e.g. `env=val ./cmd`) - else - # anything else - return false - end - return true - end if isempty(arg) print(io, "''") - elseif all(isword, arg) - have_single && (arg = replace(arg, '\'' => "\\'")) - have_double && (arg = replace(arg, '"' => "\\\"")) - print(io, arg) else - print(io, '\'', replace(arg, '\'' => "'\\''"), '\'') + have_single = false + have_double = false + isword = true + for c in arg + if '0' <= c <= '9' || 'a' <= c <= 'z' || 'A' <= c <= 'Z' + # word characters + elseif c == '_' || c == '/' || c == '+' || c == '-' || c == '.' + # other common characters + elseif c == '\'' + have_single = true + elseif c == '"' + if have_double + isword = false + break # switch to single quoting + end + have_double = true + elseif !first && c == '=' + # equals is special if it is first (e.g. `env=val ./cmd`) + else + # anything else + isword = false + break + end + end + if isword + have_single && (arg = replace(arg, '\'' => "\\'")) + have_double && (arg = replace(arg, '"' => "\\\"")) + print(io, arg) + else + print(io, '\'', replace(arg, '\'' => "'\\''"), '\'') + end end first = false end diff --git a/base/show.jl b/base/show.jl index 1c3f270333f60..0701d4c50558b 100644 --- a/base/show.jl +++ b/base/show.jl @@ -2568,11 +2568,11 @@ function type_depth_limit(str::String, n::Int; maxdepth = nothing) levelcount = Int[] # number of nodes at each level strwid = 0 st_0, st_backslash, st_squote, st_dquote = 0,1,2,4 - state::Int = st_0 - stateis(s) = (state & s) != 0 + state = Ref(st_0) + stateis(s) = (state[] & s) != 0 quoted() = stateis(st_squote) || stateis(st_dquote) - enter(s) = (state |= s) - leave(s) = (state &= ~s) + enter(s) = (state[] |= s) + leave(s) = (state[] &= ~s) for (i, c) in ANSIIterator(str) if c isa ANSIDelimiter depths[i] = depth diff --git a/base/stacktraces.jl b/base/stacktraces.jl index b095f1f687807..0e807adb92839 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -167,20 +167,22 @@ function lookup(ip::Base.InterpreterIP) if isempty(scopes) return [StackFrame(func, file, line, code, false, false, 0)] end - closure = let inlined::Bool = false, def = def - function closure_inner(lno) - if inlined - def = lno.method - def isa Union{Method,Core.CodeInstance,MethodInstance} || (def = nothing) - else - def = codeinfo - end - sf = StackFrame(IRShow.normalize_method_name(lno.method), lno.file, lno.line, def, false, inlined, 0) - inlined = true - return sf + res = Vector{StackFrame}(undef, length(scopes)) + inlined = false + def_local = def + for i in eachindex(scopes) + lno = scopes[i] + if inlined + def_local = lno.method + def_local isa Union{Method,Core.CodeInstance,MethodInstance} || (def_local = nothing) + else + def_local = codeinfo end + res[i] = StackFrame(IRShow.normalize_method_name(lno.method), lno.file, lno.line, + def_local, false, inlined, 0) + inlined = true end - return map(closure, scopes) + return res end """ diff --git a/base/timing.jl b/base/timing.jl index 22e4b5a0065bc..12e41491c80cf 100644 --- a/base/timing.jl +++ b/base/timing.jl @@ -220,30 +220,31 @@ function time_print(io::IO, elapsedtime, bytes=0, gctime=0, allocs=0, lock_confl print(io, timestr, " seconds") parens = bytes != 0 || allocs != 0 || gctime > 0 || lock_conflicts > 0 || compile_time > 0 parens && print(io, " (") - if bytes != 0 || allocs != 0 - allocs, ma = prettyprint_getunits(allocs, length(_cnt_units), Int64(1000)) + had_allocs = bytes != 0 || allocs != 0 + if had_allocs + allocs_scaled, ma = prettyprint_getunits(allocs, length(_cnt_units), Int64(1000)) if ma == 1 - print(io, Int(allocs), _cnt_units[ma], allocs==1 ? " allocation: " : " allocations: ") + print(io, Int(allocs_scaled), _cnt_units[ma], allocs_scaled==1 ? " allocation: " : " allocations: ") else - print(io, Ryu.writefixed(Float64(allocs), 2), _cnt_units[ma], " allocations: ") + print(io, Ryu.writefixed(Float64(allocs_scaled), 2), _cnt_units[ma], " allocations: ") end print(io, format_bytes(bytes)) end if gctime > 0 - if bytes != 0 || allocs != 0 + if had_allocs print(io, ", ") end print(io, Ryu.writefixed(Float64(100*gctime/elapsedtime), 2), "% gc time") end if lock_conflicts > 0 - if bytes != 0 || allocs != 0 || gctime > 0 + if had_allocs || gctime > 0 print(io, ", ") end plural = lock_conflicts == 1 ? "" : "s" print(io, lock_conflicts, " lock conflict$plural") end if compile_time > 0 - if bytes != 0 || allocs != 0 || gctime > 0 || lock_conflicts > 0 + if had_allocs || gctime > 0 || lock_conflicts > 0 print(io, ", ") end print(io, Ryu.writefixed(Float64(100*compile_time/elapsedtime), 2), "% compilation time") diff --git a/base/views.jl b/base/views.jl index d205b1b38dee4..fca7e7ced9027 100644 --- a/base/views.jl +++ b/base/views.jl @@ -58,8 +58,8 @@ function replace_ref_begin_end_!(__module__::Module, ex, withex, in_quote_contex temp_vars = Tuple{Int,Symbol}[] for j = 2:J n = nx === 0 ? ni : :($nx + $ni) - exj, used = replace_ref_begin_end_!(__module__, ref_ex.args[j], (:($firstindex($S,$n)),:($lastindex($S,$n))), in_quote_context, escs) - used_S |= used + exj, used_arg = replace_ref_begin_end_!(__module__, ref_ex.args[j], (:($firstindex($S,$n)),:($lastindex($S,$n))), in_quote_context, escs) + used_S |= used_arg ref_ex.args[j] = exj ni += 1 if need_temps diff --git a/base/weakkeydict.jl b/base/weakkeydict.jl index 1283dc9cbc8cb..e04f8cdd4a1f6 100644 --- a/base/weakkeydict.jl +++ b/base/weakkeydict.jl @@ -195,7 +195,7 @@ function length(t::WeakKeyDict) end function iterate(t::WeakKeyDict{K,V}, state...) where {K, V} - return lock(t) do + @lock t begin while true y = iterate(t.ht, state...) y === nothing && return nothing diff --git a/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/md5 b/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/md5 deleted file mode 100644 index 54152fc3afad5..0000000000000 --- a/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -ffdec003d29b6a45229b1fc3358accd3 diff --git a/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/sha512 b/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/sha512 deleted file mode 100644 index a507712c72bdd..0000000000000 --- a/deps/checksums/Downloads-4e20d029c723199c0b8ea0e2418ff240d25ddaef.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -f4d399f20b852a69503a939bbffee365efc9aa2202c8dbc3b3de63728e7183c8bcf922c8607bc29922737eb66f516c3f52f1a1898c4283c33bd856b38473dc5a diff --git a/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/md5 b/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/md5 new file mode 100644 index 0000000000000..4942dcba0de8b --- /dev/null +++ b/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/md5 @@ -0,0 +1 @@ +fb233f171b86bf48bbfc7fb6d62faf34 diff --git a/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/sha512 b/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/sha512 new file mode 100644 index 0000000000000..a520370e45343 --- /dev/null +++ b/deps/checksums/Downloads-f72cd4d87b424fc48e1137c1fd1fbcec18f49371.tar.gz/sha512 @@ -0,0 +1 @@ +213f43411aa21b420ef430aa4210ad8c7d993dd940b71ae7a2f7aec756c214d607e6861ce502c88aad5ba516abcdf420b4b16ba8514a27e4d91f38841cf165e4 diff --git a/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/md5 b/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/md5 deleted file mode 100644 index 64ee597144a75..0000000000000 --- a/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -4b7f1fbb158328c4337ef7bcf2bb81b9 diff --git a/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/sha512 b/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/sha512 deleted file mode 100644 index ecb23d19f89f6..0000000000000 --- a/deps/checksums/SparseArrays-26c80c8b45dc2dca92788332a40a99b6c360d05a.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -c9e32cfb5ba14bcbab391edf7a327c147d9e4169586c5d8e934e6bcf8d03e8741196f85dbdef05621a0af38e0c394c13f3336b03840bf3770ae6f999b4752e14 diff --git a/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/md5 b/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/md5 new file mode 100644 index 0000000000000..a7ac76aa09e8a --- /dev/null +++ b/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/md5 @@ -0,0 +1 @@ +44270a346f9ddd509cea805b9bc81156 diff --git a/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/sha512 b/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/sha512 new file mode 100644 index 0000000000000..fac4f9ef0e691 --- /dev/null +++ b/deps/checksums/SparseArrays-6b7e9ef30624f25d97bce047ad781a25bebe5551.tar.gz/sha512 @@ -0,0 +1 @@ +24997365906fb555362223b9ec49dfa1990d09a83685e4b149e34687377ec11616d97b38de99b9d750fd99ee4f62b3d6462790f0fd26c1dfd26a1ca341ef5658 diff --git a/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/md5 b/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/md5 new file mode 100644 index 0000000000000..6324ad7fdfe90 --- /dev/null +++ b/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/md5 @@ -0,0 +1 @@ +9ff35ff7277387d7895533f4c99de1ad diff --git a/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/sha512 b/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/sha512 new file mode 100644 index 0000000000000..115da6196c9eb --- /dev/null +++ b/deps/checksums/StyledStrings-24cd74a309a29dd0a240884c1ced9fef7f06ba64.tar.gz/sha512 @@ -0,0 +1 @@ +a8e233ea4203ce8cd6820279271f03b080515a45fcbcda14a634441d556da8260a2c9fcc7cfa3f0fea5196f16cc74b64e91644afedc11fa7d71c71425e15bfb0 diff --git a/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/md5 b/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/md5 deleted file mode 100644 index e58ba4519f3ff..0000000000000 --- a/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -ad2e6ba06c98990865f808b26b8f148c diff --git a/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/sha512 b/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/sha512 deleted file mode 100644 index 8f7b0e2111bce..0000000000000 --- a/deps/checksums/StyledStrings-68bf7b1f83f334391dc05fda34f48267e04e2bd0.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -24e530c095f7838380adeb6f45349cf776df524a2fc721eb8b11411d25bc132a58c1048a89d630ba1ee66bf9a52cce9a0fbe2b4a76c33b11160c00ecb7a919a1 diff --git a/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/md5 b/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/md5 new file mode 100644 index 0000000000000..e7c9d7e636a90 --- /dev/null +++ b/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/md5 @@ -0,0 +1 @@ +e817cf442bba59b5eb51a28861d7dcda diff --git a/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/sha512 b/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/sha512 new file mode 100644 index 0000000000000..a2054c12c8a50 --- /dev/null +++ b/deps/checksums/Tar-10e4e964e372dc644c375e99c43d907067c45190.tar.gz/sha512 @@ -0,0 +1 @@ +1e61e3170cae3c538695c69b6386a198bad98b483ed559225faa1061dc7a1f912c6543f8fe2441c5d4e36ded0f59ab7d86e482e640693f25bba39fe5ee99f4f6 diff --git a/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/md5 b/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/md5 deleted file mode 100644 index fbf406449fb0b..0000000000000 --- a/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -158dbd6c1ac3e7e17673dcdb8682029c diff --git a/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/sha512 b/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/sha512 deleted file mode 100644 index f7612ac2001ac..0000000000000 --- a/deps/checksums/Tar-9dd8ed1b5f8503804de49da9272150dcc18ca7c7.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -acd722496955cd6a8f1c7ccb1bd0766666b566cac91975b7a2fd0dcdc13e6638aa53beebf144a39e9c3f880818ba1e71ea8e60396d94fa333962fd4f707eb8c7 diff --git a/deps/checksums/utf8proc b/deps/checksums/utf8proc index 2ab56bdbc3251..769514c34a243 100644 --- a/deps/checksums/utf8proc +++ b/deps/checksums/utf8proc @@ -1,2 +1,2 @@ -utf8proc-d7bf128df773c2a1a7242eb80e51e91a769fc985.tar.gz/md5/42a776162314cd5dfbec6aaa3e2af42d -utf8proc-d7bf128df773c2a1a7242eb80e51e91a769fc985.tar.gz/sha512/0bb54a5f296b5c7f480c45b8cf4de7e95b498106b5b165890539ec5861194baa6c9a45bff2566d695d2f4921c1086fbe8419e8e8db353a0517a76fc307829152 +utf8proc-e5e799221b45bbb90f5fdc5c69b6b8dfbf017e78.tar.gz/md5/749152abfd6122032b02e7fb484f5b64 +utf8proc-e5e799221b45bbb90f5fdc5c69b6b8dfbf017e78.tar.gz/sha512/717552acf99d5a9df54c1378749dc3e816a1d6ab6a66704325c3715b00096f891480456c7fa09bd97d32f08d392ed4ef5b7b65da401dd26804cb8431e6a04c07 diff --git a/deps/utf8proc.version b/deps/utf8proc.version index 3c05ad3a89e8d..d98ec9b0268b6 100644 --- a/deps/utf8proc.version +++ b/deps/utf8proc.version @@ -1,2 +1,2 @@ -UTF8PROC_BRANCH=v2.11.0 -UTF8PROC_SHA1=d7bf128df773c2a1a7242eb80e51e91a769fc985 +UTF8PROC_BRANCH=v2.11.3 +UTF8PROC_SHA1=e5e799221b45bbb90f5fdc5c69b6b8dfbf017e78 diff --git a/stdlib/Downloads.version b/stdlib/Downloads.version index bf92107ba1816..b91672eebbf55 100644 --- a/stdlib/Downloads.version +++ b/stdlib/Downloads.version @@ -1,4 +1,4 @@ DOWNLOADS_BRANCH = master -DOWNLOADS_SHA1 = 4e20d029c723199c0b8ea0e2418ff240d25ddaef +DOWNLOADS_SHA1 = f72cd4d87b424fc48e1137c1fd1fbcec18f49371 DOWNLOADS_GIT_URL := https://github.com/JuliaLang/Downloads.jl.git DOWNLOADS_TAR_URL = https://api.github.com/repos/JuliaLang/Downloads.jl/tarball/$1 diff --git a/stdlib/FileWatching/src/FileWatching.jl b/stdlib/FileWatching/src/FileWatching.jl index ddaf36dfd33a4..7ebb7d7ddb085 100644 --- a/stdlib/FileWatching/src/FileWatching.jl +++ b/stdlib/FileWatching/src/FileWatching.jl @@ -801,19 +801,19 @@ function poll_fd(s::Union{RawFD, Sys.iswindows() ? WindowsRawSocket : Union{}}, fdw = _FDWatcher(s, mask) local timer # we need this flag to explicitly track whether we call `close` already, to update the internal refcount correctly - timedout = false # TODO: make this atomic + timedout = Ref(false) # TODO: make this atomic try if timeout_s >= 0 # delay creating the timer until shortly before we start the poll wait timer = Timer(timeout_s) do t - timedout && return - timedout = true + timedout[] && return + timedout[] = true close(fdw, mask) end try while true events = _wait(fdw, mask) - if timedout || !events.timedout + if timedout[] || !events.timedout @lock fdw.notify fdw.events &= ~events.events return events end @@ -827,8 +827,8 @@ function poll_fd(s::Union{RawFD, Sys.iswindows() ? WindowsRawSocket : Union{}}, end finally if @isdefined(timer) - if !timedout - timedout = true + if !timedout[] + timedout[] = true close(timer) close(fdw, mask) end diff --git a/stdlib/InteractiveUtils/src/InteractiveUtils.jl b/stdlib/InteractiveUtils/src/InteractiveUtils.jl index 60e2016cf910b..e7327ef5be331 100644 --- a/stdlib/InteractiveUtils/src/InteractiveUtils.jl +++ b/stdlib/InteractiveUtils/src/InteractiveUtils.jl @@ -351,8 +351,7 @@ function report_bug(kind) BugReportingId = Base.PkgId( Base.UUID((0xbcf9a6e7_4020_453c,0xb88e_690564246bb8)), "BugReporting") # Check if the BugReporting package exists in the current environment - local BugReporting - if Base.locate_package(BugReportingId) === nothing + BugReporting = if Base.locate_package(BugReportingId) === nothing @info "Package `BugReporting` not found - attempting temporary installation" # Create a temporary environment and add BugReporting let Pkg = Base.require_stdlib(Base.PkgId( @@ -364,13 +363,14 @@ function report_bug(kind) Base.ACTIVE_PROJECT[] = nothing pkgspec = @invokelatest Pkg.PackageSpec(BugReportingId.name, BugReportingId.uuid) @invokelatest Pkg.add(pkgspec) - BugReporting = Base.require(BugReportingId) + _BugReporting = Base.require(BugReportingId) append!(empty!(LOAD_PATH), old_load_path) Base.ACTIVE_PROJECT[] = old_active_project + _BugReporting end end else - BugReporting = Base.require(BugReportingId) + Base.require(BugReportingId) end return @invokelatest BugReporting.make_interactive_report(kind, ARGS) end diff --git a/stdlib/InteractiveUtils/src/macros.jl b/stdlib/InteractiveUtils/src/macros.jl index 9a749752ef2c7..290f05eb86730 100644 --- a/stdlib/InteractiveUtils/src/macros.jl +++ b/stdlib/InteractiveUtils/src/macros.jl @@ -388,10 +388,11 @@ function gen_call_with_extracted_types(__module__, fcn, ex0, kws = Expr[]; is_so if isa(ex0, Expr) && ex0.head === :(=) && isa(ex0.args[1], Symbol) return gen_call_with_extracted_types(__module__, fcn, ex0.args[2], kws; is_source_reflection, supports_binding_reflection, use_signature_tuple) end - where_params = nothing + _where_params = nothing if isa(ex0, Expr) - ex0, where_params = extract_where_parameters(ex0) + ex0, _where_params = extract_where_parameters(ex0) end + where_params = _where_params if isa(ex0, Expr) if ex0.head === :do && isexpr(get(ex0.args, 1, nothing), :call) # Normalize `f(args...) do ... end` calls to `f(do_anonymous_function, args...)` diff --git a/stdlib/LibGit2/src/LibGit2.jl b/stdlib/LibGit2/src/LibGit2.jl index 30d141be146d7..861aebb9247bd 100644 --- a/stdlib/LibGit2/src/LibGit2.jl +++ b/stdlib/LibGit2/src/LibGit2.jl @@ -451,13 +451,15 @@ function branch!(repo::GitRepo, branch_name::AbstractString, branch_ref = new_branch_ref end end + + branch_ref′ = branch_ref # Avoids boxing `branch_ref` try #TODO: what if branch tracks other then "origin" remote if !isempty(track) # setup tracking try with(GitConfig, repo) do cfg set!(cfg, "branch.$branch_name.remote", Consts.REMOTE_ORIGIN) - set!(cfg, "branch.$branch_name.merge", name(branch_ref)) + set!(cfg, "branch.$branch_name.merge", name(branch_ref′)) end catch @warn "Please provide remote tracking for branch '$branch_name' in '$(path(repo))'" @@ -466,15 +468,15 @@ function branch!(repo::GitRepo, branch_name::AbstractString, if set_head # checkout selected branch - with(peel(GitTree, branch_ref)) do btree + with(peel(GitTree, branch_ref′)) do btree checkout_tree(repo, btree) end # switch head to the branch - head!(repo, branch_ref) + head!(repo, branch_ref′) end finally - close(branch_ref) + close(branch_ref′) end return end @@ -509,13 +511,13 @@ function checkout!(repo::GitRepo, commit::AbstractString = ""; isempty(commit) && return # grab head name - head_name = Consts.HEAD_FILE + head_name = Ref(Consts.HEAD_FILE) try with(head(repo)) do head_ref - head_name = shortname(head_ref) + head_name[] = shortname(head_ref) # if it is HEAD use short OID instead - if head_name == Consts.HEAD_FILE - head_name = string(GitHash(head_ref)) + if head_name[] == Consts.HEAD_FILE + head_name[] = string(GitHash(head_ref)) end end catch @@ -530,7 +532,7 @@ function checkout!(repo::GitRepo, commit::AbstractString = ""; checkout_tree(repo, peeled, options = force ? CheckoutOptions(checkout_strategy = Consts.CHECKOUT_FORCE) : CheckoutOptions()) GitReference(repo, obj_oid, force=force, - msg="libgit2.checkout: moving from $head_name to $(obj_oid))") + msg="libgit2.checkout: moving from $(head_name[]) to $(obj_oid))") return nothing end diff --git a/stdlib/Markdown/src/render/html.jl b/stdlib/Markdown/src/render/html.jl index 829fa6c7bf986..f2daddec9e814 100644 --- a/stdlib/Markdown/src/render/html.jl +++ b/stdlib/Markdown/src/render/html.jl @@ -65,11 +65,12 @@ function html(io::IO, header::Header{l}) where l end end -function html(io::IO, code::Code) +function html(io::IO, code′::Code) + if code′.language == "styled" + code′ = Code("", String(styled(code′.code))) + end + code = code′ withtag(io, :pre) do - if code.language == "styled" - code = Code("", String(styled(code.code))) - end maybe_lang = !isempty(code.language) ? Any[:class=>"language-$(code.language)"] : [] withtag(io, :code, maybe_lang...) do htmlesc(io, code.code) @@ -136,10 +137,11 @@ function htmlinline(io::IO, content::Vector) end end -function htmlinline(io::IO, code::Code) - if code.language == "styled" - code = Code("", String(styled(code.code))) +function htmlinline(io::IO, code′::Code) + if code′.language == "styled" + code′ = Code("", String(styled(code′.code))) end + code = code′ withtag(io, :code) do htmlesc(io, code.code) end diff --git a/stdlib/Markdown/src/render/latex.jl b/stdlib/Markdown/src/render/latex.jl index fad0508ce0e59..1d166af42c627 100644 --- a/stdlib/Markdown/src/render/latex.jl +++ b/stdlib/Markdown/src/render/latex.jl @@ -32,10 +32,11 @@ function latex(io::IO, header::Header{l}) where l println(io) end -function latex(io::IO, code::Code) - if code.language == "styled" - code = Code("", String(styled(code.code))) +function latex(io::IO, code′::Code) + if code′.language == "styled" + code′ = Code("", String(styled(code′.code))) end + code = code′ occursin("\\end{verbatim}", code.code) && error("Cannot include \"\\end{verbatim}\" in a latex code block") wrapblock(io, "verbatim") do println(io, code.code) diff --git a/stdlib/Markdown/src/render/terminal/formatting.jl b/stdlib/Markdown/src/render/terminal/formatting.jl index c9dadfb5f3d94..09dff9e367631 100644 --- a/stdlib/Markdown/src/render/terminal/formatting.jl +++ b/stdlib/Markdown/src/render/terminal/formatting.jl @@ -17,12 +17,13 @@ function with_output_annotations(f::Function, io::AnnotIO, annots::Pair{Symbol, @nospecialize annots aio = if io isa AnnotatedIOBuffer io else io.io end start = position(aio) + 1 - f(io) + v = f(io) stop = position(aio) sortedindex = searchsortedlast(aio.annotations, (region=start:stop,), by=a -> a.region) for (i, annot) in enumerate(annots) insert!(aio.annotations, sortedindex + i, (start:stop, annot...)) end + return v end """ diff --git a/stdlib/Markdown/src/render/terminal/render.jl b/stdlib/Markdown/src/render/terminal/render.jl index a97d273131536..2d486afef3bfd 100644 --- a/stdlib/Markdown/src/render/terminal/render.jl +++ b/stdlib/Markdown/src/render/terminal/render.jl @@ -92,20 +92,19 @@ function term(io::AnnotIO, md::Header{l}, columns) where l face = Symbol("markdown_h$l") underline = _header_underlines[l] pre = ' '^margin - local line_width - with_output_annotations(io, :face => face) do io + line_width = with_output_annotations(io, :face => face) do io headline = annotprint(terminline, md.text) lines = wraplines(headline, columns - 4margin) for (i, line) in enumerate(lines) print(io, pre, line) i < length(lines) && println(io) end - line_width = if length(lines) == 1 - min(textwidth(lines[end]), columns) + if length(lines) == 1 + return min(textwidth(lines[end]), columns) elseif length(lines) > 1 - max(textwidth(lines[end]), div(columns, 3)+length(pre)) + return max(textwidth(lines[end]), div(columns, 3)+length(pre)) else - 0 + return 0 end end header_width = max(0, line_width) diff --git a/stdlib/Serialization/src/Serialization.jl b/stdlib/Serialization/src/Serialization.jl index ee40ebdd4abad..6f4894dcc059f 100644 --- a/stdlib/Serialization/src/Serialization.jl +++ b/stdlib/Serialization/src/Serialization.jl @@ -1067,11 +1067,10 @@ function deserialize(s::AbstractSerializer, ::Type{Method}) nospecializeinfer = false constprop = 0x00 purity = 0x0000 - local template_or_is_opaque, template - with(current_module => mod) do - template_or_is_opaque = deserialize(s) + template_or_is_opaque = with(current_module => mod) do + deserialize(s) end - if isa(template_or_is_opaque, Bool) + template = if isa(template_or_is_opaque, Bool) is_for_opaque_closure = template_or_is_opaque if format_version(s) >= 24 nospecializeinfer = deserialize(s)::Bool @@ -1085,10 +1084,10 @@ function deserialize(s::AbstractSerializer, ::Type{Method}) purity = UInt16(deserialize(s)::UInt8) end with(current_module => mod) do - template = deserialize(s) + deserialize(s) end else - template = template_or_is_opaque + template_or_is_opaque end generator = deserialize(s) recursion_relation = nothing diff --git a/stdlib/SharedArrays/src/SharedArrays.jl b/stdlib/SharedArrays/src/SharedArrays.jl index 6106bc9c3c81a..fdbfc989c8994 100644 --- a/stdlib/SharedArrays/src/SharedArrays.jl +++ b/stdlib/SharedArrays/src/SharedArrays.jl @@ -113,20 +113,21 @@ function SharedArray{T,N}(dims::Dims{N}; init=false, pids=Int[]) where {T,N} local shmmem_create_pid try # On OSX, the shm_seg_name length must be <= 31 characters (including the terminating NULL character) - shm_seg_name = "/jl$(lpad(string(getpid() % 10^6), 6, "0"))$(randstring(20))" + seg_name = "/jl$(lpad(string(getpid() % 10^6), 6, "0"))$(randstring(20))" + shm_seg_name = seg_name if onlocalhost shmmem_create_pid = myid() - s = shm_mmap_array(T, dims, shm_seg_name, JL_O_CREAT | JL_O_RDWR) + s = shm_mmap_array(T, dims, seg_name, JL_O_CREAT | JL_O_RDWR) else # The shared array is created on a remote machine shmmem_create_pid = pids[1] remotecall_fetch(pids[1]) do - shm_mmap_array(T, dims, shm_seg_name, JL_O_CREAT | JL_O_RDWR) + shm_mmap_array(T, dims, seg_name, JL_O_CREAT | JL_O_RDWR) nothing end end - func_mapshmem = () -> shm_mmap_array(T, dims, shm_seg_name, JL_O_RDWR) + func_mapshmem = () -> shm_mmap_array(T, dims, seg_name, JL_O_RDWR) refs = Vector{Future}(undef, length(pids)) for (i, p) in enumerate(pids) @@ -141,13 +142,13 @@ function SharedArray{T,N}(dims::Dims{N}; init=false, pids=Int[]) where {T,N} # All good, immediately unlink the segment. if (prod(dims) > 0) && (sizeof(T) > 0) if onlocalhost - rc = shm_unlink(shm_seg_name) + rc = shm_unlink(seg_name) else - rc = remotecall_fetch(shm_unlink, shmmem_create_pid, shm_seg_name) + rc = remotecall_fetch(shm_unlink, shmmem_create_pid, seg_name) end - systemerror("Error unlinking shmem segment " * shm_seg_name, rc != 0) + systemerror("Error unlinking shmem segment " * seg_name, rc != 0) end - S = SharedArray{T,N}(dims, pids, refs, shm_seg_name, s) + S = SharedArray{T,N}(dims, pids, refs, seg_name, s) initialize_shared_array(S, onlocalhost, init, pids) shm_seg_name = "" @@ -185,23 +186,21 @@ function SharedArray{T,N}(filename::AbstractString, dims::NTuple{N,Int}, offset: # If not supplied, determine the appropriate mode have_file = onlocalhost ? isfile(filename) : remotecall_fetch(isfile, pids[1], filename) - if mode === nothing - mode = have_file ? "r+" : "w+" - end - workermode = mode == "w+" ? "r+" : mode # workers don't truncate! + mode_val = mode === nothing ? (have_file ? "r+" : "w+") : mode + workermode = mode_val == "w+" ? "r+" : mode_val # workers don't truncate! # Ensure the file will be readable - if !(mode in ("r", "r+", "w+", "a+")) - throw(ArgumentError("mode must be readable, but $mode is not")) + if !(mode_val in ("r", "r+", "w+", "a+")) + throw(ArgumentError("mode must be readable, but $mode_val is not")) end if init !== false typeassert(init, Function) - if !(mode in ("r+", "w+", "a+")) - throw(ArgumentError("cannot initialize unwritable array (mode = $mode)")) + if !(mode_val in ("r+", "w+", "a+")) + throw(ArgumentError("cannot initialize unwritable array (mode = $mode_val)")) end end - if mode == "r" && !isfile(filename) - throw(ArgumentError("file $filename does not exist, but mode $mode cannot create it")) + if mode_val == "r" && !isfile(filename) + throw(ArgumentError("file $filename does not exist, but mode $mode_val cannot create it")) end # Create the file if it doesn't exist, map it if it does @@ -211,13 +210,13 @@ function SharedArray{T,N}(filename::AbstractString, dims::NTuple{N,Int}, offset: end s = Array{T}(undef, ntuple(d->0,N)) if onlocalhost - s = func_mmap(mode) + s = func_mmap(mode_val) refs[1] = remotecall(pids[1]) do func_mmap(workermode) end else refs[1] = remotecall_wait(pids[1]) do - func_mmap(mode) + func_mmap(mode_val) end end diff --git a/stdlib/SparseArrays.version b/stdlib/SparseArrays.version index 1cf516bb816fb..86daeecdabe21 100644 --- a/stdlib/SparseArrays.version +++ b/stdlib/SparseArrays.version @@ -1,4 +1,4 @@ SPARSEARRAYS_BRANCH = release-1.13 -SPARSEARRAYS_SHA1 = 26c80c8b45dc2dca92788332a40a99b6c360d05a +SPARSEARRAYS_SHA1 = 6b7e9ef30624f25d97bce047ad781a25bebe5551 SPARSEARRAYS_GIT_URL := https://github.com/JuliaSparse/SparseArrays.jl.git SPARSEARRAYS_TAR_URL = https://api.github.com/repos/JuliaSparse/SparseArrays.jl/tarball/$1 diff --git a/stdlib/StyledStrings.version b/stdlib/StyledStrings.version index b77e1a8cd9f59..54d26eb44a4ab 100644 --- a/stdlib/StyledStrings.version +++ b/stdlib/StyledStrings.version @@ -1,4 +1,4 @@ -STYLEDSTRINGS_BRANCH = main -STYLEDSTRINGS_SHA1 = 68bf7b1f83f334391dc05fda34f48267e04e2bd0 +STYLEDSTRINGS_BRANCH = release-1.13 +STYLEDSTRINGS_SHA1 = 24cd74a309a29dd0a240884c1ced9fef7f06ba64 STYLEDSTRINGS_GIT_URL := https://github.com/JuliaLang/StyledStrings.jl.git STYLEDSTRINGS_TAR_URL = https://api.github.com/repos/JuliaLang/StyledStrings.jl/tarball/$1 diff --git a/stdlib/Tar.version b/stdlib/Tar.version index ac1022efce7b5..f62e5752a7c39 100644 --- a/stdlib/Tar.version +++ b/stdlib/Tar.version @@ -1,4 +1,4 @@ TAR_BRANCH = master -TAR_SHA1 = 9dd8ed1b5f8503804de49da9272150dcc18ca7c7 +TAR_SHA1 = 10e4e964e372dc644c375e99c43d907067c45190 TAR_GIT_URL := https://github.com/JuliaIO/Tar.jl.git TAR_TAR_URL = https://api.github.com/repos/JuliaIO/Tar.jl/tarball/$1