-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Wasm RyuJit] Codegen labels #122332
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] Codegen labels #122332
Conversation
Create emitter labels for places Wasm will branch to, and display the instr group branch targets as comments when dumping out disassembly.
|
@dotnet/jit-contrib PTAL Provide annotations on the various Wasm branches to indicate their target (since they just show the depth in the control flow stack). See the We might be able to get by with more "lightweight" labels since we don't need to have the emitter do any GC tracking. ; Method Program:<<Main>$>g__Foo|0_0(int,int):int (FullOpts)
G_M10749_IG01: ;; offset=0x0000
;; size=0 bbWeight=1 PerfScore 0.00
G_M10749_IG02: ;; offset=0x0000
02 | block
02 | block
28 00 04 | i32.load 1 4
41 00 | i32.const 0
4C | i32.le_s
0D 00 | br_if 0 ;; G_M10749_IG04
;; size=10 bbWeight=1 PerfScore 6.00
G_M10749_IG03: ;; offset=0x000A
28 00 00 | i32.load 1 0
41 00 | i32.const 0
4A | i32.gt_s
0D 01 | br_if 1 ;; G_M10749_IG07
0B | end
;; size=9 bbWeight=0.50 PerfScore 2.50
G_M10749_IG04: ;; offset=0x0013
28 00 04 | i32.load 1 4
28 00 00 | i32.load 1 0
6A | i32.add
;; size=7 bbWeight=0.50 PerfScore 1.50
G_M10749_IG05: ;; offset=0x001A
0F | return
;; size=1 bbWeight=0.50 PerfScore 0.50
G_M10749_IG06: ;; offset=0x001B
0B | end
;; size=1 bbWeight=0.50 PerfScore 0.50
G_M10749_IG07: ;; offset=0x001C
41 03 | i32.const 3
;; size=2 bbWeight=0.50 PerfScore 0.50
G_M10749_IG08: ;; offset=0x001E
0F | return
;; size=1 bbWeight=0.50 PerfScore 0.50
; Total bytes of code: 31 |
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 implements codegen label support for WebAssembly RyuJIT. The changes enable the emitter to create and track labels for branch targets, and display branch target information as comments when dumping disassembly.
Key Changes
- Added
emitIns_Jfunction to emit jump instructions with target block information - Introduced
_idJumpbitfield flag to instrDesc for tracking jump instructions - Implemented IF_LABEL instruction format output (previously NYI_WASM)
- Enhanced disassembly display to show branch target labels as comments
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/jit/emitwasm.h | Added declaration for new emitIns_J function |
| src/coreclr/jit/emitwasm.cpp | Implemented emitIns_J, removed NYI_WASM for IF_LABEL, added jump target display logic, fixed brace formatting |
| src/coreclr/jit/emit.h | Added _idJump bitfield and helper methods, updated bit count comments |
| src/coreclr/jit/codegenwasm.cpp | Added label marking for loops and block ends, updated calls to use emitIns_J, fixed comment typo |
JulieLeeMSFT
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.
LGTM.
|
spmi failures |
Create emitter labels for places Wasm will branch to, and display the instr group branch targets as comments when dumping out disassembly.