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

Move various thread-local objects that were used in self-contained places out of Thread #99989

Merged
merged 7 commits into from Mar 22, 2024

Conversation

jkoritzinsky
Copy link
Member

Move the following type's thread-specific trackers out of the Thread object and into self-contained fields/thread_local globals:

  • StackingAllocator
  • LoadLevelLimiter
  • PendingTypeLoadHolder
  • CLRRandom

Each of these were only used in one centralized location and the only usage of the Thread object was to fetch the object for the given thread. I've validated that for each of these cases, MSVC makes the same inlining decisions it made before this PR.

Also, remove the thread-specific RCW active list as that code is never used.

Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@EgorBo
Copy link
Member

EgorBo commented Mar 20, 2024

Does it address #99661 too? alloc_context doesn't need to be inside Thread.

@jkoritzinsky
Copy link
Member Author

It doesn't currently (as that's used a little more often than the metric I used), but I can try making it so.

@jkotas
Copy link
Member

jkotas commented Mar 20, 2024

Does it address #99661 too? alloc_context doesn't need to be inside Thread.

This should be done in a separate change. It will chance a lot of places like assembly helpers.

…y one place that will use it in release builds, and it will only be used once in the process (all other uses are debug-only)
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkoritzinsky
Copy link
Member Author

/ba-g The unrecognized failure is #99142, which was closed as a fix was made after this PR started running CI

@jkoritzinsky jkoritzinsky merged commit 1a36949 into dotnet:main Mar 22, 2024
88 of 92 checks passed
@jkoritzinsky jkoritzinsky deleted the threadlocal branch March 22, 2024 00:49
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants