Skip to content

feat(libSceNKWebKit): implement WTF symbols and the symbol registry - #22684

Open
RiverWhy wants to merge 12 commits into
boykopovar:mainfrom
RiverWhy:feat/nkwebkit-symbol-registry
Open

RiverWhy wants to merge 12 commits into
boykopovar:mainfrom
RiverWhy:feat/nkwebkit-symbol-registry

Conversation

@RiverWhy

Copy link
Copy Markdown
Contributor

What

Stacked on #22678 (the atom string table; its two commits come first, the last commit is this change). Implements 6 11.x WTF symbol exports:

  • SymbolImpl::create, SymbolImpl::createNullSymbol and PrivateSymbolImpl::create;
  • SymbolRegistry::symbolForKey and the registry's D1/D2 destructors.

Source: pinned SymbolImpl.cpp, SymbolImpl.h and SymbolRegistry.cpp (PS5 11.x).

Details:

  • Symbol layout. A symbol is a BufferSubstring StringImpl with the symbol flag (32). It shares the description's characters and holds a reference to the description's owner at +24, followed by the symbol hash from the existing nextHashForSymbol export (+32) and the flags (+36). That's 40 bytes, or 48 for registered symbols, which add the registry pointer at +40. A substring description is resolved to its owner, as upstream does.
  • Null symbol. It has the empty string as owner and the null-symbol flag.
  • Registry storage. Upstream's registry keeps a HashSet<RefPtr<StringImpl>> that holds a strong reference to every symbol it creates. Here those references live in a host table keyed by the registry's address, and the guest HashSet stays empty. The registry's constructor is inline in the guest, so it is never called.
  • Registry behaviour. symbolForKey returns the same symbol for equal keys (8- or 16-bit). A private registry (type 1) creates registered private symbols. The destructor clears each symbol's registry pointer, then drops the registry's references, like ~SymbolRegistry.
  • WtfString.cpp. Releasing a symbol used to call std::terminate. Now it frees the symbol, releases the owner and, if the symbol is still registered, forgets it.
  • Not included: RegisteredSymbolImpl has no exports of its own here, and SymbolRegistry::remove is inline.

#22678 also gets a fix found while writing this: addSlowCase on a symbol (or any full-length substring add) used SubstringSharingImpl. That returns the string itself at full length, so the symbol itself was turned into an atom. It now always builds a new substring (or a copy when shorter than the substring header), like createSubstringSharingImpl, and #22678's test covers it.

Debt: a fragment, docs/dev/debt/changes/feat-nkwebkit-symbol-registry.md, adds the entry and removes the 6 inventory rows.

Overlap: pr_overlap.py --names finds no open PR with these exports.

Tested

Linux Mint 22.3. New nkwebkit_wtfsymbolregistry test:

  • symbol layout, flags, owner references (released when the symbol goes away) and distinct symbol hashes;
  • substring descriptions resolve to their owner;
  • 16-bit descriptions, and the null symbol;
  • atomizing a symbol gives a separate atom;
  • symbolForKey with equal 8- and 16-bit keys, public and private registries;
  • the registry's reference keeps a symbol alive, and destroying the registry clears the pointer and drops the reference;
  • destroying a registry twice; null refusals.

The full build succeeds, and all NKWebKit tests pass, including the atom and wtftext_allocation tests (the latter now also builds WtfSymbolRegistry.cpp and WtfSymbolImpl.cpp).

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: feat(libSceNKWebKit): implement the WTF atom string table #22678
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Progress report (0a025bd → 5a6572d)

📈 System libraries: 44.62% (+0.07%, +26 implemented functions)

