Repository navigation
docs(debt): name the console modules that free an IntrusivePtr without a deleter - #16296
adriadam10 merged 3 commits into
Conversation
…t a deleter The entry said the destructor throws because destroying the object needs its destructor and the LibContext allocator. The module bundled with PPSA01341 v01.007.000 shows what the release does instead: a no-op operator delete at 0x12040 and sceLibcMspaceFree at 0x2c40 with the mspace the LibContext holds at +0x20, reached only after 0x47c0 finds the LibContext's first word in a process-wide registry. The registry and the destructor are the parts not reproduced, so the entry now says that instead of the allocator as a whole.
|
The disassembly the entry now cites, from 11646d: mov (%rdi),%rdi ; pointee
116473: je 0x1164c9
116475: call 0x12060 ; lock xadd $-1 with the count at 0x00, returns the previous count
11647d: jne 0x1164c9 ; not the last reference
11647f: mov 0x8(%rbx),%rax ; deleter
116488: call *%rax ; when present
11648f: mov (%rbx),%r14
116492: mov 0x10(%rbx),%rdi ; LibContext
116496: call 0x47c0 ; registry lookup, 0 when the context is not registered
1164b1: call 0x12040 ; 'ret' — no destructor
1164bc: call 0x2c40 ; mov 0x20(%rdi),%rdi; jmp sceLibcMspaceFreeThe release the host already does (fetch_sub and compare with 1) matches 0x12060 and the count offset. What is missing is only the no-deleter branch: the registry at 0x47c0 decides whether the pointer is freed at all, and no destructor runs on the way out. Note for whoever merges: the other open AI-assisted: yes. |
|
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.
|
gabichuuuuu
left a comment
There was a problem hiding this comment.
Docs check of head fe15d88faa against main 0bae53facd: I compared what the entry says about the code with the code, and checked the links and counts. I can't check the console measurements themselves.
The destructor still throws for the last reference without a deleter (Export.cpp:1163), as the entry says.
…trusiveptr-release
…trusiveptr-release
|
Checked the entry against |
What
The
IntrusivePtrentry said the destructor throws on the last reference of a pointer without a deleter because destroying the object needs its destructor and theLibContextallocator. The module bundled with PPSA01341 v01.007.000 shows what that path does, so the entry now names it:mov (%rdi),%rdi,call 0x12060(alock xaddof -1 that returns the previous count),cmp $1,%eax— the same release the host implementation already does, with the count at 0x00 of the pointee;call 0x12040, which is a bareret, so no destructor runs;call 0x2c40, which ismov 0x20(%rdi),%rdi; jmp sceLibcMspaceFree, so theLibContextat 0x10 holds the mspace at 0x20 and the pointer is freed from it;LibContext's first word in a process-wide registry; when it has not, nothing is freed.The entry now says the registry and the destructor are what is missing, rather than the allocator as a whole, which the host
libcimplements (sceLibcMspaceFree). No code changes: the throw stays until the registry is modelled. The disassembly this comes from is attached below.Tested
Not tested. Documentation only: no code, no test and no build output changes.
The addresses above were read from
libSceNpCppWebApi.prxof PPSA01341 v01.007.000 withpython3 tools/annotate_module.py --out ..., which also resolves the 44,810 exports of that module from the NID database.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)