Skip to content

[Wasm RyuJit] Add JIT config JitWasmNyiToR2RUnsupported#125752

Merged
AndyAyersMS merged 4 commits intodotnet:mainfrom
AndyAyersMS:WasmNYIR2ROptOut
Mar 19, 2026
Merged

[Wasm RyuJit] Add JIT config JitWasmNyiToR2RUnsupported#125752
AndyAyersMS merged 4 commits intodotnet:mainfrom
AndyAyersMS:WasmNYIR2ROptOut

Conversation

@AndyAyersMS
Copy link
Member

Set this to allow crossgen2 for Wasm to continue even if there is a method that runs into an NYI_WASM in the JIT.

Set this to allow crossgen2 for Wasm to continue even if
there is a method that runs into an NYI_WASM in the JIT.
Copilot AI review requested due to automatic review settings March 18, 2026 22:52
@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 Mar 18, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS
Copy link
Member Author

For example

;; default behavior

Processing 2 dependencies
Compiling [wasm-test]Program.NonLocalContinuation(int32)
Single method repro args:--singlemethodtypename "Program,wasm-test" --singlemethodname "NonLocalContinuation" --singlemethodindex 1
C:\repos\runtime2\src\coreclr\jit\fgwasm.cpp:1075
Assertion failed 'NYI_WASM: Method has blocks only reachable via EH' in 'Program:NonLocalContinuation(int):int' during 'Wasm control flow' (IL size 69; hash 0xc5ede80b; FullOpts)

Unhandled exception. System.Exception: Child process 'c:\repos\runtime2\artifacts\bin\coreclr\windows.x64.Debug\x64\crossgen2\crossgen2.exe' failed with exit code -2147483645

;; with --codegenopt:JitWasmNyiToR2RUnsupported=1

Processing 2 dependencies
Compiling [wasm-test]Program.NonLocalContinuation(int32)
Single method repro args:--singlemethodtypename "Program,wasm-test" --singlemethodname "NonLocalContinuation" --singlemethodindex 1
Info: Method `[wasm-test]Program.NonLocalContinuation(int32)` was not compiled because `JIT implementation limitation` requires runtime JIT
Compiling [wasm-test]Program.Main()
Single method repro args:--singlemethodtypename "Program,wasm-test" --singlemethodname "Main" --singlemethodindex 1
Processing 0 dependencies
Processing 1 dependencies
Moved to phase 1
Emitting R2R Wasm file: C:\Users\andya\AppData\Local\Temp\tmp4hd3w5.tmp\test-module.wasm

@AndyAyersMS
Copy link
Member Author

PTAL @dotnet/jit-contrib @davidwrighton

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

Adds a Wasm-specific JIT config intended to allow crossgen2 to continue when codegen hits NYI_WASM, by mapping those NYIs to ReadyToRun “unsupported” failures.

Changes:

  • Adds new JIT config value JitWasmNyiToR2RUnsupported under TARGET_WASM.
  • Updates NYI_WASM to optionally call implReadyToRunUnsupported() (instead of the existing NYI path) based on the new config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/coreclr/jit/jitconfigvalues.h Introduces the new Wasm config flag intended to control NYI_WASM behavior.
src/coreclr/jit/error.h Updates NYI_WASM macro to optionally convert NYIs into R2R-unsupported failures.

You can also share your feedback on Copilot code review. Take the survey.

@AndyAyersMS
Copy link
Member Author

With this set a debug SPC still runs into two methods with asserts, see #125756

Copilot AI review requested due to automatic review settings March 18, 2026 23:18
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

Adds a Wasm-specific JIT config intended to let crossgen2 continue when encountering Wasm NYI paths by mapping NYI_WASM to an R2R-unsupported failure instead of the usual NYI handling.

Changes:

  • Introduce JitWasmNyiToR2RUnsupported JIT config value under TARGET_WASM.
  • Update NYI_WASM macro to optionally call implReadyToRunUnsupported() when the config is enabled (DEBUG-only in this PR).
  • Add a Wasm NYI check in emitTypeSize and adjust Wasm codegen default handling to consult the new config.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/coreclr/jit/jitconfigvalues.h Adds the new Wasm-only JIT config knob.
src/coreclr/jit/error.h Changes NYI_WASM macro behavior based on the new config.
src/coreclr/jit/emit.h Uses NYI_WASM when emitTypeSizes[...] is unexpectedly 0.
src/coreclr/jit/codegenwasm.cpp Adds config-aware handling for unimplemented opcodes in Wasm codegen.

You can also share your feedback on Copilot code review. Take the survey.

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.

Looks good to me! This will be very useful.

@AndyAyersMS
Copy link
Member Author

OSX Build errors like:

  ld: warning: Could not find or use auto-linked library 'swiftsys_time'
  ld: warning: Could not find or use auto-linked library 'swift_time'
  ld: warning: Could not find or use auto-linked library 'swiftunistd'
  ld: warning: Could not find or use auto-linked library 'swift_Builtin_float'
  ld: warning: Could not find or use auto-linked library 'swift_math'
  ld: warning: Could not find or use auto-linked library 'swift_errno'
  ld: warning: Could not find or use auto-linked library 'swift_signal'
  ld: warning: Could not find or use auto-linked library 'swift_stdio'
  Undefined symbols for architecture arm64:
    "__swift_FORCE_LOAD_$_swift_Builtin_float", referenced from:
        __swift_FORCE_LOAD_$_swift_Builtin_float_$_pal_swiftbindings in libSystem.Security.Cryptography.Native.Apple.a(pal_swiftbindings.o)
       (maybe you meant: __swift_FORCE_LOAD_$_swift_Builtin_float_$_pal_swiftbindings)

@EgorBo
Copy link
Member

EgorBo commented Mar 19, 2026

OSX Build errors like:

That is also from #125757

@AndyAyersMS
Copy link
Member Author

/ba-g OSX build issues

@AndyAyersMS AndyAyersMS merged commit 29faf6d into dotnet:main Mar 19, 2026
111 of 129 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

5 participants