mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
add57f5560
The ~14-min Tomba idle freeze is a gradual per-frame host-stack LEAK (not a within-one-frame spiral, not the gradual-marking theory). Confirmed via a new compiled-entry depth profile (§19): per-frame MAX guest-stack-used climbs dead-linear +1.17 KB/frame from gameplay start to 48 MB on the 64 MB main-thread stack -> native stack guard -> freeze. Once per frame an interpreted overlay (reached via func_80046264's dirty hop jal 0x80063864) does jalr func_8001A954, nesting a host call that never unwinds (the per-frame loop never returns). Full writeup RECURSION_BUG.md §16-§21. Instruments (always-on rings, runtime-only, no regen): - §17 stack_profile: per-vblank host-stack sample (main.cpp; stack_profile TCP cmd). - §18 xprobe / xprobe_arm: interp<->compiled boundary crossing flight recorder (dirty_ram_interp.c; per-frame summary + per-crossing detail). - §19 ce_profile: per-compiled-entry depth profile + raw TEB at the trip (debug_server.c; ce_profile TCP cmd) — the trustworthy instrument; the regression check for the fix (max_kb must stay FLAT). - PSX_STACK_GUARD_KB early-trip + PSX_FIBER_STACK_KB (debug_server.c / traps.c). Fix progress: - Block-loop tail-transfer surface (dirty_ram_interp.c ~1514): surface compiled tail-transfers to the trampoline instead of nesting. Correct for tail-transfers but RULED OUT as the leak (§19 climb unchanged) — the leak is the CALL path (jalr/jal). - Real fix (next): surface compiled-game CALLS to the owner trampoline, gated to compiled-game targets only (a naive all-targets surface reintroduces the dwarf->overworld lost-continuation bug). Needs a non-nesting membership test (generated psx_dispatch_game_has) or §12 CD-DMA dirty-marking precision. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>