-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use nint instead of IntPtr in _RegisterFrozenSegment. #37029
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
|
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: And I noticed this one and thought it would take 5 minutes to send a PR to make the code better. |
|
I haven't been following the nint thing, does this still put |
Yes. You can read more about the underlying design of |
|
Tagging subscribers to this area: @Maoni0 |
|
|
||
| [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
| private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, IntPtr sectionSize); | ||
| private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, nint sectionSize); |
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.
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.
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.
Right - the unmanaged code is using SIZE_T.
runtime/src/coreclr/src/vm/comutilnative.cpp
Lines 1127 to 1133 in ab49e0f
| /*===============================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?
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.
Oops, I merged this -- perhaps there was an open question here?
No description provided.