Skip to content

Fix continuation ownership for overlapping entry wrappers - #279

Open
Fiztba wants to merge 2 commits into
ran-j:mainfrom
Fiztba:fix/resume-alias-ownership
Open

Fiztba wants to merge 2 commits into
ran-j:mainfrom
Fiztba:fix/resume-alias-ownership

Conversation

@Fiztba

@Fiztba Fiztba commented Oct 9, 2026 •

Copy link
Copy Markdown

An overlapping entry_* wrapper can emit continuations that its containing function never decoded, leaving a suspended guest thread with no registered return address. A newly registered alias can also occupy an explicit SDK handler address, and unordered owner iteration can choose different wrappers for the same alias.

Collect each decoded wrapper's own in-range continuations. Preserve #271's existing external-target policy: standalone entries can promote valid branches into other functions, while nested wrappers suppress duplicate external promotion. Register explicit recompiled/stub/syscall/library starts before aliases, then choose alias owners deterministically: ordinary functions first, followed by the most specific start within each kind.

This builds on #271: standalone entry continuations and external branches remain supported, and its regression stays in place. Nested wrappers also collect their own continuations before the existing interval classification controls external promotion.

Regression cases use synthetic ELFs and the existing test infrastructure, with no game files. They cover nested JAL/JALR/syscall continuations, standalone external branch registration and matching resume labels, explicit handler collisions, overlapping owners, reversed owner insertion, and the existing standalone-entry case. The full-pipeline fixture runs separate serial, separate two-worker, and combined output.

Validation: native Windows x64, Visual Studio 2022/MSVC 19.44. Rebuilt the PR's recompiler and dependency libraries, then ran all 87 existing/new code-generator and recompiler MiniTest cases through a focused scratch runner: all passed. The exact upstream source at 2c5fbb9 passes 84/87, reproducing all three residual issues. The original PR revision 3b878b7 passes 86/87, demonstrating the legitimate standalone branch that its blanket entry guard incorrectly omitted. That guard and the original negative test assertion have been corrected. CTest 3/3 passed, including both expected-failure controls. The complete runtime test executable and Linux builds were not run for this focused change.

The change originated while restoring native King's Field IV audio, where missing generated continuations prevented the original guest driver/movie paths from returning. The full game integration is in Holyland #7, retaining its pinned patch series. This PR contains only the reusable generator fix and its tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant