You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
@@ -0,0 +1,69 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
struct Ephemeron
|
||||
{
|
||||
public object key;
|
||||
public object value;
|
||||
}
|
||||
|
||||
//
|
||||
// Instead of dependent handles, mono uses arrays of Ephemeron objects.
|
||||
//
|
||||
struct DependentHandle
|
||||
{
|
||||
Ephemeron[] data;
|
||||
|
||||
public DependentHandle (object primary, object secondary)
|
||||
{
|
||||
data = new Ephemeron [1];
|
||||
data [0].key = primary;
|
||||
data [0].value = secondary;
|
||||
GC.register_ephemeron_array (data);
|
||||
}
|
||||
|
||||
public bool IsAllocated => data != null;
|
||||
|
||||
// Getting the secondary object is more expensive than getting the first so
|
||||
// we provide a separate primary-only accessor for those times we only want the
|
||||
// primary.
|
||||
public object GetPrimary ()
|
||||
{
|
||||
if (!IsAllocated)
|
||||
throw new NotSupportedException ();
|
||||
if (data [0].key == GC.EPHEMERON_TOMBSTONE)
|
||||
return null;
|
||||
return data [0].key;
|
||||
}
|
||||
|
||||
public object GetPrimaryAndSecondary (out object secondary)
|
||||
{
|
||||
if (!IsAllocated)
|
||||
throw new NotSupportedException ();
|
||||
if (data [0].key == GC.EPHEMERON_TOMBSTONE) {
|
||||
secondary = null;
|
||||
return null;
|
||||
}
|
||||
secondary = data [0].value;
|
||||
return data [0].key;
|
||||
}
|
||||
|
||||
public void SetPrimary (object primary)
|
||||
{
|
||||
if (!IsAllocated)
|
||||
throw new NotSupportedException ();
|
||||
data [0].key = primary;
|
||||
}
|
||||
|
||||
public void SetSecondary (object secondary)
|
||||
{
|
||||
if (!IsAllocated)
|
||||
throw new NotSupportedException ();
|
||||
data [0].value = secondary;
|
||||
}
|
||||
|
||||
public void Free ()
|
||||
{
|
||||
data = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
static class JitHelpers
|
||||
{
|
||||
[Intrinsic]
|
||||
public static bool EnumEquals<T> (T x, T y) where T : struct, Enum => throw new NotImplementedException ();
|
||||
|
||||
[Intrinsic]
|
||||
public static int EnumCompareTo<T> (T x, T y) where T : struct, Enum => throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
partial class RuntimeFeature
|
||||
{
|
||||
public static bool IsDynamicCodeSupported => true;
|
||||
public static bool IsDynamicCodeCompiled => true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
partial class RuntimeHelpers
|
||||
{
|
||||
public static void InitializeArray (Array array, RuntimeFieldHandle fldHandle)
|
||||
{
|
||||
if (array == null || fldHandle.Value == IntPtr.Zero)
|
||||
throw new ArgumentNullException ();
|
||||
|
||||
InitializeArray (array, fldHandle.Value);
|
||||
}
|
||||
|
||||
public static extern int OffsetToStringData {
|
||||
[MethodImpl (MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
public static int GetHashCode (object o)
|
||||
{
|
||||
return Object.InternalGetHashCode (o);
|
||||
}
|
||||
|
||||
public static new bool Equals (object? o1, object? o2)
|
||||
{
|
||||
if (o1 == o2)
|
||||
return true;
|
||||
|
||||
if (o1 == null || o2 == null)
|
||||
return false;
|
||||
|
||||
if (o1 is ValueType)
|
||||
return ValueType.DefaultEquals (o1, o2);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
public static extern object GetObjectValue (object obj);
|
||||
|
||||
public static void RunClassConstructor (RuntimeTypeHandle type)
|
||||
{
|
||||
if (type.Value == IntPtr.Zero)
|
||||
throw new ArgumentException ("Handle is not initialized.", "type");
|
||||
|
||||
RunClassConstructor (type.Value);
|
||||
}
|
||||
|
||||
public static void EnsureSufficientExecutionStack ()
|
||||
{
|
||||
if (SufficientExecutionStack ())
|
||||
return;
|
||||
|
||||
throw new InsufficientExecutionStackException ();
|
||||
}
|
||||
|
||||
public static bool TryEnsureSufficientExecutionStack ()
|
||||
{
|
||||
return SufficientExecutionStack ();
|
||||
}
|
||||
|
||||
public static void ExecuteCodeWithGuaranteedCleanup (TryCode code, CleanupCode backoutCode, Object userData)
|
||||
{
|
||||
}
|
||||
|
||||
public static void PrepareDelegate (Delegate d)
|
||||
{
|
||||
}
|
||||
|
||||
public static void PrepareMethod (RuntimeMethodHandle method)
|
||||
{
|
||||
if (method.IsNullHandle ())
|
||||
throw new ArgumentException (SR.Argument_InvalidHandle);
|
||||
unsafe {
|
||||
PrepareMethod (method.Value, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PrepareMethod (RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
|
||||
{
|
||||
if (method.IsNullHandle ())
|
||||
throw new ArgumentException (SR.Argument_InvalidHandle);
|
||||
unsafe {
|
||||
IntPtr[] instantiations = RuntimeTypeHandle.CopyRuntimeTypeHandles (instantiation, out int length);
|
||||
fixed (IntPtr* pinst = instantiations) {
|
||||
PrepareMethod (method.Value, pinst, length);
|
||||
GC.KeepAlive (instantiation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RunModuleConstructor (ModuleHandle module)
|
||||
{
|
||||
if (module == ModuleHandle.EmptyHandle)
|
||||
throw new ArgumentException ("Handle is not initialized.", "module");
|
||||
|
||||
RunModuleConstructor (module.Value);
|
||||
}
|
||||
|
||||
[Intrinsic]
|
||||
public static bool IsReferenceOrContainsReferences<T> ()
|
||||
{
|
||||
return !typeof (T).IsValueType || RuntimeTypeHandle.HasReferences ((typeof (T) as RuntimeType));
|
||||
}
|
||||
|
||||
[Intrinsic]
|
||||
internal static bool IsBitwiseEquatable<T> ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[Intrinsic]
|
||||
internal static unsafe bool ObjectHasComponentSize (object obj)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
static object GetUninitializedObjectInternal (Type type)
|
||||
{
|
||||
return GetUninitializedObjectInternal (new RuntimeTypeHandle ((RuntimeType)type).Value);
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern unsafe void PrepareMethod (IntPtr method, IntPtr* instantiations, int ninst);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern object GetUninitializedObjectInternal (IntPtr type);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void InitializeArray (Array array, IntPtr fldHandle);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern void RunClassConstructor (IntPtr type);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void RunModuleConstructor (IntPtr module);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern bool SufficientExecutionStack ();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user