Build wasm JIT and crossgen2 R2R of System.Private.CoreLib for browser target#127935
Open
davidwrighton wants to merge 1 commit intodotnet:mainfrom
Open
Build wasm JIT and crossgen2 R2R of System.Private.CoreLib for browser target#127935davidwrighton wants to merge 1 commit intodotnet:mainfrom
davidwrighton wants to merge 1 commit intodotnet:mainfrom
Conversation
…r target Enable 'build.cmd clr+libs -os browser' to: 1. Build clrjit_universal_wasm_x64 (the wasm-targeting JIT for the host platform) 2. Build crossgen2 that can use the wasm JIT 3. Run crossgen2 on System.Private.CoreLib to produce a .wasm R2R output Key changes: - eng/Subsets.props: Remove wasm exclusion from cross-arch build; use ClrWasmJitSubset - src/coreclr/CMakeLists.txt: Early-return for wasm cross-component (only JIT+deps) - src/coreclr/jit/CMakeLists.txt: Create clrjit_universal_wasm_* target - src/coreclr/gcinfo/CMakeLists.txt: Create gcinfo_universal_wasm library - src/coreclr/crossgen-corelib.proj: Enable crossgen2 for browser with wasm format - eng/native/configureplatform.cmake: Guard emscripten flags from cross-component builds - Fix missing PROFILING_SUPPORTED guards in JIT wasm codegen Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CoreCLR build and crossgen plumbing to enable a browser/wasm-targeting “cross-components” build that produces a wasm-targeting standalone JIT (clrjit_universal_wasm_*), builds a crossgen2 that can consume that JIT, and runs crossgen2 over System.Private.CoreLib to emit a wasm object/container output.
Changes:
- Enable building the wasm-targeting standalone JIT and its gcinfo dependency under wasm targeting.
- Adjust subset/build logic so wasm targets build only the needed cross-component pieces (wasm JIT subset) rather than all cross-arch JITs.
- Enable browser corelib crossgen2 invocation with
--obj-format:wasmand a wasm-specific codegen option; tighten a few wasm/cross-component guards (profiling, natvis, emscripten flags).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| eng/Subsets.props | Enables cross-component builds for wasm targets and selects ClrWasmJitSubset instead of ClrAllJitsSubset when targeting wasm. |
| eng/native/configureplatform.cmake | Avoids applying emscripten-specific compile/link flags to cross-component builds. |
| src/coreclr/CMakeLists.txt | Adds an early-return path for wasm cross-components builds and ensures jitinterface is configured for browser when cross-component building. |
| src/coreclr/crossgen-corelib.proj | Enables browser crossgen2 with wasm obj-format and a wasm-specific codegen opt; sets wasm output path. |
| src/coreclr/gcinfo/CMakeLists.txt | Adds gcinfo_universal_wasm library creation for wasm-targeting builds. |
| src/coreclr/jit/CMakeLists.txt | Creates clrjit_universal_wasm_${ARCH_HOST_NAME} when targeting wasm. |
| src/coreclr/jit/compiler.cpp | Guards verbose printing of profiler-hook state behind PROFILING_SUPPORTED. |
| src/coreclr/jit/codegenwasm.cpp | Guards genProfilingLeaveCallback definition behind PROFILING_SUPPORTED. |
| src/coreclr/tools/aot/crossgen2/crossgen2.props | Allows shipping/picking up jitinterface content for wasm scenarios when CrossHostArch is set. |
| src/coreclr/utilcode/CMakeLists.txt | Skips linking natvis into utilcode_dac when targeting wasm (where that target isn’t built). |
Comment on lines
+187
to
+196
| # For wasm cross-component builds, only the JIT and jitinterface are needed. | ||
| # Skip subsystems (GC, VM, debug, etc.) that don't support wasm as a target. | ||
| if(CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_TARGET_ARCH_WASM) | ||
| include_directories("inc") | ||
| include_directories("minipal") | ||
| add_subdirectory(utilcode) | ||
| add_subdirectory(gcinfo) | ||
| add_subdirectory(jit) | ||
| return() | ||
| endif() |
Open
3 tasks
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.
Note
This PR was created with assistance from GitHub Copilot.
Enable
build.cmd clr+libs -os browserto:clrjit_universal_wasm_x64(the wasm-targeting JIT for the host platform)Changes
_BuildAnyCrossArch; useClrWasmJitSubsetfor wasm targetsclrjit_universal_wasm_*when target=wasmgcinfo_universal_wasmlibrary--obj-format:wasmand--codegenopt:JitWasmNyiToR2RUnsupported=1; output asSystem.Private.CoreLib.NotReadyYet.wasm#ifdef PROFILING_SUPPORTEDguards