Repository navigation
Conversation
Progress report (0c6a5bd → 714d17e)📈 System libraries: 42.2% (+0.1%, +23 implemented, -6 removed functions) ✅ 23 implemented
⚪ 15 behaviourally empty (constant return or throw)
🗑️ 6 removed
|
01ea218 to
714d17e
Compare
|
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.
Exports introduced here that are already present in
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.
|
| static bool APS5_VABI GenericCategoryEquivalentCondition_nid_no_patch(const CategoryObject* self, int value, const ErrorCode* condition) { | ||
| return condition->category == self && condition->value == value; | ||
| if (!condition) return false; | ||
| return condition->category == self && (condition->value == value || condition->value_high == value); |
There was a problem hiding this comment.
ErrorCode matches the observed guest layout { int value; const CategoryObject* category; }: on x86_64 the pointer is at offset 8, leaving bytes 4–7 as alignment padding. value_high overlays that padding, which callers do not initialize as a second value. If the padding happens to equal the queried code while the actual value differs, this returns true for an unrelated error. The same extra-word comparison appears in the generic/system/future equivalence methods and the exported base-category equivalence methods below. Please compare the actual 32-bit value only and add a regression case that poisons the padding bytes.
MarcZX10
left a comment
There was a problem hiding this comment.
Requesting one correctness fix before approval: the equivalence implementations compare value_high, which is the alignment padding in the observed { int value; category pointer; } guest layout. That can report equality for a different error code when padding matches. I left an inline comment at the first comparison; the same issue occurs in the system/future category and base-category comparisons. Please remove the padding comparisons and add a regression case with nonzero padding. The current hosted run also has a failing macOS x86_64 relinker test and a conventions failure; I could not retrieve the hosted failure log through gh during this review.
|
Windows run of 714d17e merged onto
The four already exist in |
MarcZX10
left a comment
There was a problem hiding this comment.
Review
I found a blocking duplicate definition and additional behavior that needs to be brought within the repository’s implementation rules before this PR can be considered.
Duplicate _Thrd_id_nid_postfix
This PR adds a strong C-linkage _Thrd_id_nid_postfix definition in libc/Export.cpp returning 1, while the existing definition in libc/src/Threads.cpp remains in this branch. The libc target includes both files in target_sources, so the library has two definitions of the same symbol. The current product Linux/Windows jobs were skipped, which explains why this has not been caught by those jobs.
There is also an open PR, #9170, that replaces the existing stub with a scePthreadSelf() forward based on two console-body readings and a focused test. Please remove the duplicate placeholder here and coordinate the single implementation and landing order with that author; update Depends on if the PRs are intentionally stacked. The constant 1 is not supported by the evidence cited in #9170.
Silent placeholders and scope
The new exports also include silent no-op/null placeholders, including _Cnd_broadcast, _Cnd_register_at_thread_exit, _Thrd_detach, __std_find_trivial_1, and __std_reverse_trivially_swappable_1. These are not category implementations, and the latter two return/do nothing for all inputs. CONTRIBUTING requires unimplemented paths to throw or to be explicitly recorded under the library’s Silent stubs debt. Please remove these unrelated placeholders from this PR or implement and test them, with the required debt entries if any are intentionally silent.
Category behavior
SystemCategoryEquivalentCondition accepts a condition from self even when GenericErrorMessage(value) selects GenericCategory. The category contract compares against default_error_condition(value); the MSVC STL implementation does that exact comparison. As written, a system-category condition can compare equivalent where the default condition is generic. Please remove that extra acceptance and add a regression check for both the expected generic match and the rejected system-category match.
The PR also adds no committed tests for the new category names, messages, default conditions, or equivalence behavior. The reported Windows round-trip is useful but not reproducible from this branch. Please add focused tests for those behaviors.
Current validation
- git diff --check against current main: passed.
- Current conventions check: passed.
- Current CI: conventions, eligibility, labels, and report passed; register-context, most relinker, ASan relinker, and write-watch jobs passed.
- relinker (macos-latest, clang++, x86_64) failed in its CTest step after the build. The log is unavailable through the current run-log endpoint, and the job is relinker-only, so I cannot attribute that failure to this libc change. Please rerun or report its cause.
- Linux and Windows product-test jobs were skipped.
- This head is 474 commits behind current main; please update it and rerun the focused build/tests after resolving the symbol and overlap.
The new category objects merit focused validation, but the duplicate symbol, silent placeholders, and system-category equivalence mismatch need correction first.
|
@Delciob the overlap report lists The two differ in where the value lives. #9014 took the layout from the 12.00
This PR stores the value at both +0 and +4 and accepts a match on either. A guest that builds an A proposal, since everything else here is new:
If you'd rather have it the other way round, I'm fine with that as long as the layout matches the console; then I'll rebase #9014 onto yours and keep only the layout fix and its tests. Separately, the 🤖 Generated with Claude Code |
harisibrar1
left a comment
There was a problem hiding this comment.
Checked against main 830ccd1 and the PR's own tests (core/libs/tests/GuestBadOptionalAccess.cpp, ExceptionRuntime.cpp):
- Following up on the
PlainWhatquestion: the same hunk removes thebad_optional_accesstype info, vtable and ctor/dtor exports, and thebad_variant_accesstype info and vtable, which main defines inStandardExceptions.cpp.GuestBadOptionalAccess.cppstill references_ZTISt19bad_optional_access_nid_postfix,_ZTVSt19bad_optional_access_nid_postfixand_ZNSt19bad_optional_accessC1Ev_nid_postfix, soguest_bad_optional_access_testsno longer links. Could the removal be reverted? _ZSt26__throw_bad_variant_accessvand_ZSt26_Throw_bad_optional_accessvnow throwstd::runtime_error(Export.cpp:36-37, 48) instead of main'sThrowPlain(...)with the guest vtable.ExceptionRuntime.cpp:257-260catchesstd::bad_variant_access&/std::bad_optional_access&, so the exception escapes and the test aborts. A guestcatchon those types would miss in the same way. Keeping main's versions would fix both.- The new
_ZSt6_ThrowRKSt8bad_cast,_ZSt6_ThrowRKSt20bad_array_new_length,_Throw_future_errorand_Rethrow_future_exceptionalso throw a hoststd::runtime_error, so guest handlers forbad_cast/future_errorwon't match. These probably belong in their own PR, built withThrowPlain-style guest objects. _ZSt14_Atomic_assertloses itsNotImplemented_nid_no_patch(Export.cpp:23) and becomes a silent stub with no debt entry. Was that intended?
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
|
Heads-up: this PR adds int APS5_VABI _ZSt4setwi_nid_postfix(int n) { return n; }
int APS5_VABI _ZSt12setprecisioni_nid_postfix(int n) { return n; }to I have that implementation plus a |
|
@Delciob the overlap report pairs this PR with #9170 on |
|
@Delciob a measurement on a PS5 for the So it returns the calling thread's |
|
Heads-up: this PR adds a placeholder for Could you drop that line from this PR, as requested for |
|
Closing this one; it is welcome back as a small PR once the points below are addressed.
A PR with only the two categories, layouts taken from a cited source, a guest test pinning values (including nonzero padding) and the debt lines would be reviewable. |
What
Implement std::system_category() and std::future_category() error category singleton classes in libc with correct vtables, matching the PS5 ABI layout. Export new NIDs for both categories and their message()/name()/default_error_condition() virtual methods.
Tested
Windows 10 x64, linked against libc; error_code and error_condition round-trip.
Checklist