feat(libSceNKWebKit): implement WTF time, MediaTime and ASCIILiteral dump #21957
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21957"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-11-16T23:04:38Z.
What
Implements six libSceNKWebKit WTF
dump(PrintStream&)exports that wereNotImplemented_nid_no_patchstubs:Seconds::dump,WallTime::dump,MonotonicTime::dump,TimeWithDynamicClockType::dump,MediaTime::dumpandASCIILiteral::dump.Source is a mirror of Sony's PS5 WebKit 11.x source release, neonmodder123/PS5-WebKit-11.x@80f77e94, the same tree #19828 cites: Seconds.cpp L80-L83 (
m_value, " sec"), WallTime.cpp L41-L44, MonotonicTime.cpp L41-L44, TimeWithDynamicClockType.cpp L131-L134 with theWall/Monotonic/Approximatenames of ClockType.cpp L33-L47, MediaTime.cpp L539-L545 and text/ASCIILiteral.cpp L33-L36.Each
out.print(...)follows PrintStream.h:begin()on the stream,printInternalon the streambegin()returned for each value, thenend()on the original stream.printInternalforconst char*,double,longandunsignedpasses%s,%lf,%ldand%uto the guest stream'svprintfwith a SysVva_list(asVaList*, the waysceFiosPrintfandsceAvPlayerPrintfforward theirs), as PrintStream.cpp does; formatting stays the stream's job.printInternal(ClockType)nests its ownprint, as upstream does. The guest vtable slots (vprintf2,begin4,end5) come from the declaration order in PrintStream.h.MediaTime::toDoubleis the existing export in Media.cpp.The dumps call the vtable slots directly through a private helper instead of the
printInternalexports, so building and testing this PR does not need #19839 (PrintStream::printfandprintInternalfor scalars, C strings,CStringandRawPointer, anddumpCharacter) or #19841 (printInternalfor the remaining integer widths, float andClockType, stacked on #19839); once those merge the helper can be replaced by their exports in a follow-up. At run time there is one dependency:end()is a virtual call, so a guest stream that keeps the baseWTF::PrintStream::endreaches main's_ZN3WTF11PrintStream3endEvstub (libSceNKWebKit/Export.cppline 14277) and throwsnot implementedafter the values have been printed. #19380 (WTFStackBounds,TimingScope::scopeDidEndandPrintStream::end) givesendWebKit's empty body; until it merges, these dumps complete only on streams that overrideend(). An unknownClockTypethrows (WebKitRELEASE_ASSERT_NOT_REACHED), and nullthisor stream pointers throw where WebKit faults. The debt fragment removes the six rows, adds an entry for the unmeasured slots and layouts, and narrows the Media stubs entry toPlatformTimeRanges::dump.Tested
macOS 27 (Apple Silicon, x86_64 build under Rosetta, Release, Ninja). Merged onto main
2e48261498aand rebuilt; the four focused tests pass again there. New testnkwebkit_wtftimedump(core/libs/prx/libSceNKWebKit/tests/WtfTimeDump.cpp) drives every dump through a recording guestPrintStreamwhosebeginreturns a second stream and whosevprintfformats with the guestvsnprintf: exact begin/vprintf/end sequences for all six dumps, all three clock types, rational, double, infinite and large negativeMediaTimevalues, an unknownClockTypethrowing beforebegin, and nullthis/stream pointers throwing. Control: the same test with main's stub bodies throwsnot implementedon the first dump (exit 134).public_headersand its 64 compile tests,nkwebkit_mediatime,nkwebkit_argumentreturnandnkwebkit_wtfalso pass (69/69). On that main,libressl_cryptodoes not build on macOS (libressl/strlcat.candstrlcpy.cfrom #17961 collide with the_FORTIFY_SOURCEmacros in the macOSstring.h), so for this run those two files had a local#undefthat is not part of this PR.python3 tools/check_conventions.py --base origin/mainandpython3 tools/debt_fold.py --checkpass apart from the existing failure in main'sdocs-nkwebkit-drop-readded-count-lines.mdfragment.tools/progress.py --module libSceNKWebKit: libSceNKWebKit 3240/11268 (28.75%) onmain2e48261498, 3246/11268 (28.81%) after, the six dumps moving from todo to implemented. Windows:src/WtfTimeDump.cppcompiled alone on Windows 11 with winlibs GCC 15.2.0 (the CI toolchain), using the libSceNKWebKit compile line from a Windows build tree (-O3 -DNDEBUG -std=gnu++20 -fno-asynchronous-unwind-tables -include HostStandardStreams.hpp), and again at-O0and-O2: the object builds; the library and tests were not linked or run on Windows. The MSYS2 UCRT64 GCC 16 nightly toolchain was not tried.tools/pr_overlap.py --branchreports no open pull request changing the same lines, exports or new files.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)end()(see What)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T23:19:32Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
523d4550d0:tools/check_conventions.pypassed.nkwebkit_wtftimedump_testsbuilt cleanly.nkwebkit_wtftimedump):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/WtfTimeDump.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T05:21:45Z.
Review: COMMENTED
Reviewed — comments
The reviewed changes implement six dump exports with tests, but their direct guest vtable calls and time layouts are explicitly unmeasured on console, so approval is not justified from the available evidence.
What I ran
Reviewed head
bea07ca55a15904592197c3d00e7ae5124da3904. I read the prepared description, commits, diff, manifest, all changed files included in the review folder, and targeted repository context throughrepo_read.py. No commands or tests were run by me; test results below are author-reported.Results
Findings
Blocking
None.
Non-blocking
WtfTimeDump.cpp:247-265calls the guestvprintfslot with an assumedVaList*representation, andWtfDumpStreamAbi.hpp:11-14hard-codes the vtable slots. These assumptions are disclosed in the debt entry, but have not been confirmed against a console stream. A console-level check would provide evidence for the runtime ABI claims.Not verified
PrintStreamvtable and time layouts are not verified, as the debt entry also records.Export.cppandInventoryExports.hppwere read through the pinned reader because the prepared bundle excluded their full text for size; other changed files were included in the bundle and read. No changed files were excluded from review.To get this to a good state
Nothing is required. Optional: verify the guest stream ABI on console and update the debt note with the observed result.