-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding IsTrackedType and GetTaggedMemory cDAC APIs #118250
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
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. |
...soft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/MethodTableFlags_1.cs
Outdated
Show resolved
Hide resolved
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think we can break this up into two contract methods, HasTaggedMemory and TaggedMemorySize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |