feat(libSceJsc): implement JSString ownership and conversion #10950

Merged
AZLisme merged 1 commit from upstream-pr/10950 into main 2026-10-27 08:16:01 +00:00
AZLisme commented 2026-10-25 11:20:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-10-25T11:20:11Z.


What

Implement the ten confirmed JavaScriptCore JSString exports: UTF-8/UTF-16 creation, retain/release, length/backing access, UTF-8 sizing/conversion and equality. Previously the library had no implementations for these functions. Strings own a copied UTF-16 buffer; bounded output preserves whole codepoints and null-string behavior.

Contract: WebKit revision f274ef4c03ebace644c46f8ec55746b391acdcc8, JSStringRef.cpp, OpaqueJSString.cpp and UTF8Conversion.cpp. Console version, allocation limits and foreign opaque-object interoperability remain unverified and are recorded in debt. No copied third-party implementation or new dependency.

Tested

Manual CI 40445885976, attempt 1, completed successfully for the ordered five-PR composition #11472 6e97111223 → #10975 78cb208c0c → #11269 4ccb760d12 → #10950 5746326efc → #10961 844e39236f, on frozen main 09f9a63f6b85aec9f36ce5d0d46f41c37cbd86fd. This PR’s tested head is 5746326efc33bc56c24b1a7e1192186a783eda83.

Release library job Passed Policy-approved skips Failed
Linux 121997011318 2,364 95 0
Windows 121997011314 1,745 825 0

Both jobs passed guest_jsc_string, guest_icu_unescape, guest_icu_version, all 65 public-header CTests and patched_libraries; both skip validators passed. This qualifies the recorded five-PR Linux/Windows Release composition, not either PR alone or later main. Ancillary macOS/relinker-ASan jobs do not establish macOS-library, library-ASan or native-console coverage. Earlier entries below retain their original heads, compositions, outcomes and historical status.

Maintainer CI 40382857757/a1 has mixed results; the full run failed on Linux. Exact composition: base 6b16c9c6499a, then #10961@844e39236f0e → #10953@8b4bb4d239ad → #11235@3e333ce0fc5d → #11337@d84c522f4bda → #10950@5746326efc33.

Windows job 121783493660 passed its normal Release build/library targets and suite: 1,692 passed, 815 validated expected skips, zero failed / 2,507. Linux job 121783493789 built successfully but reported 2,306 passed, 93 observed skips, two failed / 2,401: guest_sigvec_modules and guest_posix_spawn. Its skip validator was skipped; those 93 skips are not policy-qualified.

On both platforms, guest_jsc_string and all 65 header cases (public_headers plus 64 compilation batches) passed. This qualifies only the exact five-input composition, not an isolated head, newer main, other ICU follower heads, console equivalence or an overall green run. No source changes or dependency waivers result from this evidence. Existing prerequisite and review gates remain. Earlier entries below retain their historical source/base scopes.

Linux x86-64, GCC 16.2.1, Release, BUILD_TESTING=ON. Rebased onto main 63a863d3b07f after #10005 merged. Rebuilt the complete changed PRX and focused test executables against freshly rebuilt libc/libkernel runtime dependencies from the same frozen base; tests pass 1/1.

Every nonzero Unicode scalar against an independent standard-library conversion; malformed UTF-8, embedded NUL, UTF-16 surrogate boundaries, bounded output/canaries, copied ownership, concurrent reference counts and oversized-count rejection before reads.

The whole-tree public_headers --audit-only check passes. The canonical public API and umbrella headers compile standalone and twice-included with -Werror; cpp/test prototypes and ABI types use those headers. python3 tools/check_conventions.py --base origin/main and git diff --check pass.

Contributor wachi35676 reports Windows Release validation of head 5746326efc33bc56c24b1a7e1192186a783eda83 merged onto main 90f918fa7, using WinLibs GCC 15.2.0: guest_jsc_string passed twice. The reported scope includes the every-scalar standard-library conversion comparison, malformed UTF-8, surrogate boundaries, bounded-output canaries and concurrent reference counts.

This is focused runtime validation. A monolithic repository build and local Windows/macOS/PS5 execution were not performed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

