feat(libc): find public RTTI source subobjects #10411

Merged
MarcZX10 merged 2 commits from upstream-pr/10411 into main 2026-11-02 10:22:51 +00:00
MarcZX10 commented 2026-10-23 22:30:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T22:30:43Z.


What

Implement __do_find_public_src for Itanium RTTI metadata. Walk single, multiple and virtual base information, reject private paths, propagate virtual containment, and honor the -3 hint by skipping virtual bases. Add focused coverage for public, private and virtual paths and the hint behavior.

Tested

Linux x86_64: built and ran GuestDynamicCast.cpp with the libc exception exports under AddressSanitizer; the focused harness passed. Full project configuration was unavailable because SDL2 development files are missing. python3 tools/check_conventions.py --base main and git diff --check passed.

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 (not applicable)
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (not applicable)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990049850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10411). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T22:30:43Z. --- ### What Implement `__do_find_public_src` for Itanium RTTI metadata. Walk single, multiple and virtual base information, reject private paths, propagate virtual containment, and honor the `-3` hint by skipping virtual bases. Add focused coverage for public, private and virtual paths and the hint behavior. ### Tested Linux x86_64: built and ran `GuestDynamicCast.cpp` with the libc exception exports under AddressSanitizer; the focused harness passed. Full project configuration was unavailable because SDL2 development files are missing. `python3 tools/check_conventions.py --base main` and `git diff --check` passed. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file (not applicable) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (not applicable) - [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: yes
harisibrar1 commented 2026-10-24 05:39:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T05:39:59Z.

Review: COMMENTED


Checked against main 7c2400d29b and GCC libsupc++ releases/gcc-14.2.0 (04696df096, vmi_class_type_info.cc / si_class_type_info.cc / class_type_info.cc __do_find_public_src):

  • The class/si/vmi logic matches libsupc++, including the vbase offset read through the vptr and the virtual mask being ORed into the result. Nice.
  • The -3 test (GuestDynamicCast.cpp L78) uses MultipleType, whose base is non-virtual, so the new isVirtual && src2dst == -3 skip never runs. Could you add FindPublic(&VirtualType, -3, …, virtualObject.data() + 16) == 1?
  • PrivateType's flags are (16 << 8) | 1, i.e. private and virtual. Plain 16 << 8 would test what the name says without relying on the public check coming first.
  • Source/Side/Native/PrivateNative/VirtualNative look unused.
  • Small consistency point: main detects the kind with Kind() and compares types with Equal() (Runtime.cpp). Using them here instead of vtable[-1]->name() and *self == *sourceType would keep this path in line with the rest of the runtime.
  • #10416 lists this PR as a dependency but isn't stacked on it, and the two conflict in TypeInfo.cpp and GuestDynamicCast.cpp, where both test files define MultipleRecord, MultipleType, PrivateType and VirtualType differently, so the second one to land will need a rebase.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5637037908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10411#pullrequestreview-5637037908). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T05:39:59Z. **Review:** COMMENTED --- Checked against main 7c2400d29b and GCC libsupc++ releases/gcc-14.2.0 (04696df096, `vmi_class_type_info.cc` / `si_class_type_info.cc` / `class_type_info.cc` `__do_find_public_src`): - The class/si/vmi logic matches libsupc++, including the vbase offset read through the vptr and the virtual mask being ORed into the result. Nice. - The `-3` test (`GuestDynamicCast.cpp` L78) uses `MultipleType`, whose base is non-virtual, so the new `isVirtual && src2dst == -3` skip never runs. Could you add `FindPublic(&VirtualType, -3, …, virtualObject.data() + 16) == 1`? - `PrivateType`'s flags are `(16 << 8) | 1`, i.e. private and virtual. Plain `16 << 8` would test what the name says without relying on the public check coming first. - `Source`/`Side`/`Native`/`PrivateNative`/`VirtualNative` look unused. - Small consistency point: main detects the kind with `Kind()` and compares types with `Equal()` (Runtime.cpp). Using them here instead of `vtable[-1]->name()` and `*self == *sourceType` would keep this path in line with the rest of the runtime. - #10416 lists this PR as a dependency but isn't stacked on it, and the two conflict in `TypeInfo.cpp` and `GuestDynamicCast.cpp`, where both test files define `MultipleRecord`, `MultipleType`, `PrivateType` and `VirtualType` differently, so the second one to land will need a rebase. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-11-02 04:57:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:22Z.

