Detect class inited status more correctly in prestub/jitinterface#104253
Merged
davidwrighton merged 4 commits intodotnet:mainfrom Jul 3, 2024
Merged
Detect class inited status more correctly in prestub/jitinterface#104253davidwrighton merged 4 commits intodotnet:mainfrom
davidwrighton merged 4 commits intodotnet:mainfrom
Conversation
… the old IsClassInited helper meant
Contributor
|
Tagging subscribers to this area: @mangod9 |
jkotas
reviewed
Jul 1, 2024
src/coreclr/vm/methodtable.cpp
Outdated
| if (IsClassInited()) | ||
| return TRUE; | ||
|
|
||
| AttemptToPreinit(); |
Member
There was a problem hiding this comment.
AttemptToPreinit is a bit complex method. We may end up calling it here repeatedly number of times.
Would it better to set the initialized flag during SetIsStaticDataAllocated so that we do not need to be repeating the preinit check and all calls to IsClassInited() will take care of the pre-initialization automatically?
inline void SetIsStaticDataAllocated()
{
LIMITED_METHOD_CONTRACT;
DWORD dwFlags = enum_flag_IsStaticDataAllocated;
if (IsPreinited())
dwFlags |= enum_flag_Initialized;
InterlockedOr((LONG*)&m_dwFlags, (LONG)dwFlags);
}
Member
Author
There was a problem hiding this comment.
Mmm... seems like a decent idea, I'll look into that once I understand the arm64 failure seen in the tests.
Member
There was a problem hiding this comment.
The linux arm64 failure is happening on multiple PRs. Opened #104263.
…c data is allocated This allows the IsClassInitedOrPreinited function to be implemented with a single memory read in all repeated use cases
jkotas
approved these changes
Jul 2, 2024
This was referenced Jul 2, 2024
Closed
Closed
Build failure: Static graph-based restore failed with exit code .* but did not log an error.
#103526
Closed
…d correctly - AND a very subtle race condition where we need to set the IsClassInited flag bit on dynamic statics BEFORE setting the MethodTable level one
Member
Member
|
@MihuBot -nocctors |
EgorBo
approved these changes
Jul 3, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #104247 by providing a new helper function which means what the old
IsClassInitedhelper meant.This should not have a semantic effect on anything, but the performance should be a bit better.