The current overlap report finds no overlap with open PRs.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004240405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10950). Originally posted by [AZLisme](https://github.com/AZLisme) on 2026-10-25T11:20:11Z. --- ### What Implement the ten confirmed JavaScriptCore JSString exports: UTF-8/UTF-16 creation, retain/release, length/backing access, UTF-8 sizing/conversion and equality. Previously the library had no implementations for these functions. Strings own a copied UTF-16 buffer; bounded output preserves whole codepoints and null-string behavior. Contract: WebKit revision f274ef4c03ebace644c46f8ec55746b391acdcc8, [JSStringRef.cpp](https://github.com/WebKit/WebKit/blob/f274ef4c03ebace644c46f8ec55746b391acdcc8/Source/JavaScriptCore/API/JSStringRef.cpp), [OpaqueJSString.cpp](https://github.com/WebKit/WebKit/blob/f274ef4c03ebace644c46f8ec55746b391acdcc8/Source/JavaScriptCore/API/OpaqueJSString.cpp) and [UTF8Conversion.cpp](https://github.com/WebKit/WebKit/blob/f274ef4c03ebace644c46f8ec55746b391acdcc8/Source/WTF/wtf/unicode/UTF8Conversion.cpp). Console version, allocation limits and foreign opaque-object interoperability remain unverified and are recorded in debt. No copied third-party implementation or new dependency. ### Tested [Manual CI `40445885976`](https://github.com/boykopovar/AnyPS5/actions/runs/40445885976), attempt 1, completed successfully for the **ordered five-PR composition** #11472 `6e97111223` → #10975 `78cb208c0c` → #11269 `4ccb760d12` → #10950 `5746326efc` → #10961 `844e39236f`, on frozen main `09f9a63f6b85aec9f36ce5d0d46f41c37cbd86fd`. This PR’s tested head is `5746326efc33bc56c24b1a7e1192186a783eda83`. | Release library job | Passed | Policy-approved skips | Failed | |---|---:|---:|---:| | [Linux `121997011318`](https://github.com/boykopovar/AnyPS5/actions/runs/40445885976/job/121997011318) | 2,364 | 95 | 0 | | [Windows `121997011314`](https://github.com/boykopovar/AnyPS5/actions/runs/40445885976/job/121997011314) | 1,745 | 825 | 0 | Both jobs passed `guest_jsc_string`, `guest_icu_unescape`, `guest_icu_version`, all 65 public-header CTests and `patched_libraries`; both skip validators passed. This qualifies the recorded five-PR Linux/Windows Release composition, not either PR alone or later main. Ancillary macOS/relinker-ASan jobs do not establish macOS-library, library-ASan or native-console coverage. Earlier entries below retain their original heads, compositions, outcomes and historical status. [Maintainer CI 40382857757/a1](https://github.com/boykopovar/AnyPS5/actions/runs/40382857757) has mixed results; **the full run failed on Linux**. Exact composition: base `6b16c9c6499a`, then #10961@`844e39236f0e` → #10953@`8b4bb4d239ad` → #11235@`3e333ce0fc5d` → #11337@`d84c522f4bda` → #10950@`5746326efc33`. [Windows job 121783493660](https://github.com/boykopovar/AnyPS5/actions/runs/40382857757/job/121783493660) passed its normal Release build/library targets and suite: **1,692 passed, 815 validated expected skips, zero failed / 2,507**. [Linux job 121783493789](https://github.com/boykopovar/AnyPS5/actions/runs/40382857757/job/121783493789) built successfully but reported **2,306 passed, 93 observed skips, two failed / 2,401**: `guest_sigvec_modules` and `guest_posix_spawn`. Its skip validator was skipped; those 93 skips are not policy-qualified. On both platforms, `guest_jsc_string` and all 65 header cases (`public_headers` plus 64 compilation batches) passed. This qualifies only the exact five-input composition, not an isolated head, newer main, other ICU follower heads, console equivalence or an overall green run. No source changes or dependency waivers result from this evidence. Existing prerequisite and review gates remain. Earlier entries below retain their historical source/base scopes. Linux x86-64, GCC 16.2.1, Release, BUILD_TESTING=ON. Rebased onto main `63a863d3b07f` after #10005 merged. Rebuilt the complete changed PRX and focused test executables against freshly rebuilt libc/libkernel runtime dependencies from the same frozen base; tests pass 1/1. Every nonzero Unicode scalar against an independent standard-library conversion; malformed UTF-8, embedded NUL, UTF-16 surrogate boundaries, bounded output/canaries, copied ownership, concurrent reference counts and oversized-count rejection before reads. The whole-tree `public_headers --audit-only` check passes. The canonical public API and umbrella headers compile standalone and twice-included with `-Werror`; cpp/test prototypes and ABI types use those headers. `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. Contributor [wachi35676 reports Windows Release validation](https://github.com/boykopovar/AnyPS5/pull/10950#issuecomment-6405789043) of head `5746326efc33bc56c24b1a7e1192186a783eda83` merged onto main `90f918fa7`, using WinLibs GCC 15.2.0: `guest_jsc_string` passed twice. The reported scope includes the every-scalar standard-library conversion comparison, malformed UTF-8, surrogate boundaries, bounded-output canaries and concurrent reference counts. This is focused runtime validation. A monolithic repository build and local Windows/macOS/PS5 execution were not performed. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes The current overlap report finds no overlap with open PRs.
MarcZX10 commented 2026-10-25 11:36:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:36:50Z.

Review: APPROVED


I reviewed the UTF-8 decoder/encoder boundaries, null-versus-empty representation, UTF-16 ownership, partial-output capacity handling, and atomic retain/release path. The exhaustive Unicode scalar round-trip and the explicit malformed-sequence and capacity-boundary cases provide useful focused coverage. I also confirmed the changed head passes the repository conventions check and git diff --check against upstream/main. The PR reports a passing focused runtime suite; I did not rerun that suite locally. I found no blocking correctness issue in this patch.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5642994430 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10950#pullrequestreview-5642994430). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T11:36:50Z. **Review:** APPROVED --- I reviewed the UTF-8 decoder/encoder boundaries, null-versus-empty representation, UTF-16 ownership, partial-output capacity handling, and atomic retain/release path. The exhaustive Unicode scalar round-trip and the explicit malformed-sequence and capacity-boundary cases provide useful focused coverage. I also confirmed the changed head passes the repository conventions check and `git diff --check` against `upstream/main`. The PR reports a passing focused runtime suite; I did not rerun that suite locally. I found no blocking correctness issue in this patch.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10950
No description provided.