Review: COMMENTED


Reviewed — reports checked, no change requested

Two reports on the thread are run results, one of which names a failing test that this diff does not touch; neither asks for a code change.

What I ran

  • Live head c7fbae3ebd (matches batch).
  • gh pr view 10411 (headRefOid, statusCheckRollup); gh api GET of comments, review comments and reviews newer than 2026-10-27T07:16:30Z.
  • git diff --stat of the PR's changes; git grep for guest_raise_exception at the head.
  • Nothing was built or run.

Results

Check Result Note
eligibility, conventions, labels, report SUCCESS hosted
relinker (3 OS), relinker-asan, register-context, write-watch SUCCESS hosted
windows SKIPPED hosted; the Windows runs are local reports only
linux SKIPPED hosted

Findings

  • babyhuey (2026-10-27T11:08:35Z) reports 2586 selected tests with one failure, guest_raise_exception, which he says also fails on main 5d52b06ff3 (#11813). The diff changes only core/libs/prx/libc/src/exception/TypeInfo.cpp and core/libs/tests/GuestDynamicCast.cpp. guest_raise_exception is a libkernel test (core/libs/prx/libkernel/CMakeLists.txt:1172-1176) that links libc, so the diff does not provably leave it alone. Verified: file scope. Not verified: the failure on main.
  • maskym (2026-10-27T14:14:14Z) reports a local Windows run of guest_dynamic_cast passing, merged alone into main 75f3702aed. He notes a textual conflict with #10416 in GuestDynamicCast.cpp; I did not check that merge.

Sources

Not verified

  • Failure of guest_raise_exception on main (#11813) and the local Windows runs.
  • Any build or test run.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732248738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10411#pullrequestreview-5732248738). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:57:22Z. **Review:** COMMENTED --- # Reviewed — reports checked, no change requested Two reports on the thread are run results, one of which names a failing test that this diff does not touch; neither asks for a code change. ## What I ran - Live head c7fbae3ebd4e1b3048d141775d450e695325ea5c (matches batch). - gh pr view 10411 (headRefOid, statusCheckRollup); gh api GET of comments, review comments and reviews newer than 2026-10-27T07:16:30Z. - git diff --stat of the PR's changes; git grep for guest_raise_exception at the head. - Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | eligibility, conventions, labels, report | SUCCESS | hosted | | relinker (3 OS), relinker-asan, register-context, write-watch | SUCCESS | hosted | | windows | SKIPPED | hosted; the Windows runs are local reports only | | linux | SKIPPED | hosted | ## Findings - babyhuey (2026-10-27T11:08:35Z) reports 2586 selected tests with one failure, guest_raise_exception, which he says also fails on main 5d52b06ff3 (#11813). The diff changes only core/libs/prx/libc/src/exception/TypeInfo.cpp and core/libs/tests/GuestDynamicCast.cpp. guest_raise_exception is a libkernel test (core/libs/prx/libkernel/CMakeLists.txt:1172-1176) that links libc, so the diff does not provably leave it alone. Verified: file scope. Not verified: the failure on main. - maskym (2026-10-27T14:14:14Z) reports a local Windows run of guest_dynamic_cast passing, merged alone into main 75f3702aed. He notes a textual conflict with #10416 in GuestDynamicCast.cpp; I did not check that merge. ## Sources - https://github.com/boykopovar/AnyPS5/blob/c7fbae3ebd4e1b3048d141775d450e695325ea5c/core/libs/prx/libkernel/CMakeLists.txt#L1172-L1176 ## Not verified - Failure of guest_raise_exception on main (#11813) and the local Windows runs. - Any build or test run.
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!10411
No description provided.