feat(libSceJsc): implement WTF::BitVector::filterSlow #19193
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19193"
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 c1b3r-p3d1a on 2026-11-12T23:29:00Z.
What
Implements
WTF::BitVector::filterSlow(const BitVector&)(the out-of-line half ofBitVector::filter, an in-place AND) in libSceJsc, which threw. It is ported from WebKit's BitVector.cpp atc55364d53f97, the revision libSceJsc's other WTF code follows. The newsrc/WtfBitVector.cppstarts with that file's licence notice (BSD-2-Clause) under aDerived fromline.The one-word layout follows BitVector.h: the inline flag is bit 63, out-of-line storage is the word shifted left by one, and a 64-bit bit count comes before the words. The three branches are kept as written:
Where WebKit only asserts or would read through an invalid pointer, the export throws
std::invalid_argumentbefore writing: both vectors inline (the inlinefilternever callsfilterSlowthen), an empty (0) or deleted (1) vector read as out-of-line, and null arguments. The debt entry records what is unverified (console WTF version). The "throwing exports" count drops from 139 to 138.Tested
Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), Release.
jsc_wtf_bit_vectorbuilds out-of-line vectors in aligned buffers with guard words. It covers an inline other vector, with a three-word target where only word 0 changes and with the other's flag bit not leaking in. It covers an inline target against an out-of-line vector whose first word has bit 63 set and clear (flag restored, other unchanged). It covers out-of-line pairs with longer and shorter targets at bit counts 130/65, 128/192 and 1/1: common words ANDed, the extra word cleared, guard words and bit counts untouched. It also checks that every invalid case throws with nothing written.libSceJsc.prx:selfinrdi,otherinrsi, the inline test is the sign bit, storage is the word times 2, and the word count is(numBits + 63) >> 6.BitVector.cpp(cmp).main3ba8523c06: all libSceJsc andpublic_headerstests pass (74 total);python tools/check_conventions.py --base origin/mainpasses.libSceJsc.prxis not copied over the one staged inbuild/tests(#17895), so I copied it there before each run.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)Note for whoever merges after this: git merges this branch with #18430, #18442, #19104 or #14212 without a conflict, but the result has two copies of the "N throwing JavaScriptCore, Inspector, WTF and bmalloc exports" line in
docs/dev/debt/libSceJsc.md. A change to that count alone does the same, so it comes from how those branches rewrite that section. After a merge, keep one line with the recomputed count. I will rebase and recompute it if one of them merges first.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T00:08:12Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional. The change implements
WTF::BitVector::filterSlowin libSceJsc, and I found no defect in the code I read. Nothing was built or run here.What I ran
1e0786e55de7511516b2b32453bcb09590825886, basemain.Results
Export.cpporApi.hppconfigure_windows_unwind,APS5_VABIWtfStringSearch.cppcheck_conventions.pyFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceJsc/src/WtfBitVector.cpp:87narrows thestd::size_tword count tounsigned. This only matters above 2^38 bits. The second loop, a few lines below, has the same narrowing.Sources
No WebKit behaviour claim was checked. The pinned permalinks in the description and in
docs/dev/debt/libSceJsc.mdwere not opened.Not verified
Export.cpp,Api.hpp,CMakeLists.txtandlibSceJsc.hppwas not read. Only their hunks in the diff were.BitVector.cpp.To get this to a good state
Nothing is required.