Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pyre/pyre-jit-trace/src/jitcode_dispatch/resume_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,16 @@ pub(crate) fn walker_capture_snapshot_for_last_guard_impl<Sym: WalkSym>(
// This is the same transition the following walk step would make;
// it merely makes the guard's resume image observe it at the
// required point.
if after_residual_call && ctx.vstack_valid {
//
// `py_pc == vstack_cur_pypc` is not that transition: the walk has
// not left the opcode the mirror already holds, so the following
// step makes no boundary at all — `step_vstack_mirror` returns on
// the same equality. Reconciling anyway replays that opcode's
// stack effect a second time, and the permutation classes are not
// idempotent: a `SWAP` applied twice is the identity, so the two
// slots it exchanged keep their pre-swap order for the rest of the
// walk and every later guard snapshot publishes them crossed.
if after_residual_call && ctx.vstack_valid && py_pc != ctx.vstack_cur_pypc {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve same-coordinate reconciliation bookkeeping

For a same-PC after-residual capture that still needs depth normalization or hole filling, this condition skips the entire reconciliation rather than only the duplicate opcode effect. reconcile_vstack_at_boundary already suppresses a repeated SWAP via repeat_boundary, while deliberately retaining box resizing, shadow hole filling, vstack_depth publication, and vstack_last_ref clearing; bypassing it can therefore leave stale mirror state that the next real boundary uses to build later guard snapshots. Keep the same-coordinate handling inside the reconciler and suppress only the effect that must not be replayed.

AGENTS.md reference: AGENTS.md:L309-L311

Useful? React with 👍 / 👎.

let jc = unsafe { &*sym.jitcode() };
let code_ptr = jc.payload.code_ptr;
if !code_ptr.is_null() {
Expand Down
Loading