dotnet / dotnet/runtime

[wasm][R2R] Integrate CoreCLR ReadyToRun into wasi-wasm publish

Open
#132,983 1 comment 0 reactions 0 assignees View on GitHub
arch-wasm area-ReadyToRun
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

CoreCLR ReadyToRun code cannot be instantiated dynamically inside a WASI component, so publishing must place the generated R2R core module in the same component as the runtime. A prototype now demonstrates this end to end with a framework-scale composite: crossgen2 emits self-installing data/table segments, the non-PIC host supplies the shared memory/table/globals/tag, and a composition step merges the modules before rebuilding the component.

The remaining work is to integrate that proven path into the `wasi-wasm` publish pipeline rather than requiring a hand-driven splice.

Proposed scope:

- Generate the composite R2R image before linking the per-app WASI host.
- Derive the payload size and function-table requirement from that image.
- Link the host with exact image and table capacity rather than fixed manual values.
- Compose the host and R2R modules into the final WASI component.
- Publish the component forwarding stubs alongside the application assemblies.
- Preserve interpreter fallback for methods unsupported by wasm R2R.
- Add an end-to-end test that proves an R2R method executes rather than accepting a successful interpreted run.

This issue tracks the non-PIC composition path. Emitting a conforming relocatable wasm object for direct `wasm-ld` integration, and making the complete runtime PIC for `dylink.0` composition, are separate architectural follow-ups.

> [!NOTE]
> This issue was drafted with GitHub Copilot.

Contributor guide

Open the contributing guide

Research direction

Trace the wasi-wasm publish pipeline, crossgen2 composite generation, the per-app WASI host link, and the module composition step. Use the prototype path described in the issue as the starting reference, then identify how payload size and table capacity flow through publishing. Done means the final component contains the R2R module and forwarding stubs, preserves interpreter fallback, and an end-to-end test proves an R2R method executes.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
build-system, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.