Commit bde9ba9
authored
JIT: array allocation fixes (#112676)
Fix some issues with array stack allocation that are currently hard to observe:
* use correct method table for shared array types
* pad array layout out to a multiple of TARGET_POINTER_SIZE
It's currently not easy to observe the type of a stack allocated array as
accessing the type causes escape. But this becomes possible when supporting
span capture or once we have a version of the covariant store check that can
handle stack allocated arrays.
Non-padded layouts may mean elements just off the end of an odd-length
short or byte array won't be zeroed, which some unsafe uses may expect.
Added some test cases.1 parent 1e38de0 commit bde9ba9
File tree
3 files changed
+47
-7
lines changed- src
- coreclr/jit
- tests/JIT/opt/ObjectStackAllocation
3 files changed
+47
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2822 | 2822 | | |
2823 | 2823 | | |
2824 | 2824 | | |
| 2825 | + | |
2825 | 2826 | | |
2826 | 2827 | | |
2827 | 2828 | | |
| |||
2830 | 2831 | | |
2831 | 2832 | | |
2832 | 2833 | | |
2833 | | - | |
2834 | | - | |
2835 | | - | |
2836 | | - | |
| 2834 | + | |
2837 | 2835 | | |
2838 | 2836 | | |
2839 | 2837 | | |
| |||
2871 | 2869 | | |
2872 | 2870 | | |
2873 | 2871 | | |
2874 | | - | |
2875 | | - | |
2876 | | - | |
| 2872 | + | |
2877 | 2873 | | |
2878 | 2874 | | |
2879 | 2875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
781 | 782 | | |
782 | 783 | | |
783 | 784 | | |
| |||
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| |||
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
378 | 406 | | |
379 | 407 | | |
380 | 408 | | |
| |||
384 | 412 | | |
385 | 413 | | |
386 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
387 | 424 | | |
388 | 425 | | |
389 | 426 | | |
| |||
424 | 461 | | |
425 | 462 | | |
426 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
427 | 470 | | |
428 | 471 | | |
429 | 472 | | |
| |||
0 commit comments