Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Fix ordering of type initialization and stsfld #80485

Merged
merged 3 commits into from
Mar 27, 2023

Conversation

markples
Copy link
Member

@markples markples commented Jan 11, 2023

Insertion of the type initializer before the tree for a stsfld could reorder them inappropriately. This includes those computation in the spill check.

Fixes #72354.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 11, 2023
@ghost ghost assigned markples Jan 11, 2023
@ghost
Copy link

ghost commented Jan 11, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: markples
Assignees: markples
Labels:

area-CodeGen-coreclr

Milestone: -

@markples markples changed the title Fix 72354 JIT: Fix ordering of type initialization and stsfld Jan 11, 2023
@markples
Copy link
Member Author

need to check the code size regressions

@markples
Copy link
Member Author

So far all are spills of a value around a type initializer call (static = computation). This is exactly the purpose of this change, though presumably the order generally doesn't matter in practice (can't be aliasing as any read/write of static would have already triggered the initialization, so it's just "real" side effects).

@markples
Copy link
Member Author

The previous comment is incorrect. While the particular static should be fine, the computation and type initializer could be accessing a static from some other type and ordering could matter there.

@ghost ghost closed this Feb 12, 2023
@ghost
Copy link

ghost commented Feb 12, 2023

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2023
@markples markples reopened this Mar 23, 2023
@markples markples marked this pull request as ready for review March 23, 2023 21:41
@markples
Copy link
Member Author

@dotnet/jit-contrib This is the fix from long ago that I held off on because I was looking at the small code size regressions. For x64, they were mostly minopts and were due to splitting a tree as is needed because the type initialization needs to go in the middle of it. arm64 numbers follow the same pattern.

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always hard to this kind of fix without some code size impact.

@markples markples merged commit e6e252b into dotnet:main Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type initializer call ordering w.r.t. static field stores does not look right
2 participants