Repository navigation
Replace CoreCLR Wrapper type. - #137220
Merged
AaronRobinsonMSFT merged 8 commits intoNov 11, 2026
Merged
AaronRobinsonMSFT merged 8 commits into
AaronRobinsonMSFT merged 8 commits into
Conversation
Use LifetimeHolder for hijack-lock ownership through Thread::TryAcquireHijackLock. Replace thread-context guards with direct patch-skip checks and remove unused spin-lock try-acquire APIs. Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
Co-authored-by: Copilot <[email protected]> Copilot-Session: a55d02a1-d641-4165-9e80-339edfabe2b4
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
jkoritzinsky
reviewed
Nov 9, 2026
AaronRobinsonMSFT
marked this pull request as ready for review
November 10, 2026 00:03
AaronRobinsonMSFT
requested review from
elinor-fung,
jkoritzinsky and
jkotas
November 10, 2026 23:02
Wrapper type.
jkotas
approved these changes
Nov 11, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-cutting ownership refactor affects VM locking, thread hijacking, debugger cleanup, and DAC behavior, requiring platform-specific builds and runtime tests that were unavailable during review.
No open issues 🎉
What changed in this PR
This PR modernizes CoreCLR resource and lock ownership by replacing legacy Wrapper holders with LifetimeHolder or specialized holders. NativeAOT holder implementations remain unchanged.
Changes:
- Migrates resource cleanup and ownership transfer to
Free()andDetach(). - Introduces explicit lock-acquisition helpers and updates their callers.
- Removes obsolete holder templates and helpers, retaining explicit DAC-specific cleanup behavior.
| File | Description |
|---|---|
src/coreclr/vm/threadsuspend.cpp |
Uses direct patch-skip checks and explicit hijack-lock acquisition. |
src/coreclr/vm/threads.h |
Adds a lifetime-based hijack-lock holder; removes the context-check holder. |
src/coreclr/vm/syncblk.cpp |
Migrates sync-block memory cleanup to LifetimeHolder. |
src/coreclr/vm/spinlock.h |
Removes unused conditional spin-lock helpers. |
src/coreclr/vm/simplerwlock.hpp |
Replaces DacHolder with explicit runtime and DAC variants. |
src/coreclr/vm/readytoruninfo.cpp |
Uses conditional load-lock acquisition through TakeLoadLock. |
src/coreclr/vm/proftoeeinterfaceimpl.cpp |
Uses explicit hijack-lock acquisition for profiler stack walks. |
src/coreclr/vm/prestub.cpp |
Updates JIT lock acquisition and release. |
src/coreclr/vm/methodtablebuilder.cpp |
Migrates method-data wrappers to MethodDataHolder. |
src/coreclr/vm/methodtable.inl |
Makes slot copying accept a method-data pointer. |
src/coreclr/vm/methodtable.h |
Defines lifetime-based method-data ownership. |
src/coreclr/vm/methodtable.cpp |
Updates class-initialization locks and method-data holders. |
src/coreclr/vm/loaderallocator.cpp |
Uses explicit list-lock acquisition during cleanup. |
src/coreclr/vm/listlock.h |
Introduces lifetime-based list and entry-lock holders. |
src/coreclr/vm/dllimport.cpp |
Updates IL-stub lock release and reacquisition. |
src/coreclr/vm/crst.h |
Replaces DAC holder aliases with explicit variants. |
src/coreclr/vm/comcallablewrapper.cpp |
Separates owned and borrowed refcounted handles. |
src/coreclr/vm/classlayoutinfo.cpp |
Updates native-layout lock acquisition. |
src/coreclr/vm/class.cpp |
Uses the replacement method-data holder and null check. |
src/coreclr/vm/assemblybinder.cpp |
Acquires assembly load locks through TakeLoadLock. |
src/coreclr/vm/assembly.cpp |
Updates assembly-registration lock acquisition. |
src/coreclr/vm/appdomain.hpp |
Defines lifetime-based load-lock holders and acquisition helpers. |
src/coreclr/vm/appdomain.cpp |
Migrates load-lock callers and explicit release operations. |
src/coreclr/utilcode/sstring.cpp |
Localizes the allocation holder used for message formatting. |
src/coreclr/inc/utilcode.h |
Removes the obsolete clr::SafeDelete helper. |
src/coreclr/inc/holder.h |
Removes legacy templates and specializes counter ownership. |
src/coreclr/debug/ee/funceval.cpp |
Uses Free() for function-evaluation cleanup. |
src/coreclr/debug/ee/debugger.h |
Migrates debugger resource holders and DAC lock aliases. |
src/coreclr/debug/ee/debugger.cpp |
Updates external-memory access and ownership transfer. |
Review effort: Balanced
AaronRobinsonMSFT
deleted the
arobins/remove-conditional-state-holder
branch
November 11, 2026 18:16
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.
Replace legacy CoreCLR holders with
LifetimeHolderor targeted holder types, and remove obsolete templates.NativeAOT's holder implementations are unchanged.
Note
This PR description was generated with GitHub Copilot.