Skip to content

Conversation

AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Aug 30, 2025

  • Separate call invokers between JIT compatible interpreter and interpreter with Portable EntryPoints.
  • Native asserts now emit a managed stackwalk with IR offsets of interpreter frames

Current output of corewasmrun running on Chrome.

coreclr_initialize succeeded - retval: 0x00000000
onExit, code: 0

Fixes #119001

Separate call invokers between JIT compatible interpreter
and interpreter with Portable EntryPoints.
@AaronRobinsonMSFT
Copy link
Member Author

/cc @steveisok

@jkotas jkotas requested a review from radekdoulik August 30, 2025 05:51
@AaronRobinsonMSFT
Copy link
Member Author

/azp list

Copy link

CI/CD Pipelines for this repository:

Add simple interpreter managed frame stack walker when
native assert fires. This will help debugging asserts in interpreter
scenarios.
@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Initial P/Invokes on WASM Make coreclr_initialize run cleanly for corewasmrun Sep 1, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT marked this pull request as ready for review September 1, 2025 00:10
@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 00:10
Copilot

This comment was marked as outdated.

@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Make coreclr_initialize run cleanly for corewasmrun Make coreclr_initialize runs cleanly for corewasmrun Sep 1, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Make coreclr_initialize runs cleanly for corewasmrun Make coreclr_initialize run cleanly for corewasmrun Sep 1, 2025
Copy link
Contributor

@Copilot 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 implements support for making coreclr_initialize run cleanly for corewasmrun by separating call invokers between JIT-compatible interpreters and interpreters with Portable EntryPoints. The changes enable proper execution of CoreCLR with the interpreter on WebAssembly platforms.

Key changes:

  • Implements separate call invokers for interpreted vs. JIT-compiled methods on WASM
  • Adds support for Portable EntryPoints in the JIT helper system
  • Introduces WASM-specific calling convention thunks for unmanaged code interop

Reviewed Changes

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

Show a summary per file
File Description
src/coreclr/vm/wasm/helpers.cpp Implements WASM-specific call invokers and calli signature thunks
src/coreclr/vm/wasm/cgencpu.h Updates stack element size calculation for interpreter compatibility
src/coreclr/vm/wasm/calldescrworkerwasm.cpp Updates call descriptor worker to use Portable EntryPoints
src/coreclr/vm/threads.cpp Adds WASM-specific guards for patched helper assertions
src/coreclr/vm/prestub.cpp Adds interpreter data handling for IL stubs under Portable EntryPoints
src/coreclr/vm/precode_portable.hpp Extends Portable EntryPoint with state query methods and native initialization
src/coreclr/vm/precode_portable.cpp Implements new Portable EntryPoint functionality and validation
src/coreclr/vm/mlinfo.cpp Adds WASM-specific assertion for stack element size validation
src/coreclr/vm/jitinterface.h Updates helper function structure to support Portable EntryPoints
src/coreclr/vm/jitinterface.cpp Implements Portable EntryPoint support in JIT helper resolution
src/coreclr/vm/jithelpers.cpp Updates helper table structure and dynamic helper loading
src/coreclr/vm/interpexec.cpp Refactors call invokers and adds debug stack printing for WASM
src/coreclr/vm/dllimport.cpp Ensures vararg P/Invoke methods get precodes
src/coreclr/vm/callingconvention.h Updates argument offset calculation for interpreter stack alignment
src/coreclr/vm/callhelpers.h Removes unused fields from CallDescrData for WASM
src/coreclr/vm/callhelpers.cpp Updates call descriptor data initialization for WASM
src/coreclr/pal/src/arch/wasm/stubs.cpp Adds interpreter stack printing to debug break handler
src/coreclr/inc/regdisp.h Adds WASM-specific case for context pointer filling
src/coreclr/debug/ee/controller.cpp Updates helper function address comparison and logging format
src/coreclr/debug/daccess/daccess.cpp Updates helper function address comparison for new structure

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM (modulo fixes for breaks that I have introduced by the last commit :)

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit 63d560a into dotnet:main Sep 3, 2025
98 checks passed
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the wasm_qcalls branch September 3, 2025 21:01
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-VM-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm coreclr] pinvoke / Qcalls

6 participants