Conversation
|
FYI @dotnet/jit-contrib Still a work in progress, but figured I'd ask for some feedback before getting too much further. Things I know of that are still to do:
@SingleAccretion this may be more complex than what you had envisioned. |
There was a problem hiding this comment.
Pull request overview
This PR extends the WASM JIT backend to support funclets by introducing per-funclet (region) register allocation state, per-funclet locals declarations, and basic funclet prolog codegen so EH regions can be code-generated with their own Wasm-local layouts.
Changes:
- Add per-funclet RA state (SP/FP/EX + reference tracking) and resolve/register publish logic per region.
- Teach codegen/emitter to use per-funclet SP/FP and emit per-funclet local declarations / funclet prologs.
- Update internal-register tracking to be per-funclet on targets without a fixed register set (WASM).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/regallocwasm.h | Introduces per-region RA state (SP/FP/EX + ref tracking) and new catch-arg collection hook. |
| src/coreclr/jit/regallocwasm.cpp | Implements per-funclet allocation, catch-arg rewriting, per-funclet internal-reg tables, and per-funclet locals decl generation/publishing. |
| src/coreclr/jit/lclvars.cpp | Adjusts frame-location dumping to use region-0 SP/FP on non-fixed-reg targets. |
| src/coreclr/jit/emitwasm.cpp | Extends wasm arg-count computation to support funclet signatures. |
| src/coreclr/jit/codegenwasm.cpp | Uses per-funclet SP/FP accessors and implements funclet prolog local signature emission. |
| src/coreclr/jit/codegeninterface.h | Makes SP/FP storage and internal-reg tracking per-funclet for non-fixed-reg targets; makes locals decls per-funclet. |
| src/coreclr/jit/codegencommon.cpp | Implements non-fixed-reg per-funclet NodeInternalRegisters tables and initializes per-funclet SP/FP/locals storage. |
SingleAccretion
left a comment
There was a problem hiding this comment.
Looks a lot like what I was thinking about too.
Left some high-level feedback.
|
@SingleAccretion 90066eb should cover most of your feedback except internal regs. |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
SingleAccretion
left a comment
There was a problem hiding this comment.
Mostly small comments left from me. But we also need to be a bit more careful with lvRegNum mutations.
|
Hopefully closer now... @SingleAccretion in the future maybe just point out one instance of a recurring pattern? Otherwise stuff may get overlooked. |
|
There's still an issue where a node can be collected twice, eg if it both needs a register and also has internal registers, and double processing a collected node is not good. We could have the collector mark nodes perhaps, use this to avoid a double collection, and unmark them when we process them later. Also |
|
Ok, one more batch of updates:
|
SingleAccretion
left a comment
There was a problem hiding this comment.
Looking pretty good, just a few comments!
There is also #126445 (comment) which looks valid but is pre-existing and can be addressed separately.
|
@dotnet/jit-contrib PTAL |
|
LGTM but I don't understand all of it. |
|
/ba-g infrastructure issues |
Implement register allocation for funclets, along with some funclet codegen.