Uh oh!
There was an error while loading. Please reload this page.
[browser][CoreCLR] Loading Webcil - JS part - #124758
Conversation
Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung |
There was a problem hiding this comment.
Pull request overview
This PR adds JavaScript support for loading Webcil 1.0 assemblies in the browser/WASM environment, split from the larger PR #124268. The implementation enables CoreCLR on browser to load assemblies packaged in the Webcil format by instantiating .wasm wrapper modules, extracting the raw Webcil payload, and registering it in memory with proper 16-byte alignment.
Changes:
- Added new
instantiateWebcilModule()function that instantiates Webcil.wasmwrappers, extracts payloads via exported functions, and registers them under.dllvirtual paths - Exposed
getWasmMemory()andgetWasmTable()functions to access WebAssembly memory and table from native browser exports - Updated asset loading logic to detect
.wasmassemblies, classify them as "webcil10" behavior, and route them through the new instantiation path - Replaced hardcoded pointer size constant (4) with exported
sizeOfPtrconstant for better maintainability - Removed "WASM-TODO: webCIL" comment as the feature is now implemented
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Native.Browser/native/index.ts | Added getWasmMemory/getWasmTable exports to native browser module |
| src/native/libs/Common/JavaScript/types/public-api.ts | Added "webcil10" asset behavior type |
| src/native/libs/Common/JavaScript/types/exchange.ts | Added type definitions for getWasmMemory/getWasmTable and instantiateWebcilModule |
| src/native/libs/Common/JavaScript/types/ems-ambient.ts | Added wasmMemory and wasmTable properties to Emscripten ambient symbols |
| src/native/libs/Common/JavaScript/per-module/index.ts | Exported sizeOfPtr constant (value 4 for WASM32) |
| src/native/libs/Common/JavaScript/loader/run.ts | Removed "WASM-TODO: webCIL" comment as feature is implemented |
| src/native/libs/Common/JavaScript/loader/dotnet.d.ts | Added "webcil10" to public API type definitions |
| src/native/libs/Common/JavaScript/loader/assets.ts | Added webcil detection in fetchDll, memory promise controller, behavior/content-type mappings, and integration with instantiateWebcilModule |
| src/native/libs/Common/JavaScript/host/index.ts | Added instantiateWebcilModule to host exports table |
| src/native/libs/Common/JavaScript/host/host.ts | Replaced hardcoded 4 with sizeOfPtr constant, added .wasm to .dll path mapping |
| src/native/libs/Common/JavaScript/host/assets.ts | Implemented instantiateWebcilModule with version validation, payload extraction, and 16-byte aligned memory registration; updated instantiateWasm signature |
| src/native/libs/Common/JavaScript/cross-module/index.ts | Added mapping for new exports in cross-module tables |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Split of JS part of #124268
instantiateWebCILModule()in host assets:.wasmwrapper as a WebAssembly modulegetWebcilSize/getWebcilPayloadexports to extract the raw WebCIL.dllvirtual path.getWasmMemory/getWasmTable