Skip to content

Commit 2911937

Browse files
authored
Backports release 1.11 (#53472)
Backported PRs: - [x] #53361 <!-- 🤖 [master] Bump the SparseArrays stdlib from c9f7293 to cb602d7 --> - [x] #53300 <!-- allow external absint to hold custom data in `codeinst.inferred` --> - [x] #53342 <!-- Add `Base.wrap` to docs --> - [x] #53372 <!-- Silence warnings in `test/file.jl` --> - [x] #53357 <!-- 🤖 [master] Bump the Pkg stdlib from 6dd0e7c9e to 76070d295 --> - [x] #53373 <!-- fix sysimage-native-code=no option with pkgimages --> - [x] #53333 <!-- More consistent return value for annotations, take 2 --> - [x] #53354 <!-- fix code coverage bug in tail position and `else` --> - [x] #53407 <!-- fix sysimage-native-code=yes option --> - [x] #53388 <!-- Fix documentation: thread pool of main thread --> - [x] #53355 <!-- Fix synchronization issues on the GC scheduler. --> - [x] #53429 <!-- Subtype: skip slow-path in `local_∀_∃_subtype` if inputs contain no ∃ typevar. --> - [x] #53437 <!-- Add debug variant of loader_trampolines.o --> - [x] #53284 <!-- Add annotate! method for AnnotatedIOBuffer --> - [x] #53466 <!-- [MozillaCACerts_jll] Update to v2023-12-12 --> - [x] #53467 <!-- [LibGit2_jll] Update to v1.7.2 --> - [x] #53326 <!-- RFC: when loading code for internal purposes, load stdlib files directly, bypassing DEPOT_PATH, LOAD_PATH, and stale checks --> - [x] #53332 - [x] #53320 <!-- Add `Sys.isreadable, Sys.iswriteable`, update `ispath` --> - [x] #53476 Contains multiple commits, manual intervention needed: - [ ] #53285 <!-- Add update mechanism for Terminfo, and common user-alias data --> Non-merged PRs with backport label: - [ ] #53424 <!-- yet more atomics & cache-line fixes on work-stealing queue --> - [ ] #53408 <!-- task splitting: change additive accumulation to multiplicative --> - [ ] #53403 <!-- Move parallel precompilation to Base --> - [ ] #53402 <!-- Add `jl_getaffinity` and `jl_setaffinity` --> - [ ] #53391 <!-- Default to the medium code model in x86 linux --> - [ ] #53125 <!-- coverage: count coverage where explicitly requested by inference only --> - [ ] #52694 <!-- Reinstate similar for AbstractQ for backward compatibility -->
2 parents aecd8fd + d6bbf85 commit 2911937

File tree

71 files changed

+1791
-1043
lines changed

Some content is hidden

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

71 files changed

+1791
-1043
lines changed

base/Base.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,7 @@ function profile_printing_listener(cond::Base.AsyncCondition)
629629
profile = nothing
630630
try
631631
while _trywait(cond)
632-
# this call to require is mostly legal, only because Profile has no dependencies and is usually in LOAD_PATH
633-
profile = @something(profile, require(PkgId(UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")))::Module
632+
profile = @something(profile, require_stdlib(PkgId(UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")))::Module
634633
invokelatest(profile.peek_report[])
635634
if Base.get_bool_env("JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", false) === true
636635
println(stderr, "Saving heap snapshot...")

base/client.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function exec_options(opts)
260260
# Load Distributed module only if any of the Distributed options have been specified.
261261
distributed_mode = (opts.worker == 1) || (opts.nprocs > 0) || (opts.machine_file != C_NULL)
262262
if distributed_mode
263-
let Distributed = require(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
263+
let Distributed = require_stdlib(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
264264
Core.eval(MainInclude, :(const Distributed = $Distributed))
265265
Core.eval(Main, :(using Base.MainInclude.Distributed))
266266
end
@@ -386,7 +386,8 @@ function load_InteractiveUtils(mod::Module=Main)
386386
# load interactive-only libraries
387387
if !isdefined(MainInclude, :InteractiveUtils)
388388
try
389-
let InteractiveUtils = require(PkgId(UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils"))
389+
# TODO: we have to use require_stdlib here because it is a dependency of REPL, but we would sort of prefer not to
390+
let InteractiveUtils = require_stdlib(PkgId(UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils"))
390391
Core.eval(MainInclude, :(const InteractiveUtils = $InteractiveUtils))
391392
end
392393
catch ex
@@ -401,7 +402,7 @@ end
401402
function load_REPL()
402403
# load interactive-only libraries
403404
try
404-
return Base.require(PkgId(UUID(0x3fa0cd96_eef1_5676_8a61_b3b8758bbffb), "REPL"))
405+
return Base.require_stdlib(PkgId(UUID(0x3fa0cd96_eef1_5676_8a61_b3b8758bbffb), "REPL"))
405406
catch ex
406407
@warn "Failed to import REPL" exception=(ex, catch_backtrace())
407408
end

base/compiler/optimize.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,17 +534,22 @@ function any_stmt_may_throw(ir::IRCode, bb::Int)
534534
return false
535535
end
536536

537-
function conditional_successors_may_throw(lazypostdomtree::LazyPostDomtree, ir::IRCode, bb::Int)
537+
function visit_conditional_successors(callback, lazypostdomtree::LazyPostDomtree, ir::IRCode, bb::Int)
538538
visited = BitSet((bb,))
539539
worklist = Int[bb]
540540
while !isempty(worklist)
541-
thisbb = pop!(worklist)
541+
thisbb = popfirst!(worklist)
542542
for succ in ir.cfg.blocks[thisbb].succs
543543
succ in visited && continue
544544
push!(visited, succ)
545-
postdominates(get!(lazypostdomtree), succ, thisbb) && continue
546-
any_stmt_may_throw(ir, succ) && return true
547-
push!(worklist, succ)
545+
if postdominates(get!(lazypostdomtree), succ, bb)
546+
# this successor is not conditional, so no need to visit it further
547+
continue
548+
elseif callback(succ)
549+
return true
550+
else
551+
push!(worklist, succ)
552+
end
548553
end
549554
end
550555
return false
@@ -836,8 +841,10 @@ function ((; sv)::ScanStmt)(inst::Instruction, lstmt::Int, bb::Int)
836841
# inconsistent region.
837842
if !sv.result.ipo_effects.terminates
838843
sv.all_retpaths_consistent = false
839-
elseif conditional_successors_may_throw(sv.lazypostdomtree, sv.ir, bb)
840-
# Check if there are potential throws that require
844+
elseif visit_conditional_successors(sv.lazypostdomtree, sv.ir, bb) do succ::Int
845+
return any_stmt_may_throw(sv.ir, succ)
846+
end
847+
# check if this `GotoIfNot` leads to conditional throws, which taints consistency
841848
sv.all_retpaths_consistent = false
842849
else
843850
(; cfg, domtree) = get!(sv.lazyagdomtree)

base/compiler/ssair/inlining.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,9 @@ end
18181818

18191819
function ssa_substitute!(insert_node!::Inserter, subst_inst::Instruction, @nospecialize(val),
18201820
ssa_substitute::SSASubstitute)
1821-
subst_inst[:line] += ssa_substitute.linetable_offset
1821+
if subst_inst[:line] != 0
1822+
subst_inst[:line] += ssa_substitute.linetable_offset
1823+
end
18221824
return ssa_substitute_op!(insert_node!, subst_inst, val, ssa_substitute)
18231825
end
18241826

base/compiler/ssair/passes.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,12 @@ function try_inline_finalizer!(ir::IRCode, argexprs::Vector{Any}, idx::Int,
15191519
ssa_rename[ssa.id]
15201520
end
15211521
stmt′ = ssa_substitute_op!(InsertBefore(ir, SSAValue(idx)), inst, stmt′, ssa_substitute)
1522+
newline = inst[:line]
1523+
if newline != 0
1524+
newline += ssa_substitute.linetable_offset
1525+
end
15221526
ssa_rename[idx′] = insert_node!(ir, idx,
1523-
NewInstruction(inst; stmt=stmt′, line=inst[:line]+ssa_substitute.linetable_offset),
1527+
NewInstruction(inst; stmt=stmt′, line=newline),
15241528
attach_after)
15251529
end
15261530

base/compiler/types.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,17 @@ end
373373
function NativeInterpreter(world::UInt = get_world_counter();
374374
inf_params::InferenceParams = InferenceParams(),
375375
opt_params::OptimizationParams = OptimizationParams())
376+
curr_max_world = get_world_counter()
376377
# Sometimes the caller is lazy and passes typemax(UInt).
377378
# we cap it to the current world age for correctness
378379
if world == typemax(UInt)
379-
world = get_world_counter()
380+
world = curr_max_world
380381
end
381-
382382
# If they didn't pass typemax(UInt) but passed something more subtly
383383
# incorrect, fail out loudly.
384-
@assert world <= get_world_counter()
385-
384+
@assert world <= curr_max_world
386385
method_table = CachedMethodTable(InternalMethodTable(world))
387-
388386
inf_cache = Vector{InferenceResult}() # Initially empty cache
389-
390387
return NativeInterpreter(world, method_table, inf_cache, inf_params, opt_params)
391388
end
392389

0 commit comments

Comments
 (0)