Repository navigation
fix(libc): adopt the guest SDK allocator only when the title replaces the heap - #7897
Conversation
… the heap A bundled libc.prx can export the ten allocator NIDs while forwarding them to HLE, so adopting its exports for a title whose replacement table is empty sends HLE allocations back into themselves. Keep the default heap in that case, as before the guest SDK adoption.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Real-GPU run of this head (
The behaviour matches #6610 reverted, or the guard I tried locally, on every title I have. |
|
Two more Linux titles that this PR brings back, both new in the catalog and not in the description's list. Ubuntu 24.04 in WSL2, GCC 13.3, Release, lavapipe, headless with SDL's offscreen driver, 60 s each.
Both run 60 s on Windows on AI-assisted: yes |
|
One more title this brings back: Ruffle (PPSA68091, 1.2.0), which bundles
A temporary print on AI-assisted: yes (Claude Code) |
|
A performance data point for this PR: Super Meat Boy 3D (PPSA31162), which bundles
That's about 3×. Both builds run the same draws: about 150,000 occlusion dumps per 10 s, each draining the draw pipeline. So the per-draw cost on the committer is what changes. I haven't traced why each commit costs about 4.5 times as much while the bundled
AI-assisted: yes (Claude Code) |
What
Since #6610,
ApplicationHeapInitialize_nid_no_patchadopts a loaded guest SDK's ten allocator exports on Linux before it looks at the title's replacement table. Many catalog titles bundle alibc.prxthat exports those NIDs but has no allocator of its own: per @root-over on #6610, the ps5-native-app-boilerplatelibc.prximports onlymalloc,freeandposix_memalignand hands them to_sceKernelRtldSetApplicationHeapAPI. For these titles, HLE allocations now go through exports that lead back into HLE, and they abort, segfault or fail to allocate at start-up.The guest exports are now adopted only when the title's replacement table has an allocator entry. With an empty table, the title keeps the default heap, as before #6610. A title that does replace the allocator keeps #6610's path, and non-Linux hosts are unchanged.
application_heap_guest_sdk_default: it loads the same guest SDK fixture, clears the replacement table, and checks that an allocation comes from the default heap without calling the fixture's exports. Withmain'sApplicationHeap.cppit segfaults (the fixture'smallocreads a null table entry).ApplicationGuestHeapApidebt entry states the new condition.Tested
On 4a5ce8a (based on
mainb106f6f):application_heap|allocatorpass 5/5 (--repeat until-fail:5), including the new one and fix(libc): give the scripting heap hooks blocks from libc's own heap #6842'sapplication_heap_scripting. No warnings in the touched files.application_heap|allocatorpass 5/5 (the guest SDK tests are Linux-only). No warnings in the touched files. Eternal Darkness (PPSA99314) runs as onmain(413 frames in 30 s). The guarded path is Linux-only, so nothing changes on Windows.DisplayWindowVulkan check. Onmainthese ten abort, segfault or hit an illegal instruction at start-up, or Mesa reportsxmlconfig.c: 389: out of memory.. With this change all ten reach theDisplayWindowcheck again: ccleste (PPSA59322), Mario 64 (PPSA99310), Eternal Darkness (PPSA99314), Dusklight (PPSA99305), ProsperoTV (PPSA99003), PSXS5 (PPSA97510), Régie5 (PPSA99520), Media Player Classic (PPSA99015), DriftCheck (PPSA98766) and DOOM (PPSA99666). In the full catalog sweep, 41 of the 61 titles that reached that check stopped earlier after fix(libc): share the guest SDK application allocator #6610 (fix(libc): share the guest SDK application allocator #6610 has the table).main02084228aand reach theDisplayWindowcheck with this change merged onto it. So does Sahin (PPSA99404), added later, onmaind50ec76da.check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)