Skip to content

Commit

Permalink
handle #3520
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Oct 9, 2024
1 parent 8290697 commit 13ebad4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Neo.VM/EvaluationStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ public StackItem Peek(int index = 0)
/// Pushes an item onto the top of the stack.
/// </summary>
/// <param name="item">The item to be pushed.</param>
/// <param name="count">Stack reference count addition. For OpCodes loading from slot to evaluation stack, it can be 0.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Push(StackItem item)
public void Push(StackItem item, int count = 1)
{
innerList.Add(item);
referenceCounter.AddStackReference(item);
referenceCounter.AddStackReference(item, count: count);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
5 changes: 3 additions & 2 deletions src/Neo.VM/ExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,11 @@ protected virtual void PreExecuteInstruction(Instruction instruction) { }
/// Pushes an item onto the top of the current stack.
/// </summary>
/// <param name="item">The item to be pushed.</param>
/// <param name="count">Stack reference count addition. For OpCodes loading from slot to evaluation stack, it can be 0.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Push(StackItem item)
public void Push(StackItem item, int count = 1)
{
CurrentContext!.EvaluationStack.Push(item);
CurrentContext!.EvaluationStack.Push(item, count: count);
}
}
}
2 changes: 1 addition & 1 deletion src/Neo.VM/JumpTable/JumpTable.Slot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public virtual void ExecuteLoadFromSlot(ExecutionEngine engine, Slot? slot, int
throw new InvalidOperationException("Slot has not been initialized.");
if (index < 0 || index >= slot.Count)
throw new InvalidOperationException($"Index out of range when loading from slot: {index}");
engine.Push(slot[index]);
engine.Push(slot[index], count: 0);
}

#endregion
Expand Down

0 comments on commit 13ebad4

Please sign in to comment.