Repository navigation
feat(libc): implement __std_free_crt as free - #13828
Conversation
__std_free_crt forwards to free, as Microsoft STL defines it next to __std_calloc_crt, so a title that imports the pair resolves both.
|
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.
Reviewed — changes requested
The implementation and reported tests look sound, but an open PR overlap creates a real debt-file conflict and its landing order is not recorded.
What I ran
Reviewed head 87b2b8895c5ee30ebafd7f141d254602a08b1225 against PR base e8c25dd3baa6e78531d5eee067fec5cbe8af3dcf. I also checked a merge preview against current main 45e39c7ad16c93871809eee8c81c3865596e883f; it merged cleanly. Environment: Debian 12 Linux, Python 3.11.2, GCC 12.2.0. I did not build the project or run C++ tests locally.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13828 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13828
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e8c25dd3baa6e78531d5eee067fec5cbe8af3dcf --head 87b2b8895c5ee30ebafd7f141d254602a08b1225 --json
python3 /marc/AnyPS5/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13828/head-87b2b8895c5e-c8e3bdfc --json core/libs/tests/ApplicationHeap.cpp
python3 tools/pr_stack_check.py 13828 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13828/stack
python3 tools/pr_overlap.py --branch 87b2b8895c5ee30ebafd7f141d254602a08b1225
git merge-tree 87b2b8895c5ee30ebafd7f141d254602a08b1225 6ac7ce9e401899294b07fd56eea0ec72a6fb0980
git merge-tree 87b2b8895c5ee30ebafd7f141d254602a08b1225 e52854d1b6ecef00ae86bf9b86c90333000dbadf
git merge-tree 87b2b8895c5ee30ebafd7f141d254602a08b1225 c272bbe1b3d1fa9cdd9e56d7e9c56d01ef04df15Results
| Check | Result |
|---|---|
| Diff and conventions | Passed. |
| Current-main merge preview | Passed against 45e39c7ad16c93871809eee8c81c3865596e883f. |
| Export ABI audit | Passed with 3 unrelated existing explicit-alias warnings; no finding for __std_free_crt. The precheck’s isolated copy lacked the local-only audit helper, so I ran the audit directly against the exact base and head. |
| Test-quality check | Heuristic flagged possible test-registration trouble; source inspection confirms ApplicationHeap.cpp is built into application_heap_tests and the scripting test is registered. |
| PR overlap | The current overlap report identifies open #9677 in docs/dev/debt/libc.md at current-main line 68. Pairwise merge preview with #9677 reports a content conflict in that file. Pairwise previews with #12184 and #11848 are clean. |
| Hosted CI at final refresh | Windows, Ubuntu and Windows relinker, ASan, Ubuntu register-context, conventions, intake, eligibility, labels, report, and library-portability passed. Linux product tests were skipped. macOS relinker, register-context and write-watch jobs were queued. |
Unedited check output
Precheck command output:
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13828/report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13828/report.json
Conclusion: checks failed
The precheck’s conventions output:
All conventions checks passed.
Direct ABI-audit summary:
status: passed_with_warnings
findings: 3
target findings: []
Test-quality output:
{
"findings": [
{
"path": "core/libs/tests/ApplicationHeap.cpp",
"line": 1,
"kind": "possible-unregistered-cpp-test",
"message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
}
],
"negative_control_candidates": [],
"limits": [
"Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
"A test that passes against base is not by itself proof that the PR test is inadequate.",
"Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
]
}Relevant overlap-report row:
| [PR 9677](https://www.github.com/boykopovar/AnyPS5/pull/9677) | `docs/dev/debt/libc.md` [L68](https://github.com/boykopovar/AnyPS5/blob/45e39c7ad16c93871809eee8c81c3865596e883f/docs/dev/debt/libc.md#L68) | | |
Pairwise merge output with #9677:
9a8378c1e68c49c4cb99af789d4095288
100644 568e1931c1abf7cdfc763a4e8d7e8c0c5cebefb6 1 docs/dev/debt/libc.md
100644 e463077515d88ae6063cace01c374095eee7260c 2 docs/dev/debt/libc.md
100644 90228bbb4bdc6574e8e1aff000bde82daa0c8854 3 docs/dev/debt/libc.md
Auto-merging core/libs/prx/libc/src/Time.cpp
Auto-merging core/libs/prx/libkernel/Time/Time.cpp
Auto-merging core/libs/tests/GuestProcessTime.cpp
Auto-merging docs/dev/debt/libc.md
CONFLICT (content): Merge conflict in docs/dev/debt/libc.md
EXIT:1
Current hosted check snapshot:
linux completed skipped
register-context (macos-15-intel, Release) queued
relinker (macos-latest, clang++, x86_64) queued
relinker (macos-latest, clang++) queued
relinker-asan completed success
relinker (ubuntu-latest, g++) completed success
windows completed success
write-watch (macos-15) queued
register-context (ubuntu-latest, Release) completed success
write-watch (macos-15-intel) queued
relinker (windows-latest, g++) completed success
register-context (ubuntu-latest, Debug) completed success
labels completed success
conventions completed success
intake completed success
eligibility completed success
report completed success
library-portability completed success
Findings
Blocking
- Unresolved landing order with #9677. The live overlap report identifies a shared edit in
docs/dev/debt/libc.md, and a pairwise merge preview of these exact heads confirms a content conflict. The repository requires agreeing with the other PR author on which lands first and recording that order withDepends on; this PR still saysDepends on: none, and no agreement with #9677’s author is recorded. Please coordinate the order and update the relevant checklist entry or entries, then recheck the pairwise merge.
Non-blocking
- The scripting test currently allocates with
malloc_nid_postfixbefore calling__std_free_crt. A direct__std_calloc_crtto__std_free_crtcase would exercise the exact allocation/free pair motivating this PR; the existing callback test still gives useful evidence for the shared heap path.
Sources
- Current contribution rule for overlap order.
- The overlapping #9677 debt edit at its reviewed head.
- The new export implementation and its current test.
- Test registration on current main.
- Microsoft STL wrapper source pinned by the PR.
Not verified
- No local build, C++ tests or negative control. The PR description reports exact-head builds and focused CTest runs on WSL2 and Windows, but those runs were not independently reproduced here.
- No console measurement. macOS CI jobs were still queued; Linux product tests were skipped.
To get this to a good state
Please agree and record the landing order with #9677’s author. I will rerun the overlap and merge checks, then reassess the new exact head.
… and boykopovar#12560 The entry now sits next to the application heap entries, where no open pull request changes the file.
c5e9d6e to
498a8da
Compare
|
@MarcZX10 Thanks. Instead of ordering it against #9677, I moved the debt entry in 498a8da to sit with the application heap entries. The spot at the end of the section collided with #12560, so I checked every entry boundary against all open pull requests that change |
|
@MarcZX10 could you take another look when you have a moment? Your Oct 31 review asked for the landing order against #9677. I moved the debt entry instead in The two red checks are AI-assisted: yes (Claude Code) |
|
Checked the signature and forwarding against Microsoft STL, the NID against ps5rs, the test (calls the new declaration, covers the null case) and the debt entry placement; Windows and Conventions green; merged. |
What
libc gains
__std_free_crt(NIDy-r+TFZgeUU), which forwards tofree. Microsoft STL defines it asvoid __std_free_crt(void* p) noexcept { _free_crt(p); }, right after__std_calloc_crt, whose memory it releases. The name and NID are in ps5rs's libc list, as__std_calloc_crt's are.@oneandonlydean noted on #12184 that this pair member isn't on
main, so a title importing both would still have an unresolved import. #12184 adds__std_calloc_crt; this adds the other half on its own. It sits just beforefreeinFileAndHeap.cppandApi.hpp, so it merges cleanly with both #12184 (aftercalloc) and #11848 (afterfree). Its debt entry sits next to the application heap entries, where no open pull request changes the file, so it also merges cleanly with #9677 and #12560. I checked all four withgit merge-tree. The debt entry says that whether the console's wrapper frees through the application allocator, asfreedoes, isn't measured. libc goes from 1480 of 1496 to 1481 of 1497.ApplicationHeap.cpp'sscriptingmode now also checks that__std_free_crton a block frommallocreaches the application heap's free callback, and that a null pointer doesn't. The test calls the new declaration, so it doesn't build onmain.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both with the head 87b2b88 merged into
maine8c25dd.FileAndHeap.cpp,Api.hpporApplicationHeap.cpp.ctest -R ^application_heap: 12 of 12 pass on WSL2 and 10 of 10 on Windows (theguest_sdkmodes are Linux-only).application_heap_scriptingpasses 3 of 3 on--repeat until-fail:3.ctest -R public_headers: 65 of 65 pass on both hosts with the new declaration.libc.prxexportsy-r+TFZgeUUat the same address as__std_free_crt_nid_postfixin the unpatched one.mainto compare;main'sapplication_heap_scriptingpasses as before.tools/check_conventions.pypasses.tools/pr_overlap.pyfinds no conflict with mergeable pull requests, andgit merge-treemerges this cleanly with feat(libc): implement __std_calloc_crt allocation wrapper #12184, feat(libc): implement freezero #11848, fix(libc): count clock() as the process time, like the console #9677 and fix(libkernel): preserve DOS device names and trailing dots or spaces on Windows #12560.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)