cpu: track string direction across branches and ABI boundaries #593
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/599"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Joacoorandom on 2026-11-22T15:01:47Z.
Change
Allow STD/CLD around repeated memory transfers in the control-flow CPU lifter. Carry a local direction flag along the actual path and use unsigned pointer steps for forward/backward copies and fills.
A separate control-flow proof starts with DF clear and rejects any path that reaches a call, tail jump or return with DF potentially set. Joins retain both possibilities; a branch-selected backwards region must clear DF before its ABI boundary. Instruction effects invalidate stale pointer/count provenance as before.
Depends on #598; #597 is merged. Rebased the remaining two commits on current
main: fill461a4f5and direction2b74c4c. The PR still includes #598 until that dependency is merged. Review the direction increment in2b74c4c; original Windows verification predates this rebase.Verification
Commit
9014984. Windows 11 26300.9974, MSVC/ML64 19.44.35230, Python 3.12.8.All six selected tests passed. The cumulative comparison covers nineteen exports and 7,608 native/AOT/reference cases, plus 63 access-violation comparisons, including /O2. New cases cover all repeated copy/fill widths backwards, branch-selected directions and a join with different DF states. The assembly harness checks RSI/RDI restoration and physical DF on normal return.
Nine whole-PE rejection controls and five unsupported forms passed, including a set DF at a call, tail jump or return, and a missing clear on one path. Three compiled semantic mutations must mismatch: ignored backwards direction, memmove overlap and truncated repeat count.
Linux checks all passed:
Evidence and follow-up
Original MIT source-built assembly and independent byte-array reference, extending the existing comparison. No external source was copied. Assumes Windows x64 clear-DF entry; does not model exception resumption, native REP register state at a fault, concurrent observation or throughput equivalence. Non-repeated forms remain rejected. README and experiment notes updated. AI-assisted.
Checklist
Conflict-resolution update (2026-11-22)
Rebased onto current upstream
mainafter #597 was merged, preserving each increment in stack order. Local checks passed:form_coverage_check.py,docs_links_check.py,bidi_controls_check.py,cpu/lower_prefixes_check.py, plusgit diff --check. Previous native-Windows results describe the original commits; the official Windows CI on the new head provides independent revalidation. No workflow or unrelated files were edited.Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T17:34:42Z.
Verification of
9014984on an Intel Core i7-6820HQ (Skylake), Windows 11 26100.9168, MSVC/ML64 19.52.37029,devpreset. I tested this head separately from the rest of the series, see #598:Like #598, this head no longer merges cleanly with
mainnow that #597 has landed.AI-assisted (Claude Code).