fix(fiber): report the stack used by the executing fiber #5348

Merged
MathiasDevelopes merged 1 commit from upstream-pr/5348 into main 2026-10-14 06:17:17 +00:00
MathiasDevelopes commented 2026-10-13 17:38:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-13T17:38:16Z.


What

sceFiberGetInfo now reports the requested-size window of the stack the fiber executes on. It previously reported the unused caller buffer, so ChakraCore's garbage-collector stack scan could cross unmapped memory and crash Planet Coaster (PPSA01736 v01.017).

The requested context size is preserved. The extra host-call margin remains outside the reported range. A regression test scans the reported active stack while running, switching and migrating fibers; the host-stack substitution is documented in technical debt.

Overlap check: #4770 adds frame-chain tests elsewhere in Fiber.cpp and changes compiler options. It does not change sceFiberGetInfo or the lines changed here.

Tested

  • Windows x64, build 26300.9457; bundled MinGW-w64 GCC 15.2.0, Release, BUILD_TESTING=ON.
  • Independent branch tested on main 61b8742b6: built fiber_tests; ctest --test-dir build -R '^fiber$' --output-on-failure passed (0.05 s). Subsequently rebased onto 8cf6a0bc3; intervening upstream changes affect only the README and demo page. Conventions and whitespace checks passed after the rebase.
  • Full runtime libraries were built on the combined bring-up branch. This fix passed the earlier fiber/GC crash and exposed a separate missing-stencil-register failure. With the separate stencil fix also applied, Planet Coaster reaches the main menu and audio works. The tester reports about 0.2 FPS, a black roller coaster and unresponsive input during the slowdown; an automated run also recorded a WatchDog illegal-instruction trap (0xc000001d, eboot.exe+0x2bf288). Title status: Game bring-up #5342. Full gameplay and Linux were not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA01736 #5342
  • GPUs tested: n/a (fiber change)
  • AI-assisted: yes, OpenAI Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4847100016 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5348). Originally posted by [MathiasDevelopes](https://github.com/MathiasDevelopes) on 2026-10-13T17:38:16Z. --- ### What `sceFiberGetInfo` now reports the requested-size window of the stack the fiber executes on. It previously reported the unused caller buffer, so ChakraCore's garbage-collector stack scan could cross unmapped memory and crash Planet Coaster (PPSA01736 v01.017). The requested context size is preserved. The extra host-call margin remains outside the reported range. A regression test scans the reported active stack while running, switching and migrating fibers; the host-stack substitution is documented in technical debt. Overlap check: [#4770](https://github.com/boykopovar/AnyPS5/pull/4770) adds frame-chain tests elsewhere in `Fiber.cpp` and changes compiler options. It does not change `sceFiberGetInfo` or the lines changed here. ### Tested - Windows x64, build 26300.9457; bundled MinGW-w64 GCC 15.2.0, Release, `BUILD_TESTING=ON`. - Independent branch tested on `main` `61b8742b6`: built `fiber_tests`; `ctest --test-dir build -R '^fiber$' --output-on-failure` passed (0.05 s). Subsequently rebased onto `8cf6a0bc3`; intervening upstream changes affect only the README and demo page. Conventions and whitespace checks passed after the rebase. - Full runtime libraries were built on the combined bring-up branch. This fix passed the earlier fiber/GC crash and exposed a separate missing-stencil-register failure. With the separate stencil fix also applied, Planet Coaster reaches the main menu and audio works. The tester reports about 0.2 FPS, a black roller coaster and unresponsive input during the slowdown; an automated run also recorded a WatchDog illegal-instruction trap (`0xc000001d`, `eboot.exe+0x2bf288`). Title status: [Game bring-up #5342](https://github.com/boykopovar/AnyPS5/discussions/5342). Full gameplay and Linux were not tested. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA01736 [#5342](https://github.com/boykopovar/AnyPS5/discussions/5342) - [x] GPUs tested: n/a (fiber change) - [x] AI-assisted: yes, OpenAI Codex
copilot-pull-request-reviewer[bot] commented 2026-10-13 17:38:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-13T17:38:22Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5507586365 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5348#pullrequestreview-5507586365). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-13T17:38:22Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
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
boykopovar/AnyPS5!5348
No description provided.