Repository navigation
Add a CI check that the checked-in wasm CoreCLR call helpers are up to date - #135156
Merged
Merged
Conversation
…o date The browser and wasi call-helper tables under src/coreclr/vm/wasm/ are generated from the framework's [UnmanagedCallersOnly] methods, P/Invokes and QCalls, but nothing verified they matched the managed code. A stale table builds fine and crashes the corerun that links it at startup. - generate-coreclr-helpers.proj: add CallHelperTargetOS (browser|wasi) so a build that produced one flavor can regenerate just that flavor; expose it as -t/--target-os in the .sh/.cmd scripts. - Default the scripts to Release. Entries are identical across Debug, Release and Checked, but the per-import assembly comments are not (library trimming differs), so the tables are canonically generated from Release, which is what CI builds. - New wasm-coreclr-callhelpers-check.yml step, run on the Release browser_wasm CoreCLR leg (Linux host) and the wasi_wasm CoreCLR build-only leg: regenerates the leg's flavor and fails with the diff and the fix commands when src/coreclr/vm/wasm/<os>/ changes. - New wasm_coreclr_callhelpers path subset (library sources, CoreLib, crossgen2 ReadyToRun/Common, WasmPInvokeModules.props) so managed-only changes run those legs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The wasi tables predated moving the SocketAsyncEngine interop into CoreLib (#130463) and were generated from Debug libraries. Only the per-import assembly comments change; the entries are identical. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 6 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The Windows script cannot process --target-os and mishandles help arguments because its target label is missing.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds CI validation to keep checked-in CoreCLR WebAssembly call-helper tables synchronized with managed framework code.
Changes:
- Adds target-specific helper generation for browser and WASI.
- Runs regeneration checks in existing CI legs with expanded path triggers.
- Documents Release as canonical and refreshes WASI comments.
Summary: Needs changes because the Windows wrapper’s new argument parsing is broken.
| File | Description |
|---|---|
src/coreclr/vm/wasm/wasi/callhelpers-pinvoke.cpp |
Refreshes generated assembly comments. |
src/coreclr/vm/wasm/generate-coreclr-helpers.sh |
Adds target selection and Release default. |
src/coreclr/vm/wasm/generate-coreclr-helpers.proj |
Supports target-specific generation. |
src/coreclr/vm/wasm/generate-coreclr-helpers.md |
Documents generation and CI validation. |
src/coreclr/vm/wasm/generate-coreclr-helpers.cmd |
Adds Windows target selection; contains a blocking parser defect. |
eng/pipelines/runtime.yml |
Hooks checks into browser and WASI legs. |
eng/pipelines/common/templates/wasm-coreclr-callhelpers-check.yml |
Implements regeneration comparison. |
eng/pipelines/common/templates/wasi-wasm-coreclr-build-only.yml |
Adds the WASI post-build check. |
eng/pipelines/common/evaluate-default-paths.yml |
Adds relevant path triggers. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Oct 3, 2026
lewing
marked this pull request as ready for review
October 3, 2026 14:35
This was referenced Oct 3, 2026
akoeplinger
approved these changes
Oct 5, 2026
radekdoulik
approved these changes
Oct 5, 2026
radekdoulik
left a comment
Member
There was a problem hiding this comment.
LGTM, it would be nice to have it produce patch file in the artifacts.
Member
Author
|
/ba-g failures are unrelated |
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.

The checked-in CoreCLR WebAssembly call-helper tables (
src/coreclr/vm/wasm/{browser,wasi}/callhelpers-*.cpp) are generated from the framework's[UnmanagedCallersOnly]methods, P/Invokes and QCalls. Nothing checked that they still match the managed code. A stale table still builds, but the corerun that links it crashes. #134978 enabledFEATURE_PERFTRACINGon WASI without regenerating the tables. TheEventPipeEventProvider.Callbackreverse thunk was missing, and every corerun built from the checked-in tables then failed at startup withGetUnmanagedCallersOnlyThunk: unknown thunkinCoreCLR_WASI_RuntimeTests. Library tests did not catch it because app relink generates per-app tables.Related: #133187
Changes
generate-coreclr-helpers.projgains an optionalCallHelperTargetOSproperty (browserorwasi). The.shand.cmdscripts expose it as-t/--target-os, so a build that produced only one flavor can regenerate just that flavor. An invalid value gets a clear error.eng/pipelines/common/templates/wasm-coreclr-callhelpers-check.ymlregenerates the leg's own flavor. Ifsrc/coreclr/vm/wasm/<os>/then differs from what is committed, it fails with a##vsoerror, the diff, and the exact build and regenerate commands. It runs as a post-build step on two existing legs, so no new leg is added:browser_wasmCoreCLR leg (Linux host only; the step skips itself onbrowser_wasm_win);wasi_wasmCoreCLR build-only leg.wasm_coreclr_callhelperspath subset is OR'd into both legs' conditions, so managed-only interop changes run the check. It coverssrc/libraries/*/src/*,src/coreclr/System.Private.CoreLib/*,src/coreclr/tools/aot/ILCompiler.ReadyToRun/*,src/coreclr/tools/Common/*,src/coreclr/vm/wasm/*andeng/wasm/WasmPInvokeModules.props. This deliberately widens which library PRs run these two legs.-c Release.generate-coreclr-helpers.mddocuments--target-os, the canonical configuration, and the CI check.wasi/callhelpers-pinvoke.cpp, so the check starts green.Does the output depend on configuration?
I regenerated the tables from several configurations and diffed the results:
clr+libs -c ...)System.Net.NameResolutionstill referencesSystemNative_GetErrNo; Release trims it.-rc Checked -lc Release)mainEntries do not depend on configuration, so one set of tables serves every configuration's corerun. Only the
// <assembly>, ...comments on P/Invoke entries vary, because library trimming differs by configuration. Release is therefore the canonical configuration: CI builds Release, and the check compares against it exactly. The WASI table onmainhad been generated from Debug libraries. It also predated #130463, which moved the WASI socket interop into CoreLib. Regenerating from Release changes three comments:Validation (local, macOS arm64 host)
./build.sh clr+libs -os wasi -c Release./build.sh clr+libs -os wasi -c Debug./build.sh clr+libs -os wasi -rc Checked -lc Release./build.sh clr+libs -os browser -c Release/-c DebugEMSDK_PYTHONpointing at Python ≥ 3.10 locally)src/coreclr/vm/wasm/generate-coreclr-helpers.sh -c Release --target-os wasiwasi/,browser/untouchedsrc/coreclr/vm/wasm/generate-coreclr-helpers.sh -c Release --target-os browsermainsrc/coreclr/vm/wasm/generate-coreclr-helpers.sh(no--target-os)generate-coreclr-helpers.sh -t fooInvalid target OS "foo"dotnet build generate-coreclr-helpers.proj -t:GenerateCallHelpers -p:CallHelperTargetOS=linuxUnknown CallHelperTargetOS 'linux'osGroup=wasi,_BuildConfig=Release, onmain's stale WASI tableNot validated: the pipeline YAML (the step template, the leg hookups, and the new path subset with its conditions) can only be verified in CI. The
.cmdchanges have not been run on Windows.Note
This PR description was generated with the help of GitHub Copilot.