[browser][coreclr] ICU download#121800
Conversation
…["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "true";
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
src/native/libs/System.Globalization.Native/pal_icushim_static.c
Outdated
Show resolved
Hide resolved
src/native/libs/System.Globalization.Native/pal_icushim_static.c
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
Outdated
Show resolved
Hide resolved
69bcc07 to
2c4d3bb
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements ICU (International Components for Unicode) data loading functionality for browser/CoreCLR, enabling proper globalization support with culture-specific ICU shards. The implementation adds logic to detect the appropriate ICU shard based on the user's culture, download it, allocate memory, and initialize it before CoreCLR startup.
- Adds ICU resource selection and sharding logic to automatically choose the appropriate ICU data file based on culture (EFIGS, CJK, or no-CJK shards)
- Implements
loadIcuDatafunction for memory allocation and ICU initialization via WASM interop - Renames
mono_wasm_load_icu_datatowasm_load_icu_datafor runtime-agnostic naming across both Mono and CoreCLR
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Globalization.Native/pal_icushim_static.c | Renamed mono_wasm_load_icu_data to wasm_load_icu_data and updated comment references |
| src/native/libs/Common/JavaScript/types/internal.ts | Added wasm_load_icu_data method to EmscriptenModuleInternal interface |
| src/native/libs/Common/JavaScript/types/exchange.ts | Added loadIcuData to BrowserHostExports type definitions |
| src/native/libs/Common/JavaScript/cross-module/index.ts | Added loadIcuData to export table mapping |
| src/native/corehost/browserhost/loader/icu.ts | New file implementing ICU resource name selection and culture-based sharding logic |
| src/native/corehost/browserhost/loader/bootstrap.ts | Added ICU data fetching and loading to runtime bootstrap sequence |
| src/native/corehost/browserhost/libBrowserHost.footer.js | Commented out DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to enable ICU globalization |
| src/native/corehost/browserhost/host/index.ts | Added loadIcuData export to BrowserHostExports table |
| src/native/corehost/browserhost/host/host.ts | Implemented loadIcuData function with memory allocation and WASM interop |
| src/mono/browser/runtime/icu.ts | Updated function name from mono_wasm_load_icu_data to wasm_load_icu_data |
| src/mono/browser/runtime/cwraps.ts | Updated cwraps signature for renamed function |
| src/mono/browser/runtime/assets.ts | Updated function call to use renamed wasm_load_icu_data |
| src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems | Added conditional compilation for CoreCLR-specific Interop.Locale file |
| src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs | Added JavaScriptNative library constant |
| src/libraries/Common/src/Interop/Browser/Interop.Locale.CoreCLR.cs | New CoreCLR-specific locale interop using LibraryImport |
| src/coreclr/vm/wasm/callhelpers-reverse.cpp | Added CalendarData_EnumCalendarInfoCallback reverse thunk for globalization |
| src/coreclr/hosts/corerun/wasm/libCorerun.extpost.js | Commented out invariant globalization setting |
src/libraries/Common/src/Interop/Browser/Interop.Locale.CoreCLR.cs
Outdated
Show resolved
Hide resolved
pavelsavara
left a comment
There was a problem hiding this comment.
Good job, thanks for doing it!
|
Great work. The reverse helper function will be regenerated, that should still work fine though. |
This PR implements the choosing, downloading the proper ICU shard into the memory and then activating it.
Changes:
loadIcuDatafunction inhost.tsto allocate and initialize ICU.loadIcuDatafunction.coreclr_wasm_load_icu_dataand related linkage functions to the ICU shim C file.ENV["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "true";in thelibBrowserHost.footer.jsandlibCorerun.extpost.jsallowing ICU-based globalization to be used when ICU data is loaded.Resolves #120220