Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
AZLisme:feat/jsc-string-api
Oct 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
AZLisme:feat/jsc-string-api

Conversation

@AZLisme

@AZLisme AZLisme commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown

Progress report (16ff208 → 5746326)

📉 System libraries: 49.34% (-0.01%, +4 implemented, +6 declared functions)

✅ 4 implemented
Library Name
libSceJsc JSStringGetCharactersPtr
libSceJsc JSStringGetLength
libSceJsc JSStringGetUTF8CString
libSceJsc JSStringIsEqual
🆕 6 declared as stubs
Library Name
libSceJsc JSStringCreateWithCharacters
libSceJsc JSStringCreateWithUTF8CString
libSceJsc JSStringGetMaximumUTF8CStringSize
libSceJsc JSStringIsEqualToUTF8CString
libSceJsc JSStringRelease
libSceJsc JSStringRetain

Changed libraries (implemented exports)

Library Before After Change
libSceJsc No exports 4/10 (40.00%) n/a

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@wachi35676

Copy link
Copy Markdown
Contributor

Windows run, which the description lists as not performed. Head 5746326efc33 merged onto main 90f918fa7, WinLibs GCC 15.2.0, Release.

  • guest_jsc_string passes, 2 runs. That includes the every-scalar comparison against the standard-library conversion, malformed UTF-8, the surrogate boundaries, the bounded-output canaries and the concurrent reference counts.

AI-assisted: yes (Claude Code); results above were run on this machine.

@AZLisme

AZLisme commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @wachi35676 for running head 5746326efc33 merged onto main 90f918fa7 with WinLibs GCC 15.2.0. I’ve credited your two passing guest_jsc_string runs and their focused conversion, boundary, canary and reference-count coverage in Tested, separately from the local Linux validation.

@AZLisme

AZLisme commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean, run 40382857757/a1 provides focused evidence for this exact head in the recorded five-input composition on 6b16c9c6499a. guest_jsc_string and all 65 header cases passed on Linux and Windows. Windows finished with 1,692 passes, 815 validated skips and no failures. Linux had 2,306 passes, 93 observed skips and failures in guest_sigvec_modules and guest_posix_spawn; its skip validator did not run, so the full run remains failed.

The description preserves that scope and all earlier evidence and prerequisites. Please re-review these focused results; full-CI and existing review/integration gates remain open.

@AZLisme AZLisme mentioned this pull request Oct 26, 2026
12 tasks done
@AZLisme

AZLisme commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

CI 40445885976, attempt 1, now succeeds on Linux and Windows in the recorded ordered five-PR composition on 09f9a63f6b. It includes JSC 5746326efc and ICU 844e39236f; the body records every input and the exact pass/allowed-skip counts. guest_jsc_string, ICU tests, headers and patched-library checks pass on both platforms. This is composition-scoped validation.

Please re-review and merge when current integration and review requirements are satisfied.

@github-actions

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 11764 core/libs/prx/libSceJsc/Export.cpp L8
docs/dev/debt/libSceJsc.md
docs/dev/debt/libSceJsc.md

@oneandonlydean
oneandonlydean merged commit 6f0f810 into boykopovar:main Oct 27, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants