Commit 2fc2241
Fix auto layout algorithm to compute structure alignment correctly (#73738)
* New test
* Fix auto layout algorithm to compute structure alignment correctly
- In particular:
1. The alignment requirement imposed by of a non-primitive, non-enum valuetype field is the alignment of that field
2. The alignment requirement imposed by a primitive is the pointer size of the target platform, unless running on Arm32, in which case if the primitive or enum is 8 bytes in size, the alignment requirement is 8.
- The previous implementation produced an alignment of pointer size, unless running on Arm32 and one of the fields had an alignment requirement of 8 (in which case the alignment requirement computed for the structure would be 8)
In addition, add a test which verifies that the instance field layout test types are actually producing R2R compatible results at runtime.
- This test shows that we have some issues around explicit layout, so I was forced to disable that portion of the test for now.
Fixes #65281
Co-authored-by: Tomas Rylek <[email protected]>1 parent a250bfe commit 2fc2241
File tree
10 files changed
+704
-138
lines changed- src
- coreclr/tools
- Common/TypeSystem/Common
- aot/ILCompiler.TypeSystem.Tests
- CoreTestAssembly
- tests
- readytorun/fieldlayout
10 files changed
+704
-138
lines changedLines changed: 33 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| 472 | + | |
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
| |||
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
524 | | - | |
525 | 524 | | |
526 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
527 | 529 | | |
528 | 530 | | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | 531 | | |
534 | 532 | | |
535 | | - | |
536 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
537 | 561 | | |
538 | 562 | | |
539 | 563 | | |
540 | | - | |
541 | | - | |
| 564 | + | |
542 | 565 | | |
543 | 566 | | |
544 | 567 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 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 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
417 | 479 | | |
418 | 480 | | |
0 commit comments