Remove stale owner entry in xmem::arrange when target slice is unowned #437
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!437
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-437"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ahmetbagci8 on GitHub · 2026-11-29 11:23 UTC · original
ahmetbagci8:fix/xmem-arrange-stale-owner→main· +60038 −5429 · 206 files · 660 commits · closed without mergingProblem
In crates/victory-hle/src/modules/xmem.rs, rrange() builds an owner: HashMap<usize, usize> mapping slice_index -> page_number for the section. When moving *number from slice have to want:
On a subsequent iteration that wants have, owner.get(&have) finds the stale *number and overwrites its slice.index, leaving *number at the wrong slice instead of want.
Fix
Remove have from owner in the else branch when want has no current owner, and add a unit test (rrange_clears_stale_owner_when_target_slice_is_unowned) covering the freed-slice case.
Verification
@TaynanGT on GitHub · 2026-11-29 11:35 UTC · original
Thanks for isolating the stale reverse mapping. The freed-slice regression is useful; please also check that the normal occupied-target swap retains both owners and that subsequent rearrangements cannot see the old entry.
@Kal0s-design on GitHub · 2026-11-29 12:57 UTC · original · reviewed
Ran this on Windows.
cargo test -p victory-hle --libgives 223 passed (the xmem group is 19), andcargo clippy -p victory-hle --all-targets -D warningsis clean. With theelsebranch taken out, the new test fails on the[Some(1), Some(2)]assertion. With it in, it passes.The fix looks right. Once
numberleaveshavefor an unownedwant, nothing ownshaveany more, so leavingowner[have] = numberlets a later iteration movenumberback. Theelsealso covers the case whereownernames a page that's no longer in the table, which is the right outcome there too.AI-assisted: yes
@TaynanGT on GitHub · 2026-11-29 19:03 UTC · original
Thanks for running this natively and confirming the regression fails without the else branch. The new test exercises two consecutive moves into unowned slices, so the stale reverse entry is covered directly. Please keep the existing occupied-target swap coverage alongside it.
@TaynanGT on GitHub · 2026-11-30 17:07 UTC · original
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed