Skip to content

Comments

[browser][CoreCLR] Loading Webcil - JS part#124758

Merged
pavelsavara merged 1 commit intodotnet:mainfrom
pavelsavara:loading_webcil1_js
Feb 23, 2026
Merged

[browser][CoreCLR] Loading Webcil - JS part#124758
pavelsavara merged 1 commit intodotnet:mainfrom
pavelsavara:loading_webcil1_js

Conversation

@pavelsavara
Copy link
Member

Split of JS part of #124268

  • New instantiateWebCILModule() in host assets:
    • instantiates the .wasm wrapper as a WebAssembly module
    • calls getWebcilSize/getWebcilPayload exports to extract the raw WebCIL
    • copies the payload into 16-byte aligned memory, registers it under the .dll virtual path.
  • New getWasmMemory / getWasmTable

@pavelsavara pavelsavara added this to the 11.0.0 milestone Feb 23, 2026
@pavelsavara pavelsavara self-assigned this Feb 23, 2026
Copilot AI review requested due to automatic review settings February 23, 2026 16:36
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm labels Feb 23, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .wasm wrappers, extracts payloads via exported functions, and registers them under .dll virtual paths
  • Exposed getWasmMemory() and getWasmTable() functions to access WebAssembly memory and table from native browser exports
  • Updated asset loading logic to detect .wasm assemblies, classify them as "webcil10" behavior, and route them through the new instantiation path
  • Replaced hardcoded pointer size constant (4) with exported sizeOfPtr constant 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

@pavelsavara pavelsavara merged commit 202f33c into dotnet:main Feb 23, 2026
142 of 146 checks passed
@pavelsavara pavelsavara deleted the loading_webcil1_js branch February 23, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants