feat(libc): wire the collate<char> facet vtable #11166

Merged
00xDisaster merged 1 commit from upstream-pr/11166 into main 2026-10-26 21:38:28 +00:00
00xDisaster commented 2026-10-25 20:22:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 00xDisaster on 2026-10-25T20:22:44Z.


What

Fill the exported collate<char> vtable with the facet methods that already back g_collateVtable. #9979 added the nine-slot _ZTVSt7collateIcE_nid_postfix data object (NID ruZtIwbCFjk) with the console's 72-byte layout, but every slot was zero, so a title that called compare, transform or hash through the exported vtable faulted. Slots 2 through 8 now hold DestroyCollate, DeleteCollate, RetainFacet, ReleaseFacet, CollateCompare, CollateTransform and CollateHash; slots 0 and 1 stay zero for offset-to-top and typeinfo, as they were. _Getcat still installs g_collateVtable, so both the exported object and facets built by _Getcat call the same implementations.

The exported object is still writable data and supplies no RTTI typeinfo; the debt entry records both. This does not touch time_put or num_put: open #11044 and #11054 implement those different virtuals, and no open PR currently fills this array. #10158 and #10200 add the distinct adjacent messages and numpunct vtable declarations in the same LocaleSupport.cpp block; both are currently CONFLICTING, so this PR merges first and they rebase afterwards, keeping all three declarations. No dependency is required.

Tested

Linux CachyOS 7.3.0-4-cachyos, GCC 16.2.1. Base upstream/main 74ac0e7912a5eaa453fff872f4d4fe803154b08c; head c66f61ff5259e3d05eab0e35c99b948d2b62903b.

  • cmake --build build --target guest_locale_tests --parallel: passed.
  • ctest --test-dir build -R '^guest_locale$' --output-on-failure: 1/1 passed.
  • guest_locale now calls compare, transform, hash, retain and release through &_ZTVSt7collateIcE_nid_postfix[2], checks the compare ordering and FNV hash result, and checks that slots 0 and 1 remain zero while slots 2 through 8 are non-null.
  • tools/check_conventions.py --base upstream/main --head HEAD and git diff --check: clean.
  • GPUs tested: n/a.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: no
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5008331978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11166). Originally posted by [00xDisaster](https://github.com/00xDisaster) on 2026-10-25T20:22:44Z. --- ### What Fill the exported `collate<char>` vtable with the facet methods that already back `g_collateVtable`. #9979 added the nine-slot `_ZTVSt7collateIcE_nid_postfix` data object (NID `ruZtIwbCFjk`) with the console's 72-byte layout, but every slot was zero, so a title that called `compare`, `transform` or `hash` through the exported vtable faulted. Slots 2 through 8 now hold `DestroyCollate`, `DeleteCollate`, `RetainFacet`, `ReleaseFacet`, `CollateCompare`, `CollateTransform` and `CollateHash`; slots 0 and 1 stay zero for offset-to-top and typeinfo, as they were. `_Getcat` still installs `g_collateVtable`, so both the exported object and facets built by `_Getcat` call the same implementations. The exported object is still writable data and supplies no RTTI typeinfo; the debt entry records both. This does not touch `time_put` or `num_put`: open #11044 and #11054 implement those different virtuals, and no open PR currently fills this array. #10158 and #10200 add the distinct adjacent `messages` and `numpunct` vtable declarations in the same `LocaleSupport.cpp` block; both are currently `CONFLICTING`, so this PR merges first and they rebase afterwards, keeping all three declarations. No dependency is required. ### Tested Linux CachyOS 7.3.0-4-cachyos, GCC 16.2.1. Base `upstream/main` `74ac0e7912a5eaa453fff872f4d4fe803154b08c`; head `c66f61ff5259e3d05eab0e35c99b948d2b62903b`. - `cmake --build build --target guest_locale_tests --parallel`: passed. - `ctest --test-dir build -R '^guest_locale$' --output-on-failure`: 1/1 passed. - `guest_locale` now calls `compare`, `transform`, `hash`, `retain` and `release` through `&_ZTVSt7collateIcE_nid_postfix[2]`, checks the compare ordering and FNV hash result, and checks that slots 0 and 1 remain zero while slots 2 through 8 are non-null. - `tools/check_conventions.py --base upstream/main --head HEAD` and `git diff --check`: clean. - GPUs tested: n/a. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: no
MarcZX10 commented 2026-10-25 20:29:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T20:29:29Z.

Review: COMMENTED


Reviewed exact head c66f61ff5259e3d05eab0e35c99b948d2b62903b.

The exported nine-slot object points at the same collate methods as the existing facet vtable, leaves offset-to-top/typeinfo zero as documented, and the test invokes all populated slots through the exported object. The debt update correctly records the remaining RTTI limitation and the evidence boundary.

Checks: git diff --check upstream/main...HEAD passes and the conventions, eligibility, intake, labels and report checks pass. The author reports guest_locale_tests and guest_locale passing locally. The current hosted relinker and register-context jobs pass; macOS relinker/register-context and write-watch jobs are still queued, while the general Linux/Windows jobs are skipped by the path policy. I did not run a local build in this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645088693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11166#pullrequestreview-5645088693). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T20:29:29Z. **Review:** COMMENTED --- Reviewed exact head `c66f61ff5259e3d05eab0e35c99b948d2b62903b`. The exported nine-slot object points at the same collate methods as the existing facet vtable, leaves offset-to-top/typeinfo zero as documented, and the test invokes all populated slots through the exported object. The debt update correctly records the remaining RTTI limitation and the evidence boundary. Checks: `git diff --check upstream/main...HEAD` passes and the conventions, eligibility, intake, labels and report checks pass. The author reports `guest_locale_tests` and `guest_locale` passing locally. The current hosted relinker and register-context jobs pass; macOS relinker/register-context and write-watch jobs are still queued, while the general Linux/Windows jobs are skipped by the path policy. I did not run a local build in this review.
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!11166
No description provided.