You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exact ReleaseSafe case reproduces locally and intermittently, including with native JIT disabled. A diagnostic preserving the original for (const o of own) loop showed the owning thread's packed Array iterator yielding undefined at an index whose direct own[index] read still returned the expected object.
Root cause: compileForOf creates its iterator, captured next, result, and close-state bookkeeping with raw freshTemp() names but never registers those names as function locals. emitDefine/emitLoad therefore resolve the synthesized names through the shared Environment. Concurrent invocations of the same compiled function overwrite each other's Iterator Records and results. This is also wrong for recursive/reentrant execution. compileYieldStar uses the same raw temporary pattern and should use the same activation-owned abstraction.
Implement the fix at the compiler storage boundary: use frame-local bindings for ordinary functions, private activation bindings for suspendable functions, and Exec-owned scratch for program chunks. Do not serialize execution, add sleeps, weaken the corpus assertion, or special-case the test. Add structural compiler coverage plus required-bytecode parallel runtime coverage, then verify the exact ReleaseSafe no-GIL case repeatedly, unsuppressed TSan, focused/full units, and the relevant corpus gate.
The compiler now keeps for-of and yield-star protocol state in execution-owned storage: frame locals for ordinary functions, Exec scratch slots for program chunks, and the private variable environment for suspendable activations.
Validation:
exact ReleaseSafe reproducer: 100/100 passes with JIT and 100/100 with no-jit
exact unsuppressed TSan run: pass, no sanitizer report
Activity
chrisbbreuer commentedon Sep 1, 2026
Landed on main in 7d1ce5c5.
The compiler now keeps for-of and yield-star protocol state in execution-owned storage: frame locals for ordinary functions, Exec scratch slots for program chunks, and the private variable environment for suspendable activations.
Validation:
This closes the shared-activation iterator corruption without weakening synchronization or adding timing workarounds.