-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Wasm RyuJIT] Add Instruction Encoding for Local Var Declarations and Emit Local Declarations #122425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Wasm RyuJIT] Add Instruction Encoding for Local Var Declarations and Emit Local Declarations #122425
Conversation
…al JIT, since the RyuJIT backend is now emitting Wasm
There was a problem hiding this 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 introduces support for WebAssembly local variable declarations in the JIT compiler by adding a new instruction descriptor subtype and emission logic for encoding local declarations in the function prolog.
Key Changes
- Adds
instWasmValueTypeenum and mapping functions to convert between JIT types and WASM types - Introduces
instrDescLclVarDeclinstruction descriptor for encoding local declarations with count and type - Implements local declaration emission in the function prolog via
genWasmLocals()
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/wasmtypesdef.h | New header defining WASM value types and type conversion functions |
| src/coreclr/jit/registeropswasm.h | Removes trailing blank line |
| src/coreclr/jit/instrswasm.h | Adds local_cnt and local_decl instructions |
| src/coreclr/jit/emitwasm.h | Declares new emission methods for local declarations |
| src/coreclr/jit/emitwasm.cpp | Implements local declaration emission and descriptor handling |
| src/coreclr/jit/emitfmtswasm.h | Adds IF_LOCAL_CNT and IF_LOCAL_DECL instruction formats |
| src/coreclr/jit/emit.h | Adds instrDescLclVarDecl structure and bitfield flag |
| src/coreclr/jit/codegenwasm.cpp | Adds INS_end instruction to epilog |
| src/coreclr/jit/codegencommon.cpp | Implements prolog local count and declaration emission |
| src/coreclr/jit/codegen.h | Declares genWasmLocals() method |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Co-authored-by: SingleAccretion <[email protected]>
…cific debug info field on m_debugInfoSize
AndyAyersMS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, just one issue with the epilog.
Co-authored-by: Andy Ayers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good! Just a few comments.
Co-authored-by: SingleAccretion <[email protected]>
Co-authored-by: SingleAccretion <[email protected]>
@AndyAyersMS thanks for catching that. This should be fixed now if you'd like to take another look! |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
Looks like superpmi diffs is just generally broken in CI (nothing to do with this PR). Let me see if I can figure out why. Failing log entry It should be looking for |
|
I am going to cherry-pick my script fix into your PR if that's ok. |
Yes that is fine! Thanks for investigating that failure! |
This PR adds a new
instrDescsubtype for encoding Wasm local declarations, which have the form count:u32type:valtype, wherevaltypecan be encoded as a single byte for number and vector types.The PR also adds code to emit local count and local declarations as part of the prolog for a function. Some of this may need to change based on what we decide around calling convention and register (locals) allocation.