✅ 26 implemented
Library Name
libSceNKWebKit _ZN3WTF10AtomString16fromUTF8InternalEPKcS2_
libSceNKWebKit _ZN3WTF10AtomString6numberEd
libSceNKWebKit _ZN3WTF10AtomString6numberEf
libSceNKWebKit _ZN3WTF10AtomString6numberEi
libSceNKWebKit _ZN3WTF10AtomString6numberEj
libSceNKWebKit _ZN3WTF10AtomString6numberEm
libSceNKWebKit _ZN3WTF10AtomString6numberEy
libSceNKWebKit _ZN3WTF10StringImpl7destroyEPS0_
libSceNKWebKit _ZN3WTF10SymbolImpl16createNullSymbolEv
libSceNKWebKit _ZN3WTF10SymbolImpl6createERNS_10StringImplE
libSceNKWebKit _ZN3WTF14AtomStringImpl10addLiteralEPKcj
libSceNKWebKit _ZN3WTF14AtomStringImpl11addSlowCaseERNS_10StringImplE
libSceNKWebKit _ZN3WTF14AtomStringImpl11addSlowCaseERNS_15AtomStringTableERNS_10StringImplE
libSceNKWebKit _ZN3WTF14AtomStringImpl14lookUpSlowCaseERNS_10StringImplE
libSceNKWebKit _ZN3WTF14AtomStringImpl3addEPKDsj
libSceNKWebKit _ZN3WTF14AtomStringImpl3addEPKNS_10StringImpl16StaticStringImplE
libSceNKWebKit _ZN3WTF14AtomStringImpl3addEPKhj
libSceNKWebKit _ZN3WTF14AtomStringImpl3addEPNS_10StringImplEjj
libSceNKWebKit _ZN3WTF14AtomStringImpl6lookUpEPKDsj
libSceNKWebKit _ZN3WTF14AtomStringImpl6lookUpEPKhj
libSceNKWebKit _ZN3WTF14SymbolRegistry12symbolForKeyERKNS_6StringE
libSceNKWebKit _ZN3WTF14SymbolRegistryD1Ev
libSceNKWebKit _ZN3WTF14SymbolRegistryD2Ev
libSceNKWebKit _ZN3WTF17PrivateSymbolImpl6createERNS_10StringImplE
libSceNKWebKit _ZNK3WTF10AtomString23convertToASCIILowercaseEv
libSceNKWebKit _ZNK3WTF10AtomString23convertToASCIIUppercaseEv

Changed libraries (implemented exports)

Library Before After Change
libSceNKWebKit 3790/11252 (33.68%) 3816/11252 (33.91%) +0.23%

@PrivacyOnion PrivacyOnion 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.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 59b40f9624:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_wtfatomstring_tests, nkwebkit_wtfsymbolregistry_tests built cleanly.
  • CTest (nkwebkit_wtfatomstring, nkwebkit_wtfsymbolregistry):
    1/2 Test #4568: nkwebkit_wtfsymbolregistry .......   Passed    0.01 sec
    2/2 Test #4561: nkwebkit_wtfatomstring ...........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp, core/libs/prx/libSceNKWebKit/src/WtfNumberFormat.cpp, core/libs/prx/libSceNKWebKit/src/WtfString.cpp, core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hpp, core/libs/prx/libSceNKWebKit/src/WtfTextAbi.hpp, core/libs/prx/libSceNKWebKit/src/WtfAtomString.cpp, core/libs/prx/libSceNKWebKit/src/WtfSymbolRegistry.cpp reverted to main and the new tests kept, the suite fails:
    1/2 Test #4561: nkwebkit_wtfatomstring ...........Subprocess aborted***Exception:   0.15 sec
    2/2 Test #4568: nkwebkit_wtfsymbolregistry .......Subprocess aborted***Exception:   0.17 sec
    0% tests passed, 2 tests failed out of 2
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified SymbolImpl, RegisteredSymbolImpl, and SymbolRegistry ABI layout, offsets, and struct definitions in WtfSymbolExports.hpp matching upstream PS5 WebKit 11.x.
    • Checked memory management, ref counting, and destruction order in WtfSymbolRegistry.cpp and WtfString.cpp (Destroy/Release/ForgetRegisteredSymbol).
    • Audited thread safety of SymbolRegistry via RegistriesLock mutex for lookup, insertion, and registry destruction.
    • Verified null/bounds checks and exception handling for all 6 exported symbols in WtfSymbolExports.hpp and WtfAtomStringExports.hpp.
    • Confirmed AGENTS.md conventions compliance: no illegal comments, proper licence notices, no fake stub successes, and clean removal from InventoryExports.hpp.

