Scripts: follow reachable record-writer fallback calls #2650

Open
luckyteagirl wants to merge 1 commit from upstream-pr/2660 into main
luckyteagirl commented 2026-11-26 05:16:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:16:22Z.


The record-writer inspector's fallback slot scan takes the first indirect call in the next 12 listed instructions. That can name an unreachable call after a return or unconditional jump. Walk reachable instructions from the fallback target, following direct branches within the same bounded search.

What is in it

  • Use a visited, bounded queue for fallthrough and direct branch targets; stop at returns, ud2 traps, and unconditional jumps, including common objdump prefix spellings.
  • Add synthetic listings with unreachable decoys, direct and conditional branches to real calls, prefixed returns/jumps, and a self-loop.

Tested

  • On current main b49be183, the new unreachable-decoy cases reported slot 8 instead of unknown. The first patch version missed reachable calls after jumps; independent review caught that and the final fixtures now cover them. Prefixed repz ret and bnd jmp were also verified before finalizing.
  • An additional ud2 decoy fixture failed on the first PR revision and passed after recognizing the trap as a path terminator. On this branch, full Python script discovery passed 26/26 on Windows and Ubuntu under WSL. git diff --check and independent source review passed.

Regression run

  • Not applicable. Only the Python inspector and its synthetic fixture changed.

Not tested

  • A retail binary objdump listing, Rust workspace tests, GPU tests, or title smoke. The search remains a bounded heuristic: it resolves numeric direct branch targets, not indirect jump targets. PR #2049 refactors the same scan and may require a mechanical rebase.

AI use

  • Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent reviewed the CFG behavior and its revisions.
<!-- greyfinch-sync:ivall/xcl:issue:5504445845 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2660). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:16:22Z. --- The record-writer inspector's fallback slot scan takes the first indirect call in the next 12 listed instructions. That can name an unreachable call after a return or unconditional jump. Walk reachable instructions from the fallback target, following direct branches within the same bounded search. **What is in it** - Use a visited, bounded queue for fallthrough and direct branch targets; stop at returns, `ud2` traps, and unconditional jumps, including common objdump prefix spellings. - Add synthetic listings with unreachable decoys, direct and conditional branches to real calls, prefixed returns/jumps, and a self-loop. **Tested** - On current main `b49be183`, the new unreachable-decoy cases reported slot 8 instead of unknown. The first patch version missed reachable calls after jumps; independent review caught that and the final fixtures now cover them. Prefixed `repz ret` and `bnd jmp` were also verified before finalizing. - An additional `ud2` decoy fixture failed on the first PR revision and passed after recognizing the trap as a path terminator. On this branch, full Python script discovery passed 26/26 on Windows and Ubuntu under WSL. `git diff --check` and independent source review passed. **Regression run** - Not applicable. Only the Python inspector and its synthetic fixture changed. **Not tested** - A retail binary objdump listing, Rust workspace tests, GPU tests, or title smoke. The search remains a bounded heuristic: it resolves numeric direct branch targets, not indirect jump targets. PR #2049 refactors the same scan and may require a mechanical rebase. **AI use** - Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent reviewed the CFG behavior and its revisions.
github-actions[bot] commented 2026-12-01 02:32:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:39Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298729707 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2660#issuecomment-7298729707). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:32:39Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:36:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:36:46Z.


Triage (#1607) – head 1070cc5

No open PR changes the fallback-slot scan. #1730 also adds a ret check, but in the site's cursor-update search, not the fallback scan, and the lines shared with it are test listing boilerplate. #2049 keeps the linear 12-instruction scan.
The new scan follows fall-through and direct jump targets from the jae target and stops at ret/ud2, so it no longer picks up a call from the next block. The test covers ret, repz ret, ud2, jmp, bnd jmp, jne and a jmp-to-self loop. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305549484 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2660#issuecomment-7305549484). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:36:46Z. --- **Triage (#1607)** – head 1070cc5 No open PR changes the fallback-slot scan. #1730 also adds a ret check, but in the site's cursor-update search, not the fallback scan, and the lines shared with it are test listing boilerplate. #2049 keeps the linear 12-instruction scan. The new scan follows fall-through and direct jump targets from the `jae` target and stops at ret/ud2, so it no longer picks up a call from the next block. The test covers ret, `repz ret`, ud2, jmp, `bnd jmp`, jne and a jmp-to-self loop. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Decodere commented 2026-12-02 09:09:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T09:09:29Z.


merge-check
base: 1c8b551475
head: 1070cc57ff
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/re/record_writers.py and scripts/test_record_writers.py, +56/-3)
build: not run (Tier 0 Python script diff; no Rust code changed)
tests: python -m unittest discover -s scripts -p "test_record_writers.py" -v -> 2 passed, 0 failed (base 1c8b5514: 1 passed; new test_fallback_only_takes_reachable_calls passed with 9 subtests); python -m unittest discover -s scripts -p "test_*.py" -> 66 passed, 1 error (test_discord_mirror.py missing %ComSpec%/%SystemRoot% on Windows, same failure on base 1c8b5514). Rust workspace tests not run (Tier 0).
review: Read the full diff (+56/-3). Replaces the linear 12-instruction scan from the jae fallback target with a 12-instruction BFS (scripts/re/record_writers.py:16,57-82) that strips x86 prefixes, stops at ret/retq/ud2, skips fall-through after unconditional jmp/jmpq, and follows direct j*/loop* targets without revisiting indices. Prevents picking up an unreachable indirect call from the following block. All 9 subtests pass cleanly. No problems found.
performance: none (offline analysis script in scripts/re/; zero runtime impact)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ivall/xcl:comment:7340463314 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2660#issuecomment-7340463314). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:09:29Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 1070cc57ff5d194e75c0b22f4819526735e6d8cd merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/re/record_writers.py` and `scripts/test_record_writers.py`, +56/-3) build: not run (Tier 0 Python script diff; no Rust code changed) tests: `python -m unittest discover -s scripts -p "test_record_writers.py" -v` -> 2 passed, 0 failed (base `1c8b5514`: 1 passed; new `test_fallback_only_takes_reachable_calls` passed with 9 subtests); `python -m unittest discover -s scripts -p "test_*.py"` -> 66 passed, 1 error (`test_discord_mirror.py` missing `%ComSpec%`/`%SystemRoot%` on Windows, same failure on base `1c8b5514`). Rust workspace tests not run (Tier 0). review: Read the full diff (+56/-3). Replaces the linear 12-instruction scan from the `jae` fallback target with a 12-instruction BFS (`scripts/re/record_writers.py:16,57-82`) that strips x86 prefixes, stops at `ret`/`retq`/`ud2`, skips fall-through after unconditional `jmp`/`jmpq`, and follows direct `j*`/`loop*` targets without revisiting indices. Prevents picking up an unreachable indirect call from the following block. All 9 subtests pass cleanly. No problems found. performance: none (offline analysis script in `scripts/re/`; zero runtime impact) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2660:upstream-pr/2660'
git switch 'upstream-pr/2660'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2660'
git switch 'upstream-pr/2660'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2660'
git switch 'upstream-pr/2660'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2660'
git switch 'main'
git merge --squash 'upstream-pr/2660'
git switch 'main'
git merge --ff-only 'upstream-pr/2660'
git switch 'main'
git merge 'upstream-pr/2660'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2650
No description provided.