public static Instruction Create(Type type) { switch (Type.GetTypeCode(type)) { case TypeCode.Int16: return (_Int16 ?? (_Int16 = new MulOvfInt16())); case TypeCode.UInt16: return (_UInt16 ?? (_UInt16 = new MulOvfUInt16())); case TypeCode.Int32: return (_Int32 ?? (_Int32 = new MulOvfInt32())); case TypeCode.UInt32: return (_UInt32 ?? (_UInt32 = new MulOvfUInt32())); case TypeCode.Int64: return (_Int64 ?? (_Int64 = new MulOvfInt64())); case TypeCode.UInt64: return (_UInt64 ?? (_UInt64 = new MulOvfUInt64())); case TypeCode.Single: return (_Single ?? (_Single = new MulOvfSingle())); case TypeCode.Double: return (_Double ?? (_Double = new MulOvfDouble())); } throw Assert.Unreachable; }
internal InstructionArray(int maxStackDepth, int maxContinuationDepth, Instruction[] instructions, object[] objects, RuntimeLabel[] labels, List<KeyValuePair<int, object>> debugCookies) { this.MaxStackDepth = maxStackDepth; this.MaxContinuationDepth = maxContinuationDepth; this.Instructions = instructions; this.DebugCookies = debugCookies; this.Objects = objects; this.Labels = labels; }
public static Instruction Create(Type type) { switch (Type.GetTypeCode(type.IsEnum ? Enum.GetUnderlyingType(type) : type)) { case TypeCode.Object: if (type.IsValueType) { throw new NotImplementedException(); } return (_Reference ?? (_Reference = new NotEqualReference())); case TypeCode.Boolean: return (_Boolean ?? (_Boolean = new NotEqualBoolean())); case TypeCode.Char: return (_Char ?? (_Char = new NotEqualChar())); case TypeCode.SByte: return (_SByte ?? (_SByte = new NotEqualSByte())); case TypeCode.Byte: return (_Byte ?? (_Byte = new NotEqualByte())); case TypeCode.Int16: return (_Int16 ?? (_Int16 = new NotEqualInt16())); case TypeCode.UInt16: return (_UInt16 ?? (_UInt16 = new NotEqualInt16())); case TypeCode.Int32: return (_Int32 ?? (_Int32 = new NotEqualInt32())); case TypeCode.UInt32: return (_UInt32 ?? (_UInt32 = new NotEqualInt32())); case TypeCode.Int64: return (_Int64 ?? (_Int64 = new NotEqualInt64())); case TypeCode.UInt64: return (_UInt64 ?? (_UInt64 = new NotEqualInt64())); case TypeCode.Single: return (_Single ?? (_Single = new NotEqualSingle())); case TypeCode.Double: return (_Double ?? (_Double = new NotEqualDouble())); } throw new NotImplementedException(); }
public static Instruction Create(Type type) { switch (Type.GetTypeCode(type)) { case TypeCode.Char: return (_Char ?? (_Char = new GreaterThanChar())); case TypeCode.SByte: return (_SByte ?? (_SByte = new GreaterThanSByte())); case TypeCode.Byte: return (_Byte ?? (_Byte = new GreaterThanByte())); case TypeCode.Int16: return (_Int16 ?? (_Int16 = new GreaterThanInt16())); case TypeCode.UInt16: return (_UInt16 ?? (_UInt16 = new GreaterThanUInt16())); case TypeCode.Int32: return (_Int32 ?? (_Int32 = new GreaterThanInt32())); case TypeCode.UInt32: return (_UInt32 ?? (_UInt32 = new GreaterThanUInt32())); case TypeCode.Int64: return (_Int64 ?? (_Int64 = new GreaterThanInt64())); case TypeCode.UInt64: return (_UInt64 ?? (_UInt64 = new GreaterThanUInt64())); case TypeCode.Single: return (_Single ?? (_Single = new GreaterThanSingle())); case TypeCode.Double: return (_Double ?? (_Double = new GreaterThanDouble())); } throw Assert.Unreachable; }
public static Instruction Create(Type type) { var typeInfo = type.GetTypeInfo(); // Boxed enums can be unboxed as their underlying types: var typeToUse = typeInfo.IsEnum ? Enum.GetUnderlyingType(type) : type; switch (typeToUse.GetTypeCode()) { case TypeCode.Boolean: return s_boolean ?? (s_boolean = new EqualBoolean()); case TypeCode.SByte: return s_SByte ?? (s_SByte = new EqualSByte()); case TypeCode.Byte: return s_byte ?? (s_byte = new EqualByte()); case TypeCode.Char: return s_char ?? (s_char = new EqualChar()); case TypeCode.Int16: return s_int16 ?? (s_int16 = new EqualInt16()); case TypeCode.Int32: return s_int32 ?? (s_int32 = new EqualInt32()); case TypeCode.Int64: return s_int64 ?? (s_int64 = new EqualInt64()); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new EqualInt16()); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new EqualInt32()); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new EqualInt64()); case TypeCode.Single: return s_single ?? (s_single = new EqualSingle()); case TypeCode.Double: return s_double ?? (s_double = new EqualDouble()); case TypeCode.Object: if (!typeInfo.IsValueType) { return s_reference ?? (s_reference = new EqualReference()); } // TODO: Nullable<T> throw new NotImplementedException(); default: throw new NotImplementedException(); } }
public static Instruction Create(Type type) { Debug.Assert(!type.GetTypeInfo().IsEnum); switch (type.GetTypeCode()) { case TypeCode.SByte: return s_SByte ?? (s_SByte = new GreaterThanSByte()); case TypeCode.Byte: return s_byte ?? (s_byte = new GreaterThanByte()); case TypeCode.Char: return s_char ?? (s_char = new GreaterThanChar()); case TypeCode.Int16: return s_int16 ?? (s_int16 = new GreaterThanInt16()); case TypeCode.Int32: return s_int32 ?? (s_int32 = new GreaterThanInt32()); case TypeCode.Int64: return s_int64 ?? (s_int64 = new GreaterThanInt64()); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new GreaterThanUInt16()); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new GreaterThanUInt32()); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new GreaterThanUInt64()); case TypeCode.Single: return s_single ?? (s_single = new GreaterThanSingle()); case TypeCode.Double: return s_double ?? (s_double = new GreaterThanDouble()); default: throw Assert.Unreachable; } }
public static Instruction Create(Type type) { Debug.Assert(!type.GetTypeInfo().IsEnum); switch (type.GetTypeCode()) { case TypeCode.Int16: return s_int16 ?? (s_int16 = new SubOvfInt16()); case TypeCode.Int32: return s_int32 ?? (s_int32 = new SubOvfInt32()); case TypeCode.Int64: return s_int64 ?? (s_int64 = new SubOvfInt64()); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new SubOvfUInt16()); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new SubOvfUInt32()); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new SubOvfUInt64()); case TypeCode.Single: return s_single ?? (s_single = new SubOvfSingle()); case TypeCode.Double: return s_double ?? (s_double = new SubOvfDouble()); default: throw Assert.Unreachable; } }