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"); 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); 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..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,9 +13,5 @@ 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..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 @@ -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 { @@ -109,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(); 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(); } }