Skip to content
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

Merged
merged 5 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public partial class FunctionPointerCallingConventionTests
[Theory]
[InlineData(true)]
[InlineData(false)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void ManagedCallingConvention(bool modified)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -36,7 +35,6 @@ public static unsafe void ManagedCallingConvention(bool modified)
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConv_Param_Unmodified(string methodName)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -54,7 +52,6 @@ public static unsafe void UnmanagedCallConv_Param_Unmodified(string methodName)
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall), typeof(CallConvStdcall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall), typeof(CallConvThiscall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall), typeof(CallConvFastcall))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConv_Param_Modified(string methodName, Type callingConventionRuntime)
{
Type callingConvention = callingConventionRuntime.Project();
Expand All @@ -71,7 +68,7 @@ public static unsafe void UnmanagedCallConv_Param_Modified(string methodName, Ty
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/90308", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConvs_Return_Unmodified()
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -91,7 +88,6 @@ public static unsafe void UnmanagedCallConvs_Return_Unmodified()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConvs_Return_Modified()
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -118,7 +114,6 @@ public static unsafe void UnmanagedCallConvs_Return_Modified()
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall_SuppressGCTransition))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall_SuppressGCTransition))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall_SuppressGCTransition))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConv_PhysicalModifiers_Unmodified(string methodName)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -137,7 +132,6 @@ public static unsafe void UnmanagedCallConv_PhysicalModifiers_Unmodified(string
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall_SuppressGCTransition), typeof(CallConvStdcall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall_SuppressGCTransition), typeof(CallConvThiscall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall_SuppressGCTransition), typeof(CallConvFastcall))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void UnmanagedCallConv_PhysicalModifiers_Modified(string methodName, Type callingConventionRuntime)
{
Type suppressGcTransitionType = typeof(CallConvSuppressGCTransition).Project();
Expand All @@ -161,7 +155,6 @@ public static unsafe void UnmanagedCallConv_PhysicalModifiers_Modified(string me
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void GenericTypeParameter()
{
Type holder = typeof(FunctionPointerHolder).Project();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public partial class FunctionPointerEqualityTests
private const BindingFlags Bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void DifferentReturnValue()
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -31,7 +30,6 @@ public static unsafe void DifferentReturnValue()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void ObjectEquals_ModifiedTypes()
{
Type holder = typeof(FunctionPointerHolder).Project();
Expand All @@ -47,7 +45,6 @@ public static unsafe void ObjectEquals_ModifiedTypes()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void ObjectEquals_OneSideModifiedType()
{
Type holder = typeof(FunctionPointerHolder).Project();
Expand All @@ -65,7 +62,7 @@ public static unsafe void ObjectEquals_OneSideModifiedType()
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/90308", TestRuntimes.Mono)]
public static unsafe void CallingConvention_Unmodified(string methodName1, string methodName2)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -83,7 +80,6 @@ public static unsafe void CallingConvention_Unmodified(string methodName1, strin
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void CallingConvention_Modified(string methodName1, string methodName2)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand Down
8 changes: 0 additions & 8 deletions src/libraries/Common/tests/System/FunctionPointerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public partial class FunctionPointerTests
private const BindingFlags Bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void TypeMembers()
{
// Get an arbitrary function pointer
Expand Down Expand Up @@ -116,7 +115,6 @@ public static unsafe void TypeMembers()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void NonFunctionPointerThrows()
{
Assert.Throws<InvalidOperationException>(() => typeof(int).GetFunctionPointerCallingConventions());
Expand All @@ -125,7 +123,6 @@ public static unsafe void NonFunctionPointerThrows()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void TestToString()
{
// Function pointer types are inline in metadata and can't be loaded independently so they do not support the
Expand All @@ -146,7 +143,6 @@ public static unsafe void TestToString()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void FunctionPointerReturn()
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -163,7 +159,6 @@ public static unsafe void FunctionPointerReturn()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void RequiredModifiers()
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -188,7 +183,6 @@ public static unsafe void RequiredModifiers()
"Double",
"System.Double(System.String, System.Boolean*&, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyStruct&)",
"String", "Boolean*&", "MyClass", "MyStruct&")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void MethodInfo(
string methodName,
string methodToStringPostfix,
Expand Down Expand Up @@ -216,7 +210,6 @@ public static unsafe void MethodInfo(
[Theory]
[InlineData(nameof(FunctionPointerHolder.Prop_Int), "System.Int32()")]
[InlineData(nameof(FunctionPointerHolder.Prop_MyClass), "System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass()")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void Property(string name, string expectedToString)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand All @@ -235,7 +228,6 @@ public static unsafe void Property(string name, string expectedToString)
[Theory]
[InlineData(nameof(FunctionPointerHolder.Field_Int), "System.Int32()")]
[InlineData(nameof(FunctionPointerHolder.Field_MyClass), "System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass()")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
public static unsafe void Field(string name, string expectedToString)
{
Type t = typeof(FunctionPointerHolder).Project();
Expand Down
Loading