Looks Good To Me

@github-actions

github-actions Bot commented Nov 18, 2026 •

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 24322 _ZN3WTF10AtomString16fromUTF8InternalEPKcS2_
_ZN3WTF10AtomString6numberEd
_ZN3WTF10AtomString6numberEf
_ZN3WTF10AtomString6numberEi
_ZN3WTF10AtomString6numberEj
_ZN3WTF10AtomString6numberEm
_ZN3WTF10AtomString6numberEy
_ZN3WTF10StringImpl7destroyEPS0_
_ZN3WTF10SymbolImpl16createNullSymbolEv
_ZN3WTF10SymbolImpl6createERNS_10StringImplE
_ZN3WTF14AtomStringImpl10addLiteralEPKcj
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_15AtomStringTableERNS_10StringImplE
_ZN3WTF14AtomStringImpl14lookUpSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl3addEPKDsj
_ZN3WTF14AtomStringImpl3addEPKNS_10StringImpl16StaticStringImplE
_ZN3WTF14AtomStringImpl3addEPKhj
_ZN3WTF14AtomStringImpl3addEPNS_10StringImplEjj
_ZN3WTF14AtomStringImpl6lookUpEPKDsj
_ZN3WTF14AtomStringImpl6lookUpEPKhj
_ZN3WTF14SymbolRegistry12symbolForKeyERKNS_6StringE
_ZN3WTF14SymbolRegistryD1Ev
_ZN3WTF14SymbolRegistryD2Ev
_ZN3WTF17PrivateSymbolImpl6createERNS_10StringImplE
_ZNK3WTF10AtomString23convertToASCIILowercaseEv
_ZNK3WTF10AtomString23convertToASCIIUppercaseEv
PR 24910 _ZN3WTF10AtomString16fromUTF8InternalEPKcS2_
_ZN3WTF10AtomString6numberEd
_ZN3WTF10AtomString6numberEf
_ZN3WTF10AtomString6numberEi
_ZN3WTF10AtomString6numberEj
_ZN3WTF10AtomString6numberEm
_ZN3WTF10AtomString6numberEy
_ZN3WTF10StringImpl7destroyEPS0_
_ZN3WTF10SymbolImpl16createNullSymbolEv
_ZN3WTF10SymbolImpl6createERNS_10StringImplE
_ZN3WTF14AtomStringImpl10addLiteralEPKcj
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_15AtomStringTableERNS_10StringImplE
_ZN3WTF14AtomStringImpl14lookUpSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl3addEPKDsj
_ZN3WTF14AtomStringImpl3addEPKNS_10StringImpl16StaticStringImplE
_ZN3WTF14AtomStringImpl3addEPKhj
_ZN3WTF14AtomStringImpl3addEPNS_10StringImplEjj
_ZN3WTF14AtomStringImpl6lookUpEPKDsj
_ZN3WTF14AtomStringImpl6lookUpEPKhj
_ZN3WTF14SymbolRegistry12symbolForKeyERKNS_6StringE
_ZN3WTF14SymbolRegistryD1Ev
_ZN3WTF14SymbolRegistryD2Ev
_ZN3WTF17PrivateSymbolImpl6createERNS_10StringImplE
_ZNK3WTF10AtomString23convertToASCIILowercaseEv
_ZNK3WTF10AtomString23convertToASCIIUppercaseEv
PR 24917 _ZN3WTF10AtomString16fromUTF8InternalEPKcS2_
_ZN3WTF10AtomString6numberEd
_ZN3WTF10AtomString6numberEf
_ZN3WTF10AtomString6numberEi
_ZN3WTF10AtomString6numberEj
_ZN3WTF10AtomString6numberEm
_ZN3WTF10AtomString6numberEy
_ZN3WTF10StringImpl7destroyEPS0_
_ZN3WTF10SymbolImpl16createNullSymbolEv
_ZN3WTF10SymbolImpl6createERNS_10StringImplE
_ZN3WTF14AtomStringImpl10addLiteralEPKcj
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl11addSlowCaseERNS_15AtomStringTableERNS_10StringImplE
_ZN3WTF14AtomStringImpl14lookUpSlowCaseERNS_10StringImplE
_ZN3WTF14AtomStringImpl3addEPKDsj
_ZN3WTF14AtomStringImpl3addEPKNS_10StringImpl16StaticStringImplE
_ZN3WTF14AtomStringImpl3addEPKhj
_ZN3WTF14AtomStringImpl3addEPNS_10StringImplEjj
_ZN3WTF14AtomStringImpl6lookUpEPKDsj
_ZN3WTF14AtomStringImpl6lookUpEPKhj
_ZN3WTF14SymbolRegistry12symbolForKeyERKNS_6StringE
_ZN3WTF14SymbolRegistryD1Ev
_ZN3WTF14SymbolRegistryD2Ev
_ZN3WTF17PrivateSymbolImpl6createERNS_10StringImplE
_ZNK3WTF10AtomString23convertToASCIILowercaseEv
_ZNK3WTF10AtomString23convertToASCIIUppercaseEv

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.

Pull request Shared files not compared
PR 13515 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 14138 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14164 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14259 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 14478 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14860 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 15170 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 15184 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 16510 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 17550 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17569 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17771 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17793 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17886 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17912 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17922 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 18377 core/libs/prx/libSceNKWebKit/Export.cpp
PR 18395 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 18414 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19486 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 19678 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19693 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19773 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19780 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19823 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 19830 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 19839 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/src/WtfString.cpp
core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hpp
PR 19841 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/src/WtfString.cpp
core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hpp
PR 20326 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 20771 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 20938 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 21668 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 21670 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 21862 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 22789 core/libs/prx/libSceNKWebKit/src/WtfString.cpp
PR 22898 core/libs/prx/libSceNKWebKit/Export.cpp
PR 22937 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 22946 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23030 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23056 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23073 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23083 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23084 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23085 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23109 core/libs/prx/libSceNKWebKit/Export.cpp
PR 23110 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23159 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23181 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23246 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23354 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23548 core/libs/prx/libSceNKWebKit/Export.cpp
PR 23552 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23735 core/libs/prx/libSceNKWebKit/Export.cpp
PR 23752 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 23772 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23773 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 23847 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24007 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24011 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24023 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24135 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24154 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24230 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24238 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24260 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24292 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24322 core/libs/prx/libSceNKWebKit/CMakeLists.txt
PR 24355 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24417 core/libs/prx/libSceNKWebKit/CMakeLists.txt
PR 24419 core/libs/prx/libSceNKWebKit/src/WtfString.cpp
PR 24425 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24433 core/libs/prx/libSceNKWebKit/src/WtfString.cpp
PR 24457 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24504 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24509 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24516 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24529 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24544 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24546 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24549 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24561 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24562 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24715 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24867 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24868 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24873 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24901 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24909 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24910 core/libs/prx/libSceNKWebKit/CMakeLists.txt
PR 24916 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24917 core/libs/prx/libSceNKWebKit/CMakeLists.txt
PR 24920 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24922 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24925 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24929 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24930 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24932 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24933 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24937 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24956 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 24965 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 24980 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25139 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25140 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25153 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25158 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25160 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25403 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25480 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25530 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25548 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25549 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25562 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25565 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25566 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25567 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25568 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25570 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 25647 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25765 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25770 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25781 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25785 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25792 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 25803 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26075 core/libs/prx/libSceNKWebKit/Export.cpp
PR 26083 core/libs/prx/libSceNKWebKit/Export.cpp
PR 26104 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26111 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26114 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26117 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26122 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26125 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26130 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26140 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26154 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26158 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26166 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26176 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26198 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26313 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26315 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26380 core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26386 core/libs/prx/libSceNKWebKit/Export.cpp
PR 26401 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26431 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26432 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26433 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26434 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26435 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26439 core/libs/prx/libSceNKWebKit/CMakeLists.txt
core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26440 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26441 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26617 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26705 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26713 core/libs/prx/libSceNKWebKit/Export.cpp
PR 26740 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 26752 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PR 26884 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp

