Revert "[RyuJit/WASM] Remove the special prolog handling" - #130148
Revert "[RyuJit/WASM] Remove the special prolog handling"#130148jkotas wants to merge 2 commits into
Conversation
This reverts commit 0d72d09.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
This reverts commit 39c986f.
There was a problem hiding this comment.
Pull request overview
This PR reverts #128721 by reintroducing explicit “currently generating prolog/epilog” state in Compiler and using that state throughout codegen/unwind/emitter logic, including moving WASM register-parameter homing out of the prolog.
Changes:
- Introduce
Compiler::compGeneratingProlog/compGeneratingEpilogand scope them viaScopedSetVariablein prolog/epilog (and funclet prolog/epilog) generation paths. - Remove
emitter::emitGeneratingPrologOrFuncletProlog()/emitGeneratingEpilogOrFuncletEpilog()and convert most call sites to the new compiler flags. - For WASM, split
genHomeRegisterParamsand inject the real work into the first basic block (genHomeRegisterParamsOutsideProlog) to avoid prolog size restrictions.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/unwindx86.cpp | Switch prolog/epilog assertions to compiler generation flags. |
| src/coreclr/jit/unwindwasm.cpp | Switch prolog/epilog assertions to compiler generation flags. |
| src/coreclr/jit/unwindriscv64.cpp | Switch prolog checks in CFI/unwind helpers to compiler generation flags. |
| src/coreclr/jit/unwindloongarch64.cpp | Switch prolog checks in CFI/unwind helpers to compiler generation flags. |
| src/coreclr/jit/unwindarmarch.cpp | Switch prolog/epilog checks in unwind helpers to compiler generation flags. |
| src/coreclr/jit/unwindarm64.cpp | Switch prolog checks (incl. PAC CFI emission gating) to compiler generation flags. |
| src/coreclr/jit/unwindamd64.cpp | Switch prolog/epilog checks in unwind helpers to compiler generation flags. |
| src/coreclr/jit/unwind.cpp | Switch CFI helper assertions/conditions to compiler generation flags. |
| src/coreclr/jit/scopeinfo.cpp | Switch prolog scope assertions to compiler generation flags. |
| src/coreclr/jit/regset.cpp | Use compiler generation flags to allow register-modification tracking during prolog/epilog. |
| src/coreclr/jit/emitxarch.cpp | Switch prolog-only assertion to compiler generation flags. |
| src/coreclr/jit/emitriscv64.cpp | Gate RISC-V compressed/immediate emission decisions on compiler generation flags. |
| src/coreclr/jit/emitpub.h | Remove emitGenerating* APIs from the emitter public surface. |
| src/coreclr/jit/emit.h | Adjust emitter initialization logic related to current-IG state. |
| src/coreclr/jit/emit.cpp | Remove emitGenerating* helpers; switch key asserts to compiler generation flags; minor IG init adjustment. |
| src/coreclr/jit/compiler.h | Add compGeneratingProlog / compGeneratingEpilog flags to Compiler. |
| src/coreclr/jit/codegenxarch.cpp | Set compGeneratingEpilog/compGeneratingProlog during epilog/funclet prolog/epilog generation; update asserts. |
| src/coreclr/jit/codegenwasm.cpp | Make genHomeRegisterParams empty and move homing logic into genHomeRegisterParamsOutsideProlog; set compGeneratingEpilog in epilogs; update asserts in prolog helpers. |
| src/coreclr/jit/codegenriscv64.cpp | Set compiler generation flags for funclet prolog/epilog and main epilog; update asserts. |
| src/coreclr/jit/codegenloongarch64.cpp | Set compiler generation flags for funclet prolog/epilog and main epilog; update asserts. |
| src/coreclr/jit/codegenlinear.cpp | Call WASM register-param homing in the first basic block; adjust poisoning comment. |
| src/coreclr/jit/codegencommon.cpp | Set compGeneratingProlog during main prolog; update several prolog-only asserts to compiler flag. |
| src/coreclr/jit/codegenarmarch.cpp | Set compGeneratingEpilog during main epilog; update prolog asserts. |
| src/coreclr/jit/codegenarm64.cpp | Set compiler generation flags for funclet prolog/epilog; update asserts. |
| src/coreclr/jit/codegenarm.cpp | Set compiler generation flags for funclet prolog/epilog; update asserts. |
| src/coreclr/jit/codegen.h | Add WASM-only declaration for genHomeRegisterParamsOutsideProlog. |
Copilot Code ReviewHolistic AssessmentMotivation: This PR reverts PR #128721 ("[RyuJit/WASM] Remove the special prolog handling") and its follow-up fix #130131. The revert is authored by a core maintainer (jkotas), indicating the original change caused problems that warranted a full rollback. Reverting problematic changes is the standard process when issues are discovered post-merge. Approach: This is a clean mechanical revert of two commits. The resulting code restores the prior approach of using explicit Summary: ✅ LGTM. This is a straightforward revert by a core maintainer. The changes are consistent across all affected platforms (x86, ARM, ARM64, LoongArch64, RISC-V64, WASM) and all prolog/epilog/funclet code paths correctly use the Detailed FindingsDetailed Findings✅ Correctness — Consistent state management across all platformsAll prolog entry points ( ✅ Correctness — WASM prolog overflow workaround restoredThe WASM-specific ✅ Consistency — Emitter assertions updated correctlyThe emitter's ✅ Minor cleanup —
|
Reverts #128721
Fixes #130145