private void ImportLoadInt(long value, StackValueKind kind) { switch (kind) { case StackValueKind.Int32: case StackValueKind.NativeInt: _stack.Push(new Int32ConstantEntry((int)value, _method.Context.GetWellKnownType(WellKnownType.Int32))); break; case StackValueKind.Int64: _stack.Push(new Int64ConstantEntry(value, _method.Context.GetWellKnownType(WellKnownType.Int64))); break; default: throw new InvalidOperationException(kind.ToString()); } }
private void AppendCastIfNecessary(StackValueKind dstType, TypeDesc srcType) { if (dstType == StackValueKind.ByRef) { throw new NotImplementedException(); /* * Append("("); * Append(GetSignatureTypeNameAndAddReference(srcType)); * Append(")");*/ } else if (srcType.IsPointer) { throw new NotImplementedException(); //Append("(intptr_t)"); } }
public static int GetExactSize(StackValueKind kind) { switch (kind) { case StackValueKind.Int32: return(4); case StackValueKind.Int64: return(8); case StackValueKind.ObjRef: return(2); case StackValueKind.NativeInt: return(2); case StackValueKind.ByRef: return(2); default: throw new NotImplementedException($"Kind {kind} not yet supported"); } }
public LLVMValueRef ValueForStackKind(StackValueKind kind, LLVMBuilderRef builder, bool signExtend) { if (kind == StackValueKind.Int32) { return(ValueAsInt32(builder, signExtend)); } else if (kind == StackValueKind.Int64) { return(ValueAsInt64(builder, signExtend)); } else if (kind == StackValueKind.Float) { return(ValueAsType(LLVM.FloatType(), builder)); } else if (kind == StackValueKind.NativeInt || kind == StackValueKind.ByRef || kind == StackValueKind.ObjRef) { return(ValueAsInt32(builder, false)); } else { throw new NotImplementedException(); } }
public LLVMValueRef ValueForStackKind(StackValueKind kind, LLVMBuilderRef builder, bool signExtend) { if (kind == StackValueKind.Int32) { return(ValueAsInt32(builder, signExtend)); } else if (kind == StackValueKind.Int64) { return(ValueAsInt64(builder, signExtend)); } else if (kind == StackValueKind.Float) { return(ValueAsType(Type.IsWellKnownType(WellKnownType.Single) ? ILImporter.Context.FloatType : ILImporter.Context.DoubleType, builder)); } else if (kind == StackValueKind.NativeInt || kind == StackValueKind.ByRef || kind == StackValueKind.ObjRef) { return(ValueAsInt32(builder, false)); } else { throw new NotImplementedException(); } }
protected ConstantEntry(StackValueKind kind, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, llvmValue, type) { }
private void AppendCastIfNecessary(StackValueKind dstType, TypeDesc srcType) { if (dstType == StackValueKind.ByRef) { Append("("); Append(_writer.GetCppSignatureTypeName(srcType)); Append(")"); } else if (srcType.IsPointer) { Append("(intptr_t)"); } }
/// <summary> /// Push an expression named <paramref name="name"/> of kind <paramref name="kind"/>. /// </summary> /// <param name="kind">Kind of entry in stack</param> /// <param name="name">Variable to be pushed</param> /// <param name="type">Type if any of <paramref name="name"/></param> private void PushExpression(StackValueKind kind, string name, TypeDesc type = null) { Debug.Assert(kind != StackValueKind.Unknown, "Unknown stack kind"); _stack.Push(new ExpressionEntry(kind, name, type)); }
private void ImportLoadInt(long value, StackValueKind kind) { if (kind == StackValueKind.Int64) { _stack.Push(new Int64ConstantEntry(value)); } else { Debug.Assert(value >= Int32.MinValue && value <= Int32.MaxValue, "Value too large for an Int32."); _stack.Push(new Int32ConstantEntry(checked((int) value))); } }
private Value NewSpillSlot(StackValueKind kind, TypeDesc type) { if (_spillSlots == null) _spillSlots = new List<SpillSlot>(); SpillSlot spillSlot = new SpillSlot(); spillSlot.Kind = kind; spillSlot.Type = type; spillSlot.Name = "_s" + _spillSlots.Count.ToString(); _spillSlots.Add(spillSlot); return new Value() { Name = spillSlot.Name }; }
private void PushTemp(StackValueKind kind, TypeDesc type = null) { string temp = NewTempName(); Push(kind, new Value(temp), type); _builder.Append(GetStackValueKindCPPTypeName(kind, type)); _builder.Append(" "); _builder.Append(temp); _builder.Append("="); }
public GenericReturnExpressionEntry(TypeDesc genericReturnTypeDesc, StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, name, llvmValue, type) { GenericReturnTypeDesc = genericReturnTypeDesc; }
public BinaryOperator(Operation operation, bool isComparison, StackEntry op1, StackEntry op2, StackValueKind kind) : base(kind, op1.ExactSize) { Operation = operation; IsComparison = isComparison; Op1 = op1; Op2 = op2; }
private void ImportLoadInt(long value, StackValueKind kind) { }
public LocalHeapEntry(StackEntry op1, StackValueKind objKind) : base(objKind) { Op1 = op1; }
public AllocObjEntry(int objSize, StackValueKind objKind) : base(objKind) { Size = objSize; }
private void PushTemp(StackValueKind kind, TypeDesc type = null) { string temp = NewTempName(); Push(kind, new Value(temp), type); // Start declaration on a new line AppendLine(); Append(GetStackValueKindCPPTypeName(kind, type)); Append(" "); Append(temp); Append(" = "); }
public IntrinsicEntry(string targetMethod, IList <StackEntry> arguments, StackValueKind returnKind) : base(returnKind) { TargetMethod = targetMethod; Arguments = arguments; }
public int GrabTemp(StackValueKind kind, int?exactSize) => _importer.GrabTemp(kind, exactSize);
private StackValue(StackValueKind kind, TypeDesc type = null, StackValueFlags flags = StackValueFlags.None) { this.Kind = kind; this.Type = type; this.Flags = flags; }
public LdTokenEntry(StackValueKind kind, string name, T token, TypeDesc type = null) : base(kind, name, default(LLVMValueRef), type) { LdToken = token; }
private StackValue(StackValueKind kind, TypeDesc type = null) { this.Kind = kind; this.Type = type; }
private void Push(StackValueKind kind, Value value, TypeDesc type = null) { Push(new StackValue() { Kind = kind, Type = type, Value = value }); }
public LdTokenEntry(StackValueKind kind, string name, T token, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, name, llvmValue, type) { LdToken = token; }
private void AppendCastIfNecessary(TypeDesc destType, StackValueKind srcType) { if (destType.IsValueType) return; Append("("); Append(_writer.GetCppSignatureTypeName(destType)); Append(")"); }
public CastEntry(WellKnownType desiredType, StackEntry op1, StackValueKind kind) : base(kind, op1.ExactSize) { DesiredType = desiredType; Op1 = op1; }
private void ImportLoadInt(long value, StackValueKind kind) { string val; if (kind == StackValueKind.Int64) { if (value == Int64.MinValue) val = "(int64_t)(0x8000000000000000" + (_msvc ? "i64" : "LL") + ")"; else val = value.ToString() + (_msvc ? "i64" : "LL"); } else { if (value == Int32.MinValue) val = "(int32_t)(0x80000000)"; else val = ((int)value).ToString(); } Push(kind, new Value(val)); }
public IndirectEntry(StackEntry op1, StackValueKind kind, int?exactSize, uint offset = 0) : base(kind, exactSize) { Op1 = op1; Offset = offset; }
private string GetStackValueKindCPPTypeName(StackValueKind kind, TypeDesc type = null) { switch (kind) { case StackValueKind.Int32: return "int32_t"; case StackValueKind.Int64: return "int64_t"; case StackValueKind.NativeInt: return "intptr_t"; case StackValueKind.ObjRef: return "void*"; case StackValueKind.Float: return "double"; case StackValueKind.ByRef: case StackValueKind.ValueType: return _writer.GetCppSignatureTypeName(type); default: throw new NotSupportedException(); } }
public RuntimeValue GetStackFrameValue(uint pid, uint depth, StackValueKind kind, uint index) { WireProtocol.OutgoingMessage cmd = CreateMessage_GetValue_Stack(pid, depth, kind, index); WireProtocol.IncomingMessage reply = SyncRequest(cmd, 10, 100); if (reply != null) { WireProtocol.Commands.Debugging_Value_Reply cmdReply = reply.Payload as WireProtocol.Commands.Debugging_Value_Reply; return RuntimeValue.Convert(this, cmdReply.m_values); } return null; }
/// <summary> /// Push a new temporary local of kind <paramref name="kind"/> and type <paramref name="type"/> and generate its declaration. /// </summary> /// <param name="kind">Kind of entry in stack</param> /// <param name="type">Type if any for new entry in stack</param> private void PushTemp(StackValueKind kind, TypeDesc type = null) { Debug.Assert(kind != StackValueKind.Unknown, "Unknown stack kind"); PushTemp(new ExpressionEntry(kind, NewTempName(), type)); }
protected ConstantEntry(StackValueKind kind, int?exactSize) : base(kind, exactSize) { }
private WireProtocol.OutgoingMessage CreateMessage_GetValue_Stack(uint pid, uint depth, StackValueKind kind, uint index) { WireProtocol.Commands.Debugging_Value_GetStack cmd = new WireProtocol.Commands.Debugging_Value_GetStack(); cmd.m_pid = pid; cmd.m_depth = depth; cmd.m_kind = (uint)kind; cmd.m_index = index; return CreateMessage(WireProtocol.Commands.c_Debugging_Value_GetStack, 0, cmd); }
/// <summary> /// Initializes a new instance of StackEntry. /// </summary> /// <param name="kind">Kind of entry.</param> /// <param name="type">Type if any of entry.</param> protected StackEntry(StackValueKind kind, LLVMValueRef llvmValue, TypeDesc type = null) { Kind = kind; Type = type; LLVMValue = llvmValue; }
public RuntimeValue[] GetStackFrameValueAll(uint pid, uint depth, uint cValues, StackValueKind kind) { WireProtocol.OutgoingMessage[] cmds = new WireProtocol.OutgoingMessage[cValues]; RuntimeValue[] vals = null; uint i; for (i = 0; i < cValues; i++) { cmds[i] = CreateMessage_GetValue_Stack(pid, depth, kind, i); } WireProtocol.IncomingMessage[] replies = SyncMessages(cmds); if (replies != null) { vals = new RuntimeValue[cValues]; for (i = 0; i < cValues; i++) { WireProtocol.Commands.Debugging_Value_Reply reply = replies[i].Payload as WireProtocol.Commands.Debugging_Value_Reply; if (reply != null) { vals[i] = RuntimeValue.Convert(this, reply.m_values); } } } return vals; }
/// <summary> /// Initializes a new instance of StackEntry. /// </summary> /// <param name="kind">Kind of entry.</param> /// <param name="type">Type if any of entry.</param> protected StackEntry(StackValueKind kind, TypeDesc type = null) { Kind = kind; Type = type; }
/// <summary> /// Initializes new instance of ExpressionEntry /// </summary> /// <param name="kind">Kind of entry</param> /// <param name="name">String representation of entry</param> /// <param name="type">Type if any of entry</param> public ExpressionEntry(StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, type) { Name = name; RawLLVMValue = llvmValue; }
protected StackEntry(StackValueKind kind, int?exactSize = null) { Kind = kind; ExactSize = exactSize; TreeID = _treeID++; }
protected ConstantEntry(StackValueKind kind, TypeDesc type = null) : base(kind, type) { }
public LdFtnTokenEntry(StackValueKind kind, string name, MethodDesc token, bool isVirtual, TypeDesc type = null) : base(kind, name, token, type) { IsVirtual = isVirtual; }
/// <summary> /// Initializes new instance of ExpressionEntry /// </summary> /// <param name="kind">Kind of entry</param> /// <param name="name">String representation of entry</param> /// <param name="type">Type if any of entry</param> public AddressExpressionEntry(StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, name, llvmValue, type) { }
/// <summary> /// Initializes new instance of ExpressionEntry /// </summary> /// <param name="kind">Kind of entry</param> /// <param name="name">String representation of entry</param> /// <param name="type">Type if any of entry</param> public ExpressionEntry(StackValueKind kind, string name, TypeDesc type = null) : base(kind, type) { Name = name; }
public SpilledExpressionEntry(StackValueKind kind, string name, TypeDesc type, int localIndex, ILImporter importer) : base(kind, name, new LLVMValueRef(IntPtr.Zero), type) { LocalIndex = localIndex; _importer = importer; }
public InvalidStackValueTypeException(StackValueKind expected, StackValueKind got) : base($"The parameter type is invalid. Expected: {expected}. Got: {got}.") { }