Repository navigation
Add app-specific CoreCLR WASM FCall trimming - #136655
Conversation
Generate ECall manifests from runtime headers and emit app-specific tables from surviving CoreLib InternalCalls. Integrate discardable native descriptors, browser and WASI relinking, manifest generation and staging, and coverage for the shared parser and table generation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/crossgen-contrib |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
|
Tagging subscribers to this area: @agocke |
Stage CoreCLR WASM native assets for WASI, exclude ECall headers from NativeAOT builds, and avoid CA1866 in the shared runtime header parser. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
(bonus points for unifying the scheme with NAOT too) |
jkotas
left a comment
There was a problem hiding this comment.
DllImports/QCalls and FCalls are the same problem. Can we unify the lookup tables for the two so that we do not have to have two different infras to look them up and trim them?
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> # Conflicts: # src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs
Resolve fixed-address FCalls through the shared native QCall table and generate app-specific WASM bindings in callhelpers-pinvoke.cpp. Preserve existing QCall ordering and dynamic String bindings while removing the separate ECall export infrastructure and unused-entry diagnostics. Update browser/WASI helper snapshots, trimming coverage, and runtime documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Pushed a commit with the new design to run it against CI, but switched this back to draft while I polish it. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The PR description still describes a different implementation and needs to clarify which reported measurements and validation runs cover the current shared QCall/FCall table design.
1 open issue
4 resolved since last review
Review effort: Balanced
Keep validation FCall declarations and the GC-mode QCall available in all CoreLib configurations. Preserve the declarations during library trimming without rooting them in applications, and use the generated resolver for prebuilt WebAssembly runtimes. Remove the skip-table option and special native archive placement. Use RuntimeHelper_ identifiers for generated ABI aliases and cover the shared table in generator tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Drop the obsolete Agile qualifier from IsImmutableException in the managed declaration and callers, matching native implementation, shared entrypoint table, generated WebAssembly snapshots, and documentation example. Exception immutability behavior and ABI signatures are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Leave browser memmove/memset wrapper resolution to the generated tables. Remove their declarations and special-case entries from runtimehelpers.cpp while preserving the libc entries and SunOS workaround. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Conflicts |
Reconcile the upstream managed memory-pressure implementation with named FCall bindings. Register the four new GC helpers as C-linkage functions, update memory-pressure event QCalls, retain removal of ecalllist.h, and regenerate both WASM helper snapshots. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/ba-g work item failed to launch |



Extend CoreCLR's existing QCall entrypoint lookup to cover FCalls, so browser and WASI application relinking can discard native FCall implementations when their managed
InternalCalldeclarations have been trimmed.Approach
ecalllist.hregistrations with C-linkageType_Methodimplementations and the shared QCall/FCall entrypoint resolver on all CoreCLR platforms. Ordinary FCalls derive their lookup name from CoreLib metadata and cache the resolved native address. The non-WASM static table is sorted and uses binary search.callhelpers-pinvoke.cpp.There is no FCall manifest, source-line descriptor scheme, table-layout SDK header, or fourth generated helper source. Application-specific native trimming remains WASM-only; the named FCall binding mechanism is shared across CoreCLR platforms.
Validation
The following local runs cover the current shared-table implementation, including commit
2c58a649758:ExceptionDispatchInfotests passed on Windows Debug, with no failures or skips.WasmArgumentLayoutTestspassed in each of Windows Debug, browser Release, and WASI Release (384 executions total), with no failures or skips.Earlier shared-table validation also checked browser/WASI Debug-versus-Release generated-table parity, deterministic regeneration, and removal of unused validation helpers during application trimming. Those checks preceded the naming-only cleanups; they are not being presented as fresh runs at the latest commit.
Debug/Checked WASM native builds and the full cross-platform test matrix were not run locally for this revision. These results do not assert CI completion.
Size measurements
The previously reported focused-smoke and Havit Bootstrap size numbers were measured against the superseded descriptor/manifest prototype. They have been removed because they do not establish savings for the current shared-table design. Native payload size, compressed payload size, and startup/performance measurements have not been rerun for this implementation.
Note
This implementation and PR description were generated with GitHub Copilot.