Skip to content

Conversation

@radekdoulik
Copy link
Member

As they are not used on wasm.

Let GetCurrentSP return C runtime stack pointer.

Also fix few asserts.

As they are not used on wasm.

Let `GetCurrentSP` return C runtime stack pointer.

Also fix few asserts.
@radekdoulik radekdoulik added this to the Future milestone Oct 30, 2025
@radekdoulik radekdoulik requested a review from BrzVlad as a code owner October 30, 2025 11:41
@radekdoulik radekdoulik requested a review from janvorli as a code owner October 30, 2025 11:41
Copilot AI review requested due to automatic review settings October 30, 2025 11:41
@radekdoulik radekdoulik requested a review from kg as a code owner October 30, 2025 11:41
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
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 WebAssembly (WASM) support to the CoreCLR interpreter by implementing stack pointer functionality and conditionally excluding WASM-incompatible code. The changes enable proper interpreter execution on WASM platforms.

Key changes:

  • Implements GetCurrentSP() for WASM using Emscripten's stack API
  • Conditionally disables SetInterpExecMethodSP() and related stack pointer storage on WASM
  • Replaces incorrect _ASSERTE usage with PORTABILITY_ASSERT in unimplemented WASM functions
  • Excludes floating-point register update functions from WASM compilation

Reviewed Changes

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

Show a summary per file
File Description
src/coreclr/vm/wasm/cgencpu.h Implements GetCurrentSP() using emscripten_stack_get_current() and adds Emscripten stack header include; replaces assertion macros
src/coreclr/vm/wasm/excepcpu.h Replaces _ASSERTE with PORTABILITY_ASSERT for unimplemented function
src/coreclr/debug/inc/wasm/primitives.h Replaces _ASSERTE with PORTABILITY_ASSERT for unimplemented function
src/coreclr/vm/interpexec.cpp Guards four SetInterpExecMethodSP() calls with #ifndef TARGET_WASM to disable on WASM
src/coreclr/vm/frames.h Conditionally excludes SetInterpExecMethodSP(), GetInterpExecMethodSP(), and m_SP member from WASM builds
src/coreclr/vm/frames.cpp Conditionally excludes floating-point register update functions from WASM builds

radekdoulik and others added 2 commits October 30, 2025 17:38
Co-authored-by: Aaron R Robinson <[email protected]>
Remove emitBackToBackJump
Try to keep the JumpStubStubManager just on ia64 and amd64 archs as
the comment before class declaration suggests. I suspect it is now
used in other archs too, so if that doesn't work we can ifdef it just
for wasm.
@radekdoulik radekdoulik enabled auto-merge (squash) November 3, 2025 21:56
@jkotas
Copy link
Member

jkotas commented Nov 3, 2025

Gcc build breaks:

  /__w/1/s/src/coreclr/vm/threads.cpp:6815:38: error: cannot cast from type 'TADDR' (aka 'unsigned long') to pointer type 'Frame *'
   6815 |         CONSISTENCY_CHECK((pFrame) > static_cast<Frame *>(GetCurrentSP()));

@radekdoulik
Copy link
Member Author

/ba-g the failed job is timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants