Repository navigation
feat(libSceLibcInternal): implement the remaining collate<char> constructor forms and D0 - #23885
Merged
oneandonlydean merged 1 commit intoNov 19, 2026
Conversation
…ructor forms and D0 collate<char>'s base-object (const _Locinfo&, size_t) and (size_t) constructors and its deleting destructor were inventory placeholders that threw while the complete-object constructors and D1/D2 were implemented. The Itanium C++ ABI emits identical complete- and base-object constructors for a class without virtual bases, so the C2 forms do what their C1 siblings do. D0 runs the (empty) complete destructor and frees the object with operator delete, as the facet vtable's delete entry in libc does. Their mangled names hash to the inventory NIDs, so the exports are named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrivacyOnion
approved these changes
Nov 19, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 26479cb282:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_libc_internal_collate_testsbuilt cleanly. - CTest (
guest_libc_internal_collate):1/1 Test #4389: guest_libc_internal_collate ...... Passed 0.03 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceLibcInternal/Collate.cpp,core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/include/Api.hpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified _ZNSt7collateIcEC2Em_nid_postfix correctly delegates to ConstructNamedCollate(self, 'C', references) matching its C1 counterpart and throwing std::invalid_argument on nullptr self.
- Verified _ZNSt7collateIcEC2ERKSt8_Locinfom_nid_postfix correctly delegates to _ZNSt7collateIcEC1ERKSt8_Locinfom_nid_postfix, validating both self and locinfo for nullptr.
- Verified _ZNSt7collateIcED0Ev_nid_postfix null check throws std::invalid_argument before invoking _ZdlPv_nid_postfix(self) without leaking or double freeing.
- Verified removal of InventoryExports 099, 100, and 101 from InventoryExports.cpp and InventoryExports.hpp cleanly corresponds to the newly exported functions.
- Verified Technical debt fragment docs/dev/debt/changes/feat-libcinternal-collate-ctor-aliases.md properly records the removed inventory placeholders and adds the Functional entry.
- Verified test coverage in GuestLibcInternalCollate.cpp exercises layout, references count, borrowed _Locinfo immutability, allocating/deleting destructor behavior, and null pointer error rejection.
Looks Good To Me
Progress report (fa0b7e3 → 26479cb)📈 System libraries: 44.6% (+0.0076%, +3 implemented, -3 removed functions) ✅ 3 implemented
🗑️ 3 removed
Changed libraries (implemented exports)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
#22428 implemented the complete-object
collate<char>constructors, and its D1 and D2 are implemented too. Three NIDs of the same class were still inventory placeholders that threw:collate<char>::collate(const _Locinfo&, size_t), base object (C2)L71JAnoQeescollate<char>::collate(size_t), C2tkqNipin1EIcollate<char>::~collate(), deleting destructor (D0)Lt4407UMs2oThe Itanium C++ ABI emits identical complete- and base-object constructors for a class without virtual bases, so the C2 forms do what their C1 siblings in
Collate.cppdo. D0 runs the complete destructor, which has nothing to release here (D1 and D2 are empty), and frees the object withoperator delete, as the delete entry of the facet vtable in libc (DeleteCollate) does. A null object throwsstd::invalid_argument.The mangled names hash to the inventory NIDs (
tools/nid_names.py), so the exports are named and the three placeholders are gone. The debt fragment removes the three table rows and adds a Functional entry: not verified on a console.Tested
Linux Mint 22.3, GCC 13.3.0, Release, head on
maine4cee4952b.guest_libc_internal_collatebuilds each C2 form over filled storage and checks, as for the C1 forms, the layout (vtable, 64-bit reference count, cleared collation pointers) and the operations. The_Locinfoform uses a 64-bit count and leaves the borrowed_Locinfounchanged.operator newfrees exactly that allocation; the test heap counts frees and live allocations.main: the test does not link, because none of the three exports exists there. This PR: passes 3/3.tools/suite.py) on this branch: GPU tests on a GTX 1050 Ti (NVIDIA 580.178.04), an HD 630 (Mesa 25.2.8 ANV) and llvmpipe 25.2.8, everything else once.maine4cee4952bbaseline (HD 630 the same 10, llvmpipe the same 3), plus two intermittent tests that do not load libSceLibcInternal.agc_driver_pm4_order_signalon llvmpipe checks for a median below 0.1 ms. Interleaved with amainbuild, 5 runs per GPU, both builds failed 7 of 15.guest_kernel_sys_paths_readlinkat_limits_patchedfailed once at line 233 under load and passes 3/3 alone (both variants). It also failed once in a run of ours on 2026-11-15.guest_libc_internal_collateandpublic_headerspass.check_conventions.py,check_test_registration.py,check_main_sync.py(merges cleanly),check_compile.pyanddebt_fold.py --checkare clean.progress.py --module libSceLibcInternallists nocollate<char>export as pending.pr_overlap.py --branch: refactor(prx): name the libSceLibcInternal export aliases the NID databases resolve #17300 (rename-only) names the same three aliases. feat(libSceLibcInternal): implement the msun trigonometric kernels #13778, feat(libSceLibcInternal): run the deleting destructors of future_error, overflow_error and underflow_error #14834, refactor(prx): name the libSceLibcInternal export aliases the NID databases resolve #17300 and feat(libSceLibcInternal): construct the moneypunct facet and answer its members #18135 could not be compared because they conflict withmain. A trial merge with each adds no conflicting file beyond those it already has. It merges cleanly with our feat(libSceLibcInternal): implement istreambuf_iterator equal #23809, feat(libSceLibcInternal): implement basic_streambuf xsgetn and xsputn #23837, feat(libSceLibcInternal): implement the wide std::_Fiopen #23846, feat(libSceLibcInternal): implement locale::facet _Incref and _Decref #23858 and feat(libSceLibcInternal): implement the remaining messages constructor forms #23867.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)🤖 Generated with Claude Code