Skip to content
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
47c3397
collect parameters that affect price of opcode
Apr 17, 2026
ef35a92
make handlers return OpcodePriceArgs?
Apr 20, 2026
3d5240a
restrict setter access modifiers
Apr 20, 2026
6a36389
make out parameter in clone struct
Apr 20, 2026
35d29c1
rename OpcodePriceArgs to OpcodePriceParams
Apr 20, 2026
b3796e7
Merge remote-tracking branch 'origin/master' into dynamic-opcode-pricing
Apr 20, 2026
6f26c80
Update src/Neo.VM/JumpTable/JumpTable.Compound.cs
AnnaShaleva Apr 20, 2026
34233c4
Update src/Neo.VM/JumpTable/JumpTable.Compound.cs
AnnaShaleva Apr 20, 2026
7a6e6f5
Update src/Neo.VM/JumpTable/JumpTable.Push.cs
AnnaShaleva Apr 20, 2026
b35c0a0
Update src/Neo.VM/JumpTable/JumpTable.Types.cs
AnnaShaleva Apr 20, 2026
d8c2021
fix setting refsdelta in popitem
Apr 21, 2026
2ba50ee
add comments for OpcodePriceParams fields
Apr 21, 2026
56fe960
rename OpcodePriceArgs file to OpcodePriceParams
Apr 21, 2026
3587311
replace OpcodePriceParams to OpCodePriceParams
Apr 28, 2026
38c00c8
apply shargon review
Apr 28, 2026
01c566a
fix collecting params
Apr 29, 2026
7e91bb9
take into account number of elements being shifted
Apr 29, 2026
e144078
unify behaviour with NeoGo in case of exceptions
May 3, 2026
324c70c
fix collecting price params in POPITEM
May 4, 2026
06d6fbc
move CurrentInstruction access into try block
May 4, 2026
7b2f985
use Size instead GetSpan().Length
May 4, 2026
41531e1
Merge branch 'master' into dynamic-opcode-pricing
AnnaShaleva May 5, 2026
2c80440
ExecutionEngine: fix exceptions handling
AnnaShaleva May 5, 2026
76b5abf
repair parameters collection for some opcodes
May 8, 2026
1c4380c
Merge branch 'master' into dynamic-opcode-pricing
shargon May 9, 2026
308b4ca
collect parameters correctly in cases of ExecuteThrow
May 12, 2026
baab780
rename OpCodePriceParams to RunStats
May 12, 2026
3bc3be8
rename OpCodePriceParams.cs to RunStats.cs
May 12, 2026
6e6ef5b
add RunStats.cs file
May 12, 2026
89d94a7
rename priceParams to runStats
May 12, 2026
f613308
Update src/Neo.VM/ExecutionEngine.cs
shargon May 13, 2026
1c86bf9
remove using System.Xml.Schema
May 13, 2026
887b42a
collect parameters correctly in cases of ExecuteThrow in PICKITEM
May 19, 2026
9747b50
collect parameters correctly when obj is not stack-referenced in POPITEM
May 19, 2026
0261f35
make DUP and similar opcodes static
May 19, 2026
ed61412
fix collecting parameters in CONVERT
May 19, 2026
fe6571b
fix collecting parameters in SETITEM
May 19, 2026
696fd8d
fix collecting params in VALUES and KEYS
May 21, 2026
8776e11
collect index of removed element in REMOVE Map branch
May 21, 2026
c937d37
don't collect buffer length for PICKITEM
May 22, 2026
49f53a8
let PostExecuteInstruction accept null as arg
Jun 1, 2026
991c65d
Merge branch 'master' into dynamic-opcode-pricing
Jun 2, 2026
9023ea5
consider key in refsdelta
Jun 2, 2026
39cbfa3
count cloned struct fields correctly
Jun 3, 2026
4e6ff98
fix refcounting in THROW
Jun 4, 2026
1fa516d
add refsDelta return form ExecuteThrow
Jun 5, 2026
5647eb2
consider refsDelta in ExecuteThrow
Jun 8, 2026
fb9b085
consider refsDelta in ENDFINALLY
Jun 8, 2026
8d0a4d1
Merge branch 'master' into dynamic-opcode-pricing
Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ private static JumpTable ComposeJumpTable()
return jumpTable;
}