@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.

Reviewed — changes requested

Changes are required before merge: make registry lookup and insertion atomic so concurrent calls for one key return the same symbol.

What I ran

Reviewed head 59b40f9624215e3254ca6d00c890e0be4ea5d921; no build or tests were run.

Results

Check Result Note
Source review failed Registry identity race
Build and tests not run No execution performed

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfSymbolRegistry.cpp:204 and core/libs/prx/libSceNKWebKit/src/WtfSymbolRegistry.cpp:209: lookup releases the registry mutex before creating and inserting a symbol. Two concurrent calls for the same registry and key can both miss, create different symbols, and each return its own symbol; the second emplace silently fails. This breaks the registry guarantee that equal keys resolve to the same symbol. Keep lookup, creation and insertion atomic, or recheck after reacquiring the lock and discard/return the winner.

Non-blocking

None.

Not verified

No build, tests, CI results, or console behavior were verified. Export.cpp and include/InventoryExports.hpp were excluded as too large for the review folder; their diff hunks were inspected, but their full text was not read. All other changed files were read, including the full text of files marked included in the manifest.

To get this to a good state

Make registry creation safe for concurrent calls, then rerun the build and relevant NKWebKit tests.

@maskym

maskym commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Windows result for head 59b40f9624, merged alone into main 168921678f (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. main itself fails to compile one test on Windows at this commit (UploadCacheReadOnlyFlush.cpp:177, setenv; #19899 fixes it), so the tree was built with ninja -k 0. This PR adds no other build failure.

The tests this PR adds or extends, nkwebkit_wtfatomstring, nkwebkit_wtfsymbolregistry, nkwebkit_wtftext_allocation, pass 3/3, three runs. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

…r one lock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RiverWhy

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Fixed in 00cc5d4. symbolForKey now does the lookup, creation and insert under one hold of the registry lock (creation doesn't take that lock, so this can't deadlock).

The new TestConcurrentLookups runs 200 rounds of 8 threads asking one registry for the same key (each with its own key string) and requires one shared symbol with the matching ref count. Without the fix it fails 5 of 5 runs; with it, it passes.

@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.

Reviewed — no blocking findings

Nothing blocks this review; the points below are optional.

What I ran

Reviewed head 00cc5d4e8e6c003841364ce1477e3898d433343f. No commands or tests were run.

Results

Check Result Note
Source review not run Reviewed selected changed code
Tests not run No test execution

Findings

Blocking

None.

Non-blocking

  • addSlowCase(AtomStringTable&, StringImpl&) validates the supplied table but adds to the current thread’s host table instead (WtfAtomString.cpp:377-379). The debt note documents this limitation. Consider preserving the table association so guest callers using distinct tables retain expected lookup and release behavior.
  • fromUTF8Internal rejects an empty range (WtfAtomString.cpp:399-402), while invalid non-empty UTF-8 returns a null atom (WtfAtomString.cpp:405). Consider checking upstream behavior for an empty range and matching it if empty input is valid.

Not verified

No build or tests were run, and no console behavior was checked. Read the prepared description, commits, manifest and diff, plus WtfSymbolRegistry.cpp, WtfSymbolImpl.cpp, WtfString.cpp, WtfAtomString.cpp, WtfNumberFormat.cpp, WtfSymbolExports.hpp, CMakeLists.txt, and WtfSymbolRegistry.cpp tests. Export.cpp and InventoryExports.hpp were excluded from the review folder as too large; their full text was not read. Other changed files were not read.

To get this to a good state

Nothing is required. The two non-blocking points above are optional follow-up considerations.

@maskym

maskym commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Retested head 00cc5d4e8e on Windows (the head moved since my earlier run), merged alone into main 9a50e1014e.

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. main itself fails to compile one test on Windows at this commit (UploadCacheReadOnlyFlush.cpp:177, setenv; #19899 fixes it), so the tree was built with ninja -k 0. This PR adds no other build failure.

The tests this PR adds or extends, nkwebkit_wtfatomstring, nkwebkit_wtfsymbolregistry, nkwebkit_wtftext_allocation, pass 3/3, three runs. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@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.

Reviewed — no blocking findings

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 0fcc403cdb1433011262f5f3110ff88e7ca1f184 using the prepared diff and pinned reader. No build or tests were run.

Results

Check Result Note
Diff inspection passed Prepared diff reviewed
Build and tests not run No commands run
Source context passed Targeted source ranges read

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceNKWebKit/src/WtfAtomString.cpp:377: the overload receiving an AtomStringTable& ignores that table and inserts into the current thread’s table. An atom released on another thread can therefore fail to be found by RemoveAtom and terminate. This limitation is documented in the debt entry; consider tracking the owning table or routing removal through the supplied table when addressing that debt.

Sources

Behavior and limitation were checked against the changed source and the debt entry at this head.

Not verified

No build or tests were run. Full text was read for the included changed files except Export.cpp and include/InventoryExports.hpp, which the review bundle excluded for size; their relevant diff hunks were inspected. The complete test files were not read. files.json was not available through the reader; the file list showed the two excluded files above and the remaining changed files included.

To get this to a good state

Nothing is required. Optional: resolve the atom-table ownership/threading limitation described above.

@maskym

maskym commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Retested head 0fcc403cdb on Windows (the head moved since my earlier run), merged alone into main 5287bfb6f1.

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. main itself fails to compile one test on Windows at this commit (UploadCacheReadOnlyFlush.cpp:177, setenv; #19899 fixes it), so the tree was built with ninja -k 0. This PR adds no other build failure.

The tests this PR adds or extends, nkwebkit_wtfatomstring, nkwebkit_wtfsymbolregistry, nkwebkit_wtftext_allocation, pass 3/3, three runs. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 19, 2026
…ring-table

# Conflicts:
#	core/libs/prx/libSceNKWebKit/src/WtfNumberFormat.cpp
…registry

# Conflicts:
#	core/libs/prx/libSceNKWebKit/src/WtfNumberFormat.cpp

@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.

Reviewed — changes requested

Changes are required before merge: ensure atom strings can be released from a different thread than the one whose table owns them.

What I ran

Reviewed head cdae24958ed029a28964b1794cc4ba3f79397ee6 using the prepared diff and the pinned-head reader repo_read.py. No build or tests were run; the Linux Mint test results in the description are author-reported.

Results

Check Result Note
Change and targeted code review passed Inspected atom and symbol ownership paths
Build and tests not run Author-reported results only

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfAtomString.cpp:332: RemoveAtom removes an atom only from the releasing thread's CurrentTable(), and terminates if it is not there. Atoms can be transferred across threads: the added TestThreadTables moves a worker-created atom to the main thread at core/libs/prx/libSceNKWebKit/tests/WtfAtomString.cpp:442-445, but releases it before the worker exits, so it does not exercise release from another thread. If the worker exits while an atom reference remains held elsewhere, its table destructor leaves the atom's flag set; releasing that atom on the receiving thread then terminates because that thread's table does not contain it. Track the owning table for each atom or otherwise make cross-thread release remove it safely.

Non-blocking

None.

Not verified

  • Build and test execution were not performed.
  • Export.cpp and include/InventoryExports.hpp were excluded from the review folder because they were too large. Their relevant hunks were visible in diff.patch, and the changed export region in Export.cpp was read through the pinned-head reader. The complete files were not read.
  • Review scope was the changed atom and symbol implementation, its string release path, exports, tests, and build registration; other unchanged repository behavior was not audited.

To get this to a good state

Make atom-table ownership safe when references cross threads, then rerun the atom-string and full NKWebKit test suites.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 19, 2026
RiverWhy and others added 2 commits November 19, 2026 14:36
@RiverWhy

Copy link
Copy Markdown
Contributor Author

I checked this and the code is correct, so I changed no source. ~AtomStringTable (WtfAtomString.cpp:157) clears IsAtomFlag (16) on every non-static entry when the worker's thread-local table is destroyed. Destroy (WtfString.cpp:255) only calls RemoveAtom when that flag is set, so a later release on another thread takes the plain deallocate path and never reaches std::terminate. This matches upstream AtomStringTable.cpp:28-32 and AtomStringImpl.cpp:464-473, where removing an atom from another thread's table is a contract violation.

I added TestAtomOutlivesWorkerTable (tests/WtfAtomString.cpp). It creates three atoms on a worker, hands references to the main thread, lets the worker exit, then checks the flag is cleared, the reference counts are right, the main thread's own atom with the same content is untouched, and releasing them does not terminate. Commit 407846b on #22678; #22684 picks it up by merge (e20f111).

@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.

Reviewed — no blocking findings

Nothing in the reviewed code establishes a blocking defect; review remains incomplete because two changed files were excluded from the review folder and could not be read in full.

What I ran

Reviewed head e20f111179e1cb0c99b3e4fa2355df02d4e22803 using the prepared diff and repo_read.py at the pinned head. No build or tests were run. The author reports a successful full build and passing NKWebKit tests; this was not independently verified.

Results

Check Result Note
Diff and included changed files passed Targeted source and test review
Build and tests not run Author-reported only
Excluded changed files not run Full text unavailable in review folder

Findings

Blocking

None identified in the code read.

Non-blocking

None.

Not verified

Full contents of core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp were excluded as too large for the review folder. They were not read through repo_read.py. Also not verified: build/test claims, Windows behavior, and behavior on physical PS5 hardware.

Files read: description.md, commits.md, manifest.json, diff.patch, core/libs/prx/libSceNKWebKit/CMakeLists.txt, core/libs/prx/libSceNKWebKit/src/WtfAtomString.cpp, core/libs/prx/libSceNKWebKit/src/WtfString.cpp, core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hpp, core/libs/prx/libSceNKWebKit/src/WtfSymbolRegistry.cpp, and core/libs/prx/libSceNKWebKit/tests/WtfSymbolRegistry.cpp. Files excluded: Export.cpp and include/InventoryExports.hpp.

To get this to a good state

Nothing is required.

RiverWhy and others added 2 commits November 20, 2026 08:16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bol-registry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 20, 2026

@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.

Reviewed — changes requested

Changes are required before merge: reject reversed or empty UTF-8 ranges without forming an invalid length or passing them to the decoder.

What I ran

Reviewed diff and targeted code at head 5a6572d9c036916e8040f8c05e99ede207936e7d using repo_read.py. No build or tests were run in this review.

Results

Check Result Note
Diff and source review passed Targeted changed code inspected
Build and tests not run Author reports successful runs

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfAtomString.cpp:765: The function rejects end <= start only when end is non-null. A caller can pass a non-null end before start; the subsequent end - start is negative and converted to size_t for fromUTF8, potentially causing an oversized read. Check ordering before computing the length and reject or return null for an empty range, consistent with the intended behavior.

Non-blocking

None.

Not verified

  • Build and test results were not independently verified; they are reported in the PR description.
  • Export.cpp and InventoryExports.hpp full text was excluded from the review bundle; only their diff hunks were inspected. Other files in the diff and manifest were inspected in the prepared bundle.
  • Console behavior was not tested.

To get this to a good state

Validate the UTF-8 range before subtracting its pointers, then rerun the UTF-8 edge tests and the NKWebKit test suite.

@RiverWhy

Copy link
Copy Markdown
Contributor Author

A reversed range is already rejected: after a null end is replaced by start + strlen(start), line 402 throws for any end <= start, so a non-null end before start throws before end - start is computed and before the decoder is reached. Upstream's AtomString::fromUTF8Internal (AtomString.cpp:115-123) only ASSERTs !end || end > start, so the throw is the stricter port of that contract. The review's premise ('rejects end <= start only when end is non-null') reads the code the other way round: null end is normalised first and is then checked too (an empty C string throws as well, matching ASSERT(end || start[0])). I can add a test for the reversed-range case if you want one: the current test file covers null start and invalid UTF-8 but not end < start.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants