Skip to content

JIT struct work planned for .NET 9 #93105

Closed
@jakobbotsch

Description

@jakobbotsch

This issue captures the planned work items for .NET 9 with respect to struct improvements. This list is expected to change throughout the release cycle according to ongoing planning and discussions, with possible additions and subtractions to the scope.

Expanding the scope of physical promotion

.NET 8 added physical promotion, which removes many of the limitations of the existing promotion pass. Physical promotion has the following pros over the regular promotion pass:

  • It can partially promote only the struct fields that are used in the function
  • It can promote structs with arbitrary number of fields
  • It supports recursive promotion of structs
  • Physically promoted fields are always normalize-on-load
  • Physically promoted fields can always be enregistered; it does not have the notion of dependent promotion

Long term, we would like physical promotion to replace the regular promotion pass entirely. We do NOT expect this to happen in .NET 9. However, we do expect to make progress towards this goal in .NET 9.

ABI handling

The main limitation that stops physical promotion from replacing regular promotion is currently that it lacks the support around ABI boundaries that regular promotion has. This comes out of the fact that our multireg support is tied very directly into the existing promotion mechanism.
Thus, we expect to work on some of the following items in .NET 9:

The FIELD_LIST items are expected to be easier than the last two items (this is related to the fact that we do not have a good way of representing multiply-defined things in JIT IR).

Reducing scope of dependent promotion

We also expect to switch some cases where we can predict dependent promotion to be handled by physical promotion instead. This is generally expected to have good CQ benefits as it allows fields to stay in registers.

Miscellaneous work items

Moved out of .NET 9

Struct copy propagation

The JIT has to create a temporary when constructing structs on the off chance that the constructor observes address of this. However, practically no struct constructor depends on this, and we are typically able to prove this after inlining. In many cases, however, we still end up with subpar CQ due to the copy.

This work item is about introducing a pass to get rid of copies in the common case where we inlined and proved them to be unnecessary.

Metadata

Metadata

Assignees

Labels

User StoryA single user-facing feature. Can be grouped under an epic.area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions