feat(libSceIcu): embed emoji and layout property data #22036
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22036"
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 frankea on 2026-11-17T02:51:52Z.
What
Implements five libSceIcu exports whose only
NotImplemented_nid_no_patchwas a data-file guard:u_hasBinaryProperty,u_getIntPropertyValue,u_getIntPropertyMaxValue,u_getIntPropertyMap(all inProperties.cpp) andunorm_compare(Normalization.cpp). It also removes the same guard fromu_getBinaryPropertySet(Set.cpp), which stays a stub for progress because of its unreadable-error throw.This PR is stacked on #19413 and contains its commit, rebased onto
main939d3630edwithout changes. #19413 replaces ICU stubdata with aU_ICUDATA_ENTRY_POINTbuilt from the pinneddata/in/nfkc.nrmandnfkc_cf.nrm. That covers theUPROPS_SRC_NFKCandUPROPS_SRC_NFKC_CFsources. The new commit adds the two data files the remaining guarded sources need, from the ICU submodule at 049e0d6a:uemoji.icu(14386 bytes) forUPROPS_SRC_EMOJI. emojiprops.cpp L84 opens it withudata_openChoice(nullptr, "icu", "uemoji", ...).ulayout.icu(14448 bytes) forUPROPS_SRC_INPC,UPROPS_SRC_INSCandUPROPS_SRC_VO.ulayout_loadopens it in uprops.cpp L97-L141, and the getters andlayoutGetMaxValueread it at L683-L707.cmake/Icu.cmakenow takes a list of file names (nfkc.nrm nfkc_cf.nrm uemoji.icu ulayout.icu) instead of.nrmstems. It derives the array name withstring(MAKE_C_IDENTIFIER)and passes the entry count toIcuNormalizationData.cpp.in, which used a fixed 2. The list stays sorted by name, becausepointerTOCLookupFnbinary-searches the TOC.With all six data sources present,
FromDataFile,LayoutPropertyandIcu::PropertyNeedsDataare removed. The exports are plain forwards tou_hasBinaryPropertyL486-L497,u_getIntPropertyValueL756-L770 andu_getIntPropertyMaxValueL777-L788, and tou_getIntPropertyMapandu_getBinaryPropertySet. Theunorm_compareguard threw only onU_MISSING_RESOURCE_ERRORorU_FILE_ACCESS_ERROR. unormcmp.cpp L561-L638 only usesgetNFDInstance,getFCDInstanceanduniset_getUnicode32Instance(L602-L611), thenunorm_cmpEquivFold, which usesNormalizer2Factory::getNFCImpl(L178-L181). These use the compiled-in NFC data and property tables, so that status cannot occur and the guard was dead code. Its existing tests intests/Normalization.cppalready cover it, sounorm_comparehas no new test.One guard stays, with a new reason. For Basic_Emoji through RGI_Emoji (65-71), ICU adds emoji sequences (strings) to the set (characterproperties.cpp L291-L309). The guest
USetinSet.cppholds only code point ranges, so for those propertiesu_getBinaryPropertySetthrowsNotImplemented_nid_no_patch("u_getBinaryPropertySet: property of strings")instead of returning an incomplete set.u_hasBinaryPropertyfor those properties takes a single code point and is forwarded.#16971, and the copies of its data pipeline in #19720, #19628, #19645, #19635 and #19670, also replace stubdata with a full
icudt78lbuild that includes these files. If #16971 lands first, the guard removal here still applies and thecmakepart becomes redundant.Values follow Unicode 17 from the pinned ICU 78.1. The console's ICU 68 has Unicode 13, so a code point assigned or changed since then can differ. Properties 65-71 (Basic_Emoji through RGI_Emoji) first appeared in ICU 70; the console's
UCHAR_BINARY_LIMITis 65, so it answers false for them, while this branch forwards them like main's other post-68 properties. Not compared with a console.Debt: the fragment changes the
Binary property setsandu_getIntPropertyMapentries. TheCharacter propertyentry already has a pending change inmain'sfeat-icu-null-locale-default.md, andtools/debt_fold.py --checkrejects two fragments that change one entry. The new text therefore goes into that fragment: the data-file paragraph is replaced and its null-locale case mapping text is kept. #19413'sNormalizationchange is still accurate and is not touched.Progress (
python3 tools/progress.py --module libSceIcu):main939d3630ed254/2762, #19413 rebased 258/2762, this branch 263/2762. The five new exports areu_getIntPropertyMap,u_getIntPropertyMaxValue,u_getIntPropertyValue,u_hasBinaryPropertyandunorm_compare.Tested
macOS 27.0.1 on Apple silicon, x86_64 Release build under Rosetta (Ninja, AppleClang). Not run on Linux or Windows, and not on a console.
guest_icu_properties: newTestDataFilePropertiescovers:u_hasBinaryPropertyfor Emoji, Emoji_Presentation, Emoji_Modifier, Emoji_Modifier_Base, Emoji_Component, Extended_Pictographic, Basic_Emoji, RGI_Emoji and RGI_Emoji_Flag_Sequence on single code points, and for Changes_When_NFKC_Casefolded;u_getIntPropertyValuefor Emoji, NFKC_QC, InPC, InSC and vo (U+093F Left and Vowel_Dependent, U+0915 NA and Consonant, U+4E00 Upright, U+3001 Transformed_Upright, A Rotated);u_getIntPropertyMaxValuefor InPC 15, InSC 36 and vo 3;u_getIntPropertyMapfor InSC, vo and NFKC_QC.guest_icu_set: newDataFilePropertySetscovers the Emoji, Extended_Pictographic and Changes_When_NFKC_Casefolded sets.ctest -R icu: 59 of 59 passed.guest_icu_propertiesandguest_icu_setabort, withu_hasBinaryProperty: property from a data file not implementedandu_getBinaryPropertySet_nid_postfix not implemented.failed: u_hasBinaryProperty(Emoji)). ICU then returns false and 0 without throwing, so the files are needed, not only the guard removal.tools/check_conventions.py --base origin/mainpassed.tools/debt_fold.py --checkpasses for libSceIcu; it still reportsmain's pre-existing libSceLibreSsl3 fragment pair.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)AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T02:57:47Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a5182dc50d:tools/check_conventions.pypassed.guest_icu_normalization_tests,guest_icu_properties_tests,guest_icu_set_testsbuilt cleanly.guest_icu_set,guest_icu_properties,guest_icu_normalization):core/libs/prx/libSceIcu/Export.cpp,core/libs/prx/libSceIcu/Identified.hpp,core/libs/prx/libSceIcu/LegacyExports.cpp,core/libs/prx/libSceIcu/Normalization.cpp,core/libs/prx/libSceIcu/Normalization.hpp,core/libs/prx/libSceIcu/Properties.cpp,core/libs/prx/libSceIcu/Properties.hpp,core/libs/prx/libSceIcu/Set.cpp,core/libs/prx/libSceIcu/include/InventoryExports.hpp,core/libs/prx/libSceIcu/include/LegacyExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T03:06:37Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
a5182dc50d73ec383960ae404d96e85682d10de0, basemain. No merged-preview check.repo_read.py, pinned to head). No build toolchain, no tests.Results
ctest -R icuFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceIcu/Normalization.cpp:124:u_getFC_NFKC_Closure_nid_postfixreturns 0 without setting an error when the error pointer is null. The file'sStatus()helper throws on a null pointer (Normalization.cpp:28-31), the sibling exports do the same, and the debt note indocs/dev/debt/changes/feat-icu-compatibility-normalization.md:4says a null error pointer throws. A guest callingu_getFC_NFKC_Closure(0x037a, buf, 16, nullptr)gets 0 and no exception, whileunorm2_getNFKCInstance(nullptr)throws. The new test does not cover this path. Suggested change, replacing lines 124-125:Sources
Status():github.com/boykopovar/AnyPS5@a5182dc50d/core/libs/prx/libSceIcu/Normalization.cpp (L28-L31)github.com/boykopovar/AnyPS5@a5182dc50d/core/libs/prx/libSceIcu/Normalization.cpp (L124)github.com/boykopovar/AnyPS5@a5182dc50d/core/libs/prx/libSceIcu/Set.cpp (L98-L99)Not verified
ctest -R icuwere not run here. The 59 of 59 result and the macOS x86_64 build under Rosetta are author-reported.uemoji.icuandulayout.icuare not in the diff. They come from the ICU submodule, and the diff does not change its pin. Presence and sizes at the pin (14386 and 14448 bytes, per the description) are not confirmed.icudt78l/<file>in this sorted order was not checked against ICU source.unorm_compareguard was dead code, and that the existingTestComparecovers it, were not checked.diff.patch, in full). Full head text of none of them. At head through the reader:Normalization.cpplines 18-60 andSet.cpplines 80-110.LegacyExports.cpp(9,665 lines) andLegacyExports.hpp(2,263 lines) were checked only at their removed lines. Excluded by rule: none.To get this to a good state
Nothing is required.
Optional: make
u_getFC_NFKC_Closurethrow on a null error pointer, as the debt note says (see Findings).