Skip to content

Conversation

@AndyAyersMS
Copy link
Member

Allow passing -target wasm when using a Wasm cross-jit.

Allow passing `-target wasm` when using a Wasm cross-jit.
Copilot AI review requested due to automatic review settings December 12, 2025 23:04
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 12, 2025
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 WebAssembly (WASM) as a valid SPMI (Super PMI - a JIT testing tool) target architecture, enabling cross-compilation support for wasm/wasm32/wasm64 targets. The changes extend the existing architecture enumeration, command-line parsing, and target matching logic to recognize WebAssembly platforms.

Key changes:

  • Added WASM32 and WASM64 to the SPMI target architecture enumeration and classification functions
  • Extended command-line parsing to accept "wasm", "wasm32", and "wasm64" as valid target values
  • Updated architecture matching logic to support WASM32 (note: WASM64 support is incomplete)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/coreclr/tools/superpmi/superpmi-shared/spmiutil.h Adds WASM32 and WASM64 enum values and updates 32-bit/64-bit architecture helper functions
src/coreclr/tools/superpmi/superpmi-shared/spmiutil.cpp Adds TARGET_WASM32 and TARGET_WASM64 preprocessor conditionals for default architecture initialization
src/coreclr/tools/superpmi/superpmi/commandline.cpp Updates help text and command-line validation to accept wasm/wasm32/wasm64 as target values
src/coreclr/tools/superpmi/superpmi/superpmi.cpp Adds string-to-enum mapping for "wasm"/"wasm32" → WASM32 and "wasm64" → WASM64
src/coreclr/tools/superpmi/superpmi/jitinstance.cpp Refactors switch from IMAGE_FILE_MACHINE constants to CORINFO_ARCH constants and adds CORINFO_ARCH_WASM32 case

@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib PTAL

Also a bit of support for Wasm64.

Running (as jit) on a subset of codegen bring up tests:

>> superpmi.exe \clrjit_universal_wasm_x64.dll basic.mch -target wasm
Using jit(clrjit_universal_wasm_x64.dll) with input (basic.mch)
 indexCount=-1 ()
Jit startup took 7.340200ms
MISSING: Method context 1 failed to replay: SuperPMI assertion failed (missing map GetClassAlignmentRequirement): key 00007FFEA4B530E8
MISSING: Method context 2 failed to replay: SuperPMI assertion failed (missing map GetClassAlignmentRequirement): key 00007FFEA4B530E8
   1: JIT compiled BringUpTest_Add1:Add1(int):int [MinOpts, IL size=9, code size=13, hash=0xd655d0d8]
   2: JIT compiled BringUpTest_And1:And1(int):int [MinOpts, IL size=9, code size=13, hash=0x507a7698]
   3: JIT compiled BringUpTest_Args4:Args4(int,int,int,int):int [MinOpts, IL size=13, code size=22, hash=0x6912b5e7]
   4: JIT compiled BringUpTest_Args5:Args5(int,int,int,int,int):int [MinOpts, IL size=16, code size=26, hash=0xd5644518]
   5: JIT compiled BringUpTest_AsgAdd1:AsgAdd1(int):int [MinOpts, IL size=12, code size=17, hash=0x5f2e7fd8]
   6: JIT compiled BringUpTest_AsgAnd1:AsgAnd1(int):int [MinOpts, IL size=12, code size=17, hash=0x0cda2158]
   7: JIT compiled BringUpTest_AsgOr1:AsgOr1(int):int [MinOpts, IL size=13, code size=17, hash=0x224b6ff8]
   8: JIT compiled BringUpTest_AsgSub1:AsgSub1(int):int [MinOpts, IL size=12, code size=17, hash=0x9de99718]
   9: JIT compiled BringUpTest_AsgXor1:AsgXor1(int):int [MinOpts, IL size=13, code size=17, hash=0xa19d25d8]
...
Loaded 160  Jitted 160  FailedCompile 45 Excluded 0 Missing 2
Total time: 64.988700ms

Failures (not shown) are mainly for tests with calls/byrefs/casts/unordered compares.

@AndyAyersMS
Copy link
Member Author

Odd that CI skips superpmi runs for changes to superpmi sources. Probably need to adjust some triggers somewhere.

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr superpmi-replay

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Contributor

@adamperlin adamperlin left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@am11 am11 added the arch-wasm WebAssembly architecture label Dec 16, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS AndyAyersMS merged commit 35ccd52 into dotnet:main Dec 16, 2025
100 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants