-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] Perform the class init at runtime when static fields of BEFORE_FIELD_INIT type are accessed #86787
Conversation
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
The commit description is pretty confusing and is referencing code instead of being more of an explanation. Something like: Emit class init checks executed at runtime when accessing static fields of beforefieldinit types, instead of running the cctors during method compilation. |
NOTE: we keep this path in Boolean.cs because Mono could trigger ICU initialization because of this beforefieldinit behavior so in theory we can drop that path if you fix this. Although, it might regress perf slightly |
@BrzVlad thanks for pointing it out, will keep it in mind. |
This could use a testcase. |
…tic fields Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
… the class Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the test project really need to run separately from other tests?
src/tests/JIT/Methodical/beforefieldinit/StaticFieldInit.csproj
Outdated
Show resolved
Hide resolved
src/tests/JIT/Methodical/beforefieldinit/StaticFieldInit.csproj
Outdated
Show resolved
Hide resolved
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
…ide merged directory Signed-off-by: Vlad <vladionescu1399@gmail.com>
Signed-off-by: Vlad <vladionescu1399@gmail.com>
@lambdageek, what should be done with this PR? |
I feel like this is kind of risky to take for .NET 9 at this point. Static cctors order changes are hard to diagnose downstream. We could take it up early in .NET 10 |
Changed class init checks executed at runtime when accessing static fields of beforefieldinit types, instead of running the cctors during method compilation.
Related to #77513.