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] remove 2 extra members from System.Object #44081

Merged
merged 9 commits into from
Nov 3, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ internal static int EnumCompareTo<T>(T x, T y) where T : struct, Enum
return x.CompareTo(y);
}

internal static ref byte GetRawData(this object obj) =>
ref Unsafe.As<RawData>(obj).Data;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe nuint GetRawObjectDataSize(object obj)
{
Expand Down Expand Up @@ -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 .. ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<RawData>(obj).Data;
}
// Helper class to assist with unsafe pinning of arbitrary objects.
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
// It's used by VM code.
internal class RawData
{
public byte Data;
}
}
16 changes: 0 additions & 16 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 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
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}