Skip to content

Backports for 1.12.6#61154

Open
KristofferC wants to merge 27 commits intorelease-1.12from
backports-release-1.12
Open

Backports for 1.12.6#61154
KristofferC wants to merge 27 commits intorelease-1.12from
backports-release-1.12

Conversation

@KristofferC
Copy link
Member

@KristofferC KristofferC commented Feb 25, 2026

Backported PRs:

Need manual backport:

Contains multiple commits, manual intervention needed:

Non-merged PRs with backport label:

songjhaha and others added 10 commits February 25, 2026 11:47
…ished or be interrupted (#60822)

resolve #60797

Co-authored-by: songjhaha <songjh96@foxmali.com>
Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com>
Co-authored-by: Chengyu Han <git@wo-class.cn>
(cherry picked from commit d8994dc)
…=error` (#60892)

I tested this locally with:
- [x] `--depwarn=no`
- [x] `--depwarn=yes`
- [x] `--depwarn=error`

All codepaths pass for me locally.

## Motivation

To get the Artifacts tests passing in PkgEval.

(cherry picked from commit c825e10)
This allows `--trim` to safely* prune bindings without dropping the root
required for the generated machine code.

The (significantly more complex) alternative will be to examine the
bindings (back)edges during `--trim` serialization and reconstruct the
relevant binding dependency edges at that time but that does
not seem worth it compared to the 23.6 KB overhead in the sysimage
to track these roots explicitly.

Resolves #60846.

\* As a caveat, uninferred GlobalRefs can lead to missing bindings at
runtime, but this is out-of-scope for --trim.

(cherry picked from commit 484e7b1)
The officially supported argument is --sdk, not -sdk, though it seems
the later also works in practice. But with BinaryBuilder, we use a
'fake' xcrun script which only supports the officially documented
argument name.

I've also submitted a [PR to let BinaryBuilderBase.jl accept
this](JuliaPackaging/BinaryBuilderBase.jl#464);
but I think it's wise for us to stick to the officially documented
options.

(cherry picked from commit 4820747)
`thrash_counter` is initialized to `0` but only ever incremented under
this branch, which was checking `!(thrash_counter < 4)`, making the
entire mechanism effectively dead code

here was something that can demonstrate the difference but I don't know
how to add a unit test

```
# gc_thrash_mwe.jl
mutable struct Node; l::Any; r::Any; d::Vector{UInt8}; end
tree(n) = n <= 0 ? Node(nothing,nothing,rand(UInt8,64)) : Node(tree(n-1),tree(n-1),rand(UInt8,64))

const SHED = Ref(false)
const CB = @cfunction(() -> (SHED[] = true; nothing), Cvoid, ())
ccall(:jl_gc_set_cb_notify_gc_pressure, Cvoid, (Ptr{Cvoid}, Cint), CB, 1)

trees = Any[tree(18) for _ in 1:8]                       # ~640 MB scattered pointers
cache = Ref{Any}([rand(UInt8, 200) for _ in 1:1_000_000]) # ~200 MB droppable cache
GC.gc()

@time for i in 1:200
    if SHED[]; cache[] = nothing; SHED[] = false; end
    [rand(UInt8, 48) for _ in 1:50_000]
end
println(cache[] === nothing ? "PASS: cache shed under pressure" : "FAIL: pressure callback never fired")
```

```
➜  (adienes) ./julia --heap-size-hint=1500M gc_thrash_mwe.jl
  0.449891 seconds (20.03 M allocations: 1.121 GiB, 64.03% gc time, 4.14% compilation time)
PASS: cache shed under pressure

➜  (adienes) julia +nightly --heap-size-hint=1500M gc_thrash_mwe.jl
  0.619595 seconds (20.03 M allocations: 1.121 GiB, 75.61% gc time, 2.99% compilation time)
FAIL: pressure callback never fired
```

Discovered via automated Claude audit for typos and other minor /
obvious bugs.

(cherry picked from commit e98d248)
Replace manual insertion point save/restore operations with RAII-based
InsertPointGuard. This ensures insertion points properly restore debug
information too. With credit to abraemer for diagnosing and suggesting
the fix.

Fix: #61095

Co-authored-by: Adrian Braemer <adrian.braemer@tngtech.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
(cherry picked from commit 1003b8d)
…61120)

discovered via automated Claude audit for typos and other minor /
obvious bugs. I manually reviewed each result

I was less sure about this one but robot seems confident so I'm pasting
the message it gave as-is

Add a `jl_gc_wb` in `jl_update_loaded_bpart` after storing
`resolution.binding_or_const` into an existing (potentially
old-generation) binding partition's restriction field, matching every
other non-fresh store to this field.

Add a `jl_gc_wb_fresh` in `jl_replace_binding_locked2`'s
`IMPLICIT_RECOMPUTE` path, where `jl_resolve_implicit_import` can
trigger GC between the allocation of `new_bpart` and the store,
potentially promoting the fresh partition to an older generation. The
else branch already had the corresponding `jl_gc_wb_fresh`.

Neither bug is currently triggerable because the stored values are
always independently rooted through the module binding table, but the
barriers are needed to maintain GC invariants and guard against future
code changes.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit f6fd24c)
Backports #61062 (Fix extra linenode added to non-block function body)
topolarity and others added 3 commits February 25, 2026 11:33
We only support a few built-in versions of this call (due to
#57830), but those should
at least be working now with this small tweak.

This required a fix-up for built-in functions to be included in the
method table for `--trim`'d executables, so that we can dynamically
dispatch to them, as the verifier expects.
Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com>
@DilumAluthge DilumAluthge added the release Release management and versioning. label Feb 26, 2026
timholy and others added 8 commits March 3, 2026 08:21
These lead to 10-20x speedups in Revise's fieldtype-caching
Found by JET.

(cherry picked from commit 2786fb9)
`ismalformed()` is not exported from `Base`, so we need to qualify it
when calling.

Detected by JET.

(cherry picked from commit 1cd77b5)
Keeping this a ccall before adding a julia level API so we can back out
if wanted later

(cherry picked from commit 370a2a0)
Follow-up to #61140

(cherry picked from commit 49f889c)
@topolarity topolarity force-pushed the backports-release-1.12 branch from de798fb to 4c74b14 Compare March 3, 2026 23:46
@KristofferC
Copy link
Member Author

The revise error


revise_structs preference: Test Failed at /root/.julia/packages/Revise/oNu1t/test/runtests.jl:2484
--
Expression: read(`$julia --project=$test_proj_dir -e $check_bpart`, String) == "true"
Evaluated: "false" == "true"

is purely testing preference handling:

https://github.com/timholy/Revise.jl/blob/41b31a6fab7830b661cd46edd3f65dc3ea0703ad/test/runtests.jl#L2478-L2484

It creates a preference file, runs Revise and checks that it picks up the new preference. But that doesn't happen here for some reason?

topolarity and others added 5 commits March 4, 2026 14:17
These `@assert`s are not directly problematic for `--trim` (thanks to an
overload / monkey patch it does), but they can cause false positives for
dynamic dispatches in JET and similar tools so it's probably best to
replace them with the 2-arg variant (which just needs to print a String,
rather than an `Expr` containing arbitrary Julia objects)
…emoryrefnew` (#61137)

The Serialization stdlib has the following function:

https://github.com/JuliaLang/julia/blob/e46125f569f43e28261d1b55a0d85aacceee499a/stdlib/Serialization/src/Serialization.jl#L1445-L1450

As far as I can tell, there is no method matching
`Core.memoryref(x::MemoryRef, i::Int, true::Bool)` (called on line
1448).[^1]

[^1]: This issue was detected by JET.

I think this should be a call to `Core.memoryrefnew(x::MemoryRef,
i::Int, true::Bool)` instead, which is what this PR does.

(cherry picked from commit acd9708)
The sret parameter's alignment attribute was set to LLVM's preferred type
alignment (getPrefTypeAlign), which can exceed julia_alignment. This caused
misaligned memory accesses on strict-alignment targets like NVPTX, since the
caller's alloca uses julia_alignment. Fix by setting the sret alignment to
julia_alignment and not overriding it in the function definition, so that
caller and callee agree on the same alignment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a custom method table is defined in one package and imported by
another, jl_foreach_reachable_mtable visits the same table twice (once
per module binding). This causes extext methods to be collected and
serialized twice, and on loading, jl_method_table_activate asserts
because dispatch_status was already set by the first activation.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…61220)

Methods created with custom source data (e.g. via CompilerCaching's
add_method which stores domain-specific IR) are neither CodeInfo nor
compressed String. Return 0 instead of asserting, since such methods
cannot have image globalrefs.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Release management and versioning.

Projects

None yet

Development

Successfully merging this pull request may close these issues.