Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Neo Core VM] complete opcode comments #3437

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 src/Neo.VM/JumpTable/JumpTable.Compound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public virtual void NewMap(ExecutionEngine engine, Instruction instruction)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void Size(ExecutionEngine engine, Instruction instruction)
{
// TODO: we should be able to optimize by using peek instead of dup and pop
var x = engine.Pop();
switch (x)
{
Expand Down Expand Up @@ -410,7 +411,7 @@ public virtual void PickItem(ExecutionEngine engine, Instruction instruction)
/// </summary>
/// <param name="engine">The execution engine.</param>
/// <param name="instruction">The instruction being executed.</param>
/// <remarks>Pop 1, Push 1</remarks>
/// <remarks>Pop 2, Push 0</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public virtual void Append(ExecutionEngine engine, Instruction instruction)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.VM/JumpTable/JumpTable.Numeric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public virtual void Div(ExecutionEngine engine, Instruction instruction)
}

/// <summary>
/// Computes the result of raising a number to the specified power.
/// Computes the remainder after dividing a by b.
/// <see cref="OpCode.MOD"/>
/// </summary>
/// <param name="engine">The execution engine.</param>
Expand All @@ -170,7 +170,7 @@ public virtual void Mod(ExecutionEngine engine, Instruction instruction)
}

/// <summary>
/// Computes the square root of the specified integer.
/// Computes the result of raising a number to the specified power.
/// <see cref="OpCode.POW"/>
/// </summary>
/// <param name="engine">The execution engine.</param>
Expand All @@ -186,7 +186,7 @@ public virtual void Pow(ExecutionEngine engine, Instruction instruction)
}

/// <summary>
///
/// Returns the square root of a specified number.
/// <see cref="OpCode.SQRT"/>
/// </summary>
/// <param name="engine">The execution engine.</param>
Expand Down
1 change: 1 addition & 0 deletions src/Neo.VM/JumpTable/JumpTable.Splice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public virtual void Memcpy(ExecutionEngine engine, Instruction instruction)
Types.Buffer dst = engine.Pop<Types.Buffer>();
if (checked(di + count) > dst.Size)
throw new InvalidOperationException($"The value {count} is out of range.");
// TODO: check if we can optimize the memcpy by using peek instead of dup then pop
src.Slice(si, count).CopyTo(dst.InnerBuffer.Span[di..]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Neo.VM/JumpTable/JumpTable.Stack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual void Drop(ExecutionEngine engine, Instruction instruction)
}

/// <summary>
///
/// Removes the second-to-top stack item.
/// <see cref="OpCode.NIP"/>
/// </summary>
/// <param name="engine">The execution engine.</param>
Expand All @@ -59,7 +59,7 @@ public virtual void Nip(ExecutionEngine engine, Instruction instruction)
}

/// <summary>
/// Removes the nth item from the top of the evaluation stack.
/// Removes the n-th item from the top of the evaluation stack.
/// <see cref="OpCode.XDROP"/>
/// </summary>
/// <param name="engine">The execution engine.</param>
Expand Down
Loading
Loading