From fb59f61283f4a808234b90f842e7e97ba813068e Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 30 Oct 2020 14:28:50 -0400 Subject: [PATCH 1/9] [mono] Object.GetRawData -> RuntimeHelpers.GetRawData (this object) Make it into an extension method like CoreCLR. --- .../System.Private.CoreLib/src/System/Object.Mono.cs | 3 --- .../Runtime/CompilerServices/RuntimeHelpers.Mono.cs | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs index 16654bb93f611..78e04d92407ea 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs @@ -13,9 +13,6 @@ public partial class Object [MethodImplAttribute(MethodImplOptions.InternalCall)] protected extern object MemberwiseClone(); - [Intrinsic] - internal ref byte GetRawData() => ref GetRawData(); - internal object CloneInternal() => MemberwiseClone(); } } diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs index bb366f9b30f8b..f33d7b68ea9b5 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Internal.Runtime.CompilerServices; namespace System.Runtime.CompilerServices { @@ -54,6 +55,16 @@ public static void RunClassConstructor(RuntimeTypeHandle type) RunClassConstructor(type.Value); } + internal static ref byte GetRawData(this object obj) => + ref Unsafe.As(obj).Data; + + // Helper class to assist with unsafe pinning of arbitrary objects. + // It's used by VM code. + internal class RawData + { + public byte Data; + } + public static void EnsureSufficientExecutionStack() { if (SufficientExecutionStack()) From 6a8bc4d985821720826b520c918923a8ee61ad5f Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 30 Oct 2020 16:30:32 -0400 Subject: [PATCH 2/9] Move RuntimeHelpers.GetRawData and RawData class to shared location --- .../CompilerServices/RuntimeHelpers.CoreCLR.cs | 9 --------- .../System/Runtime/CompilerServices/RuntimeHelpers.cs | 9 +++++++++ .../Runtime/CompilerServices/RuntimeHelpers.Mono.cs | 11 ----------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs index 6b6e4639bfec2..7413dcb647cdd 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs @@ -185,9 +185,6 @@ internal static int EnumCompareTo(T x, T y) where T : struct, Enum return x.CompareTo(y); } - internal static ref byte GetRawData(this object obj) => - ref Unsafe.As(obj).Data; - [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static unsafe nuint GetRawObjectDataSize(object obj) { @@ -335,12 +332,6 @@ private static unsafe void DispatchTailCalls( [MethodImpl(MethodImplOptions.InternalCall)] internal static extern int GetMethodsJittedCount(); } - // Helper class to assist with unsafe pinning of arbitrary objects. - // It's used by VM code. - internal class RawData - { - public byte Data; - } // CLR arrays are laid out in memory as follows (multidimensional array bounds are optional): // [ sync block || pMethodTable || num components || MD array bounds || array data .. ] diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 727a1bee1a359..1f79668904c49 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -132,5 +132,14 @@ public static void PrepareConstrainedRegionsNoOP() internal static bool IsPrimitiveType(this CorElementType et) // COR_ELEMENT_TYPE_I1,I2,I4,I8,U1,U2,U4,U8,R4,R8,I,U,CHAR,BOOLEAN => ((1 << (int)et) & 0b_0011_0000_0000_0011_1111_1111_1100) != 0; + + internal static ref byte GetRawData(this object obj) => + ref Unsafe.As(obj).Data; + } + // Helper class to assist with unsafe pinning of arbitrary objects. + // It's used by VM code. + internal class RawData + { + public byte Data; } } diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs index f33d7b68ea9b5..bb366f9b30f8b 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Internal.Runtime.CompilerServices; namespace System.Runtime.CompilerServices { @@ -55,16 +54,6 @@ public static void RunClassConstructor(RuntimeTypeHandle type) RunClassConstructor(type.Value); } - internal static ref byte GetRawData(this object obj) => - ref Unsafe.As(obj).Data; - - // Helper class to assist with unsafe pinning of arbitrary objects. - // It's used by VM code. - internal class RawData - { - public byte Data; - } - public static void EnsureSufficientExecutionStack() { if (SufficientExecutionStack()) From f45059f59a7b598a3f05f8748845a44deaaa51fa Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 30 Oct 2020 16:36:10 -0400 Subject: [PATCH 3/9] [mono] Remove intrinsic support for Object.GetRawData --- src/mono/mono/mini/interp/transform.c | 16 ---------------- src/mono/mono/mini/intrinsics.c | 6 ------ 2 files changed, 22 deletions(-) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 2711262fbbb65..5044a7da31747 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1951,22 +1951,6 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas #endif ) *op = MINT_INTRINS_GET_TYPE; -#ifdef ENABLE_NETCORE - else if (!strcmp (tm, "GetRawData")) { -#if SIZEOF_VOID_P == 8 - interp_add_ins (td, MINT_LDC_I8_S); -#else - interp_add_ins (td, MINT_LDC_I4_S); -#endif - td->last_ins->data [0] = (gint16) MONO_ABI_SIZEOF (MonoObject); - - interp_add_ins (td, MINT_ADD_P); - SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_MP); - - td->ip += 5; - return TRUE; - } -#endif } else if (in_corlib && target_method->klass == mono_defaults.enum_class && !strcmp (tm, "HasFlag")) { gboolean intrinsify = FALSE; MonoClass *base_klass = NULL; diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index dccb2c51d4fce..f3d34d9c4a155 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -680,12 +680,6 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign int dreg = alloc_preg (cfg); EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, dreg, args [0]->dreg, 0); return ins; - } else if (in_corlib && cmethod->klass == mono_defaults.object_class) { - if (!strcmp (cmethod->name, "GetRawData")) { - int dreg = alloc_preg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_ABI_SIZEOF (MonoObject)); - return ins; - } } if (!(cfg->opt & MONO_OPT_INTRINS)) From 81bc63e241bad10d5fe1e51e60a2177b06f2aec2 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 14:46:24 -0500 Subject: [PATCH 4/9] Revert "[mono] Remove intrinsic support for Object.GetRawData" This reverts commit f45059f59a7b598a3f05f8748845a44deaaa51fa. --- src/mono/mono/mini/interp/transform.c | 16 ++++++++++++++++ src/mono/mono/mini/intrinsics.c | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 5044a7da31747..2711262fbbb65 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1951,6 +1951,22 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas #endif ) *op = MINT_INTRINS_GET_TYPE; +#ifdef ENABLE_NETCORE + else if (!strcmp (tm, "GetRawData")) { +#if SIZEOF_VOID_P == 8 + interp_add_ins (td, MINT_LDC_I8_S); +#else + interp_add_ins (td, MINT_LDC_I4_S); +#endif + td->last_ins->data [0] = (gint16) MONO_ABI_SIZEOF (MonoObject); + + interp_add_ins (td, MINT_ADD_P); + SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_MP); + + td->ip += 5; + return TRUE; + } +#endif } else if (in_corlib && target_method->klass == mono_defaults.enum_class && !strcmp (tm, "HasFlag")) { gboolean intrinsify = FALSE; MonoClass *base_klass = NULL; diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index f3d34d9c4a155..dccb2c51d4fce 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -680,6 +680,12 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign int dreg = alloc_preg (cfg); EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, dreg, args [0]->dreg, 0); return ins; + } else if (in_corlib && cmethod->klass == mono_defaults.object_class) { + if (!strcmp (cmethod->name, "GetRawData")) { + int dreg = alloc_preg (cfg); + EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_ABI_SIZEOF (MonoObject)); + return ins; + } } if (!(cfg->opt & MONO_OPT_INTRINS)) From b77d6a294ec9798ea1fbd5c7d3013c55f75dd2ff Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 14:46:40 -0500 Subject: [PATCH 5/9] Revert "Move RuntimeHelpers.GetRawData and RawData class to shared location" This reverts commit 6a8bc4d985821720826b520c918923a8ee61ad5f. --- .../CompilerServices/RuntimeHelpers.CoreCLR.cs | 9 +++++++++ .../System/Runtime/CompilerServices/RuntimeHelpers.cs | 9 --------- .../Runtime/CompilerServices/RuntimeHelpers.Mono.cs | 11 +++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs index 7413dcb647cdd..6b6e4639bfec2 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs @@ -185,6 +185,9 @@ internal static int EnumCompareTo(T x, T y) where T : struct, Enum return x.CompareTo(y); } + internal static ref byte GetRawData(this object obj) => + ref Unsafe.As(obj).Data; + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static unsafe nuint GetRawObjectDataSize(object obj) { @@ -332,6 +335,12 @@ private static unsafe void DispatchTailCalls( [MethodImpl(MethodImplOptions.InternalCall)] internal static extern int GetMethodsJittedCount(); } + // Helper class to assist with unsafe pinning of arbitrary objects. + // It's used by VM code. + internal class RawData + { + public byte Data; + } // CLR arrays are laid out in memory as follows (multidimensional array bounds are optional): // [ sync block || pMethodTable || num components || MD array bounds || array data .. ] diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 1f79668904c49..727a1bee1a359 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -132,14 +132,5 @@ public static void PrepareConstrainedRegionsNoOP() internal static bool IsPrimitiveType(this CorElementType et) // COR_ELEMENT_TYPE_I1,I2,I4,I8,U1,U2,U4,U8,R4,R8,I,U,CHAR,BOOLEAN => ((1 << (int)et) & 0b_0011_0000_0000_0011_1111_1111_1100) != 0; - - internal static ref byte GetRawData(this object obj) => - ref Unsafe.As(obj).Data; - } - // Helper class to assist with unsafe pinning of arbitrary objects. - // It's used by VM code. - internal class RawData - { - public byte Data; } } diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs index bb366f9b30f8b..f33d7b68ea9b5 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Internal.Runtime.CompilerServices; namespace System.Runtime.CompilerServices { @@ -54,6 +55,16 @@ public static void RunClassConstructor(RuntimeTypeHandle type) RunClassConstructor(type.Value); } + internal static ref byte GetRawData(this object obj) => + ref Unsafe.As(obj).Data; + + // Helper class to assist with unsafe pinning of arbitrary objects. + // It's used by VM code. + internal class RawData + { + public byte Data; + } + public static void EnsureSufficientExecutionStack() { if (SufficientExecutionStack()) From 347cd9d243f20146e5a194d4881a7f99560a3787 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 14:49:09 -0500 Subject: [PATCH 6/9] Move Object.GetRawData to RuntimeHelpers.GetRawData(this object obj) But keep it as an intrinsic --- .../Runtime/CompilerServices/RuntimeHelpers.Mono.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs index f33d7b68ea9b5..9dc704ced4464 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs @@ -55,16 +55,6 @@ public static void RunClassConstructor(RuntimeTypeHandle type) RunClassConstructor(type.Value); } - internal static ref byte GetRawData(this object obj) => - ref Unsafe.As(obj).Data; - - // Helper class to assist with unsafe pinning of arbitrary objects. - // It's used by VM code. - internal class RawData - { - public byte Data; - } - public static void EnsureSufficientExecutionStack() { if (SufficientExecutionStack()) @@ -120,6 +110,9 @@ public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) throw new PlatformNotSupportedException(); } + [Intrinsic] + internal static ref byte GetRawData(this object obj) => ref obj.GetRawData(); + [Intrinsic] public static bool IsReferenceOrContainsReferences() => IsReferenceOrContainsReferences(); From 2c85fc7601b6e43caaf2b8a484f38220c58d6198 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 14:56:24 -0500 Subject: [PATCH 7/9] Update jit and interp intrinsics for RuntimeHelpers.GetRawData --- src/mono/mono/mini/interp/transform.c | 29 ++++++++++++--------------- src/mono/mono/mini/intrinsics.c | 10 ++++----- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 2711262fbbb65..dee2d46c67520 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -1897,6 +1897,19 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas interp_add_ins (td, MINT_LDC_I4); WRITE32_INS (td->last_ins, 0, &offset); push_simple_type (td, STACK_TYPE_I4); + td->ip += 5; + return TRUE; + } else if (!strcmp (tm, "GetRawData")) { +#if SIZEOF_VOID_P == 8 + interp_add_ins (td, MINT_LDC_I8_S); +#else + interp_add_ins (td, MINT_LDC_I4_S); +#endif + td->last_ins->data [0] = (gint16) MONO_ABI_SIZEOF (MonoObject); + + interp_add_ins (td, MINT_ADD_P); + SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_MP); + td->ip += 5; return TRUE; } else if (!strcmp (tm, "IsBitwiseEquatable")) { @@ -1951,22 +1964,6 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas #endif ) *op = MINT_INTRINS_GET_TYPE; -#ifdef ENABLE_NETCORE - else if (!strcmp (tm, "GetRawData")) { -#if SIZEOF_VOID_P == 8 - interp_add_ins (td, MINT_LDC_I8_S); -#else - interp_add_ins (td, MINT_LDC_I4_S); -#endif - td->last_ins->data [0] = (gint16) MONO_ABI_SIZEOF (MonoObject); - - interp_add_ins (td, MINT_ADD_P); - SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_MP); - - td->ip += 5; - return TRUE; - } -#endif } else if (in_corlib && target_method->klass == mono_defaults.enum_class && !strcmp (tm, "HasFlag")) { gboolean intrinsify = FALSE; MonoClass *base_klass = NULL; diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index dccb2c51d4fce..c8b9d9249d237 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -680,12 +680,6 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign int dreg = alloc_preg (cfg); EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, dreg, args [0]->dreg, 0); return ins; - } else if (in_corlib && cmethod->klass == mono_defaults.object_class) { - if (!strcmp (cmethod->name, "GetRawData")) { - int dreg = alloc_preg (cfg); - EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_ABI_SIZEOF (MonoObject)); - return ins; - } } if (!(cfg->opt & MONO_OPT_INTRINS)) @@ -860,6 +854,10 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign if (strcmp (cmethod->name, "get_OffsetToStringData") == 0 && fsig->param_count == 0) { EMIT_NEW_ICONST (cfg, ins, MONO_STRUCT_OFFSET (MonoString, chars)); return ins; + } else if (!strcmp (cmethod->name, "GetRawData")) { + int dreg = alloc_preg (cfg); + EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_ABI_SIZEOF (MonoObject)); + return ins; } else if (strcmp (cmethod->name, "IsReferenceOrContainsReferences") == 0 && fsig->param_count == 0) { MonoGenericContext *ctx = mono_method_get_context (cmethod); g_assert (ctx); From 9556d0fba87536020acc0b8273336fe12d4e255b Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 15:04:16 -0500 Subject: [PATCH 8/9] Replace Object.CloneInternal by MarshalAsAttribute.CloneInternal there was only one use --- .../netcore/System.Private.CoreLib/src/System/Object.Mono.cs | 1 - .../System/Runtime/InteropServices/MarshalAsAttribute.Mono.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs index 78e04d92407ea..582a55c7c4dfd 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Object.Mono.cs @@ -13,6 +13,5 @@ public partial class Object [MethodImplAttribute(MethodImplOptions.InternalCall)] protected extern object MemberwiseClone(); - internal object CloneInternal() => MemberwiseClone(); } } diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.Mono.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.Mono.cs index 3958bd65ff9a4..fdd313adbacc2 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.Mono.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.Mono.cs @@ -6,5 +6,6 @@ namespace System.Runtime.InteropServices [StructLayout(LayoutKind.Sequential)] public partial class MarshalAsAttribute { + internal object CloneInternal() => MemberwiseClone(); } } From a87bfb01b9313cb870f149e98727a0973d95e8b4 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Mon, 2 Nov 2020 15:12:56 -0500 Subject: [PATCH 9/9] TypeInfoTests.FindMembers should pass now --- src/libraries/System.Reflection/tests/TypeInfoTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Reflection/tests/TypeInfoTests.cs b/src/libraries/System.Reflection/tests/TypeInfoTests.cs index 8cd5af684ca3e..61855a55a468c 100644 --- a/src/libraries/System.Reflection/tests/TypeInfoTests.cs +++ b/src/libraries/System.Reflection/tests/TypeInfoTests.cs @@ -733,7 +733,6 @@ public void GetConstructor(Type[] types, int? expected) } [Fact] - [ActiveIssue("https://github.com/mono/mono/issues/15029", TestRuntimes.Mono)] public static void FindMembers() { MemberInfo[] members = typeof(MembersClass).GetTypeInfo().FindMembers(MemberTypes.All, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, (MemberInfo memberInfo, object c) => true, "notused");