feat(libSceIcu): implement UTF-16 scalar counting and search #10966
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10966"
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 AZLisme on 2026-10-25T11:22:27Z.
What
New preserving rebase:
491e27444d83b53bc215a94edf132aee6a4707d7is based on frozen main6e9b9134f6ed14e659d870a33118d164096551df, which contains the actual #11760 merge1dcfe038754ae612ac90cd8ee954deffec1938c4. All 112 inheritedsceIcuUnknown_*_nid_no_patchexports continue to throw, and their unverified-prototype debt is retained. The complete upstream ICU implementations, declarations, test registrations and debt are preserved; conflict resolution adds this topic’s debt without replacing the upstream entries. Owned UTF-16 scalar counting and search implementation, declaration and fixture bytes are unchanged from previously publishedee4219de0df53ea2470cd7296955c365c62b4ff6. This branch carries only its own topic over main. The actual predecessor #10965 remains required; retain #10961→#10962→#10963→#10964→#10965→#10966→#10967→#11088.Earlier preserving rebase:
ee4219de0df53ea2470cd7296955c365c62b4ff6on frozen mainaebeaa53f54dd4eccfe313f147807e3434588404includes the actual #10961 merge2ab073a1e7889d009edaabd84ab8cb10ce829156and the earlier merged #11013 helpers. All owned implementation, declaration and fixture bytes are unchanged from published26b0bb142da26cc65d30d55793a8d7ab56f566e9. Shared CMake and umbrella files retain both the inherited unescape source/test/header and this topic; debt retains the exact main entries plus this topic’s existing additions. The immediate predecessor #10965 remains pending; retain #10961→#10962→#10963→#10964→#10965→#10966→#10967→#11088.Earlier preserving rebase
26b0bb142da26cc65d30d55793a8d7ab56f566e9is based on the common approved main6733079b2d01bb25aa1e6e771680da6a17363e3b, after #11013 actually merged asbd1b31548c4f8a21de87b3856b881083ca80492a. The complete parent invariant/version implementations, canonical headers,guest_icu_versionsource/registration and debt entry are retained. The scalar implementation, five declarations and completeguest_icu_utf16fixture are byte-identical to the published691a5dc13094source. Only CMake, umbrella-header and debt integration required conflict resolution; both original commits remain. The immediate predecessor remains #10965 and the agreed ICU landing order is unchanged.Implement the missing
u_countChar32,u_strHasMoreChar32Than,u_strchr32,u_strrchr32andu_memchr32UTF-16 scalar APIs. Preserve paired and isolated surrogate behavior, bounded embedded NULs, truncated pairs, scalar boundaries, invalid scalar rejection and source-defined null/no-read paths. Export declarations live once inApi.hpp, reachable fromlibSceIcu.hpp; implementation and tests include the canonical interface.Behavior and types follow pinned ICU 78.1 ustring.h, ustring.cpp and umachine.h. Names/NIDs are in the PS5 3.20 inventory. ABI equivalence on console hardware, firmware availability/routing and undefined input contracts remain documented debt. No new third-party dependency.
Merge order follows #10965: these topics change the same library CMake, canonical-header and debt integration files. I own both branches and will rebase this one after its predecessor merges, preserving both implementations.
BunnyFl’s firmware 13.42 report records
u_getVersionreturning78.1.0.0withsystem_ex/common_ex/lib/libSceIcu.sprxexecuted under an emulator.u_countChar32matched this implementation in 94,111 bounded cases covering null text, lengths -2/-1 and explicit limits, NULs and surrogate boundaries, with text placed at mapping boundaries. The other four APIs (u_strHasMoreChar32Than,u_strchr32,u_strrchr32,u_memchr32) are absent from that native module’s exports. They remain available here for compatibility with the older 3.20 inventory. The report does not establish execution on console hardware or general availability/routing across firmware versions.Tested
2026-11-01 Windows CI: run 41295118343,
6ee2b5b100aa46aaa68eaf2459f363e5e1a3e996+ main26fa1212b82f76dd49cf12d65e445d6ff3e0844c: 1,679 selected CTests passed, 904 skipped, zero failed. All 9 ICU cases passed, includingguest_icu_utf16. The production ICU module built, linked and was NID-patched. This is the fixed single-PR integration, not the six-topic Windows union. General full-suite, skip-audit and header CTests were not run; native ABI/context/unload, existing dependencies, CI and review gates remain.2026-11-01: preserving rebase
6ee2b5b100aa46aaa68eaf2459f363e5e1a3e996onto fixed main26fa1212b82f76dd49cf12d65e445d6ff3e0844c. Linux GCC 16.2.1 Release: baseline 61 plain + 4 logging-enabled runtime CTests; private SIG-plus-six-ICU union4908848dab02fb1f0a9fad7e9525ddb8a628177a71 + 6. All passed, with 65 public-header tests per side. Relevant:guest_icu_utf16. Scope is this fixed baseline/private composition; bare heads, later main, Windows, native ABI and unloading remain unqualified. Earlier results retain their original scope.2026-10-30 fresh Linux integration check on fixed main
0362b1521c4ee08eeeccc2f98e9987e36fca9ea1: a separate private candidate8a5c8c499f0e0a157bd110430c1d99ee73bb0d47(tree620649fa8b0512d9c7e114c670342a691fd1433a) combines #10953 at581d45c282371af828efec2a8cec6f43beacc68awith the same six unchanged published ICU heads recorded in the earlier converter-callback integration update. No public branch was rebased by this check.Fresh native Linux x86-64 Release builds passed 53/53 selected plain runtime CTests on that main baseline and 63/63 on the private candidate. With
ANYPS5_LOG_FILEset before process startup, another 4/4 baseline and 6/6 candidate runtime executions passed. Together these are 126 runtime CTest executions; both lanes also passed 65/65 public-header checks, 130 header executions total, with zero failed, skipped or Not Run rows. The candidate ran all 13 registered ICU fixtures, including both guest-memory protection fixtures; converter callbacks ran in both lanes. The selected integration set also exercises logging, heap/allocator, signal, exception and thread behavior.Production NID patching and
readelf/nminspection found the baseline’s four converter-callback NIDs and all 39 targeted candidate NIDs; this is artifact evidence, not patched-loader functional coverage. Twelve separately observed controlledstd::abortchild runs returned the expected exit 3; they are not additional CTests or proof of native signal-context behavior. Source and dependency identities were checked before and after execution.These results apply only to the fixed baseline and private SIG-plus-six-ICU candidate. They add no bare-public-head, later-main, Windows, native-ABI, full-suite, GPU or unload qualification. Earlier results keep their original inputs and scope. The existing predecessor, preserving-rebase, maintainer CI and review requirements and agreed ICU landing order still apply.
2026-10-30 converter-callback integration update: #12692 actually merged as
91a69952c100(topic207ac4b5ecfe). Against pinned main08a10d225306ad102b57408e2ef7566bcfb829b2, all six published ICU heads remain independently clean to integrate; this source review found no duplicate implementation, new dependency or individually required rebase. A separate private all-six union,6e174798251592474dd94c61975655b409b9c2e9(tree446a6e346d3c6fac2e19e358d4376376778c7ae9), preserves 35 owned helpers, the four landed converter callbacks and 13 source-registered ICU fixtures through routine shared-file resolutions; the 98 unknown stubs remain unchanged.Exact published inputs: #10962
bbccec1140eeccb5adf61f7c497791b183c1bf93, #1096328cc96f3be1e16d2e3f098b0ae5b77b4fea85e09, #109644360e8f85b0bbd184199d9a3822dc30a8bd5f81e, #10965c2076fe30ee3442546af395930defd74b7bfac2a, #10966491e27444d83b53bc215a94edf132aee6a4707d7, #10967babf2bc72012bd926f35408b3d602d162a5ecd1b.Fresh native Linux x86-64 Release, GCC 16.2.1: the pinned08a main baseline passed 18/18 selected runtime cases and 65/65 public-header checks; the exact private all-six union passed 26/26 runtime cases and 65/65 headers, with zero failures, skips or Not Run rows. The union executed all 13 ICU fixtures, including
guest_icu_copy_guest_memoryandguest_icu_utf_memory, alongside 13 heap/allocator cases; the converter-callback fixture passed in both lanes. Production NID patching plusreadelf/nminspection verified the four callback NIDs in the baseline and all 39 targeted NIDs in the union (35 owned helpers plus four callbacks). This last check is artifact inspection, not patched-module loader runtime or native-ABI proof.These results cover only that fixed baseline and private all-six union, not any bare published head, later main, Windows/native ABI, all-nine integration, full suite, title or GPU behavior. Earlier main750 and other historical results retain their original inputs and scope. The declared order remains #10962, #10963, #10964, #10965, #10966, #10967, then #11088; the already merged #12692 adds no new prerequisite. Actual #10965 merge must come first, followed by a preserving rebase, fresh integration checks and re-review before this PR lands.
Current exact-head validation:
491e27444d83b53bc215a94edf132aee6a4707d7on frozen main6e9b9134f6ed14e659d870a33118d164096551df: Linux x86-64, normal-root Release,BUILD_TESTING=ON.guest_icu_version,guest_icu_unescape,guest_icu_utf16passed 3/3; all 65/65 normal public-header CTests passed, with no failed or skipped CTest cases. The complete ICU provider and registered fixtures were built for this standalone branch. The common core was freshly built from this main once; this lane retained 190 objects only after matching their exact compiler commands, complete observed input hashes and object digests, and rebuilt or added 7 objects. Source identity before/after testing and the actual fixture/provider paths were verified. Conventions, whitespace and source-preservation checks pass.These results cover this standalone Linux component/header build. New-head native Windows, macOS, PS5, sanitizer and full-product CI remain untested here; historical platform and private-composition evidence retains its recorded source scope. The declared predecessor and agreed ICU landing order remain required.
All results below are historical and retain their stated head, base, platform and provenance. Earlier uses of “current”, “fresh”, “now” or “this rebased head” within those retained source-bound entries refer to the named historical revision. They supply no new-head Windows, macOS, physical-PS5, sanitizer, full-product or private-composition runtime credit. Existing actual-predecessor, integration, review and applicable full-CI gates remain.
Earlier exact-head validation:
ee4219de0df53ea2470cd7296955c365c62b4ff6on frozen mainaebeaa53f54dd4eccfe313f147807e3434588404: Linux x86-64, Release,BUILD_TESTING=ON. Fresh normal-root CMake builds compiled 196 objects for this independent provider’s core, complete ICU module and fixtures, with compiler caching disabled and no copied prior core/module/test binaries. Registeredguest_icu_version,guest_icu_unescape,guest_icu_utf16passed 3/3, and all 65/65 actual public-header CTests passed, with zero skips or failures. The declaration audit reports 368 libraries and 12,814 exports. Provider linkage resolves the ICU/libc/kernel PRXs from this fresh build. Existing pinned dependency source materializations and the source-built FFmpeg configuration package were verified separately; they supply no old ICU/core/test runtime results.Conventions against
origin/mainat that frozen base, whitespace and exact source-preservation checks pass. These are independent Linux component/header results, with no new native Windows, macOS, PS5, sanitizer, full-product or later-main execution claim. Earlier source/platform/CI/firmware/private-composition entries below retain their original named scopes. The declared predecessor and agreed ICU landing order remain required.Contributor Windows report: BunnyFl reports exact head
26b0bb142da26cc65d30d55793a8d7ab56f566e9merged with main74acfad65b3f0fd4eab653f3a3989d298fba1157, on Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release,BUILD_TESTING=ON.guest_icu_utf16passed all threectest -Vruns. No main-only control was run because the test calls functions introduced here. The report covers this test and composition; #10965 remains the declared predecessor, with the agreed landing, integration and review gates retained.Earlier source-only rebase
26b0bb142da26cc65d30d55793a8d7ab56f566e9: exact parent/owned-source preservation, conventions, whitespace and the Python public-header audit are checked. Parent source/header/test files are byte-identical to the approved base. The full parent CMake file is retained before adding the owned source/test block; the complete parent umbrella and debt text are retained before the owned additions. All three owned debt rows, including the firmware 13.42 evidence and its limitations, are preserved verbatim.Earlier fresh exact-head validation for
26b0bb142da26cc65d30d55793a8d7ab56f566e9on frozen base6733079b2d01bb25aa1e6e771680da6a17363e3b: Linux x86-64, GNU 16.2.1, Release,BUILD_TESTING=ON. The complete ICU module and every registered fixture were freshly built through the actual library CMake and original root helper bodies.guest_icu_version,guest_icu_utf16passed 2/2, with zero failures or skips; this includes the inherited #11013 version test and every owned topic fixture. All five C++ header units passed, covering standalone/repeated inclusion, the umbrella and composition with libc/kernel. The passing declaration audit is reused from the source owner’s exact-head receipt; C++ header compilation is fresh.The common libc/kernel runtime was freshly built once from that approved base and reused for this independent provider only after all 258 actual core project inputs, normal CMake/helper bodies, copied artifact hashes and provider paths were qualified against this head. Pinned source-built ZArchive/zstd archives were reused after source/hash/pin checks. This validates this independent ICU provider; it is not a seven-topic composite or a fresh core rebuild per branch.
Earlier validation is Linux component evidence. No new native Windows, macOS, PS5, sanitizer, full-product or GPU result is claimed; Windows-only HostWrite-refusal paths were not executed by this Linux lane. Earlier platform, maintainer CI, firmware and private-integration evidence below retains its original head/base scope and does not qualify this rebased head.
Historical evidence through published
691a5dc13094follows. Its documentation-only equality and reuse statements refer to that earlier revision, not to this new preserving rebase.Documentation follow-up
691a5dc13094cb10393793d7aa9966483f8f334arecords the firmware evidence only. The completecore/libstree (production code, public headers, CMake and tests) is byte-identical to published14a8192e3385026cf392c93490915d1e7214b5c4. Conventions and whitespace checks passed for the new documentation head. Existing runtime and header results below are reused from unchanged executable sources; no build, runtime rerun or header compilation was needed for this documentation change.Linux x86-64, GCC 16.2.1, Release, BUILD_TESTING=ON, based on
63a863d3b07f2457ee1210f1abba1c11409cdff5. The complete changed library builds through its normal CMake in an isolated runtime harness linked to libc/libkernel freshly rebuilt from that base.guest_icu_utf16passes 1/1 (0.02 s), covering 9,331 short UTF-16 patterns plus embedded NUL, surrogate, truncation, threshold, invalid-scalar, null/no-read and source-preservation cases.The global
public_headersaudit passes for 368 libraries and 12,193 exports. Both changed public headers compile standalone and through duplicate inclusion with-Werror. Conventions andgit diff --checkpass. The historical publication-time overlap command reported no overlap; later shared ICU CMake, umbrella and debt edits still require the recorded integration reconciliation.Prior implementation validation also passed 4,438,433 independent ICU 78.3 differential checks, including every 16-bit unit and all 2,048 surrogate scalar values with null sources; the rebase changes interface declarations, not that behavior. This is focused runtime validation; a monolithic repository build and Windows, macOS and PS5 execution were not performed.
The existing local eight-topic ICU integration on base
3a2c51afd2, commit80c95cdb32e1fed5d7cfeb7fb7f26307db2f9c6c, includes current #10965 alias fix58c283d6890d6faaeeb1ec5bd5fd17908ee1093b. It passed 10/10 runtime tests, preserved all 42 public exports and passed 11 header composition units including all 368 public umbrellas. That runtime/header evidence is reused for this unchanged executable tree; this documentation commit does not rerun it. The agreed landing order is #11013 first, followed by #10961–#10967; this PR retains its immediate predecessor in Depends on.Archived integration on base
63a863d3, before the current guest-write review fixes, combined all 15 queued ICU topics: 117 exports were preserved, 21/21 runtime tests passed, and 14 header composition units passed, including all 368 library umbrellas in one translation unit. That 21/21 result applies to the archived integration snapshot; it has not been rerun for the current revised branch heads.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T12:05:14Z.
Review: APPROVED
Reviewed exact head
14a8192e3385026cf392c93490915d1e7214b5c4. The UTF-16 scalar iteration correctly combines only valid lead/trail pairs, leaves isolated surrogates as individual values, observes bounded lengths without reading past the span, and treats the terminator correctly for NUL-terminated searches. Theu_strHasMoreChar32Thanfast bounds are safe (a UTF-16 span of N units contains between ceil(N/2) and N scalars), with the remaining scan handling exact thresholds. The tests exhaustively enumerate short strings across NUL and surrogate classes and check bounded/NUL-terminated behavior, invalid scalars, null shortcuts, and source preservation. The ICU build/header/debt integration is scoped to this PR and the author records its ordered integration with #10965. Localgit diff --checkandpython3 tools/check_conventions.py --base upstream/main --head refs/review/10966passed. Hosted eligibility, intake, conventions, labels, and report pass; hosted product jobs were skipped. I have not independently rerun the author-reported Linux runtime suite or ICU differential run, and Windows, macOS, and console behavior remain unverified.