Skip to content

Conversation

rcj1
Copy link
Contributor

@rcj1 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 😅

Copy link
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@max-charlamb
Copy link
Member

@jkoritzinsky is this one of the syncblock APIs which may be changing?

@jkoritzinsky
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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.

Copy link
Contributor Author

@rcj1 rcj1 Aug 1, 2025

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

Copy link
Member

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);

@rcj1
Copy link
Contributor Author

rcj1 commented Aug 4, 2025

GetTaggedMemory takes a nuint parameter; should this be replaced with a fixed-size?

@max-charlamb
Copy link
Member

GetTaggedMemory takes a nuint parameter; should this be replaced with a fixed-size?

Yes. We should avoid nuint and nint in the cDAC managed code.

Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@jkoritzinsky
Copy link
Member

Coming back to this, these API should be added to a new contract named ObjectiveC (like the BuiltInCOM contract proposed in #119320)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants