-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] Support function pointer reflection introspection API #89712
Conversation
src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs
Outdated
Show resolved
Hide resolved
@vargaz, I have a question regarding fptr namespace and name handling. The tests expect that: runtime/src/libraries/Common/tests/System/FunctionPointerTests.cs Lines 27 to 28 in 75ecb1a
Should we keep internally the following values: runtime/src/mono/mono/metadata/class-init.c Lines 1598 to 1599 in fa9ad22
and only special case ves_icall_RuntimeType_GetName and ves_icall_RuntimeType_GetNamespace for function pointers?
I am asking this because changing |
Special casing GetName/GetNamespace would probably cause less problems than setting the namespace to NULL. |
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
95266a6
to
8268bde
Compare
8268bde
to
9fed123
Compare
@@ -1,3 +1,4 @@ | |||
<linker> | |||
<assembly fullname="TestLoadAssembly" /> | |||
<assembly fullname="TestILAssembly" /> |
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.
Not sure if this is the best place to root the assembly in question, but it needs to be rooted to prevent failures in EnableAggressiveTrimming
setups for FPTR testing.
PS The assembly is used in several places to test FPTR support.
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.
LGTM, although I'd like TypeSignature
to contain more of the logic about figuring out which signature source is being used so that less of it leaked out into the rest of ModifiedType
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Reflection/ModifiedType.Mono.cs
Outdated
Show resolved
Hide resolved
6e8efb8
to
7d27b1f
Compare
…stILAssembly for aggressive trimming scenarios
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
The CI failures are unrelated. |
Microsoft.Interop.Tests.NativeExportsNE.so
#90380
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.
LGTM thanks!
@@ -5,16 +5,151 @@ namespace System.Reflection | |||
{ | |||
internal partial class ModifiedType | |||
{ | |||
/// <summary> |
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.
👍 This whole file looks much clearer now, thanks!
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 and glad the template worked for mono.
@@ -42,5 +42,20 @@ | |||
IL_0000: nop | |||
IL_0001: ret | |||
} | |||
|
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.
Thanks for adding these tests.
I assume mono_class_create_fnptr() is still used along with an internal type of "MonoFNPtrFakeClass"? |
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.
Thanks - the Mono integration looks fairly clean.
Yes, that is correct. |
This PR implements support for function pointers reflection introspection API with Mono based on the design doc.
Done
IsFunctionPointer
IsUnmanagedFunctionPointer
ToString
GetFunctionPointerParameterTypes
GetFunctionPointerReturnType
GetRequiredCustomModifiers
GetOptionalCustomModifiers
GetFunctionPointerCallingConventions
ModifiedType.Mono
GetModifiedParameterType
GetModifiedFieldType
GetModifiedPropertyType
src/libraries/Common/tests/System/ModifiedTypeTests.cs
to verify fetching custom modifiers attached to generic arguments exposed viaModifiedType
on a generic field and property (this is an addition to existing generic parameter testsNot done
What is missing in this PR is proper support for function pointer type equality and type compatibility which was reported as a separate issue: #90308 and will be handled separately.
The remaining tests cases verifying this missing functionality have been updated with the new tracking issue.
Fixes #71095