Skip to content
Merged
1 change: 0 additions & 1 deletion src/libraries/System.Reflection/tests/TypeInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
29 changes: 13 additions & 16 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 4 additions & 6 deletions src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -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<T>() => IsReferenceOrContainsReferences<T>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ namespace System.Runtime.InteropServices
[StructLayout(LayoutKind.Sequential)]
public partial class MarshalAsAttribute
{
internal object CloneInternal() => MemberwiseClone();
}
}