dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.37k stars 189 forks source link

[NativeAOT-LLVM] Implement most of globalization #2490

Closed SingleAccretion closed 5 months ago

SingleAccretion commented 5 months ago

How this works: 1) At runtime build time, we receive a transport package with the ICU libraries and data (icudt.dat and friends). 2) We package the data file into a static library with some inline assembly magic. We add a bit of code to the shim to locate the symbol in this static library, and tweak the CoreLib code to invoke that path on NativeAOT+WASM. 3) We package all of the resulting ICU static libraries into the runtime package, just like libSystem.Native.a and friends. 4) We link in the necessary pieces with the usual mechanism.

Overall few changes are required, but this is notably different from what Mono does, which runs some code at runtime startup that locates the ICU data (either by downloading it, or from the file system, or from the single-file bundle). It means that our DotNetJsApi case will still use the static data, but do that startup thing too. We can cross the bridge of reconciling these two approaches once DotNetJsApi gets a little more mature.

Another part not yet working is the time zone data, which uses Mono-specific bundling mechanism. It is the last undefined symbol for HelloWasm targeting WASI, I will tackle it separately (in #2491).

SingleAccretion commented 5 months ago

@dotnet/nativeaot-llvm

jkotas commented 5 months ago

FYI: Likely conflict with https://github.com/dotnet/runtime/pull/97216