Merge ThreadTasks into ThreadState, remove ThreadTasks#127884
Merged
Conversation
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/af877dfa-dc8f-4325-ad2c-020cf367338b Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
Member
|
Related to #127848 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies CoreCLR thread bookkeeping by merging the single ThreadTasks flag (TT_CleanupSyncBlock) into the existing ThreadState bitfield, using a previously-unused state bit. This removes the dedicated m_ThreadTasks field and relies on the already-established atomic update patterns for m_State.
Changes:
- Introduces
TS_SyncBlockCleanup(0x00000020) inThreadStateand routes sync-block cleanup queries/updates throughm_State. - Removes the
ThreadTasksenum and them_ThreadTasksmember fromThread, along with its constructor initialization and alignment assertion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/threads.h | Adds TS_SyncBlockCleanup, removes ThreadTasks / m_ThreadTasks, and switches cleanup flag operations to use atomic updates on m_State. |
| src/coreclr/vm/threads.cpp | Removes m_ThreadTasks initialization and updates the alignment comment/asserts accordingly. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ThreadTaskswas a single-entry enum (TT_CleanupSyncBlock) backed by a separatem_ThreadTasksfield onThread, even thoughThreadStatehad an unused bit (0x00000020) and already supported atomic set/reset viaInterlockedOr/InterlockedAndonm_State. The old code even contained a TODO noting the two should probably be merged.