private static void OnSysCall(ExecutionEngine engine, Instruction instruction)
private static void OnSysCall(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
runStats = null;
uint method = instruction.TokenU32;
if (method == 0x77777777)
engine.CurrentContext!.EvaluationStack.Push(StackItem.FromInterface(new object()));
Expand Down
10 changes: 7 additions & 3 deletions src/Neo.VM/ExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ protected internal void ExecuteNext()
ExecutionContext context = CurrentContext!;
Instruction? currentInstruction = context.CurrentInstruction;
Instruction instruction = currentInstruction ?? Instruction.RET;
RunStats? runStats = null;
PreExecuteInstruction(instruction);
#if VMPERF
Console.WriteLine("op:["
Expand All @@ -157,13 +158,16 @@ protected internal void ExecuteNext()
#endif
try
{
JumpTable[instruction.OpCode](this, instruction);
JumpTable[instruction.OpCode](this, instruction, out runStats);
}
catch (CatchableException ex) when (Limits.CatchEngineExceptions)
{
JumpTable.ExecuteThrow(this, ex.Message);
}
PostExecuteInstruction(instruction);
finally
{
PostExecuteInstruction(currentInstruction, runStats);
}
if (!isJumping && currentInstruction != null)
context.InstructionPointer += instruction.Size;
isJumping = false;
Expand Down Expand Up @@ -299,7 +303,7 @@ public T Pop<T>() where T : StackItem
/// <summary>
/// Called after an instruction is executed.
/// </summary>
protected virtual void PostExecuteInstruction(Instruction instruction)
protected virtual void PostExecuteInstruction(Instruction? instruction, RunStats? runStats)
{
ReferenceCounter.PostExecuteInstruction();
}
Expand Down
24 changes: 18 additions & 6 deletions src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ partial class JumpTable
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 1, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void Invert(ExecutionEngine engine, Instruction instruction)
public virtual void Invert(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x = engine.Pop().GetInteger();
engine.Push(~x);
runStats = null;
}

/// <summary>
Expand All @@ -35,13 +37,15 @@ public virtual void Invert(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 2, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void And(ExecutionEngine engine, Instruction instruction)
public virtual void And(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x2 = engine.Pop().GetInteger();
var x1 = engine.Pop().GetInteger();
engine.Push(x1 & x2);
runStats = null;
}

/// <summary>
Expand All @@ -50,13 +54,15 @@ public virtual void And(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 2, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void Or(ExecutionEngine engine, Instruction instruction)
public virtual void Or(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x2 = engine.Pop().GetInteger();
var x1 = engine.Pop().GetInteger();
engine.Push(x1 | x2);
runStats = null;
}

/// <summary>
Expand All @@ -65,13 +71,15 @@ public virtual void Or(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 2, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void XOr(ExecutionEngine engine, Instruction instruction)
public virtual void XOr(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x2 = engine.Pop().GetInteger();
var x1 = engine.Pop().GetInteger();
engine.Push(x1 ^ x2);
runStats = null;
}

/// <summary>
Expand All @@ -80,13 +88,15 @@ public virtual void XOr(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 2, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void Equal(ExecutionEngine engine, Instruction instruction)
public virtual void Equal(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x2 = engine.Pop();
var x1 = engine.Pop();
engine.Push(x1.Equals(x2, engine.Limits));
runStats = null;
}

/// <summary>
Expand All @@ -95,12 +105,14 @@ public virtual void Equal(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <param name="runStats">The opcode parameters for dynamic pricing.</param>
/// <remarks>Pop 2, Push 1</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void NotEqual(ExecutionEngine engine, Instruction instruction)
public virtual void NotEqual(ExecutionEngine engine, Instruction instruction, out RunStats? runStats)
{
var x2 = engine.Pop();
var x1 = engine.Pop();
engine.Push(!x1.Equals(x2, engine.Limits));
runStats = null;
}
}
Loading