Adding IsTrackedType and GetTaggedMemory cDAC APIs#118250
Adding IsTrackedType and GetTaggedMemory cDAC APIs#118250rcj1 wants to merge 5 commits intodotnet:mainfrom
Conversation
rcj1
commented
Jul 31, 2025
- Grouping these two together because they both rely on TaggedMemory
- Putting this up as a draft until I can fully test on a Mac 😅
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
…j1/runtime into IsTrackedType_GetTaggedMemory
|
@jkoritzinsky is this one of the syncblock APIs which may be changing? |
|
No, this is not one that I'm looking at changing. Im only looking at ones related to the monitor in the syncblock. |
| TargetPointer objPtr = objAddr.ToTargetPointer(_target); | ||
| TargetPointer mt = objectContract.GetMethodTableAddress(objPtr); | ||
| if (mt == TargetPointer.Null) | ||
| hr = HResults.E_INVALIDARG; |
There was a problem hiding this comment.
If we end up in this condition, both *isTrackedType and *hasTaggedMemory should be false.
| if (taggedMemoryPtr != null) | ||
| { | ||
| *taggedMemory = taggedMemoryPtr.Value.ToClrDataAddress(_target); | ||
| *taggedMemorySizeInBytes = 2 * (nuint)_target.PointerSize; |
There was a problem hiding this comment.
Can we make this part of the contract? It would be nice for this to be driven by the runtime, either through a constant in the contract spec or a data descriptor.
There was a problem hiding this comment.
Yes I think we can break this up into two contract methods, HasTaggedMemory and TaggedMemorySize
There was a problem hiding this comment.
You could use an out variable to give the size.
For example:
TargetPointer TaggedMemory(TargetPointer address, out uint size);|
GetTaggedMemory takes a nuint parameter; should this be replaced with a fixed-size? |
Yes. We should avoid |
|
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
|
Coming back to this, these API should be added to a new contract named ObjectiveC (like the BuiltInCOM contract proposed in #119320) |