StackEntry NewEntry () { stack = stack ?? new Stack<StackEntry> (); var entry = new StackEntry (); stack.Push (entry); return entry; }
private void Start(StackEntry data, int index) { if (!Begin(data.Instructions[index])) { MarkCompleted(data, index); } }
private void UpdateDisplay(ulong address, byte[] memory) { for (var i = memory.Length - NativeIntegerSize; i >= 0; i -= (int)NativeIntegerSize) { ulong value = MainForm.ToLong(memory, (uint)i, NativeIntegerSize); var at = address + (ulong)i; var offset = StackFrame - at; var entry = new StackEntry() { Address = BasePlatform.ToHex(at, NativeIntegerSize), HexValue = BasePlatform.ToHex(value, NativeIntegerSize), Value = value, Offset = Platform.StackFrame.Name.ToUpperInvariant() + (offset >= 0 ? "-" + BasePlatform.ToHex(offset, 1) : "+" + BasePlatform.ToHex(-(long)offset, 1)), Index = stackentries.Count, Info = MainForm.GetAddressInfo(value) }; stackentries.Add(entry); } }
public void WriteObjectEnd() { if (m_state == State.PropertyName) { var obj = new JSValue(new ReadOnlyDictionary <string, JSValue>((Dictionary <string, JSValue>)m_dynamic)); if (m_stack.Count == 0) { m_result = obj; m_state = State.Finish; return; } else { StackEntry entry = m_stack.Pop(); if (entry.State == State.PropertyValue) { ((Dictionary <string, JSValue>)entry.Dynamic)[entry.PropertyName] = obj; m_dynamic = entry.Dynamic; m_state = State.PropertyName; return; } else if (entry.State == State.Array) { ((List <JSValue>)entry.Dynamic).Add(obj); m_dynamic = entry.Dynamic; m_state = State.Array; return; } } } throw new InvalidOperationException(); }
private void UpdateDisplay(ulong address, byte[] memory) { uint size = NativeIntegerSize; for (int i = memory.Length - NativeIntegerSize; i >= 0; i -= (int)size) { // FIXME: for 64 bit ulong value = (ulong)(memory[i] | (memory[i + 1] << 8) | (memory[i + 2] << 16) | (memory[i + 3] << 24)); var at = address + (ulong)i; var offset = (long)(Platform.StackFrame.Value - at); var entry = new StackEntry() { Address = BasePlatform.ToHex(at, size), HexValue = BasePlatform.ToHex(value, size), Value = value, Offset = Platform.StackFrame.Name.ToUpper() + (offset >= 0 ? "-" + BasePlatform.ToHex((ulong)offset, 1) : "+" + BasePlatform.ToHex((ulong)-offset, 1)), Index = stackentries.Count, }; stackentries.Add(entry); } }
// <summary> // Perform a shift action. // </summary> public virtual void Shift(ushort newState, byte major, object minor) { this._idx = (this._idx + 1); if ((this._idx >= 100)) { this.StackOverflow(minor); return; } StackEntry tos = this._stack[this._idx]; tos.stateno = newState; tos.major = major; tos.minor = minor; if (((this._tracePrompt != null) && (this._idx > 0))) { Trace.WriteLine(String.Format("{0}Shift {1}", this._tracePrompt, newState)); b = new StringBuilder(String.Format("{0}Stack:", this._tracePrompt)); for (i = 1; (i <= this._idx); i = (i + 1)) { b.AppendFormat(this._tokenNames[this._stack[i].major]); } b.ToString(); Trace.WriteLine(b.ToString()); } }
public void WriteObjectEnd() { if (m_state == State.PropertyName) { if (m_stack.Count == 0) { m_result = m_dynamic; m_state = State.Finish; return; } else { StackEntry entry = m_stack.Last(); if (entry.State == State.PropertyValue) { ((JObject)entry.Dynamic)[entry.PropertyName] = m_dynamic; m_dynamic = entry.Dynamic; m_state = State.PropertyName; m_stack.RemoveAt(m_stack.Count - 1); return; } else if (entry.State == State.Array) { entry.Dynamic.Add(m_dynamic); m_dynamic = entry.Dynamic; m_state = State.Array; m_stack.RemoveAt(m_stack.Count - 1); return; } } } throw new InvalidOperationException(); }
private StackEntry popEntry() { StackEntry e = stack_[stack_.Count - 1]; stack_.RemoveRange(stack_.Count - 1, 1); return(e); }
protected void DoStackSelected(StackEntry stackEntry) { if (this.StackSelected != null) { this.StackSelected(this, new StackEventArgs(stackEntry)); } }
public AbstractStack(int nargs) { stack_ = new List<StackEntry>(); args_ = new StackEntry[nargs]; for (int i = 0; i < args_.Length; i++) args_[i] = new StackEntry(null, null); }
StackEntry NewEntry() { stack = stack ?? new Stack <StackEntry> (); var entry = new StackEntry(); stack.Push(entry); return(entry); }
public Task(IEnumerator <object> e, object tag = null) { Tag = tag; callStack = new StackEntry { Enumerator = e }; InitialEnumeratorType = e.GetType(); }
public void Push(StackEntry entry) { if (entries.Count == maxSize) { throw Error("Exceeded the maximum stack size of {0}.", maxSize); } entries.Add(entry); }
/// <nodoc /> public DisplayStackTraceEntry(string file, int line, int position, string functionName, StackEntry entry) { File = file; Line = line; Position = position; FunctionName = functionName; Entry = entry; }
private void HandleYieldedResult(object result) { switch (result) { case null: waitTime = 0; break; case int i: waitTime = i; break; case float f: waitTime = f; break; case double d: waitTime = (float)d; break; case IEnumerator <object> enumerator: callStack = new StackEntry { Enumerator = enumerator, Caller = callStack }; Advance(0); break; case WaitPredicate predicate: waitPredicate = predicate; break; case Node3D node3D: { var ac = node3D.Components.Get <AnimationComponent>(); var firstAnimation = ac != null && ac.Animations.Count > 0 ? ac.Animations[0] : null; waitPredicate = firstAnimation != null?WaitForAnimation(firstAnimation) : null; break; } case Animation animation: waitPredicate = WaitForAnimation(animation); break; case Node node: { var defaultAnimation = node.Components.Get <AnimationComponent>()?.DefaultAnimation; waitPredicate = defaultAnimation != null?WaitForAnimation(defaultAnimation) : null; break; } case IEnumerable <object> _: throw new InvalidOperationException("Use IEnumerator<object> instead of IEnumerable<object> for " + result); default: throw new InvalidOperationException("Invalid object yielded " + result); } }
/// <summary> /// Calls MarkUseDef for any local variables encountered /// </summary> /// <param name="node"></param> private void PerNodeLocalVarLiveness(StackEntry node, IList <LocalVariableDescriptor> localVariableTable) { // For LocalVariableEntry, LocalVariableAddressEntry, StoreLocalVariableEntry, StoreIndEntry??, FieldAddressEntry? if (node is ILocalVariable) { var localVarNode = (ILocalVariable)node; MarkUseDef(localVarNode, localVariableTable); } }
public AbstractStack(int nargs) { stack_ = new List <StackEntry>(); args_ = new StackEntry[nargs]; for (int i = 0; i < args_.Length; i++) { args_[i] = new StackEntry(null, null); } }
private void MarkCompleted(StackEntry data, int index) { data.Index++; if (data.Type == StackEntryType.Parallel) { data.Completed.Set(index, true); } }
/// <summary> /// Exits from all IEnumerators, sets Updating to null. /// </summary> public void Dispose() { while (callStack != null) { callStack.Enumerator.Dispose(); callStack = callStack.Caller; } waitPredicate = null; }
/// <summary> /// Executes the ON command. /// </summary> public void Execute() { var counter = _expressionEvaluator.GetExpression().ValueAsShort(); if ((counter < 0) || (counter > 255)) { throw new Exceptions.IllegalQuantityException(); } var type = _runEnvironment.CurrentLine.NextToken(); if ((type.Statement != TokenType.Goto) && (type.Statement != TokenType.Gosub)) { throw new Exceptions.SyntaxErrorException(); } int? foundLine = null; IToken token; do { var lineNumber = _runEnvironment.CurrentLine.GetLineNumber(); if (!lineNumber.HasValue) { throw new Exceptions.SyntaxErrorException(); } counter--; if (counter == 0) { foundLine = lineNumber; } token = _runEnvironment.CurrentLine.NextToken(); }while (token.Seperator == TokenType.Comma); // Put back next token. _runEnvironment.CurrentLine.PushToken(token); if (foundLine.HasValue) { if (type.Statement == TokenType.Gosub) { var returnAddress = new StackEntry { Line = _runEnvironment.CurrentLine, LineToken = _runEnvironment.CurrentLine.CurrentToken }; _runEnvironment.ProgramStack.Push(returnAddress); _runEnvironment.TestForStackOverflow(); } _runEnvironment.CurrentLine = _programRepository.GetLine(foundLine.Value); } }
private void ImportAppendTree(StackEntry entry, bool spill = false) { if (spill) { ImportSpillAppendTree(entry); } else { _currentBasicBlock?.Statements.Add(entry); } }
private void treeView1_DoubleClick(object sender, EventArgs e) { if (treeView1.SelectedNode != null) { StackEntry se = (StackEntry)treeView1.SelectedNode.Tag; if (se.Location.line >= 0) { DoStackSelected(se); } } }
public AbstractStack(AbstractStack other) { stack_ = new List<StackEntry>(); for (int i = 0; i < other.stack_.Count; i++) stack_.Add(new StackEntry(other.stack_[i].declaration, other.stack_[i].assignment)); args_ = new StackEntry[other.args_.Length]; for (int i = 0; i < args_.Length; i++) args_[i] = new StackEntry(other.args_[i].declaration, other.args_[i].assignment); pri_ = other.pri_; alt_ = other.alt_; }
public DNode popAsTemp() { StackEntry entry = popEntry(); if (entry.declaration.uses.Count == 0) { return(entry.assignment); } //Debug.Assert(false, "not yet handled"); return(null); }
void Push (IMatrix matrix) { // If we're in a SaveTransform block, // increment the pop count. current = current ?? NewEntry (); current.Matrices.Add (matrix); current.PopCount++; // push the transform push (matrix); }
private static void PrintStackForDiagnostics(Stack <StackEntry> stack) { StackEntry[] clone = new StackEntry[stack.Count]; stack.CopyTo(clone, 0); Console.Write("Exploring path.."); for (int i = stack.Count - 1; i >= 0; i--) { Console.Write(clone[i].Node + " (" + clone[i].GetCurrentColor() + ")" + " "); } Console.WriteLine(); }
private void lvStackEntries_SelectedIndexChanged(object sender, EventArgs e) { if (lvStackEntries.SelectedItems.Count == 0) { tbStackDetails.Text = ""; return; } StackEntry o = (StackEntry)lvStackEntries.SelectedItems[0].Tag; tbStackDetails.Text = o.Details; }
private void SetNext(StackEntry entry) { if (Current != null) { Current.Next = entry; } Current = entry; if (First == null) { First = Current; } }
void Push(IMatrix matrix) { // If we're in a SaveTransform block, // increment the pop count. current = current ?? NewEntry(); current.Matrices.Add(matrix); current.popCount++; // push the transform push(matrix); }
public static int Add(string Entry) { var SE = new StackEntry { Trace = Entry, StartTime = DateTime.UtcNow, ExitTime = DateTime.MaxValue, Duration = TimeSpan.MinValue }; _StackEntries.Add(SE); return(_StackEntries.Count - 1); }
private StackEntry?LowerNode(StackEntry node) { var visitorAdapter = new GenericStackEntryAdapter(this); _nextNode = null; node.Accept(visitorAdapter); if (_nextNode != null) { return(_nextNode); } return(node.Next); }
private void gridStack_MouseMove( object sender, System.Windows.Forms.MouseEventArgs e) { // Handles gridStack.MouseMove System.Windows.Forms.DataGrid.HitTestInfo hit; hit = gridStack.HitTest(e.X, e.Y); StackEntry stackentry = mStackArray[hit.Row]; string memberName; memberName = gridStack.TableStyles[0].GridColumnStyles[hit.Column].MappingName; this.ToolTip.SetToolTip(gridStack, stackentry.GetText(memberName)); }
private StackEntry ImportSpillStackEntry(StackEntry entry, int?tempNumber = null) { if (tempNumber == null) { tempNumber = GrabTemp(entry.Kind, entry.ExactSize); var temp = _localVariableTable[tempNumber.Value]; } var node = new StoreLocalVariableEntry(tempNumber.Value, false, entry); ImportAppendTree(node); return(new LocalVariableEntry(tempNumber.Value, entry.Kind, entry.ExactSize)); }
private void ImportSpillAppendTree(StackEntry entry) { // If we have an assignment and the variable being assigned to // has prior loads on the evaluation stack then we need to ensure // these loads are completed before the variable is modified if (entry is StoreLocalVariableEntry) { // TODO: Do we need to check that variable being assigned to is a struct type? // Convert loads into assignmented to new temps ImportSpillLocalReferences(entry.As <StoreLocalVariableEntry>().LocalNumber); } ImportAppendTree(entry); }
public void RestoreTransform () { // If there is a current entry, use it. if (current == null) throw new EtoException ("RestoreTransform called without SaveTransform"); // Pop the drawing context // popCount times while (current.PopCount-- > 0) { // return a cloned matrix // since the caller may dispose it. pop (); } stack.Pop (); current = (stack.Count == 0) ? NewEntry () : stack.Peek (); }
/// <summary> /// Append string representation of <paramref name="value"/> to <see cref="_builder"/>. /// </summary> /// <param name="value">Value to print.</param> private void Append(StackEntry value) { value.Append(_builder); }
private StackEntry NewSpillSlot(StackEntry entry) { if (_spillSlots == null) _spillSlots = new List<SpillSlot>(); SpillSlot spillSlot = new SpillSlot(); spillSlot.Kind = entry.Kind; spillSlot.Type = entry.Type; spillSlot.Name = "_s" + _spillSlots.Count.ToStringInvariant(); _spillSlots.Add(spillSlot); return new ExpressionEntry(entry.Kind, spillSlot.Name, entry.Type); }
/// <summary> /// Generate a cast in case the stack type of source is not identical or compatible with destination type. /// </summary> /// <param name="destType">Type of destination</param> /// <param name="srcEntry">Source entry from stack</param> private void AppendCastIfNecessary(TypeDesc destType, StackEntry srcEntry) { ConstantEntry constant = srcEntry as ConstantEntry; if ((constant != null) && (constant.IsCastNecessary(destType)) || !destType.IsValueType) { Append("("); Append(_writer.GetCppSignatureTypeName(destType)); Append(")"); } }
/// <summary> /// Push a new entry onto evaluation stack and declare a temporary local to hold its representation. /// </summary> /// <param name="entry">Entry to push onto evaluation stack.</param> private void PushTemp(StackEntry entry) { _stack.Push(entry); // Start declaration on a new line AppendLine(); Append(GetStackValueKindCPPTypeName(entry.Kind, entry.Type)); Append(" "); Append(entry); Append(" = "); }
private LocalEntry StackToLocalEntry(Instruction instruction, StackEntry stackEntry) { return new LocalEntry(instruction, stackEntry.IsValueKnown, stackEntry.Value); }
public void Push(StackEntry value) { _stack.Push(value); }
public void SaveTransform () { // Create a stack the first time. current = NewEntry (); }