Commit 129f8a3
Use Virtual IPs in R2R format (#128423)
## Summary
This PR converts the WASM ReadyToRun format to use virtual IPs for
addressing instead of direct function table indices, and updates R2RDump
to correctly handle the new format.
## Changes
### RUNTIME_FUNCTION format changes
- **BeginAddress** now encodes a virtual IP (bits 30:0) and an
**IsFunclet** flag (bit 31)
- A sentinel entry (0xFFFFFFFF) followed by a 4-byte **min function
table index** is appended after the RUNTIME_FUNCTION table entries
- **UnwindInfo** now encodes frame size (ULEB128) and virtual IP count /
2 (ULEB128)
### R2RDump fixes
- Mask bit 31 (funclet flag) when parsing WASM RUNTIME_FUNCTION entries
- WASM-specific display showing VirtualIP, IsFunclet flag, and size in
virtual IPs
- Dump the min function table index after the RuntimeFunctions table
sentinel
- Fix WASM disassembly function resolution: virtual IP → table index
(via minFunctionTableIndex + runtimeFunctionId) → global function index
(via elem section) → code section index (subtract imported function
count)
- Handle both active (flags==0) and passive (flags==1) WASM elem
segments
### ReadyToRun format documentation
- Added WASM-specific RUNTIME_FUNCTION section to readytorun-format.md
- Documented UnwindInfo encoding, sentinel entry, and min function table
index trailer
## Known Issues
- **GCDecoder** is not yet handled correctly for the new WASM format.
This will be addressed in a follow-up PR.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 518c8cb commit 129f8a3
35 files changed
Lines changed: 1147 additions & 129 deletions
File tree
- docs/design/coreclr/botr
- src
- coreclr
- inc
- tools
- Common/Compiler/ObjectWriter
- Dwarf
- aot
- ILCompiler.ReadyToRun/Compiler/DependencyAnalysis
- ReadyToRun
- ILCompiler.Reflection.ReadyToRun
- Wasm32
- r2rdump
- vm
- datadescriptor
- wasm
- native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
416 | 446 | | |
417 | 447 | | |
418 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
539 | 537 | | |
540 | | - | |
541 | 538 | | |
542 | 539 | | |
543 | 540 | | |
544 | 541 | | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
| 542 | + | |
550 | 543 | | |
551 | | - | |
| 544 | + | |
| 545 | + | |
552 | 546 | | |
553 | 547 | | |
554 | 548 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| |||
135 | 140 | | |
136 | 141 | | |
137 | 142 | | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| |||
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | 931 | | |
935 | 932 | | |
936 | 933 | | |
937 | 934 | | |
938 | 935 | | |
939 | 936 | | |
940 | | - | |
941 | 937 | | |
942 | 938 | | |
| 939 | + | |
943 | 940 | | |
944 | 941 | | |
945 | 942 | | |
946 | | - | |
| 943 | + | |
947 | 944 | | |
948 | 945 | | |
949 | 946 | | |
950 | 947 | | |
951 | | - | |
| 948 | + | |
952 | 949 | | |
953 | 950 | | |
954 | 951 | | |
955 | | - | |
956 | 952 | | |
957 | 953 | | |
958 | 954 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
124 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
| 195 | + | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
Lines changed: 77 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
64 | 118 | | |
65 | 119 | | |
66 | 120 | | |
| |||
78 | 132 | | |
79 | 133 | | |
80 | 134 | | |
| 135 | + | |
| 136 | + | |
81 | 137 | | |
82 | 138 | | |
83 | 139 | | |
| |||
124 | 180 | | |
125 | 181 | | |
126 | 182 | | |
127 | | - | |
| 183 | + | |
128 | 184 | | |
129 | | - | |
| 185 | + | |
| 186 | + | |
130 | 187 | | |
131 | 188 | | |
132 | 189 | | |
| |||
157 | 214 | | |
158 | 215 | | |
159 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
160 | 232 | | |
161 | 233 | | |
162 | 234 | | |
163 | 235 | | |
164 | 236 | | |
165 | 237 | | |
166 | 238 | | |
167 | | - | |
| 239 | + | |
168 | 240 | | |
169 | 241 | | |
170 | 242 | | |
| |||
179 | 251 | | |
180 | 252 | | |
181 | 253 | | |
182 | | - | |
| 254 | + | |
| 255 | + | |
183 | 256 | | |
184 | 257 | | |
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
901 | | - | |
902 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
903 | 906 | | |
904 | 907 | | |
905 | 908 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments