[browser][CoreCLR] Loading Webcil - JS part#124758
Merged
pavelsavara merged 1 commit intodotnet:mainfrom Feb 23, 2026
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung |
Contributor
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 |
This was referenced Feb 23, 2026
maraf
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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