| 
 | 1 | +// Copyright (c) MOSA Project. Licensed under the New BSD License.  | 
 | 2 | +using System;  | 
 | 3 | +using System.Collections.Generic;  | 
 | 4 | +using System.Reflection;  | 
 | 5 | +using System.Runtime.CompilerServices;  | 
 | 6 | + | 
 | 7 | +namespace Internal;  | 
 | 8 | + | 
 | 9 | +internal static class Impl  | 
 | 10 | +{  | 
 | 11 | +	public static class Debug  | 
 | 12 | +	{  | 
 | 13 | +		public const string NoMessage = "No message";  | 
 | 14 | +		public const string NoDetails = "No details";  | 
 | 15 | +		public const string NoCategory = "No category";  | 
 | 16 | +		public const string NoValue = "No value";  | 
 | 17 | +		public const string FailText = "{0}\nDetails: {1}"; // {0} = Message, {1} = Details  | 
 | 18 | +		public const string WriteText = "DEBUG ({0}): {1}"; // {0} = Category, {1} = Value/Message  | 
 | 19 | +	}  | 
 | 20 | + | 
 | 21 | +	public static class ConstructorInfo  | 
 | 22 | +	{  | 
 | 23 | +		public const string ConstructorName = ".ctor";  | 
 | 24 | +		public const string TypeConstructorName = ".cctor";  | 
 | 25 | +	}  | 
 | 26 | + | 
 | 27 | +	public static class RuntimeHelpers  | 
 | 28 | +	{  | 
 | 29 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 30 | +		public static extern void InitializeArray(Array array, RuntimeFieldHandle fldHandle);  | 
 | 31 | + | 
 | 32 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 33 | +		public static extern int GetHashCode(object o);  | 
 | 34 | + | 
 | 35 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 36 | +		public new static extern bool Equals(object o1, object o2);  | 
 | 37 | + | 
 | 38 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 39 | +		public static extern T UnsafeCast<T>(object o) where T : class;  | 
 | 40 | + | 
 | 41 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 42 | +		public static extern IEnumerable<Assembly> GetAssemblies();  | 
 | 43 | + | 
 | 44 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 45 | +		public static extern object CreateInstance(Type type, params object[] args);  | 
 | 46 | + | 
 | 47 | +		// The body of this function will be replaced by the EE with unsafe code  | 
 | 48 | +		// See getILIntrinsicImplementation for how this happens.  | 
 | 49 | +		[Intrinsic]  | 
 | 50 | +		public static bool EnumEquals<T>(T x, T y) where T : Enum => x.Equals(y);  | 
 | 51 | + | 
 | 52 | +		[Intrinsic]  | 
 | 53 | +		public static bool IsReferenceOrContainsReferences<T>() => throw new InvalidOperationException();  | 
 | 54 | +	}  | 
 | 55 | + | 
 | 56 | +	public static class Bmi1  | 
 | 57 | +	{  | 
 | 58 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 59 | +		public static extern uint ResetLowestSetBit(uint value);  | 
 | 60 | + | 
 | 61 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 62 | +		public static extern uint TrailingZeroCount(uint value);  | 
 | 63 | +	}  | 
 | 64 | + | 
 | 65 | +	public static class Lzcnt  | 
 | 66 | +	{  | 
 | 67 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 68 | +		public static extern uint LeadingZeroCount(uint value);  | 
 | 69 | +	}  | 
 | 70 | + | 
 | 71 | +	public static class Popcnt  | 
 | 72 | +	{  | 
 | 73 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 74 | +		public static extern uint PopCount(uint value);  | 
 | 75 | +	}  | 
 | 76 | + | 
 | 77 | +	public static class Object  | 
 | 78 | +	{  | 
 | 79 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 80 | +		public static extern Type GetType(object obj);  | 
 | 81 | + | 
 | 82 | +		[MethodImpl(MethodImplOptions.InternalCall)]  | 
 | 83 | +		public static extern Type MemberwiseClone(object obj);  | 
 | 84 | +	}  | 
 | 85 | +}  | 
0 commit comments