Repository navigation
fix(libSceNpCppWebApi): count Vector<String> and Vector<unsigned long> references where the bundled module does - #10925
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed head f4296894ac390b15c1ff7c75f2ec785a167a5b86. The String-vector constructor initializes the count before pointer adoption increments it; copies/destruction use 0x38, and the unsigned-long vector assignment/destructor use 0x20, matching the offsets and module evidence in the PR. The tests check the affected count slots and deleter behavior. Independently ran strict C++20 syntax checks for the changed implementation and test files, plus conventions and git diff --check; all passed. I did not rerun the runtime suite locally; the author reports the four focused CTests pass. The disclosed same-object assignment behavior remains a separate follow-up.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head f429689. The String-vector and unsigned-long-vector reference offsets are separated and applied consistently to construction, copies, assignment, and destruction; the tests check reference changes and deleter behavior. Local strict syntax, conventions, and diff checks passed. The author reports four Linux runtime tests; I did not rerun them locally. The documented self-assignment limitation remains outside this change.
|
Windows run of head
AI-assisted: yes (Claude Code); results above were run on this machine. |
f429689 to
41a2d68
Compare
41a2d68 to
309192e
Compare
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, The tree also carried the open PRs #11724, #11644, #11639, #11636, #11635, #11630, #11353, #11347, #11221, #11706, #11693, #11686, #11682, all merged cleanly, so the run is a joint one; the tests of this PR are AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
@MarcZX10 Merged The order is unchanged: #11631 lands first, and #12801 follows this PR. Two new PRs from edubox, #12808 and #13255, add debt entries next to the |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, changes requested
The reference-count fixes remain consistent with the earlier review, but the current head is behind main and does not include the current head of declared dependency #11631.
What I ran
Reviewed head 5c847d9387cb636e36a2edafe6059f1d782122e3 against PR base 98ddd9c1792bbab016ceed5db267a93d1d61f00a. Current main is 1c6b316cf762c7a8d34623907d62bc1cba2217b6. Environment: Debian 12 x86_64, Python 3.11.2, GCC 12.2.0. The current-main merge preview is clean; no local build or CTest run was performed.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10925
python3 tools/pr_stack_check.py 10925 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10925-5c847d9387cb/stack
git diff --name-status 98ddd9c1792bbab016ceed5db267a93d1d61f00a..1c6b316cf762c7a8d34623907d62bc1cba2217b6 -- core/libs/prx/libSceNpCppWebApi/Export.cpp core/libs/tests/GuestNpCppWebApiIntrusivePtr.cpp core/libs/tests/GuestNpCppWebApiString.cpp docs/dev/debt/libSceNpCppWebApi.md
gh pr checks 10925 --repo boykopovar/AnyPS5 --watch=falseResults
| Check | Result |
|---|---|
| Diff and conventions | Passed |
| Current-main merge preview | Clean, but current main is not an ancestor of this head |
| Dependency chain | #11631 → #10925; #10925 omits current #11631 head, which conflicts with current main |
| Focused tests | Author reports the four WebApi tests plus three alias tests passed three runs each on this head; not rerun locally |
| Hosted CI | Windows, conventions, eligibility, labels and report passed; Linux and specialized jobs skipped |
Observed stack and CI output
Target branch tip: `1c6b316cf762c7a8d34623907d62bc1cba2217b6`
Dependency order: #11631 → #10925
PR #11631: conflict against current base; head `04b3dd67f8ea9a03ca205dff4ebc4f088e154f7b`
PR #10925: clean against current base; head `5c847d9387cb636e36a2edafe6059f1d782122e3`
#11631 → #10925: current_dependency_head_not_included
conventions pass
intake pass
labels pass
windows pass
linux skipping
register-context skipping
relinker skipping
relinker-asan skipping
write-watch skipping
eligibility pass
report pass
Negative control
Not applicable to this recheck: no new behavior assertion was added since the earlier exact-head runtime test report.
Findings
Blocking
The branch includes main only through 98ddd9c1792bbab016ceed5db267a93d1d61f00a, while current main is 1c6b316cf762c7a8d34623907d62bc1cba2217b6. CONTRIBUTING.md requires keeping branches up to date. The PR also declares dependency #11631, but its current head is absent and that PR currently conflicts with main. The minimal next step is to resolve/rebase #11631, then refresh this branch on current main with the updated dependency and rerun the focused tests on the resulting head.
Non-blocking
The intervening main commits do not touch this PR's implementation or test paths, and the current-main merge preview is clean. The reported tests are useful evidence for the unchanged code but do not verify the refreshed dependency chain.
Sources
- Branch synchronization rule in CONTRIBUTING.md
- Reference-count implementation and tests at the reviewed head
- Declared dependency #11631
Not verified
No local build or CTest run; author-reported focused tests only. No PS5 console/title behavior. The refreshed dependency stack has not been tested.
To get this to a good state
After #11631 is resolved on current main, rebase this PR on its updated head and current main, then rerun the four focused tests plus the three alias tests three times. I will rerun the same no-build checks and review that exact head.
…tructors after the String destructor
|
@MarcZX10 #11631 still conflicts with
So the PR no longer depends on #11631; the checklist says Head 3fdaafe also merges |
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, changes requested
The implementation and its reported focused tests remain consistent with the earlier review, but this branch still does not include current main, as required by the repository rules.
What I ran
Reviewed head 3fdaafe5c346ba6640cb2afd0045e8139ac50c9e against PR base da026c70655a132031d45e2008c24f993870d801 on Debian 12 x86_64, Python 3.11.2, GCC 12.2.0. Current main is ed1e0ed08fc2452192df91793a33dd0cc7ad5212; the merge preview is clean.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10925
git diff --check da026c70655a132031d45e2008c24f993870d801...3fdaafe5c346ba6640cb2afd0045e8139ac50c9e
git merge-tree --write-tree refs/remotes/upstream/main 3fdaafe5c346ba6640cb2afd0045e8139ac50c9e
gh pr checks 10925 --repo boykopovar/AnyPS5Results
| Check | Result |
|---|---|
| Diff check | Passed. |
| Conventions and PR template | Passed. |
| Current-main merge preview | Clean; preview tree 9b0c08ba14c5101ae02d5e3417b92a547999c852. |
| Dependency status | Checklist says Depends on: none; #11631 no longer overlaps the moved destructor rows. #11221 is stacked on this PR, and #12801/#12808/#13255 declare this PR as a dependency. |
| Hosted CI | Windows, conventions, labels, eligibility, library portability and report passed. Linux and specialized build jobs were skipped by workflow filters. |
| Focused C++ tests and header audit | The author reports all seven np_cpp_web_api tests pass three runs on this head, with the two directly affected tests aborting against main's original Export.cpp; the 374-library/23,571-export header audit passes. I did not run these locally. |
| ABI audit and test-quality heuristic | Not executable in the isolated checkout because the helper scripts are local-only and absent from this PR's tree. |
| Stack checker | Confirms a clean current-main merge preview, but emits a false-positive self-cycle for #10925. |
Selected unedited output
All conventions checks passed.
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10925-3fdaafe5c346/head-3fdaafe5c346-91a89562/tools/pr_abi_audit.py': [Errno 2] No such file or directory
- PR #10925: Declared dependency cycle involving PRs [10925]
Target branch tip: `ed1e0ed08fc2452192df91793a33dd0cc7ad5212`
Dependency order: #10925
PR #10925: clean against current base; head `3fdaafe5c346ba6640cb2afd0045e8139ac50c9e`
9b0c08ba14c5101ae02d5e3417b92a547999c852
Negative control
The author reports that the two directly affected tests abort when run with the baseline Export.cpp from main. I did not independently run that control or build an exact-head binary.
Findings
Blocking
The PR head contains main only through da026c70655a132031d45e2008c24f993870d801, while current main is ed1e0ed08fc2452192df91793a33dd0cc7ad5212. CONTRIBUTING.md requires keeping the branch up to date. The merge preview is clean and intervening main changes do not touch this PR's files, but the branch remains behind. Please merge current main into this branch and rerun the focused tests on the resulting exact head.
Non-blocking
The stack checker reports a self-cycle despite confirming the PR's checklist has no dependency and the merge preview is clean. Its ABI and test-quality helpers are also unavailable in the isolated checkout.
Sources
Not verified
No local build or CTest run; the focused tests and header audit are author-reported. No PS5 title run.
To get this to a good state
Merge current main into the branch and rerun the seven np_cpp_web_api tests plus the header audit on the resulting exact head. I will repeat the no-build checks and review that head before responding again.
|
@MarcZX10 Head b7ec1d9 merges #14122 and #14136 were opened after this PR and change the same lines (the |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
The implementation and reported tests remain consistent with the earlier review, but the open overlap with #14122 and #14136 has no agreed landing order and causes real merge conflicts.
What I ran
Reviewed head b7ec1d9006b704cc84f98391ea566ee92844f68f against base cc26ab44380db3cd7b53715b84f13945227ce28b on Debian 12 x86_64, Python 3.11.2 and GCC 12.2.0. Its preview onto current main (7c4dcf0ad84de7a473ce97bb21644c614f1c3bd3) is clean. The #11221 dependent head 1c163f759c3854e6c8b5c433d8bbbfcc566efd1b includes this head.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10925
git diff --check cc26ab44380db3cd7b53715b84f13945227ce28b...b7ec1d9006b704cc84f98391ea566ee92844f68f
git merge-tree --write-tree upstream/main refs/anyps5/review/10925
git merge-base --is-ancestor refs/anyps5/review/10925 refs/anyps5/review/11221
git merge-tree --write-tree --name-only refs/anyps5/review/10925 refs/anyps5/review/14122
git merge-tree --write-tree --name-only refs/anyps5/review/10925 refs/anyps5/review/14136
gh pr checks 10925 --repo boykopovar/AnyPS5Results
| Check | Result |
|---|---|
| Diff and current-main preview | Passed; preview tree fea8af4f74c18d3141995da878164d239c1b0533. |
| Stack | Passed; #10925 is included in #11221. The local stack helper reports a false-positive self-cycle. |
| Conventions | Hosted check passed. |
| Pairwise overlap previews | Failed with content conflicts against both #14122 and #14136 in Export.cpp, GuestNpCppWebApiIntrusivePtr.cpp, and the debt file. |
| Hosted CI | Windows and labels remain pending; conventions, eligibility, library-portability, and report passed. Linux and specialized jobs were skipped. |
| Focused tests | The author reports all 9 np_cpp_web_api tests pass three runs on this head, with intrusive_ptr and string tests failing against baseline main; I did not run them locally. |
Selected unedited merge-preview output
CONFLICT (content): Merge conflict in core/libs/prx/libSceNpCppWebApi/Export.cpp
CONFLICT (content): Merge conflict in core/libs/tests/GuestNpCppWebApiIntrusivePtr.cpp
CONFLICT (content): Merge conflict in docs/dev/debt/libSceNpCppWebApi.md
CONFLICT (content): Merge conflict in core/libs/prx/libSceNpCppWebApi/Export.cpp
CONFLICT (content): Merge conflict in core/libs/tests/GuestNpCppWebApiIntrusivePtr.cpp
CONFLICT (content): Merge conflict in docs/dev/debt/libSceNpCppWebApi.md
Findings
Blocking
The live overlap previews conflict with #14122 and #14136 in the implementation, intrusive-pointer tests, and debt file. The PR discussion says the landing order is still for the authors to agree, and the checklist remains Depends on: none. The repository requires overlapping PR authors to agree on order and declare dependencies. Please coordinate the order with the authors of #14122 and #14136 and update the relevant Depends on lines before this stack is ready.
Non-blocking
The head is behind current main, but its current-main preview is clean and main has not changed these PR paths since the base; I am not requesting a rebase for age alone. Windows CI was still pending at this snapshot.
Sources
Not verified
No local build or CTest run. Windows checks are pending; no Linux product run or console run. The reported test results are author-provided.
To get this to a good state
Agree with the owners of #14122 and #14136 which PRs land first, record the order in the affected checklists, then rerun the pairwise merge previews and current main preview. I will repeat these checks on the updated heads.
|
@AlexFigas At Could you guard same-object assignment before releasing? The nearby |
…pointer is assigned to itself
|
@oneandonlydean Thanks, you are right: @MarcZX10 On the order with #14122 and #14136: I asked their author to declare |
What
libSceNpCppWebApicounted everyIntrusivePtr<Vector<T>>reference at offset 0x30 in the pointee, and its pointer/deleter constructor did not count the reference it adopts. The module bundled with PPSA21564 (sce_module/libSceNpCppWebApi.prx, the library's own code) puts the count 0x18 bytes past a first member the size of one element. That is 0x20 for 8-byte elements, 0x30 forIntrusivePtrelements and 0x38 forStringelements. EveryIntrusivePtr<Vector<T>>destructor, copy constructor and pointer/deleter constructor the module exports agrees.For
Vector<String>, the module's code does the following (addresses in the relinked module, read from the disassembly):Vector<String>::Vector(LibContext*)(0xabc0) zeroes the 32-bit count at 0x38.IntrusivePtr<Vector<String>>::IntrusivePtr(Vector<String>*, deleter, LibContext*)(0x10fc0) stores the three fields and increments the count at 0x38 when the pointer is not null. The copy constructor (0x11010) increments it too.lock xadd. When the old value was 1, it destroys the object through the deleter.pushBack(0xacf0) keepsbegin, the capacity end andendat 0x20, 0x28 and 0x30.For
IntrusivePtr<Vector<unsigned long>>, the destructor (0xe890, which jumps to 0xe7d0) and the assignment (0xe8a0) use 0x20.PPSA21564's own code creates a
Vector<String>withoperator new(0x48)and the exported constructor (0x2dbece to 0x2dbeec), so the count lives in title memory that only the constructor initializes. Here, the constructor left those bytes alone and the pointer/deleter constructor did not count the adoption. The first release therefore decremented whatever value was there: it either leaked the vector or called the deleter while references remained.Changes:
Vector<String>constructor zeroes the count at 0x38.IntrusivePtr<Vector<String>>pointer/deleter constructor increments the count, and its copy constructor and destructor use 0x38.IntrusivePtr<Vector<unsigned long>>destructor and assignment use 0x20. The assignment goes throughAssignIntrusivePtr, which skips it when both pointers hold the same object, as the module does (cmp qword ptr [rdi], r14; je). Without that, a sole owner assigned to itself ran the deleter and then copied from the cleared pointer, losing the object.Vector<String>test starts from the constructor's 0 and checks adoption, copy, release and a null adoption.Vector<unsigned long>assignment, and the shared assignment test also assigns a sole-owner pointer to itself: the object, count, deleter and context must be unchanged and the deleter must not run.IntrusivePtrandVectordebt entries give the offset for each element type.The
IntrusivePtr<Vector<IntrusivePtr<T>>>functions keep 0x30, which the module confirms. The host-side body thatpushBackcreates is unchanged.Tested
Ubuntu 24.04 (WSL2), GCC 13.3, Release build with
BUILD_TESTING=ON, head b21d67c, which adds the self-assignment guard to b7ec1d9, which mergesmaincc26ab4 into the previous head 743b6e0 (mainf1e340b), and 3fdaafe before it (mainda026c7).mainnow defines the fiveIntrusivePtr<Vector<String>>andIntrusivePtr<Vector<unsigned long>>exports this PR changes in a new block near the end ofExport.cpp, so the merge resolves the conflict by applying this PR's offsets and the adoption count there:libSceNpCppWebApibuilds, with no warnings.ctest -R np_cpp_web_apipasses all 9 tests, 3 runs each:guest_np_cpp_web_api_intrusive_ptr,guest_np_cpp_web_api_string,guest_np_cpp_web_api_signed_outandguest_np_cpp_web_api_offline,main'sguest_np_cpp_web_api_matchmakingandguest_np_cpp_web_api_title_cloud_storage, and the alias testsguest_np_cpp_web_api_alias_append,guest_np_cpp_web_api_alias_string_vectorandguest_np_cpp_web_api_alias_intrusive_vector. WithExport.cppfrommaincc26ab4,guest_np_cpp_web_api_intrusive_ptrandguest_np_cpp_web_api_stringabort.Export.cppfrom b7ec1d9 (the assignment without the guard), the self-assignment case ofguest_np_cpp_web_api_intrusive_ptraborts.python3 core/libs/tests/test_public_headers.py --audit-onlyverifies 394 libraries and 25128 exports.python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch fix/npcppwebapi-vector-reference-countsreports:mainor with this head. It appended destructor rows at the end of the table inGuestNpCppWebApiIntrusivePtr.cpp, where this PR's two rows were, so 65a8e8e moved them next to theStringdestructor; this PR does not depend on it.Stringdebt entry between theIntrusivePtrandVectorentries this PR edits, so the two conflict indocs/dev/debt/libSceNpCppWebApi.md.Export.cppandGuestNpCppWebApiString.cppmerge cleanly, and with fix(libSceNpCppWebApi): match Common::String layout and copy semantics #12801 merged into feat(libSceNpCppWebApi): iterate Vector<String> with begin, end and the Iterator<String> operators #11221's head 3760ab7, which contains this head, the 9np_cpp_web_apitests pass 3 runs each. fix(libSceNpCppWebApi): match Common::String layout and copy semantics #12801 declaresDepends on: #10925.Vectorentry this PR rewrites, so each conflicts with this PR indocs/dev/debt/libSceNpCppWebApi.mdonly. This PR was reviewed first, so both declareDepends on: #10925(feat(libSceNpCppWebApi): bring up the SessionManager friends player sessions family #13255 also on feat(libSceNpCppWebApi): iterate Vector<String> with begin, end and the Iterator<String> operators #11221).StringVectorReferenceCountOffsetconstant next toVectorReferenceCountOffset, theIntrusivePtr<Vector<String>>release inExport.cpp, and rows ofGuestNpCppWebApiIntrusivePtr.cppand the debt file. Neither merges with this head without a conflict, though both merge withmain. This PR was opened and reviewed first; they declareDepends on: noneand#14122, #12447, so I have not added a dependency here and leave the order to be agreed there.main. It has no review yet and this PR does not wait for it.main()keep feat(libSceNpCppWebApi): cover the UserProfile models and remaining Common instantiations #9015's rows and calls next to this PR's.No title run.
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)