Commit 6bc04bf
authored
JIT: empty array enumerator opt (#109237)
For empty arrays, `GetEnumerator` returns a static instance rather
than a new instance. This hinders the JIT's ability to optimize when
it is able to stack allocate the new instance.
Detect when a stack allocation comes from an array `GetEnumerator`
and fold the branch in the inlined enumerator method to always take
the new instance path (since it is now cheap, allocation free, and
is functionally equivalent).
Contributes to #108913.1 parent e4fe27d commit 6bc04bf
3 files changed
+63
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
| 552 | + | |
551 | 553 | | |
552 | 554 | | |
553 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8966 | 8966 | | |
8967 | 8967 | | |
8968 | 8968 | | |
| 8969 | + | |
| 8970 | + | |
| 8971 | + | |
| 8972 | + | |
| 8973 | + | |
| 8974 | + | |
| 8975 | + | |
| 8976 | + | |
| 8977 | + | |
8969 | 8978 | | |
8970 | 8979 | | |
8971 | 8980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
626 | 678 | | |
627 | 679 | | |
628 | 680 | | |
| |||
0 commit comments