vouillon requested fitzgen for a review on PR #13450.
vouillon requested wasmtime-compiler-reviewers for a review on PR #13450.
vouillon requested wasmtime-core-reviewers for a review on PR #13450.
vouillon opened PR #13450 from vouillon:array-copy-fix to bytecodealliance:main:
translate_per_element_copyderives rawsrc_elem_addr/dst_elem_addrpointers once and uses only those raw pointers inside the per-element forward/backward loop. As a result, the original source and destination array gc-refs are dead in CLIF after the address computation and are not in the stack maps at safe points inside the loop.This was harmless until the DRC collector started firing
force_gcfrom inside the read barrier when the over-approximated-stack-roots list grew past 1024 entries (https://github.com/bytecodealliance/wasmtime/pull/13422). At that point, a GC could run mid-copy with neither the source nor the destination array marked from any frame's stack map. Sweep could then free the arrays out from under the copy.Fix this by extracting the array gc-refs from the source and destination entities (when they are arrays) and threading them through the loop's forward and backward iteration blocks as block parameters. After the fix, the stack map at the in-barrier
force_gcinsidearray.copy's loop lists the source and destination arrays in addition to the freshly-read element.
vouillon updated PR #13450.
vouillon updated PR #13450.
:thumbs_up: fitzgen submitted PR review:
Good catch, thanks!
fitzgen commented on PR #13450:
Looks like this has some conflicts that need to be resolved before it can merge.
vouillon updated PR #13450.
vouillon updated PR #13450.
fitzgen added PR #13450 Keep source/destination arrays alive across array.copy's per-element loop to the merge queue.
github-merge-queue[bot] removed PR #13450 Keep source/destination arrays alive across array.copy's per-element loop from the merge queue.
fitzgen added PR #13450 Keep source/destination arrays alive across array.copy's per-element loop to the merge queue.
github-merge-queue[bot] removed PR #13450 Keep source/destination arrays alive across array.copy's per-element loop from the merge queue.
fitzgen added PR #13450 Keep source/destination arrays alive across array.copy's per-element loop to the merge queue.
fitzgen removed PR #13450 Keep source/destination arrays alive across array.copy's per-element loop from the merge queue.
fitzgen added PR #13450 Keep source/destination arrays alive across array.copy's per-element loop to the merge queue.
:check: fitzgen merged PR #13450.
fitzgen removed PR #13450 Keep source/destination arrays alive across array.copy's per-element loop from the merge queue.
Last updated: Jun 01 2026 at 09:49 UTC