Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Allow sharing ReferenceCounter between engines (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored Jul 5, 2020
1 parent baf4989 commit 87d7675
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/neo-vm/ExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ExecutionEngine : IDisposable

#endregion

public ReferenceCounter ReferenceCounter { get; } = new ReferenceCounter();
public ReferenceCounter ReferenceCounter { get; }
public Stack<ExecutionContext> InvocationStack { get; } = new Stack<ExecutionContext>();
public ExecutionContext CurrentContext { get; private set; }
public ExecutionContext EntryContext { get; private set; }
Expand All @@ -61,9 +61,14 @@ internal protected set
}
}

public ExecutionEngine()
public ExecutionEngine() : this(new ReferenceCounter())
{
ResultStack = new EvaluationStack(ReferenceCounter);
}

protected ExecutionEngine(ReferenceCounter referenceCounter)
{
this.ReferenceCounter = referenceCounter;
this.ResultStack = new EvaluationStack(referenceCounter);
}

#region Limits
Expand Down

0 comments on commit 87d7675

Please sign in to comment.