Skip to content

Conversation

@eerhardt
Copy link
Member

No description provided.

@jkotas
Copy link
Member

jkotas commented May 26, 2020

What is motivating this?

@jkotas
Copy link
Member

jkotas commented May 26, 2020

I mean there are hundreds (or even more) places that can use a cleanup like this. I am wondering why you have picked this one.

@eerhardt
Copy link
Member Author

What is motivating this?
I mean there are hundreds (or even more) places that can use a cleanup like this. I am wondering why you have picked this one.

I was looking through all the places where we are rooting methods/types for the linker:

https://github.com/dotnet/runtime/blob/master/src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml

And I noticed this one and thought it would take 5 minutes to send a PR to make the code better.

@mjsabby
Copy link
Contributor

mjsabby commented May 26, 2020

I haven't been following the nint thing, does this still put System.IntPtr in the metadata?

@eerhardt
Copy link
Member Author

does this still put System.IntPtr in the metadata?

Yes. You can read more about the underlying design of nint here, if you are interested.

@ghost
Copy link

ghost commented May 26, 2020

Tagging subscribers to this area: @Maoni0
Notify danmosemsft if you want to be subscribed.


[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, IntPtr sectionSize);
private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, nint sectionSize);
Copy link
Member

Choose a reason for hiding this comment

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

The unmanaged size is using unsigned type for this, but fixing that would require changes in the code that looks up this API via private reflection.

Copy link
Member Author

@eerhardt eerhardt May 27, 2020

Choose a reason for hiding this comment

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

Right - the unmanaged code is using SIZE_T.

/*===============================RegisterFrozenSegment===============================
**Action: Registers the frozen segment
**Returns: segment_handle
**Arguments: args-> pointer to section, size of section
**Exceptions: None
==============================================================================*/
void* QCALLTYPE GCInterface::RegisterFrozenSegment(void* pSection, SIZE_T sizeSection)

I didn't want to actually change the managed type. Unless @mjsabby was OK with it. I assume that is the only user of this experimental feature, or are there others?

Copy link
Member

Choose a reason for hiding this comment

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

Oops, I merged this -- perhaps there was an open question here?

@danmoseley danmoseley merged commit d3db91a into dotnet:master May 27, 2020
@eerhardt eerhardt deleted the UseNIntFrozenSegment branch May 27, 2020 14:21
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
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.

5 participants