Full Code of neo-project/neo-vm for AI

master 9af8dbd56c8f cached
270 files
1.4 MB
358.8k tokens
848 symbols
1 requests
Download .txt
Showing preview only (1,562K chars total). Download the full file or copy to clipboard to get everything.
Repository: neo-project/neo-vm
Branch: master
Commit: 9af8dbd56c8f
Files: 270
Total size: 1.4 MB

Directory structure:
gitextract_7tmmrk3b/

├── .editorconfig
├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── LICENSE
├── README.md
├── benchmarks/
│   └── Neo.VM.Benchmarks/
│       ├── Benchmarks.POC.cs
│       ├── Benchmarks_VMHotPaths.cs
│       ├── Builders/
│       │   ├── Helper.cs
│       │   ├── Instruction.cs
│       │   ├── InstructionBuilder.cs
│       │   └── JumpTarget.cs
│       ├── Neo.VM.Benchmarks.csproj
│       ├── OpCodes/
│       │   ├── Arrays/
│       │   │   └── OpCode.ReverseN.cs
│       │   ├── Benchmark.Opcode.cs
│       │   ├── BenchmarkEngine.cs
│       │   ├── BenchmarkMode.cs
│       │   ├── Benchmarks_StackOps.cs
│       │   └── OpCodeBase.cs
│       ├── Program.cs
│       ├── TestArray.cs
│       ├── TestStruct.cs
│       └── VMTypes/
│           ├── Benchmarks_Convert.cs
│           └── Benchmarks_DeepCopy.cs
├── neo-vm.sln
├── src/
│   └── Neo.VM/
│       ├── BadScriptException.cs
│       ├── CatchableException.cs
│       ├── Collections/
│       │   └── OrderedDictionary.cs
│       ├── Debugger.cs
│       ├── EvaluationStack.cs
│       ├── ExceptionHandlingContext.cs
│       ├── ExceptionHandlingState.cs
│       ├── ExecutionContext.SharedStates.cs
│       ├── ExecutionContext.cs
│       ├── ExecutionEngine.cs
│       ├── ExecutionEngineLimits.cs
│       ├── IReferenceCounter.cs
│       ├── Instruction.cs
│       ├── IsExternalInit.cs
│       ├── JumpTable/
│       │   ├── JumpTable.Bitwisee.cs
│       │   ├── JumpTable.Compound.cs
│       │   ├── JumpTable.Control.cs
│       │   ├── JumpTable.Numeric.cs
│       │   ├── JumpTable.Push.cs
│       │   ├── JumpTable.Slot.cs
│       │   ├── JumpTable.Splice.cs
│       │   ├── JumpTable.Stack.cs
│       │   ├── JumpTable.Types.cs
│       │   └── JumpTable.cs
│       ├── Neo.VM.csproj
│       ├── OpCode.cs
│       ├── OperandSizeAttribute.cs
│       ├── RCVersion.cs
│       ├── ReferenceCounter.cs
│       ├── ReferenceCounterV2.cs
│       ├── ReferenceEqualityComparer.cs
│       ├── Script.cs
│       ├── ScriptBuilder.cs
│       ├── Slot.cs
│       ├── StronglyConnectedComponents/
│       │   └── Tarjan.cs
│       ├── Types/
│       │   ├── Array.cs
│       │   ├── Boolean.cs
│       │   ├── Buffer.cs
│       │   ├── ByteString.cs
│       │   ├── CompoundType.cs
│       │   ├── Integer.cs
│       │   ├── InteropInterface.cs
│       │   ├── Map.cs
│       │   ├── Null.cs
│       │   ├── Pointer.cs
│       │   ├── PrimitiveType.cs
│       │   ├── StackItem.Vertex.cs
│       │   ├── StackItem.cs
│       │   ├── StackItemType.cs
│       │   └── Struct.cs
│       ├── Unsafe.cs
│       ├── Utility.cs
│       ├── VMState.cs
│       └── VMUnhandledException.cs
└── tests/
    └── Neo.VM.Tests/
        ├── Converters/
        │   ├── ScriptConverter.cs
        │   └── UppercaseEnum.cs
        ├── Extensions/
        │   ├── JsonExtensions.cs
        │   └── StringExtensions.cs
        ├── Helpers/
        │   └── RandomHelper.cs
        ├── Neo.VM.Tests.csproj
        ├── Properties/
        │   └── AssemblyInfo.cs
        ├── Tests/
        │   ├── OpCodes/
        │   │   ├── Arithmetic/
        │   │   │   ├── GE.json
        │   │   │   ├── GT.json
        │   │   │   ├── LE.json
        │   │   │   ├── LT.json
        │   │   │   ├── MODMUL.json
        │   │   │   ├── MODPOW.json
        │   │   │   ├── NOT.json
        │   │   │   ├── NUMEQUAL.json
        │   │   │   ├── NUMNOTEQUAL.json
        │   │   │   ├── POW.json
        │   │   │   ├── SHL.json
        │   │   │   ├── SHR.json
        │   │   │   ├── SIGN.json
        │   │   │   └── SQRT.json
        │   │   ├── Arrays/
        │   │   │   ├── APPEND.json
        │   │   │   ├── CLEARITEMS.json
        │   │   │   ├── HASKEY.json
        │   │   │   ├── KEYS.json
        │   │   │   ├── NEWARRAY.json
        │   │   │   ├── NEWARRAY0.json
        │   │   │   ├── NEWARRAY_T.json
        │   │   │   ├── NEWMAP.json
        │   │   │   ├── NEWSTRUCT.json
        │   │   │   ├── NEWSTRUCT0.json
        │   │   │   ├── PACK.json
        │   │   │   ├── PACKMAP.json
        │   │   │   ├── PACKSTRUCT.json
        │   │   │   ├── PICKITEM.json
        │   │   │   ├── POPITEM.json
        │   │   │   ├── REMOVE.json
        │   │   │   ├── REVERSEITEMS.json
        │   │   │   ├── SETITEM.json
        │   │   │   ├── SIZE.json
        │   │   │   ├── UNPACK.json
        │   │   │   └── VALUES.json
        │   │   ├── BitwiseLogic/
        │   │   │   ├── AND.json
        │   │   │   ├── EQUAL.json
        │   │   │   ├── INVERT.json
        │   │   │   ├── NOTEQUAL.json
        │   │   │   ├── OR.json
        │   │   │   └── XOR.json
        │   │   ├── Control/
        │   │   │   ├── ABORT.json
        │   │   │   ├── ABORTMSG.json
        │   │   │   ├── ASSERT.json
        │   │   │   ├── ASSERTMSG.json
        │   │   │   ├── CALL.json
        │   │   │   ├── CALLA.json
        │   │   │   ├── CALL_L.json
        │   │   │   ├── JMP.json
        │   │   │   ├── JMPEQ.json
        │   │   │   ├── JMPEQ_L.json
        │   │   │   ├── JMPGE.json
        │   │   │   ├── JMPGE_L.json
        │   │   │   ├── JMPGT.json
        │   │   │   ├── JMPGT_L.json
        │   │   │   ├── JMPIF.json
        │   │   │   ├── JMPIFNOT.json
        │   │   │   ├── JMPIFNOT_L.json
        │   │   │   ├── JMPIF_L.json
        │   │   │   ├── JMPLE.json
        │   │   │   ├── JMPLE_L.json
        │   │   │   ├── JMPLT.json
        │   │   │   ├── JMPLT_L.json
        │   │   │   ├── JMPNE.json
        │   │   │   ├── JMPNE_L.json
        │   │   │   ├── JMP_L.json
        │   │   │   ├── NOP.json
        │   │   │   ├── RET.json
        │   │   │   ├── SYSCALL.json
        │   │   │   ├── THROW.json
        │   │   │   ├── TRY_CATCH.json
        │   │   │   ├── TRY_CATCH_FINALLY.json
        │   │   │   ├── TRY_CATCH_FINALLY10.json
        │   │   │   ├── TRY_CATCH_FINALLY2.json
        │   │   │   ├── TRY_CATCH_FINALLY3.json
        │   │   │   ├── TRY_CATCH_FINALLY4.json
        │   │   │   ├── TRY_CATCH_FINALLY5.json
        │   │   │   ├── TRY_CATCH_FINALLY6.json
        │   │   │   ├── TRY_CATCH_FINALLY7.json
        │   │   │   ├── TRY_CATCH_FINALLY8.json
        │   │   │   ├── TRY_CATCH_FINALLY9.json
        │   │   │   └── TRY_FINALLY.json
        │   │   ├── Push/
        │   │   │   ├── PUSHA.json
        │   │   │   ├── PUSHDATA1.json
        │   │   │   ├── PUSHDATA2.json
        │   │   │   ├── PUSHDATA4.json
        │   │   │   ├── PUSHINT8_to_PUSHINT256.json
        │   │   │   ├── PUSHM1_to_PUSH16.json
        │   │   │   └── PUSHNULL.json
        │   │   ├── Slot/
        │   │   │   ├── INITSLOT.json
        │   │   │   ├── INITSSLOT.json
        │   │   │   ├── LDARG.json
        │   │   │   ├── LDARG0.json
        │   │   │   ├── LDARG1.json
        │   │   │   ├── LDARG2.json
        │   │   │   ├── LDARG3.json
        │   │   │   ├── LDARG4.json
        │   │   │   ├── LDARG5.json
        │   │   │   ├── LDARG6.json
        │   │   │   ├── LDLOC.json
        │   │   │   ├── LDLOC0.json
        │   │   │   ├── LDLOC1.json
        │   │   │   ├── LDLOC2.json
        │   │   │   ├── LDLOC3.json
        │   │   │   ├── LDLOC4.json
        │   │   │   ├── LDLOC5.json
        │   │   │   ├── LDLOC6.json
        │   │   │   ├── LDSFLD.json
        │   │   │   ├── LDSFLD0.json
        │   │   │   ├── LDSFLD1.json
        │   │   │   ├── LDSFLD2.json
        │   │   │   ├── LDSFLD3.json
        │   │   │   ├── LDSFLD4.json
        │   │   │   ├── LDSFLD5.json
        │   │   │   ├── LDSFLD6.json
        │   │   │   ├── STARG.json
        │   │   │   ├── STARG0.json
        │   │   │   ├── STARG1.json
        │   │   │   ├── STARG2.json
        │   │   │   ├── STARG3.json
        │   │   │   ├── STARG4.json
        │   │   │   ├── STARG5.json
        │   │   │   ├── STARG6.json
        │   │   │   ├── STLOC.json
        │   │   │   ├── STSFLD.json
        │   │   │   ├── STSFLD0.json
        │   │   │   ├── STSFLD1.json
        │   │   │   ├── STSFLD2.json
        │   │   │   ├── STSFLD3.json
        │   │   │   ├── STSFLD4.json
        │   │   │   ├── STSFLD5.json
        │   │   │   └── STSFLD6.json
        │   │   ├── Splice/
        │   │   │   ├── CAT.json
        │   │   │   ├── LEFT.json
        │   │   │   ├── MEMCPY.json
        │   │   │   ├── NEWBUFFER.json
        │   │   │   ├── RIGHT.json
        │   │   │   └── SUBSTR.json
        │   │   ├── Stack/
        │   │   │   ├── CLEAR.json
        │   │   │   ├── DEPTH.json
        │   │   │   ├── DROP.json
        │   │   │   ├── NIP.json
        │   │   │   ├── OVER.json
        │   │   │   ├── PICK.json
        │   │   │   ├── REVERSE3.json
        │   │   │   ├── REVERSE4.json
        │   │   │   ├── REVERSEN.json
        │   │   │   ├── ROLL.json
        │   │   │   ├── ROT.json
        │   │   │   ├── SWAP.json
        │   │   │   ├── TUCK.json
        │   │   │   └── XDROP.json
        │   │   └── Types/
        │   │       ├── CONVERT.json
        │   │       ├── ISNULL.json
        │   │       └── ISTYPE.json
        │   └── Others/
        │       ├── Debugger.json
        │       ├── Init.json
        │       ├── InvocationLimits.json
        │       ├── OtherCases.json
        │       ├── ScriptLogic.json
        │       ├── StackItemLimits.json
        │       └── StackLimits.json
        ├── Types/
        │   ├── TestEngine.cs
        │   ├── VMUT.cs
        │   ├── VMUTActionType.cs
        │   ├── VMUTEntry.cs
        │   ├── VMUTExecutionContextState.cs
        │   ├── VMUTExecutionEngineState.cs
        │   ├── VMUTStackItem.cs
        │   ├── VMUTStackItemType.cs
        │   └── VMUTStep.cs
        ├── UT_Debugger.cs
        ├── UT_EvaluationStack.cs
        ├── UT_ExecutionContext.cs
        ├── UT_ReferenceCounter.cs
        ├── UT_ReferenceCounterComprehensive.cs
        ├── UT_Script.cs
        ├── UT_ScriptBuilder.cs
        ├── UT_Slot.cs
        ├── UT_StackItem.cs
        ├── UT_Struct.cs
        ├── UT_Unsafe.cs
        ├── UT_Utility.cs
        ├── UT_VMJson.cs
        └── VMJsonTestBase.cs

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
###############################
# Core EditorConfig Options   #
###############################

# dotnet-format requires version 3.1.37601
# dotnet tool update -g dotnet-format
# remember to have: git config --global core.autocrlf false  #(which is usually default)

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
end_of_line = lf

# (Please don't specify an indent_size here; that has too many unintended consequences.)
spelling_exclusion_path = SpellingExclusions.dic

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Powershell files
[*.ps1]
indent_size = 2

# Shell script files
[*.sh]
end_of_line = lf
indent_size = 2

# YAML files
[*.yml]
end_of_line = lf
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
# Use file-scoped namespace
csharp_style_namespace_declarations = file_scoped:warning

# Member can be made 'readonly'
csharp_style_prefer_readonly_struct_member = true
dotnet_diagnostic.IDE0251.severity = warning

dotnet_diagnostic.CS1591.severity = silent
// Use primary constructor
csharp_style_prefer_primary_constructors = false

# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = false
dotnet_separate_import_directive_groups = false

# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_collection_expression = never

# Whitespace options
dotnet_style_allow_multiple_blank_lines_experimental = false

# Non-private static fields are PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style

dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static

dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case

# Non-private readonly fields are PascalCase
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style

dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly

dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case

# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style

dotnet_naming_symbols.local_functions.applicable_kinds = local_function

dotnet_naming_style.local_function_style.capitalization = pascal_case

file_header_template = Copyright (C) 2015-2026 The Neo Project.\n\n{fileName} file belongs to the neo project and is free\nsoftware distributed under the MIT software license, see the\naccompanying file LICENSE in the main directory of the\nrepository or http://www.opensource.org/licenses/mit-license.php\nfor more details.\n\nRedistribution and use in source and binary forms with or without\nmodifications are permitted.

# Require file header
dotnet_diagnostic.IDE0073.severity = warning

# RS0016: Only enable if API files are present
dotnet_public_api_analyzer.require_api_files = true

# IDE0055: Fix formatting
# Workaround for https://github.com/dotnet/roslyn/issues/70570
dotnet_diagnostic.IDE0055.severity = warning

# CSharp code style settings:
[*.cs]
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

# Whitespace options
csharp_style_allow_embedded_statements_on_same_line_experimental = false
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# IDE0230: Use UTF-8 string literal
csharp_style_prefer_utf8_string_literals = true:silent

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Blocks are allowed
csharp_prefer_braces = true:silent
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = none

[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]

# Avoid "this." and "Me." if not necessary
dotnet_diagnostic.IDE0003.severity = warning
dotnet_diagnostic.IDE0009.severity = warning

# IDE0011: Add braces
csharp_prefer_braces = when_multiline:warning
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
dotnet_diagnostic.IDE0011.severity = warning

# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = warning

# IDE0052: Remove unread private member
dotnet_diagnostic.IDE0052.severity = warning

# IDE0059: Unnecessary assignment to a value
dotnet_diagnostic.IDE0059.severity = warning

# Use collection expression for array
dotnet_diagnostic.IDE0300.severity = warning

# CA1012: Abstract types should not have public constructors
dotnet_diagnostic.CA1012.severity = warning

# CA1822: Make member static
dotnet_diagnostic.CA1822.severity = warning

# csharp_style_allow_embedded_statements_on_same_line_experimental
dotnet_diagnostic.IDE2001.severity = warning

# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
dotnet_diagnostic.IDE2002.severity = warning

# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
dotnet_diagnostic.IDE2004.severity = warning

# csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
dotnet_diagnostic.IDE2005.severity = warning

# csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental
dotnet_diagnostic.IDE2006.severity = warning

[src/{VisualStudio}/**/*.{cs,vb}]
# CA1822: Make member static
# There is a risk of accidentally breaking an internal API that partners rely on though IVT.
dotnet_code_quality.CA1822.api_surface = private


================================================
FILE: .github/workflows/main.yml
================================================
name: .NET Core Test and Publish

on:
  push:
    branches: [master]
  pull_request:

env:
  DOTNET_VERSION: 10.0.x

jobs:

  Test:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v6
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: |
          ${{ env.DOTNET_VERSION }}
    - name: Check format
      run: |
        dotnet format --verify-no-changes --verbosity diagnostic
    - name: Test
      run: |
        find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
        dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov
    - name: Codecov
      uses: codecov/codecov-action@v6
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        files: ${{ github.workspace }}/TestResults/coverage/coverage.info
        fail_ci_if_error: false

  PublishMyGet:
    if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
    needs: Test
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v6
      with:
        fetch-depth: 0
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}
    - name: Pack with dotnet
      run: git rev-list --count HEAD |xargs printf "CI%05d" |xargs dotnet pack -c Debug -o out --include-source --version-suffix
    - name: Publish to MyGet
      run: dotnet nuget push out/*.nupkg -s https://www.myget.org/F/neo/api/v2/package -k ${MYGET_TOKEN} -ss https://www.myget.org/F/neo/symbols/api/v2/package -sk ${MYGET_TOKEN}
      env:
        MYGET_TOKEN: ${{ secrets.MYGET_TOKEN }}

  Release:
    if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
    needs: Test
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v6
    - name: Get version
      id: get_version
      run: |
        sudo apt install xmlstarlet
        find src -name *.csproj | xargs xmlstarlet sel -t -v "concat('version=v',//Version/text())" | xargs echo >> $GITHUB_OUTPUT
    - name: Check tag
      if: steps.get_version.outputs.version != 'v' && startsWith(steps.get_version.outputs.version, 'v')
      id: check_tag
      run: curl -s -I ${{ format('https://github.com/{0}/releases/tag/{1}', github.repository, steps.get_version.outputs.version) }} | head -n 1 | cut -d$' ' -f2 | xargs printf "statusCode=%s" | xargs echo >> $GITHUB_OUTPUT
    - name: Create release
      if: steps.check_tag.outputs.statusCode == '404'
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ steps.get_version.outputs.version }}
        release_name: ${{ steps.get_version.outputs.version }}
        prerelease: ${{ contains(steps.get_version.outputs.version, '-') }}
    - name: Setup .NET Core
      if: steps.check_tag.outputs.statusCode == '404'
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}
    - name: Publish to NuGet
      if: steps.check_tag.outputs.statusCode == '404'
      run: |
        dotnet pack -o out -c Release
        dotnet nuget push out/*.nupkg -s https://api.nuget.org/v3/index.json -k ${NUGET_TOKEN}
      env:
        NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}


================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Git worktrees (project-local)
.worktrees/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2016 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
<a href="https://neo.org/"><img src="https://neo3.azureedge.net/images/logo%20files-dark.svg" width="250px" alt="neo-logo"></a>

# NeoVM — The NEO Virtual Machine

[![NuGet](https://img.shields.io/nuget/v/Neo.VM.svg)](https://www.nuget.org/packages/Neo.VM/)
[![Coverage Status](https://coveralls.io/repos/github/neo-project/neo-vm/badge.svg)](https://coveralls.io/github/neo-project/neo-vm)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

NeoVM is the lightweight, deterministic, stack-based virtual machine that executes Neo smart contracts. It’s designed to be embeddable, predictable, and portable across platforms. For an overview and deep dives (architecture, stacks, instruction set), see the official developer docs. ([NEO Developer Resource](https://developers.neo.org/docs/n3/foundation/neovm))

---

## Features

* **Deterministic & Turing-complete** execution for smart contracts.
* **Small, embeddable runtime** suitable for host applications beyond the Neo blockchain.
* **Clear isolation boundary**: external effects are provided by the host via an interop/syscall layer (e.g., ApplicationEngine in Neo).
* **Rich instruction set** (control flow, stacks, arithmetic, crypto, data structures).

---

## Packages

The VM is published as a NuGet package:

```
dotnet add package Neo.VM
```

This adds the VM to your project; you can then embed and drive it from your host application.

Targets **.NET 10.0** and **.NET Standard 2.1** (compatible with a wide range of runtimes).

---

## Contributing

Contributions are welcome! Typical flow:

1. Fork the repo and create a feature branch.
2. Make changes with tests (`tests/Neo.VM.Tests`).
3. Ensure `dotnet test` passes and follow standard C# conventions.
4. Open a pull request with a clear description and rationale.

---

## See also

* **neo (core library)** — base classes, ledger, P2P, IO. ([Github](https://github.com/neo-project/neo))
* **neo-devpack-dotnet** — C# → NeoVM compiler and developer toolkit. ([Github](https://github.com/neo-project/neo-devpack-dotnet))


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Benchmarks.POC.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmarks.POC.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;
using System.Diagnostics;

namespace Neo.VM.Benchmarks;

public class Benchmarks_PoCs
{
    [Benchmark]
    public static void NeoIssue2528()
    {
        // https://github.com/neo-project/neo/issues/2528
        // L01: INITSLOT 1, 0
        // L02: NEWARRAY0
        // L03: DUP
        // L04: DUP
        // L05: PUSHINT16 2043
        // L06: STLOC 0
        // L07: PUSH1
        // L08: PACK
        // L09: LDLOC 0
        // L10: DEC
        // L11: STLOC 0
        // L12: LDLOC 0
        // L13: JMPIF_L L07
        // L14: PUSH1
        // L15: PACK
        // L16: APPEND
        // L17: PUSHINT32 38000
        // L18: STLOC 0
        // L19: PUSH0
        // L20: PICKITEM
        // L21: LDLOC 0
        // L22: DEC
        // L23: STLOC 0
        // L24: LDLOC 0
        // L25: JMPIF_L L19
        // L26: DROP
        Run("VwEAwkpKAfsHdwARwG8AnXcAbwAl9////xHAzwJwlAAAdwAQzm8AnXcAbwAl9////0U=");
    }

    [Benchmark]
    public static void NeoVMIssue418()
    {
        // https://github.com/neo-project/neo-vm/issues/418
        // L00: NEWARRAY0
        // L01: PUSH0
        // L02: PICK
        // L03: PUSH1
        // L04: PACK
        // L05: PUSH1
        // L06: PICK
        // L07: PUSH1
        // L08: PACK
        // L09: INITSSLOT 1
        // L10: PUSHINT16 510
        // L11: DEC
        // L12: STSFLD0
        // L13: PUSH1
        // L14: PICK
        // L15: PUSH1
        // L16: PICK
        // L17: PUSH2
        // L18: PACK
        // L19: REVERSE3
        // L20: PUSH2
        // L21: PACK
        // L22: LDSFLD0
        // L23: DUP
        // L24: JMPIF L11
        // L25: DROP
        // L26: ROT
        // L27: DROP
        Run("whBNEcARTRHAVgEB/gGdYBFNEU0SwFMSwFhKJPNFUUU=");
    }

    [Benchmark]
    public static void NeoIssue2723()
    {
        // L00: INITSSLOT 1
        // L01: PUSHINT32 130000
        // L02: STSFLD 0
        // L03: PUSHINT32 1048576
        // L04: NEWBUFFER
        // L05: DROP
        // L06: LDSFLD 0
        // L07: DEC
        // L08: DUP
        // L09: STSFLD 0
        // L10: JMPIF L03
        Run("VgEC0PsBAGcAAgAAEACIRV8AnUpnACTz");
    }

    // Below are PoCs from issue https://github.com/neo-project/neo/issues/2723 by @dusmart
    [Benchmark]
    public static void PoC_NewBuffer()
    {
        // INITSLOT 0100
        // PUSHINT32 23000000
        // STLOC 00
        // PUSHINT32 1048576
        // NEWBUFFER
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f2ffffff
        // CLEAR
        // RET
        Run("VwEAAsDzXgF3AAIAABAAiEVvAJ13AG8AJfL///9JQA==");
    }

    [Benchmark]
    public static void PoC_Cat()
    {
        // INITSLOT 0100
        // PUSHINT32 1048575
        // NEWBUFFER
        // PUSH1
        // NEWBUFFER
        // PUSHINT32 133333337
        // STLOC 00
        // OVER
        // OVER
        // CAT
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f5ffffff
        // CLEAR
        // RET
        Run("VwEAAv//DwCIEYgCWYHyB3cAS0uLRW8AnXcAbwAl9f///0lA");
    }

    [Benchmark]
    public static void PoC_Left()
    {
        // INITSLOT 0100
        // PUSHINT32 1048576
        // NEWBUFFER
        // PUSHINT32 133333337
        // STLOC 00
        // DUP
        // PUSHINT32 1048576
        // LEFT
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f1ffffff
        // CLEAR
        // RET
        Run("VwEAAgAAEACIAlmB8gd3AEoCAAAQAI1FbwCddwBvACXx////SUA=");
    }

    [Benchmark]
    public static void PoC_Right()
    {
        // INITSLOT 0100
        // PUSHINT32 1048576
        // NEWBUFFER
        // PUSHINT32 133333337
        // STLOC 00
        // DUP
        // PUSHINT32 1048576
        // RIGHT
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f1ffffff
        // CLEAR
        // RET
        Run("VwEAAgAAEACIAlmB8gd3AEoCAAAQAI5FbwCddwBvACXx////SUA=");
    }

    [Benchmark]
    public static void PoC_ReverseN()
    {
        // INITSLOT 0100
        // PUSHINT16 2040
        // STLOC 00
        // PUSHDATA1 aaabbbbbbbbbcccccccdddddddeeeeeeefffffff
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L cfffffff
        // PUSHINT32 23000000
        // STLOC 00
        // PUSHINT16 2040
        // REVERSEN
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f5ffffff
        // CLEAR
        // RET
        Run("VwEAAfgHdwAMKGFhYWJiYmJiYmJiYmNjY2NjY2NkZGRkZGRkZWVlZWVlZWZmZmZmZmZvAJ13AG8AJc////8CwPNeAXcAAfgHVW8AnXcAbwAl9f///0lA");
    }

    [Benchmark]
    public static void PoC_Substr()
    {
        // INITSLOT 0100
        // PUSHINT32 1048576
        // NEWBUFFER
        // PUSHINT32 133333337
        // STLOC 00
        // DUP
        // PUSH0
        // PUSHINT32 1048576
        // SUBSTR
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f0ffffff
        // CLEAR
        // RET
        Run("VwEAAgAAEACIAlmB8gd3AEoQAgAAEACMRW8AnXcAbwAl8P///0lA");
    }

    [Benchmark]
    public static void PoC_NewArray()
    {
        // INITSLOT 0100
        // PUSHINT32 1333333337
        // STLOC 00
        // PUSHINT16 2040
        // NEWARRAY
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f4ffffff
        // RET
        Run("VwEAAlkNeU93AAH4B8NFbwCddwBvACX0////QA==");
    }

    [Benchmark]
    public static void PoC_NewStruct()
    {
        // INITSLOT 0100
        // PUSHINT32 1333333337
        // STLOC 00
        // PUSHINT16 2040
        // NEWSTRUCT
        // DROP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f4ffffff
        // RET
        Run("VwEAAlkNeU93AAH4B8ZFbwCddwBvACX0////QA==");
    }

    [Benchmark]
    public static void PoC_Roll()
    {
        // INITSLOT 0100
        // PUSHINT16 2040
        // STLOC 00
        // PUSHDATA1 aaabbbbbbbbbcccccccdddddddeeeeeeefffffff
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L cfffffff
        // PUSHINT32 23000000
        // STLOC 00
        // PUSHINT16 2039
        // ROLL
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f5ffffff
        // CLEAR
        // RET
        Run("VwEAAfgHdwAMKGFhYWJiYmJiYmJiYmNjY2NjY2NkZGRkZGRkZWVlZWVlZWZmZmZmZmZvAJ13AG8AJc////8CwPNeAXcAAfcHUm8AnXcAbwAl9f///0lA");
    }

    [Benchmark]
    public static void PoC_XDrop()
    {
        // INITSLOT 0100
        // PUSHINT16 2040
        // STLOC 00
        // PUSHDATA1 aaabbbbbbbbbcccccccdddddddeeeeeeefffffff
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L cfffffff
        // PUSHINT32 23000000
        // STLOC 00
        // PUSHINT16 2039
        // XDROP
        // DUP
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f4ffffff
        // CLEAR
        // RET
        Run("VwEAAfgHdwAMKGFhYWJiYmJiYmJiYmNjY2NjY2NkZGRkZGRkZWVlZWVlZWZmZmZmZmZvAJ13AG8AJc////8CwPNeAXcAAfcHSEpvAJ13AG8AJfT///9JQA==");
    }

    [Benchmark]
    public static void PoC_MemCpy()
    {
        // INITSLOT 0100
        // PUSHINT32 1048576
        // NEWBUFFER
        // PUSHINT32 1048576
        // NEWBUFFER
        // PUSHINT32 133333337
        // STLOC 00
        // OVER
        // PUSH0
        // PUSH2
        // PICK
        // PUSH0
        // PUSHINT32 1048576
        // MEMCPY
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L eeffffff
        // CLEAR
        // RET
        Run("VwEAAgAAEACIAgAAEACIAlmB8gd3AEsQEk0QAgAAEACJbwCddwBvACXu////SUA=");
    }

    [Benchmark]
    public static void PoC_Unpack()
    {
        // INITSLOT 0200
        // PUSHINT16 1010
        // NEWARRAY
        // STLOC 01
        // PUSHINT32 1333333337
        // STLOC 00
        // LDLOC 01
        // UNPACK
        // CLEAR
        // LDLOC 00
        // DEC
        // STLOC 00
        // LDLOC 00
        // JMPIF_L f5ffffff
        // RET
        Run("VwIAAfIDw3cBAlkNeU93AG8BwUlvAJ13AG8AJfX///9A");
    }

    [Benchmark]
    public static void PoC_GetScriptContainer()
    {
        // SYSCALL System.Runtime.GetScriptContainer
        // DROP
        // JMP fa
        Run("QS1RCDBFIvo=");
    }

    private static void Run(string poc)
    {
        byte[] script = Convert.FromBase64String(poc);
        using ExecutionEngine engine = new();
        engine.LoadScript(script);
        engine.Execute();

        Debug.Assert(engine.State == VMState.HALT);
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Benchmarks_VMHotPaths.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmarks_VMHotPaths.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;
using Neo.VM.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using VMArray = Neo.VM.Types.Array;

namespace Neo.VM.Benchmarks;

public class Benchmarks_ArrayBuild
{
    [Params(1, 8, 32, 256, 1024)]
    public int N { get; set; }

    private static readonly StackItem Item = StackItem.Null;

    [Benchmark]
    public VMArray BuildWithListFill()
    {
        var referenceCounter = new ReferenceCounter();
        var items = new List<StackItem>(N);
        for (int i = 0; i < N; i++)
            items.Add(Item);
        return new VMArray(referenceCounter, items);
    }

    [Benchmark]
    public VMArray BuildWithArrayFill()
    {
        var referenceCounter = new ReferenceCounter();
        var itemArray = new StackItem[N];
        System.Array.Fill(itemArray, Item);
        return new VMArray(referenceCounter, itemArray);
    }
}

public class Benchmarks_MapSubItems
{
    [Params(1, 8, 32, 256, 1024)]
    public int N { get; set; }

    private Map _map = null!;

    [GlobalSetup]
    public void Setup()
    {
        _map = new Map();
        for (int i = 0; i < N; i++)
            _map[new Integer(i)] = new Integer(i + 1);
    }

    [Benchmark]
    public int EnumerateYield()
    {
        int count = 0;
        foreach (var _ in SubItemsYield(_map))
            count++;
        return count;
    }

    [Benchmark]
    public int EnumerateConcat()
    {
        int count = 0;
        foreach (var _ in SubItemsConcat(_map))
            count++;
        return count;
    }

    private static IEnumerable<StackItem> SubItemsYield(Map map)
    {
        foreach (var key in map.Keys)
            yield return key;
        foreach (var value in map.Values)
            yield return value;
    }

    private static IEnumerable<StackItem> SubItemsConcat(Map map) => map.Keys.Concat(map.Values);
}

public class Benchmarks_ListCopy
{
    private const int SourceCount = 4096;

    [Params(1, 8, 32, 256, 1024, 2048)]
    public int CopyCount { get; set; }

    private List<StackItem> _source = null!;
    private List<StackItem> _target = null!;

    [GlobalSetup]
    public void Setup()
    {
        _source = new List<StackItem>(SourceCount);
        for (int i = 0; i < SourceCount; i++)
            _source.Add(StackItem.Null);
        _target = new List<StackItem>(CopyCount);
    }

    [Benchmark]
    public int AddRangeSkip()
    {
        _target.Clear();
        _target.AddRange(_source.Skip(_source.Count - CopyCount));
        return _target.Count;
    }

    [Benchmark]
    public int ManualLoop()
    {
        _target.Clear();
        int start = _source.Count - CopyCount;
        for (int i = start; i < _source.Count; i++)
            _target.Add(_source[i]);
        return _target.Count;
    }
}

public class Benchmarks_InstructionAdvance
{
    [Params(1024, 4096, 16384)]
    public int InstructionCount { get; set; }

    private Script _script = null!;
    private ExecutionContext _context = null!;

    [GlobalSetup]
    public void Setup()
    {
        var bytes = new byte[InstructionCount];
        System.Array.Fill(bytes, (byte)OpCode.PUSH0);
        _script = new Script(bytes);
        _context = new ExecutionContext(_script, 0, new ReferenceCounter());
    }

    [IterationSetup]
    public void IterationSetup()
    {
        WarmInstructionCache();
        _context.InstructionPointer = 0;
    }

    [Benchmark]
    public Instruction? AdvanceWithMoveNext()
    {
        Instruction? last = null;
        while (true)
        {
            last = _context.CurrentInstruction ?? Instruction.RET;
            if (!_context.MoveNext()) break;
        }
        return last;
    }

    [Benchmark]
    public Instruction? AdvanceWithPointer()
    {
        Instruction? last = null;
        while (true)
        {
            var current = _context.CurrentInstruction;
            if (current is null) break;
            last = current;
            _context.InstructionPointer += current.Size;
        }
        return last;
    }

    private void WarmInstructionCache()
    {
        while (true)
        {
            var current = _context.CurrentInstruction;
            if (current is null) break;
            _context.InstructionPointer += current.Size;
        }
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Builders/Helper.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Helper.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.Buffers.Binary;

namespace Neo.VM.Benchmarks.Builders;

public static class Helper
{
    public static void RebuildOffsets(this IReadOnlyList<Instruction> instructions)
    {
        var offset = 0;
        foreach (var instruction in instructions)
        {
            instruction._offset = offset;
            offset += instruction.Size;
        }
    }

    public static void RebuildOperands(this IReadOnlyList<Instruction> instructions)
    {
        foreach (var instruction in instructions)
        {
            if (instruction._target is null) continue;
            bool isLong;
            if (instruction._opCode >= OpCode.JMP && instruction._opCode <= OpCode.CALL_L)
                isLong = (instruction._opCode - OpCode.JMP) % 2 != 0;
            else
                isLong = instruction._opCode == OpCode.PUSHA || instruction._opCode == OpCode.CALLA || instruction._opCode == OpCode.TRY_L || instruction._opCode == OpCode.ENDTRY_L;
            if (instruction._opCode == OpCode.TRY || instruction._opCode == OpCode.TRY_L)
            {
                var offset1 = instruction._target._instruction?._offset - instruction._offset ?? 0;
                var offset2 = instruction._target2!._instruction?._offset - instruction._offset ?? 0;
                if (isLong)
                {
                    instruction._operand = new byte[sizeof(int) + sizeof(int)];
                    BinaryPrimitives.WriteInt32LittleEndian(instruction._operand, offset1);
                    BinaryPrimitives.WriteInt32LittleEndian(instruction._operand.AsSpan(sizeof(int)), offset2);
                }
                else
                {
                    instruction._operand = new byte[sizeof(sbyte) + sizeof(sbyte)];
                    var sbyte1 = checked((sbyte)offset1);
                    var sbyte2 = checked((sbyte)offset2);
                    instruction._operand[0] = unchecked((byte)sbyte1);
                    instruction._operand[1] = unchecked((byte)sbyte2);
                }
            }
            else
            {
                int offset = instruction._target._instruction!._offset - instruction._offset;
                if (isLong)
                {
                    instruction._operand = BitConverter.GetBytes(offset);
                }
                else
                {
                    var sbyte1 = checked((sbyte)offset);
                    instruction._operand = [unchecked((byte)sbyte1)];
                }
            }
        }
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Builders/Instruction.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Instruction.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Microsoft.CodeAnalysis;
using System.Diagnostics;
using System.Reflection;

namespace Neo.VM.Benchmarks.Builders;

[DebuggerDisplay("{_opCode}")]
public class Instruction
{
    private static readonly int[] s_operandSizePrefixTable = new int[256];
    private static readonly int[] s_operandSizeTable = new int[256];

    public OpCode _opCode;
    public byte[]? _operand;
    public JumpTarget? _target;
    public JumpTarget? _target2;
    public int _offset;

    public int Size
    {
        get
        {
            int prefixSize = s_operandSizePrefixTable[(int)_opCode];
            return prefixSize > 0
                ? sizeof(OpCode) + _operand!.Length
                : sizeof(OpCode) + s_operandSizeTable[(int)_opCode];
        }
    }

    static Instruction()
    {
        foreach (var field in typeof(OpCode).GetFields(BindingFlags.Public | BindingFlags.Static))
        {
            var attribute = field.GetCustomAttribute<OperandSizeAttribute>();
            if (attribute is null) continue;
            var index = (int)(OpCode)field.GetValue(null)!;
            s_operandSizePrefixTable[index] = attribute.SizePrefix;
            s_operandSizeTable[index] = attribute.Size;
        }
    }

    public byte[] ToArray()
    {
        if (_operand is null) return [(byte)_opCode];
        return _operand.Prepend((byte)_opCode).ToArray();
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Builders/InstructionBuilder.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// InstructionBuilder.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.Buffers.Binary;
using System.Numerics;

namespace Neo.VM.Benchmarks.Builders;

internal class InstructionBuilder
{
    private readonly List<Instruction> _instructions = new();

    public InstructionBuilder() { }

    internal Instruction AddInstruction(Instruction instruction)
    {
        _instructions.Add(instruction);
        return instruction;
    }

    internal Instruction AddInstruction(OpCode opcode)
    {
        return AddInstruction(new Instruction
        {
            _opCode = opcode
        });
    }

    internal Instruction Jump(OpCode opcode, JumpTarget target)
    {
        return AddInstruction(new Instruction
        {
            _opCode = opcode,
            _target = target
        });
    }

    internal void Push(bool value)
    {
        AddInstruction(value ? OpCode.PUSHT : OpCode.PUSHF);
    }

    internal Instruction Ret() => AddInstruction(OpCode.RET);

    internal Instruction Push(BigInteger number)
    {
        if (number >= -1 && number <= 16) return AddInstruction(number == -1 ? OpCode.PUSHM1 : OpCode.PUSH0 + (byte)(int)number);
        Span<byte> buffer = stackalloc byte[32];
        if (!number.TryWriteBytes(buffer, out var bytesWritten, isUnsigned: false, isBigEndian: false))
            throw new ArgumentOutOfRangeException(nameof(number));
        var instruction = bytesWritten switch
        {
            1 => new Instruction
            {
                _opCode = OpCode.PUSHINT8,
                _operand = PadRight(buffer, bytesWritten, 1, number.Sign < 0).ToArray()
            },
            2 => new Instruction
            {
                _opCode = OpCode.PUSHINT16,
                _operand = PadRight(buffer, bytesWritten, 2, number.Sign < 0).ToArray()
            },
            <= 4 => new Instruction
            {
                _opCode = OpCode.PUSHINT32,
                _operand = PadRight(buffer, bytesWritten, 4, number.Sign < 0).ToArray()
            },
            <= 8 => new Instruction
            {
                _opCode = OpCode.PUSHINT64,
                _operand = PadRight(buffer, bytesWritten, 8, number.Sign < 0).ToArray()
            },
            <= 16 => new Instruction
            {
                _opCode = OpCode.PUSHINT128,
                _operand = PadRight(buffer, bytesWritten, 16, number.Sign < 0).ToArray()
            },
            <= 32 => new Instruction
            {
                _opCode = OpCode.PUSHINT256,
                _operand = PadRight(buffer, bytesWritten, 32, number.Sign < 0).ToArray()
            },
            _ => throw new ArgumentOutOfRangeException($"Number too large: {bytesWritten}")
        };
        AddInstruction(instruction);
        return instruction;
    }

    internal Instruction Push(string s)
    {
        return Push(s.ToStrictUtf8Bytes());
    }

    internal Instruction Push(byte[] data)
    {
        OpCode opcode;
        byte[] buffer;
        switch (data.Length)
        {
            case <= byte.MaxValue:
                opcode = OpCode.PUSHDATA1;
                buffer = new byte[sizeof(byte) + data.Length];
                buffer[0] = (byte)data.Length;
                Buffer.BlockCopy(data, 0, buffer, sizeof(byte), data.Length);
                break;
            case <= ushort.MaxValue:
                opcode = OpCode.PUSHDATA2;
                buffer = new byte[sizeof(ushort) + data.Length];
                BinaryPrimitives.WriteUInt16LittleEndian(buffer, (ushort)data.Length);
                Buffer.BlockCopy(data, 0, buffer, sizeof(ushort), data.Length);
                break;
            default:
                opcode = OpCode.PUSHDATA4;
                buffer = new byte[sizeof(uint) + data.Length];
                BinaryPrimitives.WriteUInt32LittleEndian(buffer, (uint)data.Length);
                Buffer.BlockCopy(data, 0, buffer, sizeof(uint), data.Length);
                break;
        }
        return AddInstruction(new Instruction
        {
            _opCode = opcode,
            _operand = buffer
        });
    }

    internal void Push(object? obj)
    {
        switch (obj)
        {
            case bool data:
                Push(data);
                break;
            case byte[] data:
                Push(data);
                break;
            case string data:
                Push(data);
                break;
            case BigInteger data:
                Push(data);
                break;
            case char data:
                Push((ushort)data);
                break;
            case sbyte data:
                Push(data);
                break;
            case byte data:
                Push(data);
                break;
            case short data:
                Push(data);
                break;
            case ushort data:
                Push(data);
                break;
            case int data:
                Push(data);
                break;
            case uint data:
                Push(data);
                break;
            case long data:
                Push(data);
                break;
            case ulong data:
                Push(data);
                break;
            case Enum data:
                Push(BigInteger.Parse(data.ToString("d")));
                break;
            case null:
                AddInstruction(OpCode.PUSHNULL);
                break;
            default:
                throw new NotSupportedException($"Unsupported constant value: {obj}");
        }
    }

    // Helper method to reverse stack items
    internal void ReverseStackItems(int count)
    {
        switch (count)
        {
            case 2:
                AddInstruction(OpCode.SWAP);
                break;
            case 3:
                AddInstruction(OpCode.REVERSE3);
                break;
            case 4:
                AddInstruction(OpCode.REVERSE4);
                break;
            default:
                Push(count);
                AddInstruction(OpCode.REVERSEN);
                break;
        }
    }

    internal static ReadOnlySpan<byte> PadRight(Span<byte> buffer, int dataLength, int padLength, bool negative)
    {
        byte pad = negative ? (byte)0xff : (byte)0;
        for (int x = dataLength; x < padLength; x++)
            buffer[x] = pad;
        return buffer[..padLength];
    }

    internal Instruction IsType(Types.StackItemType type)
    {
        return AddInstruction(new Instruction
        {
            _opCode = OpCode.ISTYPE,
            _operand = [(byte)type]
        });
    }

    internal Instruction ChangeType(Types.StackItemType type)
    {
        return AddInstruction(new Instruction
        {
            _opCode = OpCode.CONVERT,
            _operand = [(byte)type]
        });
    }

    internal byte[] ToArray()
    {
        var instructions = _instructions.ToArray();
        instructions.RebuildOffsets();
        instructions.RebuildOperands();
        return instructions.Select(p => p.ToArray()).SelectMany(p => p).ToArray();
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Builders/JumpTarget.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// JumpTarget.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

namespace Neo.VM.Benchmarks.Builders;

public class JumpTarget
{
    public Instruction? _instruction;
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Neo.VM.Benchmarks.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\Neo.VM\Neo.VM.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Arrays/OpCode.ReverseN.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// OpCode.ReverseN.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Benchmarks.Builders;

namespace Neo.VM.Benchmarks.OpCodes.Arrays;

public class OpCode_ReverseN : OpCodeBase
{
    protected override byte[] CreateScript(BenchmarkMode benchmarkMode)
    {
        var builder = new InstructionBuilder();
        var initBegin = new JumpTarget();
        builder.AddInstruction(new Builders.Instruction { _opCode = OpCode.INITSLOT, _operand = [1, 0] });
        builder.Push(ItemCount);
        builder.AddInstruction(OpCode.STLOC0);
        initBegin._instruction = builder.AddInstruction(OpCode.NOP);
        builder.Push(0);
        builder.AddInstruction(OpCode.LDLOC0);
        builder.AddInstruction(OpCode.DEC);
        builder.AddInstruction(OpCode.STLOC0);
        builder.AddInstruction(OpCode.LDLOC0);
        builder.Jump(OpCode.JMPIF, initBegin);
        if (benchmarkMode == BenchmarkMode.BaseLine)
        {
            return builder.ToArray();
        }
        builder.Push(ItemCount);
        builder.AddInstruction(OpCode.REVERSEN);
        if (benchmarkMode == BenchmarkMode.OneGAS)
        {
            // just keep running until GAS is exhausted
            var loopStart = new JumpTarget { _instruction = builder.AddInstruction(OpCode.NOP) };
            builder.Push(ItemCount);
            builder.AddInstruction(OpCode.REVERSEN);
            builder.Jump(OpCode.JMP, loopStart);
        }

        return builder.ToArray();
    }
}

// for 0

// BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.4249/23H2/2023Update/SunValley3)
// Intel Core i9-14900HX, 1 CPU, 32 logical and 24 physical cores
// .NET SDK 8.0.205
//   [Host]     : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
//   DefaultJob : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
//
//
// | Method               | ItemCount | Mean             | Error         | StdDev         | Median           | Ratio     | RatioSD  |
// |--------------------- |---------- |-----------------:|--------------:|---------------:|-----------------:|----------:|---------:|
// | Bench_ReverseN       | 1         |         63.43 us |      0.466 us |       0.518 us |         63.45 us |      0.99 |     0.01 |
// | Bench_OneGasReverseN | 1         |    403,904.11 us |  6,492.511 us |   6,073.099 us |    402,932.40 us |  6,315.67 |    89.44 |
// | Bench_BaseLine       | 1         |         63.96 us |      0.763 us |       0.714 us |         63.92 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 2         |         62.55 us |      0.988 us |       0.924 us |         62.46 us |      0.95 |     0.02 |
// | Bench_OneGasReverseN | 2         |    424,297.10 us |  8,453.137 us |   7,493.486 us |    423,912.90 us |  6,446.21 |   118.35 |
// | Bench_BaseLine       | 2         |         65.83 us |      0.845 us |       0.749 us |         65.95 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 4         |         63.93 us |      0.418 us |       0.371 us |         63.89 us |      0.95 |     0.03 |
// | Bench_OneGasReverseN | 4         |    443,708.92 us |  6,689.013 us |   6,256.907 us |    444,636.60 us |  6,560.69 |   229.86 |
// | Bench_BaseLine       | 4         |         67.64 us |      1.281 us |       1.524 us |         67.79 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 8         |         66.69 us |      0.757 us |       0.671 us |         66.69 us |      1.00 |     0.02 |
// | Bench_OneGasReverseN | 8         |    463,571.38 us |  6,614.687 us |   6,187.382 us |    465,568.00 us |  6,963.59 |    85.80 |
// | Bench_BaseLine       | 8         |         66.64 us |      0.870 us |       0.771 us |         66.68 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 16        |         65.85 us |      0.994 us |       0.929 us |         65.61 us |      0.94 |     0.02 |
// | Bench_OneGasReverseN | 16        |    740,905.55 us | 71,090.901 us | 209,613.127 us |    653,644.75 us |  9,341.86 | 3,092.85 |
// | Bench_BaseLine       | 16        |         70.08 us |      1.376 us |       1.638 us |         70.15 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 32        |         66.47 us |      0.928 us |       2.187 us |         65.77 us |      1.02 |     0.04 |
// | Bench_OneGasReverseN | 32        |    631,596.65 us | 11,060.847 us |  10,346.323 us |    629,654.10 us |  9,360.06 |   221.36 |
// | Bench_BaseLine       | 32        |         67.49 us |      0.900 us |       0.842 us |         67.56 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 64        |         72.21 us |      0.921 us |       0.862 us |         72.05 us |      1.02 |     0.02 |
// | Bench_OneGasReverseN | 64        |    787,570.95 us |  6,915.746 us |   6,468.994 us |    786,778.70 us | 11,090.76 |   177.74 |
// | Bench_BaseLine       | 64        |         71.02 us |      0.946 us |       0.884 us |         71.06 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 128       |         80.17 us |      0.723 us |       0.676 us |         80.19 us |      0.98 |     0.01 |
// | Bench_OneGasReverseN | 128       |  1,134,510.61 us | 14,991.714 us |  14,023.259 us |  1,133,177.90 us | 13,828.61 |   184.58 |
// | Bench_BaseLine       | 128       |         81.90 us |      0.623 us |       0.553 us |         81.77 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 256       |         98.24 us |      1.140 us |       1.067 us |         98.05 us |      0.99 |     0.01 |
// | Bench_OneGasReverseN | 256       |  1,785,906.33 us | 13,785.746 us |  12,895.195 us |  1,788,819.30 us | 18,067.20 |   198.87 |
// | Bench_BaseLine       | 256       |         98.85 us |      0.961 us |       0.899 us |         98.95 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 512       |        136.19 us |      1.614 us |       1.510 us |        136.34 us |      1.02 |     0.02 |
// | Bench_OneGasReverseN | 512       |  3,100,087.41 us | 16,564.249 us |  15,494.209 us |  3,097,066.60 us | 23,209.57 |   381.50 |
// | Bench_BaseLine       | 512       |        133.60 us |      2.144 us |       2.006 us |        132.73 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 1024      |        207.06 us |      2.213 us |       2.070 us |        206.76 us |      1.01 |     0.01 |
// | Bench_OneGasReverseN | 1024      |  5,762,294.72 us | 20,289.404 us |  16,942.572 us |  5,764,133.80 us | 28,109.14 |   349.87 |
// | Bench_BaseLine       | 1024      |        205.07 us |      2.360 us |       2.208 us |        205.07 us |      1.00 |     0.00 |
// |                      |           |                  |               |                |                  |           |          |
// | Bench_ReverseN       | 2040      |        345.09 us |      4.271 us |       3.995 us |        345.40 us |      0.97 |     0.01 |
// | Bench_OneGasReverseN | 2040      | 11,005,147.03 us | 37,306.455 us |  33,071.200 us | 11,003,479.70 us | 31,019.36 |   356.02 |
// | Bench_BaseLine       | 2040      |        354.62 us |      4.623 us |       4.325 us |        353.32 us |      1.00 |     0.00 |



// for StackItems that has a size of maximum stack size.
// | Method               | ItemCount | Mean            | Error         | StdDev        |
// |--------------------- |---------- |----------------:|--------------:|--------------:|
// | Bench_ReverseN       | 1         |        104.0 us |       0.77 us |       0.72 us |
// | Bench_OneGasReverseN | 1         |    389,585.4 us |   4,740.18 us |   4,433.96 us |
// | Bench_ReverseN       | 2         |        148.3 us |       2.25 us |       2.10 us |
// | Bench_OneGasReverseN | 2         |    417,831.5 us |   6,651.20 us |   6,221.53 us |
// | Bench_ReverseN       | 4         |        231.8 us |       3.92 us |       3.67 us |
// | Bench_OneGasReverseN | 4         |    428,442.6 us |   8,034.41 us |   7,515.39 us |
// | Bench_ReverseN       | 8         |        387.8 us |       5.23 us |       4.89 us |
// | Bench_OneGasReverseN | 8         |    448,046.9 us |   6,270.18 us |   5,235.89 us |
// | Bench_ReverseN       | 16        |        240.0 us |       7.30 us |      21.53 us |
// | Bench_OneGasReverseN | 16        |    522,904.3 us |   7,157.93 us |   6,695.54 us |
// | Bench_ReverseN       | 32        |        302.4 us |       9.53 us |      27.79 us |
// | Bench_OneGasReverseN | 32        |    626,536.6 us |   6,629.69 us |   6,201.42 us |
// | Bench_ReverseN       | 64        |      1,728.3 us |      34.27 us |      58.19 us |
// | Bench_OneGasReverseN | 64        |    827,284.5 us |  15,943.00 us |  14,913.09 us |
// | Bench_ReverseN       | 128       |      3,704.5 us |      73.98 us |     175.82 us |
// | Bench_OneGasReverseN | 128       |  1,125,104.6 us |  10,629.65 us |   9,942.98 us |
// | Bench_ReverseN       | 256       |      6,381.1 us |     127.42 us |     290.21 us |
// | Bench_OneGasReverseN | 256       |  1,804,355.7 us |   9,690.50 us |   8,590.37 us |
// | Bench_ReverseN       | 512       |      9,485.9 us |     184.52 us |     492.52 us |
// | Bench_OneGasReverseN | 512       |  3,159,411.1 us |  28,901.54 us |  27,034.52 us |
// | Bench_ReverseN       | 1024      |     14,125.6 us |     282.51 us |     577.08 us |
// | Bench_OneGasReverseN | 1024      |  5,799,154.5 us |  33,817.93 us |  31,633.31 us |
// | Bench_ReverseN       | 2040      |     22,868.0 us |     449.84 us |     929.00 us |
// | Bench_OneGasReverseN | 2040      | 11,100,853.9 us | 159,980.97 us | 141,818.97 us |


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmark.Opcode.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmark.Opcode.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

namespace Neo.VM.Benchmarks.OpCodes;

public class Benchmark_Opcode
{
    internal static readonly long OneGasDatoshi = 1_0000_0000;

    public static readonly IReadOnlyDictionary<OpCode, long> OpCodePrices = new Dictionary<OpCode, long>
    {
        [OpCode.PUSHINT8] = 1 << 0,
        [OpCode.PUSHINT16] = 1 << 0,
        [OpCode.PUSHINT32] = 1 << 0,
        [OpCode.PUSHINT64] = 1 << 0,
        [OpCode.PUSHINT128] = 1 << 2,
        [OpCode.PUSHINT256] = 1 << 2,
        [OpCode.PUSHT] = 1 << 0,
        [OpCode.PUSHF] = 1 << 0,
        [OpCode.PUSHA] = 1 << 2,
        [OpCode.PUSHNULL] = 1 << 0,
        [OpCode.PUSHDATA1] = 1 << 3,
        [OpCode.PUSHDATA2] = 1 << 9,
        [OpCode.PUSHDATA4] = 1 << 12,
        [OpCode.PUSHM1] = 1 << 0,
        [OpCode.PUSH0] = 1 << 0,
        [OpCode.PUSH1] = 1 << 0,
        [OpCode.PUSH2] = 1 << 0,
        [OpCode.PUSH3] = 1 << 0,
        [OpCode.PUSH4] = 1 << 0,
        [OpCode.PUSH5] = 1 << 0,
        [OpCode.PUSH6] = 1 << 0,
        [OpCode.PUSH7] = 1 << 0,
        [OpCode.PUSH8] = 1 << 0,
        [OpCode.PUSH9] = 1 << 0,
        [OpCode.PUSH10] = 1 << 0,
        [OpCode.PUSH11] = 1 << 0,
        [OpCode.PUSH12] = 1 << 0,
        [OpCode.PUSH13] = 1 << 0,
        [OpCode.PUSH14] = 1 << 0,
        [OpCode.PUSH15] = 1 << 0,
        [OpCode.PUSH16] = 1 << 0,
        [OpCode.NOP] = 1 << 0,
        [OpCode.JMP] = 1 << 1,
        [OpCode.JMP_L] = 1 << 1,
        [OpCode.JMPIF] = 1 << 1,
        [OpCode.JMPIF_L] = 1 << 1,
        [OpCode.JMPIFNOT] = 1 << 1,
        [OpCode.JMPIFNOT_L] = 1 << 1,
        [OpCode.JMPEQ] = 1 << 1,
        [OpCode.JMPEQ_L] = 1 << 1,
        [OpCode.JMPNE] = 1 << 1,
        [OpCode.JMPNE_L] = 1 << 1,
        [OpCode.JMPGT] = 1 << 1,
        [OpCode.JMPGT_L] = 1 << 1,
        [OpCode.JMPGE] = 1 << 1,
        [OpCode.JMPGE_L] = 1 << 1,
        [OpCode.JMPLT] = 1 << 1,
        [OpCode.JMPLT_L] = 1 << 1,
        [OpCode.JMPLE] = 1 << 1,
        [OpCode.JMPLE_L] = 1 << 1,
        [OpCode.CALL] = 1 << 9,
        [OpCode.CALL_L] = 1 << 9,
        [OpCode.CALLA] = 1 << 9,
        [OpCode.CALLT] = 1 << 15,
        [OpCode.ABORT] = 0,
        [OpCode.ABORTMSG] = 0,
        [OpCode.ASSERT] = 1 << 0,
        [OpCode.ASSERTMSG] = 1 << 0,
        [OpCode.THROW] = 1 << 9,
        [OpCode.TRY] = 1 << 2,
        [OpCode.TRY_L] = 1 << 2,
        [OpCode.ENDTRY] = 1 << 2,
        [OpCode.ENDTRY_L] = 1 << 2,
        [OpCode.ENDFINALLY] = 1 << 2,
        [OpCode.RET] = 0,
        [OpCode.SYSCALL] = 0,
        [OpCode.DEPTH] = 1 << 1,
        [OpCode.DROP] = 1 << 1,
        [OpCode.NIP] = 1 << 1,
        [OpCode.XDROP] = 1 << 4,
        [OpCode.CLEAR] = 1 << 4,
        [OpCode.DUP] = 1 << 1,
        [OpCode.OVER] = 1 << 1,
        [OpCode.PICK] = 1 << 1,
        [OpCode.TUCK] = 1 << 1,
        [OpCode.SWAP] = 1 << 1,
        [OpCode.ROT] = 1 << 1,
        [OpCode.ROLL] = 1 << 4,
        [OpCode.REVERSE3] = 1 << 1,
        [OpCode.REVERSE4] = 1 << 1,
        [OpCode.REVERSEN] = 1 << 4,
        [OpCode.INITSSLOT] = 1 << 4,
        [OpCode.INITSLOT] = 1 << 6,
        [OpCode.LDSFLD0] = 1 << 1,
        [OpCode.LDSFLD1] = 1 << 1,
        [OpCode.LDSFLD2] = 1 << 1,
        [OpCode.LDSFLD3] = 1 << 1,
        [OpCode.LDSFLD4] = 1 << 1,
        [OpCode.LDSFLD5] = 1 << 1,
        [OpCode.LDSFLD6] = 1 << 1,
        [OpCode.LDSFLD] = 1 << 1,
        [OpCode.STSFLD0] = 1 << 1,
        [OpCode.STSFLD1] = 1 << 1,
        [OpCode.STSFLD2] = 1 << 1,
        [OpCode.STSFLD3] = 1 << 1,
        [OpCode.STSFLD4] = 1 << 1,
        [OpCode.STSFLD5] = 1 << 1,
        [OpCode.STSFLD6] = 1 << 1,
        [OpCode.STSFLD] = 1 << 1,
        [OpCode.LDLOC0] = 1 << 1,
        [OpCode.LDLOC1] = 1 << 1,
        [OpCode.LDLOC2] = 1 << 1,
        [OpCode.LDLOC3] = 1 << 1,
        [OpCode.LDLOC4] = 1 << 1,
        [OpCode.LDLOC5] = 1 << 1,
        [OpCode.LDLOC6] = 1 << 1,
        [OpCode.LDLOC] = 1 << 1,
        [OpCode.STLOC0] = 1 << 1,
        [OpCode.STLOC1] = 1 << 1,
        [OpCode.STLOC2] = 1 << 1,
        [OpCode.STLOC3] = 1 << 1,
        [OpCode.STLOC4] = 1 << 1,
        [OpCode.STLOC5] = 1 << 1,
        [OpCode.STLOC6] = 1 << 1,
        [OpCode.STLOC] = 1 << 1,
        [OpCode.LDARG0] = 1 << 1,
        [OpCode.LDARG1] = 1 << 1,
        [OpCode.LDARG2] = 1 << 1,
        [OpCode.LDARG3] = 1 << 1,
        [OpCode.LDARG4] = 1 << 1,
        [OpCode.LDARG5] = 1 << 1,
        [OpCode.LDARG6] = 1 << 1,
        [OpCode.LDARG] = 1 << 1,
        [OpCode.STARG0] = 1 << 1,
        [OpCode.STARG1] = 1 << 1,
        [OpCode.STARG2] = 1 << 1,
        [OpCode.STARG3] = 1 << 1,
        [OpCode.STARG4] = 1 << 1,
        [OpCode.STARG5] = 1 << 1,
        [OpCode.STARG6] = 1 << 1,
        [OpCode.STARG] = 1 << 1,
        [OpCode.NEWBUFFER] = 1 << 8,
        [OpCode.MEMCPY] = 1 << 11,
        [OpCode.CAT] = 1 << 11,
        [OpCode.SUBSTR] = 1 << 11,
        [OpCode.LEFT] = 1 << 11,
        [OpCode.RIGHT] = 1 << 11,
        [OpCode.INVERT] = 1 << 2,
        [OpCode.AND] = 1 << 3,
        [OpCode.OR] = 1 << 3,
        [OpCode.XOR] = 1 << 3,
        [OpCode.EQUAL] = 1 << 5,
        [OpCode.NOTEQUAL] = 1 << 5,
        [OpCode.SIGN] = 1 << 2,
        [OpCode.ABS] = 1 << 2,
        [OpCode.NEGATE] = 1 << 2,
        [OpCode.INC] = 1 << 2,
        [OpCode.DEC] = 1 << 2,
        [OpCode.ADD] = 1 << 3,
        [OpCode.SUB] = 1 << 3,
        [OpCode.MUL] = 1 << 3,
        [OpCode.DIV] = 1 << 3,
        [OpCode.MOD] = 1 << 3,
        [OpCode.POW] = 1 << 6,
        [OpCode.SQRT] = 1 << 6,
        [OpCode.MODMUL] = 1 << 5,
        [OpCode.MODPOW] = 1 << 11,
        [OpCode.SHL] = 1 << 3,
        [OpCode.SHR] = 1 << 3,
        [OpCode.NOT] = 1 << 2,
        [OpCode.BOOLAND] = 1 << 3,
        [OpCode.BOOLOR] = 1 << 3,
        [OpCode.NZ] = 1 << 2,
        [OpCode.NUMEQUAL] = 1 << 3,
        [OpCode.NUMNOTEQUAL] = 1 << 3,
        [OpCode.LT] = 1 << 3,
        [OpCode.LE] = 1 << 3,
        [OpCode.GT] = 1 << 3,
        [OpCode.GE] = 1 << 3,
        [OpCode.MIN] = 1 << 3,
        [OpCode.MAX] = 1 << 3,
        [OpCode.WITHIN] = 1 << 3,
        [OpCode.PACKMAP] = 1 << 11,
        [OpCode.PACKSTRUCT] = 1 << 11,
        [OpCode.PACK] = 1 << 11,
        [OpCode.UNPACK] = 1 << 11,
        [OpCode.NEWARRAY0] = 1 << 4,
        [OpCode.NEWARRAY] = 1 << 9,
        [OpCode.NEWARRAY_T] = 1 << 9,
        [OpCode.NEWSTRUCT0] = 1 << 4,
        [OpCode.NEWSTRUCT] = 1 << 9,
        [OpCode.NEWMAP] = 1 << 3,
        [OpCode.SIZE] = 1 << 2,
        [OpCode.HASKEY] = 1 << 6,
        [OpCode.KEYS] = 1 << 4,
        [OpCode.VALUES] = 1 << 13,
        [OpCode.PICKITEM] = 1 << 6,
        [OpCode.APPEND] = 1 << 13,
        [OpCode.SETITEM] = 1 << 13,
        [OpCode.REVERSEITEMS] = 1 << 13,
        [OpCode.REMOVE] = 1 << 4,
        [OpCode.CLEARITEMS] = 1 << 4,
        [OpCode.POPITEM] = 1 << 4,
        [OpCode.ISNULL] = 1 << 1,
        [OpCode.ISTYPE] = 1 << 1,
        [OpCode.CONVERT] = 1 << 13,
    };

    internal static void RunScript(byte[] script)
    {
        LoadScript(script).ExecuteBenchmark();
    }

    internal static BenchmarkEngine RunScriptUntil(byte[] script, OpCode opCode)
    {
        return LoadScript(script).ExecuteUntil(opCode);
    }

    internal static BenchmarkEngine LoadScript(byte[] script)
    {
        var engine = new BenchmarkEngine();
        engine.LoadScript(script);
        return engine;
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkEngine.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// BenchmarkEngine.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace Neo.VM.Benchmarks.OpCodes;

/// <summary>
/// A simple benchmark engine for <see cref="ExecutionEngine"/>.
/// </summary>
public class BenchmarkEngine : ExecutionEngine
{
    private readonly Dictionary<OpCode, (int Count, TimeSpan TotalTime)> _opcodeStats = new();
    private readonly Dictionary<Script, HashSet<uint>> _breakPoints = new();
    private long _gasConsumed = 0;

    public BenchmarkEngine() : base(ComposeJumpTable()) { }

    /// <summary>
    /// Add a breakpoint at the specified position of the specified script. The VM will break the execution when it reaches the breakpoint.
    /// </summary>
    /// <param name="script">The script to add the breakpoint.</param>
    /// <param name="position">The position of the breakpoint in the script.</param>
    public void AddBreakPoint(Script script, uint position)
    {
        if (!_breakPoints.TryGetValue(script, out var hashset))
        {
            hashset = [];
            _breakPoints.Add(script, hashset);
        }
        hashset.Add(position);
    }

    /// <summary>
    /// Start or continue execution of the VM.
    /// </summary>
    /// <returns>Returns the state of the VM after the execution.</returns>
    public BenchmarkEngine ExecuteUntil(OpCode opCode)
    {
        if (State == VMState.BREAK)
            State = VMState.NONE;
        while (State == VMState.NONE)
        {
            ExecuteNext();
            try
            {
                var instruction = CurrentContext!.CurrentInstruction!.OpCode;
                if (instruction == opCode) break;
            }
            catch
            {
                break;
            }
        }
        return this;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void ExecuteBenchmark()
    {
        while (State != VMState.HALT && State != VMState.FAULT)
        {
#if DEBUG
            var stopwatch = Stopwatch.StartNew();
#endif
            ExecuteNext();
#if DEBUG
            stopwatch.Stop();
            UpdateOpcodeStats(CurrentContext!.CurrentInstruction!.OpCode, stopwatch.Elapsed);
#endif
        }
#if DEBUG
        PrintOpcodeStats();
#endif
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void ExecuteOneGASBenchmark()
    {
        while (State != VMState.HALT && State != VMState.FAULT)
        {
            var instruction = CurrentContext!.CurrentInstruction ?? Instruction.RET;
            _gasConsumed += Benchmark_Opcode.OpCodePrices[instruction.OpCode];
            if (_gasConsumed >= Benchmark_Opcode.OneGasDatoshi)
            {
                State = VMState.HALT;
            }
#if DEBUG
            var stopwatch = Stopwatch.StartNew();
#endif
            ExecuteNext();
#if DEBUG
            stopwatch.Stop();
            UpdateOpcodeStats(instruction.OpCode, stopwatch.Elapsed);
#endif
        }
#if DEBUG
        PrintOpcodeStats();
#endif
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void ExecuteTwentyGASBenchmark()
    {
        while (State != VMState.HALT && State != VMState.FAULT)
        {
            var instruction = CurrentContext!.CurrentInstruction ?? Instruction.RET;
            _gasConsumed += Benchmark_Opcode.OpCodePrices[instruction.OpCode];
            if (_gasConsumed >= 20 * Benchmark_Opcode.OneGasDatoshi)
            {
                State = VMState.HALT;
            }
#if DEBUG
            var stopwatch = Stopwatch.StartNew();
#endif
            ExecuteNext();
#if DEBUG
            stopwatch.Stop();
            UpdateOpcodeStats(instruction.OpCode, stopwatch.Elapsed);
#endif
        }
#if DEBUG
        PrintOpcodeStats();
#endif
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void ExecuteOpCodesBenchmark()
    {
        while (State != VMState.HALT && State != VMState.FAULT)
        {
            var instruction = CurrentContext!.CurrentInstruction ?? Instruction.RET;
            _gasConsumed += Benchmark_Opcode.OpCodePrices[instruction.OpCode];
            if (_gasConsumed >= Benchmark_Opcode.OneGasDatoshi)
            {
                State = VMState.HALT;
            }
#if DEBUG
            var stopwatch = Stopwatch.StartNew();
#endif
            ExecuteNext();
#if DEBUG
            stopwatch.Stop();
            UpdateOpcodeStats(instruction.OpCode, stopwatch.Elapsed);
#endif
        }
#if DEBUG
        PrintOpcodeStats();
#endif
    }

    protected override void OnFault(Exception ex)
    {
        base.OnFault(ex);
        // throw ex;
    }

    private void UpdateOpcodeStats(OpCode opcode, TimeSpan elapsed)
    {
        if (!_opcodeStats.TryGetValue(opcode, out var value))
        {
            _opcodeStats[opcode] = (1, elapsed);
        }
        else
        {
            var (count, totalTime) = value;
            _opcodeStats[opcode] = (count + 1, totalTime + elapsed);
        }
    }

    private void PrintOpcodeStats()
    {
        Console.WriteLine("Opcode Statistics:");
        foreach (var kvp in _opcodeStats)
        {
            Console.WriteLine($"{kvp.Key,-15} " +
                              $"Count: {kvp.Value.Count,8} " +
                              $"Total Time: {kvp.Value.TotalTime.TotalMilliseconds * 1000,10:F2} μs " +
                              $"Avg Time: {kvp.Value.TotalTime.TotalMilliseconds * 1000 / kvp.Value.Count,10:F2} μs");
        }
    }

    private static JumpTable ComposeJumpTable()
    {
        var jumpTable = new JumpTable();
        jumpTable[OpCode.SYSCALL] = OnSysCall;
        return jumpTable;
    }

    private static void OnSysCall(ExecutionEngine engine, Instruction instruction)
    {
        uint method = instruction.TokenU32;
        if (method == 0x77777777)
            engine.CurrentContext!.EvaluationStack.Push(StackItem.FromInterface(new object()));
        else if (method == 0xaddeadde)
            engine.JumpTable.ExecuteThrow(engine, "error");
        else
            throw new Exception();
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkMode.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// BenchmarkMode.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

namespace Neo.VM.Benchmarks.OpCodes;

public enum BenchmarkMode
{
    SimpleOpCode,
    OneGAS,
    BaseLine
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmarks_StackOps.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmarks_StackOps.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;

namespace Neo.VM.Benchmarks.OpCodes;

[MemoryDiagnoser]
[CsvExporter]
[MarkdownExporterAttribute.GitHub]
[InvocationCount(1)]
public class Benchmarks_StackOps
{
    private const int RepeatCount = 1000;
    private const int MultipleCount = 50;
    private const int MultipleIterations = RepeatCount * MultipleCount;

    // Keep description strings in sync with RepeatCount/MultipleCount.
    private const string SwapShallowDescription = "SWAP_Shallow_2x1000";
    private const string SwapDeepDescription = "SWAP_Deep_100x1000";
    private const string SwapMultipleDescription = "SWAP_Multiple_50x1000";
    private const string RotShallowDescription = "ROT_Shallow_3x1000";
    private const string RotDeepDescription = "ROT_Deep_100x1000";
    private const string RotMultipleDescription = "ROT_Multiple_50x1000";

    private BenchmarkEngine _engine = null!;

    private byte[] _swapShallowScript = [];
    private byte[] _swapDeepScript = [];
    private byte[] _swapMultipleScript = [];
    private byte[] _rotShallowScript = [];
    private byte[] _rotDeepScript = [];
    private byte[] _rotMultipleScript = [];

    [GlobalSetup]
    public void GlobalSetup()
    {
        _swapShallowScript = BuildScript(sb =>
        {
            sb.EmitPush(1);
            sb.EmitPush(2);
            for (int i = 0; i < RepeatCount; i++)
                sb.Emit(OpCode.SWAP);
        });
        _swapDeepScript = BuildScript(sb =>
        {
            for (int i = 0; i < 100; i++)
                sb.EmitPush(i);
            for (int i = 0; i < RepeatCount; i++)
                sb.Emit(OpCode.SWAP);
        });
        _swapMultipleScript = BuildScript(sb =>
        {
            sb.EmitPush(1);
            sb.EmitPush(2);
            for (int i = 0; i < MultipleIterations; i++)
                sb.Emit(OpCode.SWAP);
        });

        _rotShallowScript = BuildScript(sb =>
        {
            sb.EmitPush(1);
            sb.EmitPush(2);
            sb.EmitPush(3);
            for (int i = 0; i < RepeatCount; i++)
                sb.Emit(OpCode.ROT);
        });
        _rotDeepScript = BuildScript(sb =>
        {
            for (int i = 0; i < 100; i++)
                sb.EmitPush(i);
            for (int i = 0; i < RepeatCount; i++)
                sb.Emit(OpCode.ROT);
        });
        _rotMultipleScript = BuildScript(sb =>
        {
            sb.EmitPush(1);
            sb.EmitPush(2);
            sb.EmitPush(3);
            for (int i = 0; i < MultipleIterations; i++)
                sb.Emit(OpCode.ROT);
        });
    }

    private static byte[] BuildScript(Action<ScriptBuilder> build)
    {
        using var sb = new ScriptBuilder();
        build(sb);
        return sb.ToArray();
    }

    private void SetupEngine(byte[] script)
    {
        _engine = new BenchmarkEngine();
        _engine.LoadScript(script);
    }

    #region SWAP Benchmarks

    [IterationSetup(Target = nameof(Bench_SWAP_Shallow))]
    public void Setup_SWAP_Shallow() => SetupEngine(_swapShallowScript);

    [Benchmark(Description = SwapShallowDescription)]
    public void Bench_SWAP_Shallow()
    {
        _engine.ExecuteBenchmark();
    }

    [IterationSetup(Target = nameof(Bench_SWAP_Deep))]
    public void Setup_SWAP_Deep() => SetupEngine(_swapDeepScript);

    [Benchmark(Description = SwapDeepDescription)]
    public void Bench_SWAP_Deep()
    {
        _engine.ExecuteBenchmark();
    }

    [IterationSetup(Target = nameof(Bench_SWAP_Multiple))]
    public void Setup_SWAP_Multiple() => SetupEngine(_swapMultipleScript);

    [Benchmark(Description = SwapMultipleDescription)]
    public void Bench_SWAP_Multiple()
    {
        _engine.ExecuteBenchmark();
    }

    #endregion

    #region ROT Benchmarks

    [IterationSetup(Target = nameof(Bench_ROT_Shallow))]
    public void Setup_ROT_Shallow() => SetupEngine(_rotShallowScript);

    [Benchmark(Description = RotShallowDescription)]
    public void Bench_ROT_Shallow()
    {
        _engine.ExecuteBenchmark();
    }

    [IterationSetup(Target = nameof(Bench_ROT_Deep))]
    public void Setup_ROT_Deep() => SetupEngine(_rotDeepScript);

    [Benchmark(Description = RotDeepDescription)]
    public void Bench_ROT_Deep()
    {
        _engine.ExecuteBenchmark();
    }

    [IterationSetup(Target = nameof(Bench_ROT_Multiple))]
    public void Setup_ROT_Multiple() => SetupEngine(_rotMultipleScript);

    [Benchmark(Description = RotMultipleDescription)]
    public void Bench_ROT_Multiple()
    {
        _engine.ExecuteBenchmark();
    }

    #endregion
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/OpCodeBase.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// OpCodeBase.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;

namespace Neo.VM.Benchmarks.OpCodes;

public abstract class OpCodeBase
{
    [Params(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2040)]
    public int ItemCount { get; set; } = 10;
    protected byte[] baseLineScript = Array.Empty<byte>();
    protected byte[] script = Array.Empty<byte>();
    protected byte[] multiScript = Array.Empty<byte>();

    [GlobalSetup]
    public void Setup()
    {
        script = CreateScript(BenchmarkMode.SimpleOpCode);
        multiScript = CreateScript(BenchmarkMode.OneGAS);
        baseLineScript = CreateScript(BenchmarkMode.BaseLine);
    }

    [Benchmark(Baseline = true)]
    public void Bench_BaseLine() => Benchmark_Opcode.RunScript(baseLineScript);

    [Benchmark]
    public void Bench_OneOpCode() => Benchmark_Opcode.RunScript(script);

    /// <summary>
    /// Benchmark how long 1 GAS can run.
    /// </summary>
    [Benchmark]
    public void Bench_OneGAS() => Benchmark_Opcode.LoadScript(multiScript).ExecuteOneGASBenchmark();

    protected abstract byte[] CreateScript(BenchmarkMode benchmarkMode);
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/Program.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Program.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Neo.VM.Benchmarks;
using System.Reflection;

// Define the benchmark or execute class
if (Environment.GetEnvironmentVariable("NEO_VM_BENCHMARK") != null)
{
    BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
else
{
    var benchmarkType = typeof(Benchmarks_PoCs);
    var instance = Activator.CreateInstance(benchmarkType);
    benchmarkType.GetMethods(BindingFlags.Public | BindingFlags.Instance)
        .FirstOrDefault(m => m.GetCustomAttribute<GlobalSetupAttribute>() != null)?
        .Invoke(instance, null); // setup

    var methods = benchmarkType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static)
        .Where(m => m.DeclaringType == benchmarkType && !m.GetCustomAttributes<GlobalSetupAttribute>().Any());
    foreach (var method in methods)
    {
        method.Invoke(instance, null);
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/TestArray.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// TestArray.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;
using System.Collections;

namespace Neo.VM.Benchmarks;

public class TestArray : CompoundType, IReadOnlyList<StackItem>
{
    protected readonly List<StackItem> InnerList;

    /// <summary>
    /// Get or set item in the array.
    /// </summary>
    /// <param name="index">The index of the item in the array.</param>
    /// <returns>The item at the specified index.</returns>
    public StackItem this[int index]
    {
        get => InnerList[index];
        set
        {
            if (IsReadOnly) throw new InvalidOperationException("The object is readonly.");
            ReferenceCounter?.RemoveReference(InnerList[index], this);
            InnerList[index] = value;
            ReferenceCounter?.AddReference(value, this);
        }
    }

    /// <summary>
    /// The number of items in the array.
    /// </summary>
    public override int Count => InnerList.Count;
    public override IEnumerable<StackItem> SubItems => InnerList;
    public override int SubItemsCount => InnerList.Count;
    public override StackItemType Type => StackItemType.Array;

    /// <summary>
    /// Create an array containing the specified items.
    /// </summary>
    /// <param name="items">The items to be included in the array.</param>
    public TestArray(IEnumerable<StackItem>? items = null)
        : this(null, items)
    {
    }

    /// <summary>
    /// Create an array containing the specified items. And make the array use the specified <see cref="IReferenceCounter"/>.
    /// </summary>
    /// <param name="referenceCounter">The <see cref="IReferenceCounter"/> to be used by this array.</param>
    /// <param name="items">The items to be included in the array.</param>
    public TestArray(IReferenceCounter? referenceCounter, IEnumerable<StackItem>? items = null)
        : base(referenceCounter)
    {
        InnerList = items switch
        {
            null => new List<StackItem>(),
            List<StackItem> list => list,
            _ => new List<StackItem>(items)
        };
        if (referenceCounter != null)
            foreach (StackItem item in InnerList)
                referenceCounter.AddReference(item, this);
    }

    /// <summary>
    /// Add a new item at the end of the array.
    /// </summary>
    /// <param name="item">The item to be added.</param>
    public void Add(StackItem item)
    {
        if (IsReadOnly) throw new InvalidOperationException("The object is readonly.");
        InnerList.Add(item);
        ReferenceCounter?.AddReference(item, this);
    }

    public override void Clear()
    {
        if (IsReadOnly) throw new InvalidOperationException("The object is readonly.");
        if (ReferenceCounter != null)
            foreach (StackItem item in InnerList)
                ReferenceCounter.RemoveReference(item, this);
        InnerList.Clear();
    }

    public override StackItem ConvertTo(StackItemType type)
    {
        if (Type == StackItemType.Array && type == StackItemType.Struct)
            return new Struct(ReferenceCounter, new List<StackItem>(InnerList));
        return base.ConvertTo(type);
    }

    internal sealed override StackItem DeepCopy(Dictionary<StackItem, StackItem> refMap, bool asImmutable)
    {
        if (refMap.TryGetValue(this, out StackItem? mappedItem)) return mappedItem;
        var result = this is TestStruct ? new TestStruct(ReferenceCounter) : new TestArray(ReferenceCounter);
        refMap.Add(this, result);
        foreach (StackItem item in InnerList)
            result.Add(item.DeepCopy(refMap, asImmutable));
        result.IsReadOnly = true;
        return result;
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }

    public IEnumerator<StackItem> GetEnumerator()
    {
        return InnerList.GetEnumerator();
    }

    /// <summary>
    /// Remove the item at the specified index.
    /// </summary>
    /// <param name="index">The index of the item to be removed.</param>
    public void RemoveAt(int index)
    {
        if (IsReadOnly) throw new InvalidOperationException("The object is readonly.");
        ReferenceCounter?.RemoveReference(InnerList[index], this);
        InnerList.RemoveAt(index);
    }

    /// <summary>
    /// Reverse all items in the array.
    /// </summary>
    public void Reverse()
    {
        if (IsReadOnly) throw new InvalidOperationException("The object is readonly.");
        InnerList.Reverse();
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/TestStruct.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// TestStruct.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;

namespace Neo.VM.Benchmarks;

public class TestStruct : TestArray
{
    public override StackItemType Type => StackItemType.Struct;

    /// <summary>
    /// Create a structure with the specified fields.
    /// </summary>
    /// <param name="fields">The fields to be included in the structure.</param>
    public TestStruct(IEnumerable<StackItem>? fields = null)
        : this(null, fields)
    {
    }

    /// <summary>
    /// Create a structure with the specified fields. And make the structure use the specified <see cref="IReferenceCounter"/>.
    /// </summary>
    /// <param name="referenceCounter">The <see cref="IReferenceCounter"/> to be used by this structure.</param>
    /// <param name="fields">The fields to be included in the structure.</param>
    public TestStruct(IReferenceCounter? referenceCounter, IEnumerable<StackItem>? fields = null)
        : base(referenceCounter, fields)
    {
    }

    /// <summary>
    /// Create a new structure with the same content as this structure. All nested structures will be copied by value.
    /// </summary>
    /// <param name="limits">Execution engine limits</param>
    /// <returns>The copied structure.</returns>
    public TestStruct Clone(ExecutionEngineLimits limits)
    {
        int count = (int)(limits.MaxStackSize - 1);
        TestStruct result = new(ReferenceCounter);
        Queue<TestStruct> queue = new();
        queue.Enqueue(result);
        queue.Enqueue(this);
        while (queue.Count > 0)
        {
            TestStruct a = queue.Dequeue();
            TestStruct b = queue.Dequeue();
            foreach (StackItem item in b)
            {
                count--;
                if (count < 0) throw new InvalidOperationException("Beyond clone limits!");
                if (item is TestStruct sb)
                {
                    TestStruct sa = new(ReferenceCounter);
                    a.Add(sa);
                    queue.Enqueue(sa);
                    queue.Enqueue(sb);
                }
                else
                {
                    a.Add(item);
                }
            }
        }
        return result;
    }

    public override StackItem ConvertTo(StackItemType type)
    {
        if (type == StackItemType.Array)
            return new TestArray(ReferenceCounter, new List<StackItem>(InnerList));
        return base.ConvertTo(type);
    }

    public override bool Equals(StackItem? other)
    {
        throw new NotSupportedException();
    }

    internal override bool Equals(StackItem? other, ExecutionEngineLimits limits)
    {
        if (other is not TestStruct s) return false;
        Stack<StackItem> stack1 = new();
        Stack<StackItem> stack2 = new();
        stack1.Push(this);
        stack2.Push(s);
        uint count = limits.MaxStackSize;
        uint maxComparableSize = limits.MaxComparableSize;
        while (stack1.Count > 0)
        {
            if (count-- == 0)
                throw new InvalidOperationException("Too many struct items to compare.");
            StackItem a = stack1.Pop();
            StackItem b = stack2.Pop();
            if (a is ByteString byteString)
            {
                if (!byteString.Equals(b, ref maxComparableSize)) return false;
            }
            else
            {
                if (maxComparableSize == 0)
                    throw new InvalidOperationException("The operand exceeds the maximum comparable size.");
                maxComparableSize -= 1;
                if (a is TestStruct sa)
                {
                    if (ReferenceEquals(a, b)) continue;
                    if (b is not TestStruct sb) return false;
                    if (sa.Count != sb.Count) return false;
                    foreach (StackItem item in sa)
                        stack1.Push(item);
                    foreach (StackItem item in sb)
                        stack2.Push(item);
                }
                else
                {
                    if (!a.Equals(b)) return false;
                }
            }
        }
        return true;
    }
}


================================================
FILE: benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_Convert.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmarks_Convert.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;
using Neo.VM.Types;
using Array = Neo.VM.Types.Array;
using Buffer = Neo.VM.Types.Buffer;

namespace Neo.VM.Benchmarks.VMTypes;

public class Benchmarks_Convert
{
    private Dictionary<StackItemType, List<StackItem>>? testItemsByType;

    [GlobalSetup]
    public void Setup()
    {
        testItemsByType = CreateTestItemsByType();
    }

    [Benchmark]
    [ArgumentsSource(nameof(GetTypeConversionPairs))]
    public void BenchConvertTo(StackItemType fromType, StackItemType toType)
    {
        if (testItemsByType is null)
            throw new InvalidOperationException($"{nameof(testItemsByType)} not initialized");

        foreach (var item in testItemsByType[fromType])
        {
            try
            {
                _ = item.ConvertTo(toType);
            }
            catch (Exception)
            {
                // Ignore invalid casts as they're expected for some conversions
            }
        }
    }

    public static IEnumerable<object[]> GetTypeConversionPairs()
    {
        var types = Enum.GetValues<StackItemType>();
        foreach (var fromType in types)
        {
            foreach (var toType in types)
            {
                yield return new object[] { fromType, toType };
            }
        }
    }

    private static Dictionary<StackItemType, List<StackItem>> CreateTestItemsByType()
    {
        var referenceCounter = new ReferenceCounter();
        var result = new Dictionary<StackItemType, List<StackItem>>();

        foreach (StackItemType type in Enum.GetValues<StackItemType>())
        {
            result[type] = new List<StackItem>();
        }

        result[StackItemType.Boolean].Add(StackItem.True);
        result[StackItemType.Boolean].Add(StackItem.False);

        result[StackItemType.Integer].Add(new Integer(42));
        result[StackItemType.Integer].Add(new Integer(-1));

        result[StackItemType.ByteString].Add(new ByteString(new byte[] { 1, 2, 3 }));
        result[StackItemType.ByteString].Add(new ByteString(new byte[] { 255, 0, 128 }));

        // Create a 128-byte buffer
        var longBuffer = new byte[128];
        for (int i = 0; i < 128; i++) longBuffer[i] = (byte)(i % 256);
        result[StackItemType.Buffer].Add(new Buffer(longBuffer));
        result[StackItemType.Buffer].Add(new Buffer(new byte[128])); // Another 128-byte buffer, all zeros

        // Create an array with 10 items
        var longArray = new Array(referenceCounter);
        for (int i = 0; i < 10; i++) longArray.Add(new Integer(i));
        result[StackItemType.Array].Add(longArray);
        result[StackItemType.Array].Add(new Array(referenceCounter) { StackItem.True, new ByteString(new byte[] { 3, 4, 5 }) });

        // Create a struct with 10 items
        var longStruct = new Struct(referenceCounter);
        for (int i = 0; i < 10; i++) longStruct.Add(new Integer(i * 10));
        result[StackItemType.Struct].Add(longStruct);
        result[StackItemType.Struct].Add(new Struct(referenceCounter) { StackItem.False, new Buffer(new byte[] { 6, 7, 8 }) });

        // Create a map with 10 items
        var longMap = new Map(referenceCounter);
        for (int i = 0; i < 10; i++) longMap[new Integer(i)] = new ByteString(new byte[] { (byte)(i * 20) });
        result[StackItemType.Map].Add(longMap);
        result[StackItemType.Map].Add(new Map(referenceCounter) { [new ByteString(new byte[] { 9 })] = StackItem.True });

        result[StackItemType.InteropInterface].Add(new InteropInterface(new object()));
        result[StackItemType.InteropInterface].Add(new InteropInterface("test string"));

        return result;
    }
}

// BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.4249/23H2/2023Update/SunValley3)
// Intel Core i9-14900HX, 1 CPU, 32 logical and 24 physical cores
// .NET SDK 8.0.205
//   [Host]     : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
//   DefaultJob : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
//
//
// | Method         | fromType         | toType           | Mean         | Error       | StdDev      |
// |--------------- |----------------- |----------------- |-------------:|------------:|------------:|
// | BenchConvertTo | Any              | Any              |     1.762 ns |   0.0195 ns |   0.0182 ns |
// | BenchConvertTo | Any              | Pointer          |     1.791 ns |   0.0196 ns |   0.0183 ns |
// | BenchConvertTo | Any              | Boolean          |     1.774 ns |   0.0245 ns |   0.0229 ns |
// | BenchConvertTo | Any              | Integer          |     1.781 ns |   0.0236 ns |   0.0220 ns |
// | BenchConvertTo | Any              | ByteString       |     1.767 ns |   0.0255 ns |   0.0226 ns |
// | BenchConvertTo | Any              | Buffer           |     1.774 ns |   0.0217 ns |   0.0203 ns |
// | BenchConvertTo | Any              | Array            |     1.770 ns |   0.0412 ns |   0.0385 ns |
// | BenchConvertTo | Any              | Struct           |     1.787 ns |   0.0227 ns |   0.0212 ns |
// | BenchConvertTo | Any              | Map              |     1.796 ns |   0.0292 ns |   0.0273 ns |
// | BenchConvertTo | Any              | InteropInterface |     1.820 ns |   0.0549 ns |   0.0675 ns |
// | BenchConvertTo | Pointer          | Any              |     2.312 ns |   0.0210 ns |   0.0175 ns |
// | BenchConvertTo | Pointer          | Pointer          |     2.337 ns |   0.0157 ns |   0.0146 ns |
// | BenchConvertTo | Pointer          | Boolean          |     2.352 ns |   0.0190 ns |   0.0169 ns |
// | BenchConvertTo | Pointer          | Integer          |     2.334 ns |   0.0231 ns |   0.0216 ns |
// | BenchConvertTo | Pointer          | ByteString       |     2.317 ns |   0.0298 ns |   0.0279 ns |
// | BenchConvertTo | Pointer          | Buffer           |     2.329 ns |   0.0274 ns |   0.0256 ns |
// | BenchConvertTo | Pointer          | Array            |     2.338 ns |   0.0257 ns |   0.0241 ns |
// | BenchConvertTo | Pointer          | Struct           |     2.336 ns |   0.0318 ns |   0.0298 ns |
// | BenchConvertTo | Pointer          | Map              |     2.351 ns |   0.0676 ns |   0.0903 ns |
// | BenchConvertTo | Pointer          | InteropInterface |     2.281 ns |   0.0133 ns |   0.0125 ns |
// | BenchConvertTo | Boolean          | Any              | 5,926.451 ns | 118.1195 ns | 136.0266 ns |
// | BenchConvertTo | Boolean          | Pointer          | 6,001.282 ns |  15.3048 ns |  12.7802 ns |
// | BenchConvertTo | Boolean          | Boolean          |     4.459 ns |   0.0151 ns |   0.0133 ns |
// | BenchConvertTo | Boolean          | Integer          |    14.104 ns |   0.1526 ns |   0.1428 ns |
// | BenchConvertTo | Boolean          | ByteString       |    11.650 ns |   0.0539 ns |   0.0450 ns |
// | BenchConvertTo | Boolean          | Buffer           |    26.106 ns |   0.1549 ns |   0.1449 ns |
// | BenchConvertTo | Boolean          | Array            | 5,813.116 ns |  28.1911 ns |  26.3700 ns |
// | BenchConvertTo | Boolean          | Struct           | 5,809.844 ns |  19.1249 ns |  15.9702 ns |
// | BenchConvertTo | Boolean          | Map              | 6,061.558 ns |  29.3991 ns |  27.4999 ns |
// | BenchConvertTo | Boolean          | InteropInterface | 5,924.682 ns |  80.5533 ns |  75.3496 ns |
// | BenchConvertTo | Integer          | Any              | 5,240.903 ns |  41.0628 ns |  38.4102 ns |
// | BenchConvertTo | Integer          | Pointer          | 5,479.116 ns |  75.8232 ns |  70.9251 ns |
// | BenchConvertTo | Integer          | Boolean          |     5.981 ns |   0.0445 ns |   0.0416 ns |
// | BenchConvertTo | Integer          | Integer          |     4.277 ns |   0.0177 ns |   0.0166 ns |
// | BenchConvertTo | Integer          | ByteString       |    19.053 ns |   0.2125 ns |   0.1883 ns |
// | BenchConvertTo | Integer          | Buffer           |    32.782 ns |   0.1653 ns |   0.1380 ns |
// | BenchConvertTo | Integer          | Array            | 4,693.207 ns |  14.2446 ns |  12.6275 ns |
// | BenchConvertTo | Integer          | Struct           | 4,737.341 ns |  60.1813 ns |  56.2936 ns |
// | BenchConvertTo | Integer          | Map              | 4,808.431 ns |  23.5380 ns |  22.0174 ns |
// | BenchConvertTo | Integer          | InteropInterface | 4,684.409 ns |  24.7033 ns |  21.8989 ns |
// | BenchConvertTo | ByteString       | Any              | 5,833.857 ns |  20.1553 ns |  18.8533 ns |
// | BenchConvertTo | ByteString       | Pointer          | 5,807.973 ns |  11.7754 ns |  10.4386 ns |
// | BenchConvertTo | ByteString       | Boolean          |    33.007 ns |   0.1574 ns |   0.1472 ns |
// | BenchConvertTo | ByteString       | Integer          |    23.622 ns |   0.0755 ns |   0.0669 ns |
// | BenchConvertTo | ByteString       | ByteString       |     4.288 ns |   0.0152 ns |   0.0142 ns |
// | BenchConvertTo | ByteString       | Buffer           |    24.881 ns |   0.0889 ns |   0.0788 ns |
// | BenchConvertTo | ByteString       | Array            | 6,030.813 ns |  19.9562 ns |  18.6670 ns |
// | BenchConvertTo | ByteString       | Struct           | 5,811.185 ns |  24.0781 ns |  22.5226 ns |
// | BenchConvertTo | ByteString       | Map              | 5,866.820 ns |  17.0315 ns |  15.0980 ns |
// | BenchConvertTo | ByteString       | InteropInterface | 5,757.124 ns |  16.3184 ns |  14.4658 ns |
// | BenchConvertTo | Buffer           | Any              | 4,886.279 ns |  17.1370 ns |  14.3102 ns |
// | BenchConvertTo | Buffer           | Pointer          | 4,698.364 ns |  14.5491 ns |  12.1492 ns |
// | BenchConvertTo | Buffer           | Boolean          |     6.130 ns |   0.0323 ns |   0.0302 ns |
// | BenchConvertTo | Buffer           | Integer          | 4,645.764 ns |  15.8146 ns |  14.7930 ns |
// | BenchConvertTo | Buffer           | ByteString       |    29.874 ns |   0.1518 ns |   0.1268 ns |
// | BenchConvertTo | Buffer           | Buffer           |     4.939 ns |   0.0190 ns |   0.0178 ns |
// | BenchConvertTo | Buffer           | Array            | 4,683.427 ns |  21.3813 ns |  20.0001 ns |
// | BenchConvertTo | Buffer           | Struct           | 4,680.762 ns |  15.7220 ns |  13.9371 ns |
// | BenchConvertTo | Buffer           | Map              | 4,706.510 ns |  14.2061 ns |  12.5934 ns |
// | BenchConvertTo | Buffer           | InteropInterface | 4,703.050 ns |  15.8002 ns |  14.0064 ns |
// | BenchConvertTo | Array            | Any              | 4,652.710 ns |  23.2061 ns |  20.5716 ns |
// | BenchConvertTo | Array            | Pointer          | 4,625.049 ns |  12.4455 ns |  11.6415 ns |
// | BenchConvertTo | Array            | Boolean          |     5.568 ns |   0.0181 ns |   0.0169 ns |
// | BenchConvertTo | Array            | Integer          | 4,659.897 ns |  19.8036 ns |  18.5243 ns |
// | BenchConvertTo | Array            | ByteString       | 4,663.020 ns |  12.4988 ns |  11.6914 ns |
// | BenchConvertTo | Array            | Buffer           | 4,680.281 ns |  14.9748 ns |  13.2748 ns |
// | BenchConvertTo | Array            | Array            |     4.246 ns |   0.0124 ns |   0.0110 ns |
// | BenchConvertTo | Array            | Struct           | 1,193.106 ns |  98.5374 ns | 285.8748 ns |
// | BenchConvertTo | Array            | Map              | 4,742.631 ns |  35.5855 ns |  33.2867 ns |
// | BenchConvertTo | Array            | InteropInterface | 4,670.743 ns |   9.3547 ns |   7.8116 ns |
// | BenchConvertTo | Struct           | Any              | 4,643.558 ns |  31.0451 ns |  29.0396 ns |
// | BenchConvertTo | Struct           | Pointer          | 4,867.925 ns |  22.2347 ns |  19.7105 ns |
// | BenchConvertTo | Struct           | Boolean          |     5.581 ns |   0.0251 ns |   0.0235 ns |
// | BenchConvertTo | Struct           | Integer          | 4,653.442 ns |  17.7417 ns |  16.5956 ns |
// | BenchConvertTo | Struct           | ByteString       | 4,646.242 ns |  13.7830 ns |  12.8926 ns |
// | BenchConvertTo | Struct           | Buffer           | 4,776.205 ns |  14.1918 ns |  13.2751 ns |
// | BenchConvertTo | Struct           | Array            | 1,622.573 ns | 144.8116 ns | 398.8532 ns |
// | BenchConvertTo | Struct           | Struct           |     4.195 ns |   0.0327 ns |   0.0290 ns |
// | BenchConvertTo | Struct           | Map              | 4,672.579 ns |  17.6257 ns |  16.4871 ns |
// | BenchConvertTo | Struct           | InteropInterface | 4,653.476 ns |   8.2047 ns |   7.6747 ns |
// | BenchConvertTo | Map              | Any              | 4,676.540 ns |  15.2010 ns |  13.4753 ns |
// | BenchConvertTo | Map              | Pointer          | 4,663.489 ns |  13.7871 ns |  12.2219 ns |
// | BenchConvertTo | Map              | Boolean          |     5.535 ns |   0.0205 ns |   0.0192 ns |
// | BenchConvertTo | Map              | Integer          | 4,661.275 ns |  12.4402 ns |  11.6366 ns |
// | BenchConvertTo | Map              | ByteString       | 4,662.482 ns |  25.7111 ns |  24.0502 ns |
// | BenchConvertTo | Map              | Buffer           | 4,859.809 ns |  18.2981 ns |  16.2208 ns |
// | BenchConvertTo | Map              | Array            | 4,627.149 ns |  10.7487 ns |   9.5285 ns |
// | BenchConvertTo | Map              | Struct           | 4,646.504 ns |  22.4190 ns |  20.9707 ns |
// | BenchConvertTo | Map              | Map              |     4.160 ns |   0.0180 ns |   0.0169 ns |
// | BenchConvertTo | Map              | InteropInterface | 4,667.024 ns |  14.1790 ns |  13.2630 ns |
// | BenchConvertTo | InteropInterface | Any              | 4,700.511 ns |  17.4725 ns |  15.4889 ns |
// | BenchConvertTo | InteropInterface | Pointer          | 4,705.819 ns |  25.2035 ns |  23.5754 ns |
// | BenchConvertTo | InteropInterface | Boolean          |     5.557 ns |   0.0244 ns |   0.0228 ns |
// | BenchConvertTo | InteropInterface | Integer          | 4,695.410 ns |  21.8674 ns |  20.4547 ns |
// | BenchConvertTo | InteropInterface | ByteString       | 4,674.552 ns |  18.8705 ns |  17.6515 ns |
// | BenchConvertTo | InteropInterface | Buffer           | 4,649.237 ns |  23.9084 ns |  22.3639 ns |
// | BenchConvertTo | InteropInterface | Array            | 4,827.652 ns |  29.7153 ns |  27.7957 ns |
// | BenchConvertTo | InteropInterface | Struct           | 4,624.202 ns |  10.3563 ns |   8.0855 ns |
// | BenchConvertTo | InteropInterface | Map              | 4,695.310 ns |  23.1192 ns |  21.6257 ns |
// | BenchConvertTo | InteropInterface | InteropInterface |     4.137 ns |   0.0156 ns |   0.0138 ns |


================================================
FILE: benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_DeepCopy.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Benchmarks_DeepCopy.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using BenchmarkDotNet.Attributes;
using Array = Neo.VM.Types.Array;

namespace Neo.VM.Benchmarks.VMTypes;

public class Benchmarks_DeepCopy
{
    public static IEnumerable<(int Depth, int ElementsPerLevel)> ParamSource()
    {
        int[] depths = [2, 4];
        int[] elementsPerLevel = [2, 4, 6];

        foreach (var depth in depths)
        {
            foreach (var elements in elementsPerLevel)
            {
                if (depth <= 8 || elements <= 2)
                {
                    yield return (depth, elements);
                }
            }
        }
    }

    [ParamsSource(nameof(ParamSource))]
    public (int Depth, int ElementsPerLevel) Params;

    [Benchmark]
    public void BenchNestedArrayDeepCopy()
    {
        var root = new Array(new ReferenceCounter());
        CreateNestedArray(root, Params.Depth, Params.ElementsPerLevel);
        _ = root.DeepCopy();
    }

    [Benchmark]
    public void BenchNestedArrayDeepCopyWithReferenceCounter()
    {
        var referenceCounter = new ReferenceCounter();
        var root = new Array(referenceCounter);
        CreateNestedArray(root, Params.Depth, Params.ElementsPerLevel, referenceCounter);
        _ = root.DeepCopy();
    }

    [Benchmark]
    public void BenchNestedTestArrayDeepCopy()
    {
        var root = new TestArray(new ReferenceCounter());
        CreateNestedTestArray(root, Params.Depth, Params.ElementsPerLevel);
        _ = root.DeepCopy();
    }

    [Benchmark]
    public void BenchNestedTestArrayDeepCopyWithReferenceCounter()
    {
        var referenceCounter = new ReferenceCounter();
        var root = new TestArray(referenceCounter);
        CreateNestedTestArray(root, Params.Depth, Params.ElementsPerLevel, referenceCounter);
        _ = root.DeepCopy();
    }

    private static void CreateNestedArray(Array? rootArray, int depth, int elementsPerLevel = 1, IReferenceCounter? referenceCounter = null)
    {
        if (depth < 0)
        {
            throw new ArgumentException("Depth must be non-negative", nameof(depth));
        }

        ArgumentNullException.ThrowIfNull(rootArray);

        if (depth == 0)
        {
            return;
        }

        for (var i = 0; i < elementsPerLevel; i++)
        {
            var childArray = new Array(referenceCounter);
            rootArray.Add(childArray);
            CreateNestedArray(childArray, depth - 1, elementsPerLevel, referenceCounter);
        }
    }

    private static void CreateNestedTestArray(TestArray rootArray, int depth, int elementsPerLevel = 1, IReferenceCounter? referenceCounter = null)
    {
        if (depth < 0)
        {
            throw new ArgumentException("Depth must be non-negative", nameof(depth));
        }

        ArgumentNullException.ThrowIfNull(rootArray);

        if (depth == 0)
        {
            return;
        }

        for (var i = 0; i < elementsPerLevel; i++)
        {
            var childArray = new TestArray(referenceCounter);
            rootArray.Add(childArray);
            CreateNestedTestArray(childArray, depth - 1, elementsPerLevel, referenceCounter);
        }
    }
}


================================================
FILE: neo-vm.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32505.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0F08E36C-9F18-423D-8F8C-C8C2FACF00F7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM", "src\Neo.VM\Neo.VM.csproj", "{6A621185-36A9-4E1A-8D3D-462D19503E32}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{210DA31B-019E-48CE-9498-D56A7987C4E6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM.Tests", "tests\Neo.VM.Tests\Neo.VM.Tests.csproj", "{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{68EA7507-C4D7-4BF1-9552-D6ACDC00C209}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.VM.Benchmarks", "benchmarks\Neo.VM.Benchmarks\Neo.VM.Benchmarks.csproj", "{1F7EE0A2-3803-478E-B4FE-EB62F076767B}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{6A621185-36A9-4E1A-8D3D-462D19503E32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{6A621185-36A9-4E1A-8D3D-462D19503E32}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{6A621185-36A9-4E1A-8D3D-462D19503E32}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{6A621185-36A9-4E1A-8D3D-462D19503E32}.Release|Any CPU.Build.0 = Release|Any CPU
		{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC}.Release|Any CPU.Build.0 = Release|Any CPU
		{1F7EE0A2-3803-478E-B4FE-EB62F076767B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{1F7EE0A2-3803-478E-B4FE-EB62F076767B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{1F7EE0A2-3803-478E-B4FE-EB62F076767B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{1F7EE0A2-3803-478E-B4FE-EB62F076767B}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(NestedProjects) = preSolution
		{6A621185-36A9-4E1A-8D3D-462D19503E32} = {0F08E36C-9F18-423D-8F8C-C8C2FACF00F7}
		{56063C9E-49B3-4CE2-96C5-E5F7ECACC5FC} = {210DA31B-019E-48CE-9498-D56A7987C4E6}
		{1F7EE0A2-3803-478E-B4FE-EB62F076767B} = {68EA7507-C4D7-4BF1-9552-D6ACDC00C209}
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {F8AC7AA8-85DE-4A98-9B58-BA08AB813C99}
	EndGlobalSection
EndGlobal


================================================
FILE: src/Neo.VM/BadScriptException.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// BadScriptException.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;

namespace Neo.VM;

/// <summary>
/// Represents the exception thrown when the bad script is parsed.
/// </summary>
public class BadScriptException : Exception
{
    /// <summary>
    /// Initializes a new instance of the <see cref="BadScriptException"/> class.
    /// </summary>
    public BadScriptException() { }

    /// <summary>
    /// Initializes a new instance of the <see cref="BadScriptException"/> class with a specified error message.
    /// </summary>
    /// <param name="message">The message that describes the error.</param>
    public BadScriptException(string message) : base(message) { }
}


================================================
FILE: src/Neo.VM/CatchableException.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// CatchableException.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;

namespace Neo.VM;

public class CatchableException : Exception
{
    public CatchableException(string message) : base(message)
    {
    }
}


================================================
FILE: src/Neo.VM/Collections/OrderedDictionary.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// OrderedDictionary.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

#if !NET5_0_OR_GREATER

using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

namespace Neo.VM.Collections;

class OrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue> where TKey : notnull
{
    private class TItem
    {
        public readonly TKey Key;
        public TValue Value;

        public TItem(TKey key, TValue value)
        {
            Key = key;
            Value = value;
        }
    }

    private class InternalCollection : KeyedCollection<TKey, TItem>
    {
        protected override TKey GetKeyForItem(TItem item)
        {
            return item.Key;
        }
    }

    private readonly InternalCollection collection = new();

    public int Count => collection.Count;
    public bool IsReadOnly => false;
    public ICollection<TKey> Keys => collection.Select(p => p.Key).ToArray();
    public ICollection<TValue> Values => collection.Select(p => p.Value).ToArray();

    public TValue this[TKey key]
    {
        get
        {
            return collection[key].Value;
        }
        set
        {
            if (collection.TryGetValue(key, out var entry))
                entry.Value = value;
            else
                Add(key, value);
        }
    }

    public void Add(TKey key, TValue value)
    {
        collection.Add(new TItem(key, value));
    }

    public bool ContainsKey(TKey key)
    {
        return collection.Contains(key);
    }

    public bool Remove(TKey key)
    {
        return collection.Remove(key);
    }

    public bool TryGetValue(TKey key, out TValue value)
    {
        if (collection.TryGetValue(key, out var entry))
        {
            value = entry.Value;
            return true;
        }
        value = default!;
        return false;
    }

    void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
    {
        Add(item.Key, item.Value);
    }

    public void Clear()
    {
        collection.Clear();
    }

    bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
    {
        return collection.Contains(item.Key);
    }

    void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
    {
        for (int i = 0; i < collection.Count; i++)
            array[i + arrayIndex] = new KeyValuePair<TKey, TValue>(collection[i].Key, collection[i].Value);
    }

    bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
    {
        return collection.Remove(item.Key);
    }

    IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
    {
        return collection.Select(p => new KeyValuePair<TKey, TValue>(p.Key, p.Value)).GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return collection.Select(p => new KeyValuePair<TKey, TValue>(p.Key, p.Value)).GetEnumerator();
    }
}

#endif


================================================
FILE: src/Neo.VM/Debugger.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Debugger.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.Collections.Generic;

namespace Neo.VM;

/// <summary>
/// A simple debugger for <see cref="ExecutionEngine"/>.
/// </summary>
public class Debugger
{
    private readonly ExecutionEngine _engine;
    private readonly Dictionary<Script, HashSet<uint>> _breakPoints = new();

    /// <summary>
    /// Create a debugger on the specified <see cref="ExecutionEngine"/>.
    /// </summary>
    /// <param name="engine">The <see cref="ExecutionEngine"/> to attach the debugger.</param>
    public Debugger(ExecutionEngine engine)
    {
        _engine = engine;
    }

    /// <summary>
    /// Add a breakpoint at the specified position of the specified script.
    /// The VM will break the execution when it reaches the breakpoint.
    /// </summary>
    /// <param name="script">The script to add the breakpoint.</param>
    /// <param name="position">The position of the breakpoint in the script.</param>
    public void AddBreakPoint(Script script, uint position)
    {
        if (!_breakPoints.TryGetValue(script, out var hashset))
        {
            hashset = new HashSet<uint>();
            _breakPoints.Add(script, hashset);
        }
        hashset.Add(position);
    }

    /// <summary>
    /// Start or continue execution of the VM.
    /// </summary>
    /// <returns>Returns the state of the VM after the execution.</returns>
    public VMState Execute()
    {
        if (_engine.State == VMState.BREAK)
            _engine.State = VMState.NONE;
        while (_engine.State == VMState.NONE)
            ExecuteAndCheckBreakPoints();
        return _engine.State;
    }

    private void ExecuteAndCheckBreakPoints()
    {
        _engine.ExecuteNext();
        if (_engine.State == VMState.NONE && _engine.InvocationStack.Count > 0 && _breakPoints.Count > 0)
        {
            if (_breakPoints.TryGetValue(_engine.CurrentContext!.Script, out var hashset) &&
                hashset.Contains((uint)_engine.CurrentContext.InstructionPointer))
            {
                _engine.State = VMState.BREAK;
            }
        }
    }

    /// <summary>
    /// Removes the breakpoint at the specified position in the specified script.
    /// </summary>
    /// <param name="script">The script to remove the breakpoint.</param>
    /// <param name="position">The position of the breakpoint in the script.</param>
    /// <returns>
    /// <see langword="true"/> if the breakpoint is successfully found and removed;
    /// otherwise, <see langword="false"/>.
    /// </returns>
    public bool RemoveBreakPoint(Script script, uint position)
    {
        if (!_breakPoints.TryGetValue(script, out var hashset)) return false;
        if (!hashset.Remove(position)) return false;
        if (hashset.Count == 0) _breakPoints.Remove(script);
        return true;
    }

    /// <summary>
    /// Execute the next instruction.
    /// If the instruction involves a call to a method,
    /// it steps into the method and breaks the execution on the first instruction of that method.
    /// </summary>
    /// <returns>The VM state after the instruction is executed.</returns>
    public VMState StepInto()
    {
        if (_engine.State == VMState.HALT || _engine.State == VMState.FAULT)
            return _engine.State;
        _engine.ExecuteNext();
        if (_engine.State == VMState.NONE)
            _engine.State = VMState.BREAK;
        return _engine.State;
    }

    /// <summary>
    /// Execute until the currently executed method is returned.
    /// </summary>
    /// <returns>The VM state after the currently executed method is returned.</returns>
    public VMState StepOut()
    {
        if (_engine.State == VMState.BREAK)
            _engine.State = VMState.NONE;
        int c = _engine.InvocationStack.Count;
        while (_engine.State == VMState.NONE && _engine.InvocationStack.Count >= c)
            ExecuteAndCheckBreakPoints();
        if (_engine.State == VMState.NONE)
            _engine.State = VMState.BREAK;
        return _engine.State;
    }

    /// <summary>
    /// Execute the next instruction.
    /// If the instruction involves a call to a method, it does not step into the method (it steps over it instead).
    /// </summary>
    /// <returns>The VM state after the instruction is executed.</returns>
    public VMState StepOver()
    {
        if (_engine.State == VMState.HALT || _engine.State == VMState.FAULT)
            return _engine.State;
        _engine.State = VMState.NONE;
        int c = _engine.InvocationStack.Count;
        do
        {
            ExecuteAndCheckBreakPoints();
        }
        while (_engine.State == VMState.NONE && _engine.InvocationStack.Count > c);
        if (_engine.State == VMState.NONE)
            _engine.State = VMState.BREAK;
        return _engine.State;
    }
}


================================================
FILE: src/Neo.VM/EvaluationStack.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// EvaluationStack.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;

namespace Neo.VM;

/// <summary>
/// Represents the evaluation stack in the VM.
/// </summary>
public sealed class EvaluationStack : IReadOnlyList<StackItem>
{
    private readonly List<StackItem> _innerList = [];
    private readonly IReferenceCounter _referenceCounter;

    internal IReferenceCounter ReferenceCounter => _referenceCounter;

    internal EvaluationStack(IReferenceCounter referenceCounter)
    {
        _referenceCounter = referenceCounter;
    }

    public StackItem this[int index]
    {
        get => Peek(index);
    }

    public IReadOnlyList<StackItem> this[Range range]
    {
        get
        {
            var start = range.Start.GetOffset(_innerList.Count);
            var end = range.End.GetOffset(_innerList.Count);

            if (start > end)
                throw new ArgumentOutOfRangeException(nameof(range), "Range start must be less than or equal to end.");

            List<StackItem> copyList = new(_innerList);
            copyList.Reverse();
            return copyList.GetRange(start, end - start);
        }
    }

    /// <summary>
    /// Gets the number of items on the stack.
    /// </summary>
    public int Count => _innerList.Count;

    internal void Clear()
    {
        foreach (var item in _innerList)
            _referenceCounter.RemoveStackReference(item);
        _innerList.Clear();
    }

    internal void CopyTo(EvaluationStack stack, int count = -1)
    {
        if (count < -1 || count > _innerList.Count)
            throw new ArgumentOutOfRangeException(nameof(count), $"Out of stack bounds: {count}/{_innerList.Count}");
        if (count == 0) return;
        if (count == -1 || count == _innerList.Count)
            stack._innerList.AddRange(_innerList);
        else
            stack._innerList.AddRange(_innerList.Skip(_innerList.Count - count));
    }

    public IEnumerator<StackItem> GetEnumerator()
    {
        return _innerList.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return _innerList.GetEnumerator();
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    internal void Insert(int index, StackItem item)
    {
        if (index > _innerList.Count)
            throw new InvalidOperationException($"Insert index is out of stack bounds: {index}/{_innerList.Count}");
        _innerList.Insert(_innerList.Count - index, item);
        _referenceCounter.AddStackReference(item);
    }

    internal void MoveTo(EvaluationStack stack, int count = -1)
    {
        if (count == 0) return;
        CopyTo(stack, count);
        if (count == -1 || count == _innerList.Count)
            _innerList.Clear();
        else
            _innerList.RemoveRange(_innerList.Count - count, count);
    }

    /// <summary>
    /// Returns the item at the specified index from the top of the stack without removing it.
    /// </summary>
    /// <param name="index">The index of the object from the top of the stack.</param>
    /// <returns>The item at the specified index.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public StackItem Peek(int index = 0)
    {
        if (index >= _innerList.Count)
            throw new InvalidOperationException($"Peek index is out of stack bounds: {index}/{_innerList.Count}");
        if (index < 0)
        {
            index += _innerList.Count;
            if (index < 0) throw new InvalidOperationException($"Peek index is out of stack bounds: {index}/{_innerList.Count}");
        }
        return _innerList[_innerList.Count - index - 1];
    }

    /// <summary>
    /// Pushes an item onto the top of the stack.
    /// </summary>
    /// <param name="item">The item to be pushed.</param>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void Push(StackItem item)
    {
        _innerList.Add(item);
        _referenceCounter.AddStackReference(item);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    internal void Reverse(int n)
    {
        if (n < 0 || n > _innerList.Count)
            throw new ArgumentOutOfRangeException(nameof(n), $"Out of stack bounds: {n}/{_innerList.Count}");
        if (n <= 1) return;
        _innerList.Reverse(_innerList.Count - n, n);
    }

    /// <summary>
    /// Swaps two items on the stack by their indices from the top.
    /// This is an O(1) operation that doesn't trigger reference counting changes.
    /// Note: The caller must ensure indices are within bounds and non-negative.
    /// </summary>
    /// <param name="index1">First index from top of stack.</param>
    /// <param name="index2">Second index from top of stack.</param>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    internal void Swap(int index1, int index2)
    {
        if (index1 == index2) return;

        int actualIndex1 = _innerList.Count - index1 - 1;
        int actualIndex2 = _innerList.Count - index2 - 1;

        // Direct swap - no reference counting needed since items stay on stack
        (_innerList[actualIndex1], _innerList[actualIndex2]) = (_innerList[actualIndex2], _innerList[actualIndex1]);
    }

    /// <summary>
    /// Removes and returns the item at the top of the stack.
    /// </summary>
    /// <returns>The item removed from the top of the stack.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public StackItem Pop()
    {
        return Remove<StackItem>(0);
    }

    /// <summary>
    /// Removes and returns the item at the top of the stack and convert it to the specified type.
    /// </summary>
    /// <typeparam name="T">The type to convert to.</typeparam>
    /// <returns>The item removed from the top of the stack.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Pop<T>() where T : StackItem
    {
        return Remove<T>(0);
    }

    internal T Remove<T>(int index) where T : StackItem
    {
        if (index >= _innerList.Count)
            throw new ArgumentOutOfRangeException(nameof(index), $"Out of stack bounds: {index}/{_innerList.Count}");
        if (index < 0)
        {
            index += _innerList.Count;
            if (index < 0)
                throw new ArgumentOutOfRangeException(nameof(index), $"Out of stack bounds: {index}/{_innerList.Count}");
        }
        index = _innerList.Count - index - 1;
        if (_innerList[index] is not T item)
            throw new InvalidCastException($"The item can't be casted to type {typeof(T)}");
        _innerList.RemoveAt(index);
        _referenceCounter.RemoveStackReference(item);
        return item;
    }

    public override string ToString()
    {
        return $"[{string.Join(", ", _innerList.Select(p => $"{p.Type}({p})"))}]";
    }
}


================================================
FILE: src/Neo.VM/ExceptionHandlingContext.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExceptionHandlingContext.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.Diagnostics;

namespace Neo.VM;

/// <summary>
/// Represents the context used for exception handling.
/// </summary>
[DebuggerDisplay("State={State}, CatchPointer={CatchPointer}, FinallyPointer={FinallyPointer}, EndPointer={EndPointer}")]
public sealed class ExceptionHandlingContext
{
    /// <summary>
    /// The position of the <see langword="catch"/> block.
    /// </summary>
    public int CatchPointer { get; }

    /// <summary>
    /// The position of the <see langword="finally"/> block.
    /// </summary>
    public int FinallyPointer { get; }

    /// <summary>
    /// The end position of the <see langword="try"/>-<see langword="catch"/>-<see langword="finally"/> block.
    /// </summary>
    public int EndPointer { get; internal set; } = -1;

    /// <summary>
    /// Indicates whether the <see langword="catch"/> block is included in the context.
    /// </summary>
    public bool HasCatch => CatchPointer >= 0;

    /// <summary>
    /// Indicates whether the <see langword="finally"/> block is included in the context.
    /// </summary>
    public bool HasFinally => FinallyPointer >= 0;

    /// <summary>
    /// Indicates the state of the context.
    /// </summary>
    public ExceptionHandlingState State { get; internal set; } = ExceptionHandlingState.Try;

    internal ExceptionHandlingContext(int catchPointer, int finallyPointer)
    {
        CatchPointer = catchPointer;
        FinallyPointer = finallyPointer;
    }
}


================================================
FILE: src/Neo.VM/ExceptionHandlingState.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExceptionHandlingState.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

namespace Neo.VM;

/// <summary>
/// Indicates the state of the <see cref="ExceptionHandlingContext"/>.
/// </summary>
public enum ExceptionHandlingState : byte
{
    /// <summary>
    /// Indicates that the <see langword="try"/> block is being executed.
    /// </summary>
    Try,

    /// <summary>
    /// Indicates that the <see langword="catch"/> block is being executed.
    /// </summary>
    Catch,

    /// <summary>
    /// Indicates that the <see langword="finally"/> block is being executed.
    /// </summary>
    Finally
}


================================================
FILE: src/Neo.VM/ExecutionContext.SharedStates.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExecutionContext.SharedStates.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;
using System.Collections.Generic;

namespace Neo.VM;

partial class ExecutionContext
{
    private class SharedStates
    {
        public readonly Script Script;
        public readonly EvaluationStack EvaluationStack;
        public Slot? StaticFields;
        public readonly Dictionary<Type, object> States;

        public SharedStates(Script script, IReferenceCounter referenceCounter)
        {
            Script = script;
            EvaluationStack = new(referenceCounter);
            States = new();
        }
    }
}


================================================
FILE: src/Neo.VM/ExecutionContext.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExecutionContext.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace Neo.VM;

/// <summary>
/// Represents a frame in the VM execution stack.
/// </summary>
[DebuggerDisplay("InstructionPointer={InstructionPointer}")]
public sealed partial class ExecutionContext
{
    private readonly SharedStates _sharedStates;
    private int _instructionPointer;

    /// <summary>
    /// Indicates the number of values that the context should return when it is unloaded.
    /// </summary>
    public int RVCount { get; }

    /// <summary>
    /// The script to run in this context.
    /// </summary>
    public Script Script => _sharedStates.Script;

    /// <summary>
    /// The evaluation stack for this context.
    /// </summary>
    public EvaluationStack EvaluationStack => _sharedStates.EvaluationStack;

    /// <summary>
    /// The slot used to store the static fields.
    /// </summary>
    public Slot? StaticFields
    {
        get => _sharedStates.StaticFields;
        internal set => _sharedStates.StaticFields = value;
    }

    /// <summary>
    /// The slot used to store the local variables of the current method.
    /// </summary>
    public Slot? LocalVariables { get; internal set; }

    /// <summary>
    /// The slot used to store the arguments of the current method.
    /// </summary>
    public Slot? Arguments { get; internal set; }

    /// <summary>
    /// The stack containing nested <see cref="ExceptionHandlingContext"/>.
    /// </summary>
    public Stack<ExceptionHandlingContext>? TryStack { get; internal set; }

    /// <summary>
    /// The pointer indicating the current instruction.
    /// </summary>
    public int InstructionPointer
    {
        get
        {
            return _instructionPointer;
        }
        internal set
        {
            if (value < 0 || value > Script.Length)
                throw new ArgumentOutOfRangeException(nameof(value), $"Out of script bounds: {value}/{Script.Length}");
            _instructionPointer = value;
        }
    }

    /// <summary>
    /// Returns the current <see cref="Instruction"/>.
    /// </summary>
    public Instruction? CurrentInstruction
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return GetInstruction(InstructionPointer);
        }
    }

    /// <summary>
    /// Returns the next <see cref="Instruction"/>.
    /// </summary>
    public Instruction? NextInstruction
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            var current = CurrentInstruction;
            if (current is null) return null;
            return GetInstruction(InstructionPointer + current.Size);
        }
    }

    internal ExecutionContext(Script script, int rvcount, IReferenceCounter referenceCounter)
        : this(new SharedStates(script, referenceCounter), rvcount, 0)
    {
    }

    private ExecutionContext(SharedStates sharedStates, int rvcount, int initialPosition)
    {
        if (rvcount < -1 || rvcount > ushort.MaxValue)
            throw new ArgumentOutOfRangeException(nameof(rvcount), $"Out of range: {rvcount}");
        _sharedStates = sharedStates;
        RVCount = rvcount;
        InstructionPointer = initialPosition;
    }

    /// <summary>
    /// Clones the context so that they share the same script, stack, and static fields.
    /// </summary>
    /// <returns>The cloned context.</returns>
    public ExecutionContext Clone()
    {
        return Clone(InstructionPointer);
    }

    /// <summary>
    /// Clones the context so that they share the same script, stack, and static fields.
    /// </summary>
    /// <param name="initialPosition">The instruction pointer of the new context.</param>
    /// <returns>The cloned context.</returns>
    public ExecutionContext Clone(int initialPosition)
    {
        return new ExecutionContext(_sharedStates, 0, initialPosition);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private Instruction? GetInstruction(int ip) => ip >= Script.Length ? null : Script.GetInstruction(ip);

    /// <summary>
    /// Gets custom data of the specified type. If the data does not exist, create a new one.
    /// </summary>
    /// <typeparam name="T">The type of data to be obtained.</typeparam>
    /// <param name="factory">A delegate used to create the entry. If factory is null, new() will be used.</param>
    /// <returns>The custom data of the specified type.</returns>
    public T GetState<T>(Func<T>? factory = null) where T : class, new()
    {
        if (!_sharedStates.States.TryGetValue(typeof(T), out var value))
        {
            value = factory is null ? new T() : factory();
            _sharedStates.States[typeof(T)] = value;
        }
        return (T)value;
    }

    internal bool MoveNext()
    {
        var current = CurrentInstruction;
        if (current is null) return false;
        InstructionPointer += current.Size;
        return InstructionPointer < Script.Length;
    }
}


================================================
FILE: src/Neo.VM/ExecutionEngine.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExecutionEngine.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace Neo.VM;

/// <summary>
/// Represents the VM used to execute the script.
/// </summary>
public class ExecutionEngine : IDisposable
{
    private VMState _state = VMState.BREAK;

    internal bool isJumping = false;

    public JumpTable JumpTable { get; }

    /// <summary>
    /// Restrictions on the VM.
    /// </summary>
    public ExecutionEngineLimits Limits { get; }

    /// <summary>
    /// Used for reference counting of objects in the VM.
    /// </summary>
    public IReferenceCounter ReferenceCounter { get; }

    /// <summary>
    /// The invocation stack of the VM.
    /// </summary>
    public Stack<ExecutionContext> InvocationStack { get; } = new();

    /// <summary>
    /// The top frame of the invocation stack.
    /// </summary>
    public ExecutionContext? CurrentContext { get; private set; }

    /// <summary>
    /// The bottom frame of the invocation stack.
    /// </summary>
    public ExecutionContext? EntryContext { get; private set; }

    /// <summary>
    /// The stack to store the return values.
    /// </summary>
    public EvaluationStack ResultStack { get; }

    /// <summary>
    /// The VM object representing the uncaught exception.
    /// </summary>
    public StackItem? UncaughtException { get; internal set; }

    /// <summary>
    /// The current state of the VM.
    /// </summary>
    public VMState State
    {
        get
        {
            return _state;
        }
        protected internal set
        {
            if (_state != value)
            {
                _state = value;
                OnStateChanged();
            }
        }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExecutionEngine"/> class.
    /// </summary>
    /// <param name="jumpTable">The jump table to be used.</param>
    public ExecutionEngine(JumpTable? jumpTable = null)
        : this(jumpTable, new ReferenceCounterV2(), ExecutionEngineLimits.Default) { }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExecutionEngine"/> class
    /// with the specified <see cref="VM.IReferenceCounter"/> and <see cref="ExecutionEngineLimits"/>.
    /// </summary>
    /// <param name="jumpTable">The jump table to be used.</param>
    /// <param name="referenceCounter">The reference counter to be used.</param>
    /// <param name="limits">Restrictions on the VM.</param>
    internal ExecutionEngine(JumpTable? jumpTable, IReferenceCounter referenceCounter, ExecutionEngineLimits limits)
    {
        JumpTable = jumpTable ?? JumpTable.Default;
        Limits = limits;
        ReferenceCounter = referenceCounter;
        ResultStack = new(referenceCounter);
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    protected virtual void Dispose(bool disposing)
    {
        if (disposing)
        {
            InvocationStack.Clear();
        }
    }

    /// <summary>
    /// Start execution of the VM.
    /// </summary>
    /// <returns></returns>
    public virtual VMState Execute()
    {
        if (State == VMState.BREAK)
            State = VMState.NONE;
        while (State != VMState.HALT && State != VMState.FAULT)
            ExecuteNext();
        return State;
    }

    /// <summary>
    /// Execute the next instruction.
    /// </summary>
    protected internal void ExecuteNext()
    {
        if (InvocationStack.Count == 0)
        {
            State = VMState.HALT;
        }
        else
        {
            try
            {
                ExecutionContext context = CurrentContext!;
                Instruction? currentInstruction = context.CurrentInstruction;
                Instruction instruction = currentInstruction ?? Instruction.RET;
                PreExecuteInstruction(instruction);
#if VMPERF
                Console.WriteLine("op:["
                                  + this.CurrentContext.InstructionPointer.ToString("X04")
                                  + "]"
                                  + this.CurrentContext.CurrentInstruction?.OpCode
                                  + " "
                                  + this.CurrentContext.EvaluationStack);
#endif
                try
                {
                    JumpTable[instruction.OpCode](this, instruction);
                }
                catch (CatchableException ex) when (Limits.CatchEngineExceptions)
                {
                    JumpTable.ExecuteThrow(this, ex.Message);
                }
                PostExecuteInstruction(instruction);
                if (!isJumping && currentInstruction != null)
                    context.InstructionPointer += instruction.Size;
                isJumping = false;
            }
            catch (Exception e)
            {
                OnFault(e);
            }
        }
    }

    /// <summary>
    /// Loads the specified context into the invocation stack.
    /// </summary>
    /// <param name="context">The context to load.</param>
    public virtual void LoadContext(ExecutionContext context)
    {
        if (InvocationStack.Count >= Limits.MaxInvocationStackSize)
            throw new InvalidOperationException($"MaxInvocationStackSize exceed: {InvocationStack.Count}");
        InvocationStack.Push(context);
        EntryContext ??= context;
        CurrentContext = context;
    }

    /// <summary>
    /// Called when a context is unloaded.
    /// </summary>
    /// <param name="context">The context being unloaded.</param>
    internal protected virtual void ContextUnloaded(ExecutionContext context)
    {
        if (InvocationStack.Count == 0)
        {
            CurrentContext = null;
            EntryContext = null;
        }
        else
        {
            CurrentContext = InvocationStack.Peek();
        }
        if (context.StaticFields != null && context.StaticFields != CurrentContext?.StaticFields)
        {
            context.StaticFields.ClearReferences();
        }
        context.LocalVariables?.ClearReferences();
        context.Arguments?.ClearReferences();
    }

    /// <summary>
    /// Create a new context with the specified script without loading.
    /// </summary>
    /// <param name="script">The script used to create the context.</param>
    /// <param name="rvcount">The number of values that the context should return when it is unloaded.</param>
    /// <param name="initialPosition">The pointer indicating the current instruction.</param>
    /// <returns>The created context.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    protected ExecutionContext CreateContext(Script script, int rvcount, int initialPosition)
    {
        return new ExecutionContext(script, rvcount, ReferenceCounter)
        {
            InstructionPointer = initialPosition
        };
    }

    /// <summary>
    /// Create a new context with the specified script and load it.
    /// </summary>
    /// <param name="script">The script used to create the context.</param>
    /// <param name="rvcount">The number of values that the context should return when it is unloaded.</param>
    /// <param name="initialPosition">The pointer indicating the current instruction.</param>
    /// <returns>The created context.</returns>
    public ExecutionContext LoadScript(Script script, int rvcount = -1, int initialPosition = 0)
    {
        var context = CreateContext(script, rvcount, initialPosition);
        LoadContext(context);
        return context;
    }

    /// <summary>
    /// Called when an exception that cannot be caught by the VM is thrown.
    /// </summary>
    /// <param name="ex">The exception that caused the <see cref="VMState.FAULT"/> state.</param>
    protected virtual void OnFault(Exception ex)
    {
        State = VMState.FAULT;

#if VMPERF
        if (ex != null)
        {
            Console.Error.WriteLine(ex);
        }
#endif
    }

    /// <summary>
    /// Called when the state of the VM changed.
    /// </summary>
    protected virtual void OnStateChanged()
    {
    }

    /// <summary>
    /// Returns the item at the specified index from the top of the current stack without removing it.
    /// </summary>
    /// <param name="index">The index of the object from the top of the stack.</param>
    /// <returns>The item at the specified index.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public StackItem Peek(int index = 0)
    {
        return CurrentContext!.EvaluationStack.Peek(index);
    }

    /// <summary>
    /// Removes and returns the item at the top of the current stack.
    /// </summary>
    /// <returns>The item removed from the top of the stack.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public StackItem Pop()
    {
        return CurrentContext!.EvaluationStack.Pop();
    }

    /// <summary>
    /// Removes and returns the item at the top of the current stack and convert it to the specified type.
    /// </summary>
    /// <typeparam name="T">The type to convert to.</typeparam>
    /// <returns>The item removed from the top of the stack.</returns>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Pop<T>() where T : StackItem
    {
        return CurrentContext!.EvaluationStack.Pop<T>();
    }

    /// <summary>
    /// Called after an instruction is executed.
    /// </summary>
    protected virtual void PostExecuteInstruction(Instruction instruction)
    {
        ReferenceCounter.CheckPostExecution();
    }

    /// <summary>
    /// Called before an instruction is executed.
    /// </summary>
    protected virtual void PreExecuteInstruction(Instruction instruction) { }

    /// <summary>
    /// Pushes an item onto the top of the current stack.
    /// </summary>
    /// <param name="item">The item to be pushed.</param>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void Push(StackItem item)
    {
        CurrentContext!.EvaluationStack.Push(item);
    }
}


================================================
FILE: src/Neo.VM/ExecutionEngineLimits.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// ExecutionEngineLimits.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;
using System.Runtime.CompilerServices;

namespace Neo.VM;

/// <summary>
/// Represents the restrictions on the VM.
/// </summary>
public sealed record ExecutionEngineLimits
{
    /// <summary>
    /// The default strategy.
    /// </summary>
    public static readonly ExecutionEngineLimits Default = new();

    /// <summary>
    /// The maximum number of bits that <see cref="OpCode.SHL"/> and <see cref="OpCode.SHR"/> can shift.
    /// </summary>
    public int MaxShift { get; init; } = 256;

    /// <summary>
    /// The maximum number of items that can be contained in the VM's evaluation stacks and slots.
    /// </summary>
    public uint MaxStackSize { get; init; } = 2 * 1024;

    /// <summary>
    /// The maximum size of an item in the VM.
    /// </summary>
    public uint MaxItemSize { get; init; } = ushort.MaxValue * 2;

    /// <summary>
    /// The largest comparable size.
    /// If a <see cref="Types.ByteString"/> or <see cref="Types.Struct"/> exceeds this size,
    /// comparison operations on it cannot be performed in the VM.
    /// </summary>
    public uint MaxComparableSize { get; init; } = 65536;

    /// <summary>
    /// The maximum number of frames in the invocation stack of the VM.
    /// </summary>
    public uint MaxInvocationStackSize { get; init; } = 1024;

    /// <summary>
    /// The maximum nesting depth of <see langword="try"/>-<see langword="catch"/>-<see langword="finally"/> blocks.
    /// </summary>
    public uint MaxTryNestingDepth { get; init; } = 16;

    /// <summary>
    /// Allow to catch the ExecutionEngine Exceptions
    /// </summary>
    public bool CatchEngineExceptions { get; init; } = true;

    /// <summary>
    /// Assert that the size of the item meets the limit.
    /// </summary>
    /// <param name="size">The size to be checked.</param>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void AssertMaxItemSize(int size)
    {
        if (size < 0 || size > MaxItemSize)
        {
            throw new InvalidOperationException($"MaxItemSize exceed: {size}/{MaxItemSize}");
        }
    }

    /// <summary>
    /// Assert that the number of bits shifted meets the limit.
    /// </summary>
    /// <param name="shift">The number of bits shifted.</param>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void AssertShift(int shift)
    {
        if (shift > MaxShift || shift < 0)
        {
            throw new InvalidOperationException($"Invalid shift value: {shift}/{MaxShift}");
        }
    }
}


================================================
FILE: src/Neo.VM/IReferenceCounter.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// IReferenceCounter.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;

namespace Neo.VM;

/// <summary>
/// Used for reference counting of objects in the VM.
/// </summary>
public interface IReferenceCounter
{
    /// <summary>
    /// Reference Counter version
    /// </summary>
    RCVersion Version { get; }

    /// <summary>
    /// Gets the count of references.
    /// </summary>
    int Count { get; }

    /// <summary>
    /// Adds an item to the zero-referred list.
    ///
    /// This method is used when an item has no remaining references.
    /// It adds the item to the zero-referred list to be checked for cleanup later.
    ///
    /// Use this method when you detect that an item has zero references and may need to be cleaned up.
    /// </summary>
    /// <param name="item">The item to add.</param>
    void AddZeroReferred(StackItem item);

    /// <summary>
    /// Adds a reference to a specified item with a parent compound type.
    ///
    /// This method is used when an item gains a new reference through a parent compound type.
    /// It increments the reference count and updates the tracking structures if necessary.
    ///
    /// Use this method when you need to add a reference from a compound type to a stack item.
    /// </summary>
    /// <param name="item">The item to add a reference to.</param>
    /// <param name="parent">The parent compound type.</param>
    void AddReference(StackItem item, CompoundType parent);

    /// <summary>
    /// Adds a stack reference to a specified item with a count.
    ///
    /// This method is used when an item gains a new stack reference, usually due to being pushed onto the evaluation stack.
    /// It increments the reference count and updates the tracking structures if necessary.
    ///
    /// Use this method when you need to add one or more stack references to a stack item.
    /// </summary>
    /// <param name="item">The item to add a stack reference to.</param>
    /// <param name="count">The number of references to add.</param>
    void AddStackReference(StackItem item, int count = 1);

    /// <summary>
    /// Removes a reference from a specified item with a parent compound type.
    ///
    /// This method is used when an item loses a reference from a parent compound type.
    /// It decrements the reference count and updates the tracking structures if necessary.
    ///
    /// Use this method when you need to remove a reference from a compound type to a stack item.
    /// </summary>
    /// <param name="item">The item to remove a reference from.</param>
    /// <param name="parent">The parent compound type.</param>
    void RemoveReference(StackItem item, CompoundType parent);

    /// <summary>
    /// Removes a stack reference from a specified item.
    ///
    /// This method is used when an item loses a stack reference, usually due to being popped off the evaluation stack.
    /// It decrements the reference count and updates the tracking structures if necessary.
    ///
    /// Use this method when you need to remove one or more stack references from a stack item.
    /// </summary>
    /// <param name="item">The item to remove a stack reference from.</param>
    void RemoveStackReference(StackItem item);

    /// <summary>
    /// Checks and processes items that have zero references.
    /// This method is used to check items in the zero-referred list and clean up those that are no longer needed.
    /// </summary>
    /// <returns>The current reference count.</returns>
    int CheckZeroReferred();

    /// <summary>
    /// Validate reference counters after execution and throw if limits are violated.
    /// </summary>
    void CheckPostExecution();
}


================================================
FILE: src/Neo.VM/Instruction.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// Instruction.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System;
using System.Buffers.Binary;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;

namespace Neo.VM;

/// <summary>
/// Represents instructions in the VM script.
/// </summary>
[DebuggerDisplay("OpCode={OpCode}")]
public class Instruction
{
    /// <summary>
    /// Represents the instruction with <see cref="OpCode.RET"/>.
    /// </summary>
    public static Instruction RET { get; } = new Instruction(OpCode.RET);

    /// <summary>
    /// The <see cref="VM.OpCode"/> of the instruction.
    /// </summary>
    public readonly OpCode OpCode;

    /// <summary>
    /// The operand of the instruction.
    /// </summary>
    public readonly ReadOnlyMemory<byte> Operand;

    private static readonly int[] OperandSizePrefixTable = new int[256];
    private static readonly int[] OperandSizeTable = new int[256];

    /// <summary>
    /// Gets the size of the instruction.
    /// </summary>
    public int Size
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            var prefixSize = OperandSizePrefixTable[(byte)OpCode];
            return prefixSize > 0
                ? 1 + prefixSize + Operand.Length
                : 1 + OperandSizeTable[(byte)OpCode];
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="short"/>.
    /// </summary>
    public short TokenI16
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return BinaryPrimitives.ReadInt16LittleEndian(Operand.Span);
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="int"/>.
    /// </summary>
    public int TokenI32
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return BinaryPrimitives.ReadInt32LittleEndian(Operand.Span);
        }
    }

    /// <summary>
    /// Gets the second operand as <see cref="int"/>.
    /// </summary>
    public int TokenI32_1
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return BinaryPrimitives.ReadInt32LittleEndian(Operand.Span[4..]);
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="sbyte"/>.
    /// </summary>
    public sbyte TokenI8
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return (sbyte)Operand.Span[0];
        }
    }

    /// <summary>
    /// Gets the second operand as <see cref="sbyte"/>.
    /// </summary>
    public sbyte TokenI8_1
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return (sbyte)Operand.Span[1];
        }
    }

    /// <summary>
    /// Gets the operand as <see cref="string"/>.
    /// </summary>
    public string TokenString
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return Encoding.ASCII.GetString(Operand.Span);
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="ushort"/>.
    /// </summary>
    public ushort TokenU16
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return BinaryPrimitives.ReadUInt16LittleEndian(Operand.Span);
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="uint"/>.
    /// </summary>
    public uint TokenU32
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return BinaryPrimitives.ReadUInt32LittleEndian(Operand.Span);
        }
    }

    /// <summary>
    /// Gets the first operand as <see cref="byte"/>.
    /// </summary>
    public byte TokenU8
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return Operand.Span[0];
        }
    }

    /// <summary>
    /// Gets the second operand as <see cref="byte"/>.
    /// </summary>
    public byte TokenU8_1
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            return Operand.Span[1];
        }
    }

    static Instruction()
    {
        foreach (FieldInfo field in typeof(OpCode).GetFields(BindingFlags.Public | BindingFlags.Static))
        {
            var attribute = field.GetCustomAttribute<OperandSizeAttribute>();
            if (attribute == null) continue;
            var index = (byte)(OpCode)field.GetValue(null)!;
            OperandSizePrefixTable[index] = attribute.SizePrefix;
            OperandSizeTable[index] = attribute.Size;
        }
    }

    private Instruction(OpCode opcode)
    {
        OpCode = opcode;
#if NET5_0_OR_GREATER
        if (!Enum.IsDefined(opcode)) throw new BadScriptException();
#else
        if (!Enum.IsDefined(typeof(OpCode), opcode)) throw new BadScriptException();
#endif
    }

    internal Instruction(ReadOnlyMemory<byte> script, int ip) : this((OpCode)script.Span[ip++])
    {
        var span = script.Span;
        var operandSizePrefix = OperandSizePrefixTable[(byte)OpCode];
        var operandSize = 0;
        switch (operandSizePrefix)
        {
            case 0:
                operandSize = OperandSizeTable[(byte)OpCode];
                break;
            case 1:
                if (ip >= span.Length)
                    throw new BadScriptException($"Instruction out of bounds. InstructionPointer: {ip}");
                operandSize = span[ip];
                break;
            case 2:
                if (ip + 1 >= span.Length)
                    throw new BadScriptException($"Instruction out of bounds. InstructionPointer: {ip}");
                operandSize = BinaryPrimitives.ReadUInt16LittleEndian(span[ip..]);
                break;
            case 4:
                if (ip + 3 >= span.Length)
                    throw new BadScriptException($"Instruction out of bounds. InstructionPointer: {ip}");
                operandSize = BinaryPrimitives.ReadInt32LittleEndian(span[ip..]);
                if (operandSize < 0)
                    throw new BadScriptException($"Instruction out of bounds. InstructionPointer: {ip}, operandSize: {operandSize}");
                break;
        }
        ip += operandSizePrefix;
        if (operandSize > 0)
        {
            if (ip + operandSize > script.Length)
                throw new BadScriptException($"Instrucion out of bounds. InstructionPointer: {ip}, operandSize: {operandSize}, length: {script.Length}");
            Operand = script.Slice(ip, operandSize);
        }
    }
}


================================================
FILE: src/Neo.VM/IsExternalInit.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// IsExternalInit.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

#if !NET5_0_OR_GREATER

#pragma warning disable IDE0130

using System.ComponentModel;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Reserved to be used by the compiler for tracking metadata.
/// This class should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}

#endif


================================================
FILE: src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// JumpTable.Bitwisee.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using System.Runtime.CompilerServices;

namespace Neo.VM;

partial class JumpTable
{
    /// <summary>
    /// Flips all of the bits of an integer.
    /// <see cref="OpCode.INVERT"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Invert(ExecutionEngine engine, Instruction instruction)
    {
        var x = engine.Pop().GetInteger();
        engine.Push(~x);
    }

    /// <summary>
    /// Computes the bitwise AND of two integers.
    /// <see cref="OpCode.AND"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void And(ExecutionEngine engine, Instruction instruction)
    {
        var x2 = engine.Pop().GetInteger();
        var x1 = engine.Pop().GetInteger();
        engine.Push(x1 & x2);
    }

    /// <summary>
    /// Computes the bitwise OR of two integers.
    /// <see cref="OpCode.OR"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Or(ExecutionEngine engine, Instruction instruction)
    {
        var x2 = engine.Pop().GetInteger();
        var x1 = engine.Pop().GetInteger();
        engine.Push(x1 | x2);
    }

    /// <summary>
    /// Computes the bitwise XOR (exclusive OR) of two integers.
    /// <see cref="OpCode.XOR"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void XOr(ExecutionEngine engine, Instruction instruction)
    {
        var x2 = engine.Pop().GetInteger();
        var x1 = engine.Pop().GetInteger();
        engine.Push(x1 ^ x2);
    }

    /// <summary>
    /// Determines whether two objects are equal according to the execution engine's comparison rules.
    /// <see cref="OpCode.EQUAL"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Equal(ExecutionEngine engine, Instruction instruction)
    {
        var x2 = engine.Pop();
        var x1 = engine.Pop();
        engine.Push(x1.Equals(x2, engine.Limits));
    }

    /// <summary>
    /// Determines whether two objects are not equal according to the execution engine's comparison rules.
    /// <see cref="OpCode.NOTEQUAL"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NotEqual(ExecutionEngine engine, Instruction instruction)
    {
        var x2 = engine.Pop();
        var x1 = engine.Pop();
        engine.Push(!x1.Equals(x2, engine.Limits));
    }
}


================================================
FILE: src/Neo.VM/JumpTable/JumpTable.Compound.cs
================================================
// Copyright (C) 2015-2026 The Neo Project.
//
// JumpTable.Compound.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
// accompanying file LICENSE in the main directory of the
// repository or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.VM.Types;
using System;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using Array = System.Array;
using Buffer = Neo.VM.Types.Buffer;
using VMArray = Neo.VM.Types.Array;

namespace Neo.VM;

partial class JumpTable
{
    /// <summary>
    /// Packs a map from the evaluation stack.
    /// <see cref="OpCode.PACKMAP"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2n+1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void PackMap(ExecutionEngine engine, Instruction instruction)
    {
        var size = (int)engine.Pop().GetInteger();
        if (size < 0 || size * 2 > engine.CurrentContext!.EvaluationStack.Count)
            throw new InvalidOperationException($"The map size is out of valid range, 2*{size}/[0, {engine.CurrentContext!.EvaluationStack.Count}].");
        Map map = new(engine.ReferenceCounter);
        for (var i = 0; i < size; i++)
        {
            var key = engine.Pop<PrimitiveType>();
            var value = engine.Pop();
            map[key] = value;
        }
        engine.Push(map);
    }

    /// <summary>
    /// Packs a struct from the evaluation stack.
    /// <see cref="OpCode.PACKSTRUCT"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop n+1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void PackStruct(ExecutionEngine engine, Instruction instruction)
    {
        var size = (int)engine.Pop().GetInteger();
        if (size < 0 || size > engine.CurrentContext!.EvaluationStack.Count)
            throw new InvalidOperationException($"The struct size is out of valid range, {size}/[0, {engine.CurrentContext!.EvaluationStack.Count}].");
        Struct @struct = new(engine.ReferenceCounter);
        for (var i = 0; i < size; i++)
        {
            var item = engine.Pop();
            @struct.Add(item);
        }
        engine.Push(@struct);
    }

    /// <summary>
    /// Packs an array from the evaluation stack.
    /// <see cref="OpCode.PACK"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop n+1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Pack(ExecutionEngine engine, Instruction instruction)
    {
        var size = (int)engine.Pop().GetInteger();
        if (size < 0 || size > engine.CurrentContext!.EvaluationStack.Count)
            throw new InvalidOperationException($"The array size is out of valid range, {size}/[0, {engine.CurrentContext!.EvaluationStack.Count}].");
        VMArray array = new(engine.ReferenceCounter);
        for (var i = 0; i < size; i++)
        {
            var item = engine.Pop();
            array.Add(item);
        }
        engine.Push(array);
    }

    /// <summary>
    /// Unpacks a compound type from the evaluation stack.
    /// <see cref="OpCode.UNPACK"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 2n+1 or n+1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Unpack(ExecutionEngine engine, Instruction instruction)
    {
        var compound = engine.Pop<CompoundType>();
        switch (compound)
        {
            case Map map:
                foreach (var (key, value) in map.Reverse())
                {
                    engine.Push(value);
                    engine.Push(key);
                }
                break;
            case VMArray array:
                for (var i = array.Count - 1; i >= 0; i--)
                {
                    engine.Push(array[i]);
                }
                break;
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {compound.Type}");
        }
        engine.Push(compound.Count);
    }

    /// <summary>
    /// Creates a new empty array with zero elements on the evaluation stack.
    /// <see cref="OpCode.NEWARRAY0"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>
    /// Pop 0, Push 1
    /// TODO: Change to NewNullArray method or add it?
    /// </remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewArray0(ExecutionEngine engine, Instruction instruction)
    {
        engine.Push(new VMArray(engine.ReferenceCounter));
    }

    /// <summary>
    /// Creates a new array with a specified number of elements on the evaluation stack.
    /// <see cref="OpCode.NEWARRAY"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewArray(ExecutionEngine engine, Instruction instruction)
    {
        var n = (int)engine.Pop().GetInteger();
        if (n < 0 || n > engine.Limits.MaxStackSize)
            throw new InvalidOperationException($"The array size is out of valid range, {n}/[0, {engine.Limits.MaxStackSize}].");
        var nullArray = new StackItem[n];
        Array.Fill(nullArray, StackItem.Null);
        engine.Push(new VMArray(engine.ReferenceCounter, nullArray));
    }

    /// <summary>
    /// Creates a new array with a specified number of elements and a specified type on the evaluation stack.
    /// <see cref="OpCode.NEWARRAY_T"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewArray_T(ExecutionEngine engine, Instruction instruction)
    {
        var n = (int)engine.Pop().GetInteger();
        if (n < 0 || n > engine.Limits.MaxStackSize)
            throw new InvalidOperationException($"The array size is out of valid range, {n}/[0, {engine.Limits.MaxStackSize}].");

        var type = (StackItemType)instruction.TokenU8;
#if NET5_0_OR_GREATER
        if (!Enum.IsDefined(type))
#else
        if (!Enum.IsDefined(typeof(StackItemType), type))
#endif
            throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {instruction.TokenU8}");

        var item = instruction.TokenU8 switch
        {
            (byte)StackItemType.Boolean => StackItem.False,
            (byte)StackItemType.Integer => Integer.Zero,
            (byte)StackItemType.ByteString => ByteString.Empty,
            _ => StackItem.Null
        };
        var itemArray = new StackItem[n];
        Array.Fill(itemArray, item);
        engine.Push(new VMArray(engine.ReferenceCounter, itemArray));
    }

    /// <summary>
    /// Creates a new empty struct with zero elements on the evaluation stack.
    /// <see cref="OpCode.NEWSTRUCT0"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 0, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewStruct0(ExecutionEngine engine, Instruction instruction)
    {
        engine.Push(new Struct(engine.ReferenceCounter));
    }

    /// <summary>
    /// Creates a new struct with a specified number of elements on the evaluation stack.
    /// <see cref="OpCode.NEWSTRUCT"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewStruct(ExecutionEngine engine, Instruction instruction)
    {
        var n = (int)engine.Pop().GetInteger();
        if (n < 0 || n > engine.Limits.MaxStackSize)
            throw new InvalidOperationException($"The struct size is out of valid range, {n}/[0, {engine.Limits.MaxStackSize}].");

        var nullArray = new StackItem[n];
        Array.Fill(nullArray, StackItem.Null);
        engine.Push(new Struct(engine.ReferenceCounter, nullArray));
    }

    /// <summary>
    /// Creates a new empty map on the evaluation stack.
    /// <see cref="OpCode.NEWMAP"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 0, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void NewMap(ExecutionEngine engine, Instruction instruction)
    {
        engine.Push(new Map(engine.ReferenceCounter));
    }

    /// <summary>
    /// Gets the size of the top item on the evaluation stack and pushes it onto the stack.
    /// <see cref="OpCode.SIZE"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [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)
        {
            case CompoundType compound:
                engine.Push(compound.Count);
                break;
            case PrimitiveType primitive:
                engine.Push(primitive.Size);
                break;
            case Buffer buffer:
                engine.Push(buffer.Size);
                break;
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Checks whether the top item on the evaluation stack has the specified key.
    /// <see cref="OpCode.HASKEY"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void HasKey(ExecutionEngine engine, Instruction instruction)
    {
        var key = engine.Pop<PrimitiveType>();
        var x = engine.Pop();
        // Check the type of the top item and perform the corresponding action.
        switch (x)
        {
            // For arrays, check if the index is within bounds and push the result onto the stack.
            case VMArray array:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= engine.Limits.MaxItemSize)
                        throw new InvalidOperationException($"The index {index} is invalid for OpCode {instruction.OpCode}.");
                    engine.Push(index < array.Count);
                    break;
                }
            // For maps, check if the key exists and push the result onto the stack.
            case Map map:
                {
                    engine.Push(map.ContainsKey(key));
                    break;
                }
            // For buffers, check if the index is within bounds and push the result onto the stack.
            case Buffer buffer:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= engine.Limits.MaxItemSize)
                        throw new InvalidOperationException($"The index {index} is invalid for OpCode {instruction.OpCode}.");
                    engine.Push(index < buffer.Size);
                    break;
                }
            // For byte strings, check if the index is within bounds and push the result onto the stack.
            case ByteString array:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= engine.Limits.MaxItemSize)
                        throw new InvalidOperationException($"The index {index} is invalid for OpCode {instruction.OpCode}.");
                    engine.Push(index < array.Size);
                    break;
                }
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Retrieves the keys of a map and pushes them onto the evaluation stack as an array.
    /// <see cref="OpCode.KEYS"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Keys(ExecutionEngine engine, Instruction instruction)
    {
        var map = engine.Pop<Map>();
        engine.Push(new VMArray(engine.ReferenceCounter, map.Keys));
    }

    /// <summary>
    /// Retrieves the values of a compound type and pushes them onto the evaluation stack as an array.
    /// <see cref="OpCode.VALUES"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Values(ExecutionEngine engine, Instruction instruction)
    {
        var x = engine.Pop();
        var values = x switch
        {
            VMArray array => array,
            Map map => map.Values,
            _ => throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}"),
        };
        VMArray newArray = new(engine.ReferenceCounter);
        foreach (var item in values)
            if (item is Struct s)
                newArray.Add(s.Clone(engine.Limits));
            else
                newArray.Add(item);
        engine.Push(newArray);
    }

    /// <summary>
    /// Retrieves the item from an array, map, buffer, or byte string based on the specified key,
    /// and pushes it onto the evaluation stack.
    /// <see cref="OpCode.PICKITEM"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void PickItem(ExecutionEngine engine, Instruction instruction)
    {
        var key = engine.Pop<PrimitiveType>();
        var x = engine.Pop();
        switch (x)
        {
            case VMArray array:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= array.Count)
                        throw new CatchableException($"The index of {nameof(VMArray)} is out of range, {index}/[0, {array.Count}).");
                    engine.Push(array[(int)index]);
                    break;
                }
            case Map map:
                {
                    if (!map.TryGetValue(key, out var value))
                        throw new CatchableException($"Key {key} not found in {nameof(Map)}.");
                    engine.Push(value);
                    break;
                }
            case PrimitiveType primitive:
                {
                    var byteArray = primitive.GetSpan();
                    var index = key.GetInteger();
                    if (index < 0 || index >= byteArray.Length)
                        throw new CatchableException($"The index of {nameof(PrimitiveType)} is out of range, {index}/[0, {byteArray.Length}).");
                    engine.Push((BigInteger)byteArray[(int)index]);
                    break;
                }
            case Buffer buffer:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= buffer.Size)
                        throw new CatchableException($"The index of {nameof(Buffer)} is out of range, {index}/[0, {buffer.Size}).");
                    engine.Push((BigInteger)buffer.InnerBuffer.Span[(int)index]);
                    break;
                }
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Appends an item to the end of the specified array.
    /// <see cref="OpCode.APPEND"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 0</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Append(ExecutionEngine engine, Instruction instruction)
    {
        var newItem = engine.Pop();
        var array = engine.Pop<VMArray>();
        if (newItem is Struct s) newItem = s.Clone(engine.Limits);
        array.Add(newItem);
        if (engine.ReferenceCounter.Version == RCVersion.V2 && array.IsStackReferenced)
            engine.ReferenceCounter.AddStackReference(newItem);
    }

    /// <summary>
    /// A value v, index n (or key) and an array (or map) are taken from main stack. Attribution array[n]=v (or map[n]=v) is performed.
    /// <see cref="OpCode.SETITEM"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 3, Push 0</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void SetItem(ExecutionEngine engine, Instruction instruction)
    {
        var value = engine.Pop();
        if (value is Struct s) value = s.Clone(engine.Limits);
        var key = engine.Pop<PrimitiveType>();
        var x = engine.Pop();
        var isRC2 = engine.ReferenceCounter.Version == RCVersion.V2;
        switch (x)
        {
            case VMArray array:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= array.Count)
                        throw new CatchableException($"The index of {nameof(VMArray)} is out of range, {index}/[0, {array.Count}).");
                    var i = (int)index;
                    if (isRC2 && array.IsStackReferenced)
                        engine.ReferenceCounter.RemoveStackReference(array[i]);
                    array[i] = value;
                    if (isRC2 && array.IsStackReferenced)
                        engine.ReferenceCounter.AddStackReference(value);
                    break;
                }
            case Map map:
                {
                    if (isRC2 && map.IsStackReferenced)
                    {
                        if (!map.TryGetValue(key, out var value1))
                        {
                            engine.ReferenceCounter.AddStackReference(key);
                        }
                        else
                        {
                            engine.ReferenceCounter.RemoveStackReference(value1);
                        }
                        engine.ReferenceCounter.AddStackReference(value);
                    }
                    map[key] = value;
                    break;
                }
            case Buffer buffer:
                {
                    var index = key.GetInteger();
                    if (index < 0 || index >= buffer.Size)
                        throw new CatchableException($"The index of {nameof(Buffer)} is out of range, {index}/[0, {buffer.Size}).");
                    if (value is not PrimitiveType p)
                        throw new InvalidOperationException($"Only primitive type values can be set in {nameof(Buffer)} in {instruction.OpCode}.");
                    var b = p.GetInteger();
                    if (b < sbyte.MinValue || b > byte.MaxValue)
                        throw new InvalidOperationException($"Overflow in {instruction.OpCode}, {b} is not a byte type.");
                    buffer.InnerBuffer.Span[(int)index] = (byte)b;
                    break;
                }
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Reverses the order of items in the specified array or buffer.
    /// <see cref="OpCode.REVERSEITEMS"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 0</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void ReverseItems(ExecutionEngine engine, Instruction instruction)
    {
        var x = engine.Pop();
        switch (x)
        {
            case VMArray array:
                array.Reverse();
                break;
            case Buffer buffer:
                buffer.InnerBuffer.Span.Reverse();
                break;
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Removes the item at the specified index from the array or map.
    /// <see cref="OpCode.REMOVE"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 2, Push 0</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void Remove(ExecutionEngine engine, Instruction instruction)
    {
        var key = engine.Pop<PrimitiveType>();
        var x = engine.Pop();
        switch (x)
        {
            case VMArray array:
                var index = key.GetInteger();
                if (index < 0 || index >= array.Count)
                    throw new InvalidOperationException($"The index of {nameof(VMArray)} is out of range, {index}/[0, {array.Count}).");

                var i = (int)index;
                var item = array[i];
                array.RemoveAt(i);

                if (engine.ReferenceCounter.Version == RCVersion.V2 && array.IsStackReferenced)
                    engine.ReferenceCounter.RemoveStackReference(item);
                break;
            case Map map:
                var old = map.Remove(key);
                if (old is not null && engine.ReferenceCounter.Version == RCVersion.V2 && map.IsStackReferenced)
                {
                    engine.ReferenceCounter.RemoveStackReference(key);
                    engine.ReferenceCounter.RemoveStackReference(old);
                }
                break;
            default:
                throw new InvalidOperationException($"Invalid type for {instruction.OpCode}: {x.Type}");
        }
    }

    /// <summary>
    /// Clears all items from the compound type.
    /// <see cref="OpCode.CLEARITEMS"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 0</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void ClearItems(ExecutionEngine engine, Instruction instruction)
    {
        var x = engine.Pop<CompoundType>();
        if (engine.ReferenceCounter.Version == RCVersion.V2 && x.IsStackReferenced)
        {
            foreach (var xSubItem in x.SubItems)
            {
                engine.ReferenceCounter.RemoveStackReference(xSubItem);
            }
        }
        x.Clear();
    }

    /// <summary>
    /// Removes and returns the item at the top of the specified array.
    /// <see cref="OpCode.POPITEM"/>
    /// </summary>
    /// <param name="engine">The execution engine.</param>
    /// <param name="instruction">The instruction being executed.</param>
    /// <remarks>Pop 1, Push 1</remarks>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public virtual void PopItem(ExecutionEngine engine, Instruction instruction)
    {
        var x = engine.Pop<VMArray>();
        var index = x.Count - 1;
        var item = x[index];
        engine.Push(item);
        x.RemoveAt(index);
        if (engine.ReferenceCounter.Version == RCVersion.V2 && x.IsStackReferenced)
            engine.ReferenceCounter.RemoveStackReference(item);
    }
}


====
Download .txt
gitextract_7tmmrk3b/

├── .editorconfig
├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── LICENSE
├── README.md
├── benchmarks/
│   └── Neo.VM.Benchmarks/
│       ├── Benchmarks.POC.cs
│       ├── Benchmarks_VMHotPaths.cs
│       ├── Builders/
│       │   ├── Helper.cs
│       │   ├── Instruction.cs
│       │   ├── InstructionBuilder.cs
│       │   └── JumpTarget.cs
│       ├── Neo.VM.Benchmarks.csproj
│       ├── OpCodes/
│       │   ├── Arrays/
│       │   │   └── OpCode.ReverseN.cs
│       │   ├── Benchmark.Opcode.cs
│       │   ├── BenchmarkEngine.cs
│       │   ├── BenchmarkMode.cs
│       │   ├── Benchmarks_StackOps.cs
│       │   └── OpCodeBase.cs
│       ├── Program.cs
│       ├── TestArray.cs
│       ├── TestStruct.cs
│       └── VMTypes/
│           ├── Benchmarks_Convert.cs
│           └── Benchmarks_DeepCopy.cs
├── neo-vm.sln
├── src/
│   └── Neo.VM/
│       ├── BadScriptException.cs
│       ├── CatchableException.cs
│       ├── Collections/
│       │   └── OrderedDictionary.cs
│       ├── Debugger.cs
│       ├── EvaluationStack.cs
│       ├── ExceptionHandlingContext.cs
│       ├── ExceptionHandlingState.cs
│       ├── ExecutionContext.SharedStates.cs
│       ├── ExecutionContext.cs
│       ├── ExecutionEngine.cs
│       ├── ExecutionEngineLimits.cs
│       ├── IReferenceCounter.cs
│       ├── Instruction.cs
│       ├── IsExternalInit.cs
│       ├── JumpTable/
│       │   ├── JumpTable.Bitwisee.cs
│       │   ├── JumpTable.Compound.cs
│       │   ├── JumpTable.Control.cs
│       │   ├── JumpTable.Numeric.cs
│       │   ├── JumpTable.Push.cs
│       │   ├── JumpTable.Slot.cs
│       │   ├── JumpTable.Splice.cs
│       │   ├── JumpTable.Stack.cs
│       │   ├── JumpTable.Types.cs
│       │   └── JumpTable.cs
│       ├── Neo.VM.csproj
│       ├── OpCode.cs
│       ├── OperandSizeAttribute.cs
│       ├── RCVersion.cs
│       ├── ReferenceCounter.cs
│       ├── ReferenceCounterV2.cs
│       ├── ReferenceEqualityComparer.cs
│       ├── Script.cs
│       ├── ScriptBuilder.cs
│       ├── Slot.cs
│       ├── StronglyConnectedComponents/
│       │   └── Tarjan.cs
│       ├── Types/
│       │   ├── Array.cs
│       │   ├── Boolean.cs
│       │   ├── Buffer.cs
│       │   ├── ByteString.cs
│       │   ├── CompoundType.cs
│       │   ├── Integer.cs
│       │   ├── InteropInterface.cs
│       │   ├── Map.cs
│       │   ├── Null.cs
│       │   ├── Pointer.cs
│       │   ├── PrimitiveType.cs
│       │   ├── StackItem.Vertex.cs
│       │   ├── StackItem.cs
│       │   ├── StackItemType.cs
│       │   └── Struct.cs
│       ├── Unsafe.cs
│       ├── Utility.cs
│       ├── VMState.cs
│       └── VMUnhandledException.cs
└── tests/
    └── Neo.VM.Tests/
        ├── Converters/
        │   ├── ScriptConverter.cs
        │   └── UppercaseEnum.cs
        ├── Extensions/
        │   ├── JsonExtensions.cs
        │   └── StringExtensions.cs
        ├── Helpers/
        │   └── RandomHelper.cs
        ├── Neo.VM.Tests.csproj
        ├── Properties/
        │   └── AssemblyInfo.cs
        ├── Tests/
        │   ├── OpCodes/
        │   │   ├── Arithmetic/
        │   │   │   ├── GE.json
        │   │   │   ├── GT.json
        │   │   │   ├── LE.json
        │   │   │   ├── LT.json
        │   │   │   ├── MODMUL.json
        │   │   │   ├── MODPOW.json
        │   │   │   ├── NOT.json
        │   │   │   ├── NUMEQUAL.json
        │   │   │   ├── NUMNOTEQUAL.json
        │   │   │   ├── POW.json
        │   │   │   ├── SHL.json
        │   │   │   ├── SHR.json
        │   │   │   ├── SIGN.json
        │   │   │   └── SQRT.json
        │   │   ├── Arrays/
        │   │   │   ├── APPEND.json
        │   │   │   ├── CLEARITEMS.json
        │   │   │   ├── HASKEY.json
        │   │   │   ├── KEYS.json
        │   │   │   ├── NEWARRAY.json
        │   │   │   ├── NEWARRAY0.json
        │   │   │   ├── NEWARRAY_T.json
        │   │   │   ├── NEWMAP.json
        │   │   │   ├── NEWSTRUCT.json
        │   │   │   ├── NEWSTRUCT0.json
        │   │   │   ├── PACK.json
        │   │   │   ├── PACKMAP.json
        │   │   │   ├── PACKSTRUCT.json
        │   │   │   ├── PICKITEM.json
        │   │   │   ├── POPITEM.json
        │   │   │   ├── REMOVE.json
        │   │   │   ├── REVERSEITEMS.json
        │   │   │   ├── SETITEM.json
        │   │   │   ├── SIZE.json
        │   │   │   ├── UNPACK.json
        │   │   │   └── VALUES.json
        │   │   ├── BitwiseLogic/
        │   │   │   ├── AND.json
        │   │   │   ├── EQUAL.json
        │   │   │   ├── INVERT.json
        │   │   │   ├── NOTEQUAL.json
        │   │   │   ├── OR.json
        │   │   │   └── XOR.json
        │   │   ├── Control/
        │   │   │   ├── ABORT.json
        │   │   │   ├── ABORTMSG.json
        │   │   │   ├── ASSERT.json
        │   │   │   ├── ASSERTMSG.json
        │   │   │   ├── CALL.json
        │   │   │   ├── CALLA.json
        │   │   │   ├── CALL_L.json
        │   │   │   ├── JMP.json
        │   │   │   ├── JMPEQ.json
        │   │   │   ├── JMPEQ_L.json
        │   │   │   ├── JMPGE.json
        │   │   │   ├── JMPGE_L.json
        │   │   │   ├── JMPGT.json
        │   │   │   ├── JMPGT_L.json
        │   │   │   ├── JMPIF.json
        │   │   │   ├── JMPIFNOT.json
        │   │   │   ├── JMPIFNOT_L.json
        │   │   │   ├── JMPIF_L.json
        │   │   │   ├── JMPLE.json
        │   │   │   ├── JMPLE_L.json
        │   │   │   ├── JMPLT.json
        │   │   │   ├── JMPLT_L.json
        │   │   │   ├── JMPNE.json
        │   │   │   ├── JMPNE_L.json
        │   │   │   ├── JMP_L.json
        │   │   │   ├── NOP.json
        │   │   │   ├── RET.json
        │   │   │   ├── SYSCALL.json
        │   │   │   ├── THROW.json
        │   │   │   ├── TRY_CATCH.json
        │   │   │   ├── TRY_CATCH_FINALLY.json
        │   │   │   ├── TRY_CATCH_FINALLY10.json
        │   │   │   ├── TRY_CATCH_FINALLY2.json
        │   │   │   ├── TRY_CATCH_FINALLY3.json
        │   │   │   ├── TRY_CATCH_FINALLY4.json
        │   │   │   ├── TRY_CATCH_FINALLY5.json
        │   │   │   ├── TRY_CATCH_FINALLY6.json
        │   │   │   ├── TRY_CATCH_FINALLY7.json
        │   │   │   ├── TRY_CATCH_FINALLY8.json
        │   │   │   ├── TRY_CATCH_FINALLY9.json
        │   │   │   └── TRY_FINALLY.json
        │   │   ├── Push/
        │   │   │   ├── PUSHA.json
        │   │   │   ├── PUSHDATA1.json
        │   │   │   ├── PUSHDATA2.json
        │   │   │   ├── PUSHDATA4.json
        │   │   │   ├── PUSHINT8_to_PUSHINT256.json
        │   │   │   ├── PUSHM1_to_PUSH16.json
        │   │   │   └── PUSHNULL.json
        │   │   ├── Slot/
        │   │   │   ├── INITSLOT.json
        │   │   │   ├── INITSSLOT.json
        │   │   │   ├── LDARG.json
        │   │   │   ├── LDARG0.json
        │   │   │   ├── LDARG1.json
        │   │   │   ├── LDARG2.json
        │   │   │   ├── LDARG3.json
        │   │   │   ├── LDARG4.json
        │   │   │   ├── LDARG5.json
        │   │   │   ├── LDARG6.json
        │   │   │   ├── LDLOC.json
        │   │   │   ├── LDLOC0.json
        │   │   │   ├── LDLOC1.json
        │   │   │   ├── LDLOC2.json
        │   │   │   ├── LDLOC3.json
        │   │   │   ├── LDLOC4.json
        │   │   │   ├── LDLOC5.json
        │   │   │   ├── LDLOC6.json
        │   │   │   ├── LDSFLD.json
        │   │   │   ├── LDSFLD0.json
        │   │   │   ├── LDSFLD1.json
        │   │   │   ├── LDSFLD2.json
        │   │   │   ├── LDSFLD3.json
        │   │   │   ├── LDSFLD4.json
        │   │   │   ├── LDSFLD5.json
        │   │   │   ├── LDSFLD6.json
        │   │   │   ├── STARG.json
        │   │   │   ├── STARG0.json
        │   │   │   ├── STARG1.json
        │   │   │   ├── STARG2.json
        │   │   │   ├── STARG3.json
        │   │   │   ├── STARG4.json
        │   │   │   ├── STARG5.json
        │   │   │   ├── STARG6.json
        │   │   │   ├── STLOC.json
        │   │   │   ├── STSFLD.json
        │   │   │   ├── STSFLD0.json
        │   │   │   ├── STSFLD1.json
        │   │   │   ├── STSFLD2.json
        │   │   │   ├── STSFLD3.json
        │   │   │   ├── STSFLD4.json
        │   │   │   ├── STSFLD5.json
        │   │   │   └── STSFLD6.json
        │   │   ├── Splice/
        │   │   │   ├── CAT.json
        │   │   │   ├── LEFT.json
        │   │   │   ├── MEMCPY.json
        │   │   │   ├── NEWBUFFER.json
        │   │   │   ├── RIGHT.json
        │   │   │   └── SUBSTR.json
        │   │   ├── Stack/
        │   │   │   ├── CLEAR.json
        │   │   │   ├── DEPTH.json
        │   │   │   ├── DROP.json
        │   │   │   ├── NIP.json
        │   │   │   ├── OVER.json
        │   │   │   ├── PICK.json
        │   │   │   ├── REVERSE3.json
        │   │   │   ├── REVERSE4.json
        │   │   │   ├── REVERSEN.json
        │   │   │   ├── ROLL.json
        │   │   │   ├── ROT.json
        │   │   │   ├── SWAP.json
        │   │   │   ├── TUCK.json
        │   │   │   └── XDROP.json
        │   │   └── Types/
        │   │       ├── CONVERT.json
        │   │       ├── ISNULL.json
        │   │       └── ISTYPE.json
        │   └── Others/
        │       ├── Debugger.json
        │       ├── Init.json
        │       ├── InvocationLimits.json
        │       ├── OtherCases.json
        │       ├── ScriptLogic.json
        │       ├── StackItemLimits.json
        │       └── StackLimits.json
        ├── Types/
        │   ├── TestEngine.cs
        │   ├── VMUT.cs
        │   ├── VMUTActionType.cs
        │   ├── VMUTEntry.cs
        │   ├── VMUTExecutionContextState.cs
        │   ├── VMUTExecutionEngineState.cs
        │   ├── VMUTStackItem.cs
        │   ├── VMUTStackItemType.cs
        │   └── VMUTStep.cs
        ├── UT_Debugger.cs
        ├── UT_EvaluationStack.cs
        ├── UT_ExecutionContext.cs
        ├── UT_ReferenceCounter.cs
        ├── UT_ReferenceCounterComprehensive.cs
        ├── UT_Script.cs
        ├── UT_ScriptBuilder.cs
        ├── UT_Slot.cs
        ├── UT_StackItem.cs
        ├── UT_Struct.cs
        ├── UT_Unsafe.cs
        ├── UT_Utility.cs
        ├── UT_VMJson.cs
        └── VMJsonTestBase.cs
Download .txt
SYMBOL INDEX (848 symbols across 97 files)

FILE: benchmarks/Neo.VM.Benchmarks/Benchmarks.POC.cs
  class Benchmarks_PoCs (line 17) | public class Benchmarks_PoCs
    method NeoIssue2528 (line 19) | [Benchmark]
    method NeoVMIssue418 (line 52) | [Benchmark]
    method NeoIssue2723 (line 87) | [Benchmark]
    method PoC_NewBuffer (line 105) | [Benchmark]
    method PoC_Cat (line 124) | [Benchmark]
    method PoC_Left (line 148) | [Benchmark]
    method PoC_Right (line 170) | [Benchmark]
    method PoC_ReverseN (line 192) | [Benchmark]
    method PoC_Substr (line 218) | [Benchmark]
    method PoC_NewArray (line 241) | [Benchmark]
    method PoC_NewStruct (line 259) | [Benchmark]
    method PoC_Roll (line 277) | [Benchmark]
    method PoC_XDrop (line 303) | [Benchmark]
    method PoC_MemCpy (line 330) | [Benchmark]
    method PoC_Unpack (line 357) | [Benchmark]
    method PoC_GetScriptContainer (line 378) | [Benchmark]
    method Run (line 387) | private static void Run(string poc)

FILE: benchmarks/Neo.VM.Benchmarks/Benchmarks_VMHotPaths.cs
  class Benchmarks_ArrayBuild (line 21) | public class Benchmarks_ArrayBuild
    method BuildWithListFill (line 28) | [Benchmark]
    method BuildWithArrayFill (line 38) | [Benchmark]
  class Benchmarks_MapSubItems (line 48) | public class Benchmarks_MapSubItems
    method Setup (line 55) | [GlobalSetup]
    method EnumerateYield (line 63) | [Benchmark]
    method EnumerateConcat (line 72) | [Benchmark]
    method SubItemsYield (line 81) | private static IEnumerable<StackItem> SubItemsYield(Map map)
    method SubItemsConcat (line 89) | private static IEnumerable<StackItem> SubItemsConcat(Map map) => map.K...
  class Benchmarks_ListCopy (line 92) | public class Benchmarks_ListCopy
    method Setup (line 102) | [GlobalSetup]
    method AddRangeSkip (line 111) | [Benchmark]
    method ManualLoop (line 119) | [Benchmark]
  class Benchmarks_InstructionAdvance (line 130) | public class Benchmarks_InstructionAdvance
    method Setup (line 138) | [GlobalSetup]
    method IterationSetup (line 147) | [IterationSetup]
    method AdvanceWithMoveNext (line 154) | [Benchmark]
    method AdvanceWithPointer (line 166) | [Benchmark]
    method WarmInstructionCache (line 180) | private void WarmInstructionCache()

FILE: benchmarks/Neo.VM.Benchmarks/Builders/Helper.cs
  class Helper (line 16) | public static class Helper
    method RebuildOffsets (line 18) | public static void RebuildOffsets(this IReadOnlyList<Instruction> inst...
    method RebuildOperands (line 28) | public static void RebuildOperands(this IReadOnlyList<Instruction> ins...

FILE: benchmarks/Neo.VM.Benchmarks/Builders/Instruction.cs
  class Instruction (line 18) | [DebuggerDisplay("{_opCode}")]
    method Instruction (line 41) | static Instruction()
    method ToArray (line 53) | public byte[] ToArray()

FILE: benchmarks/Neo.VM.Benchmarks/Builders/InstructionBuilder.cs
  class InstructionBuilder (line 17) | internal class InstructionBuilder
    method InstructionBuilder (line 21) | public InstructionBuilder() { }
    method AddInstruction (line 23) | internal Instruction AddInstruction(Instruction instruction)
    method AddInstruction (line 29) | internal Instruction AddInstruction(OpCode opcode)
    method Jump (line 37) | internal Instruction Jump(OpCode opcode, JumpTarget target)
    method Push (line 46) | internal void Push(bool value)
    method Ret (line 51) | internal Instruction Ret() => AddInstruction(OpCode.RET);
    method Push (line 53) | internal Instruction Push(BigInteger number)
    method Push (line 97) | internal Instruction Push(string s)
    method Push (line 102) | internal Instruction Push(byte[] data)
    method Push (line 134) | internal void Push(object? obj)
    method ReverseStackItems (line 189) | internal void ReverseStackItems(int count)
    method PadRight (line 209) | internal static ReadOnlySpan<byte> PadRight(Span<byte> buffer, int dat...
    method IsType (line 217) | internal Instruction IsType(Types.StackItemType type)
    method ChangeType (line 226) | internal Instruction ChangeType(Types.StackItemType type)
    method ToArray (line 235) | internal byte[] ToArray()

FILE: benchmarks/Neo.VM.Benchmarks/Builders/JumpTarget.cs
  class JumpTarget (line 14) | public class JumpTarget

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Arrays/OpCode.ReverseN.cs
  class OpCode_ReverseN (line 16) | public class OpCode_ReverseN : OpCodeBase
    method CreateScript (line 18) | protected override byte[] CreateScript(BenchmarkMode benchmarkMode)

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmark.Opcode.cs
  class Benchmark_Opcode (line 14) | public class Benchmark_Opcode
    method RunScript (line 218) | internal static void RunScript(byte[] script)
    method RunScriptUntil (line 223) | internal static BenchmarkEngine RunScriptUntil(byte[] script, OpCode o...
    method LoadScript (line 228) | internal static BenchmarkEngine LoadScript(byte[] script)

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkEngine.cs
  class BenchmarkEngine (line 21) | public class BenchmarkEngine : ExecutionEngine
    method BenchmarkEngine (line 27) | public BenchmarkEngine() : base(ComposeJumpTable()) { }
    method AddBreakPoint (line 34) | public void AddBreakPoint(Script script, uint position)
    method ExecuteUntil (line 48) | public BenchmarkEngine ExecuteUntil(OpCode opCode)
    method ExecuteBenchmark (line 68) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteOneGASBenchmark (line 87) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteTwentyGASBenchmark (line 112) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteOpCodesBenchmark (line 137) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method OnFault (line 162) | protected override void OnFault(Exception ex)
    method UpdateOpcodeStats (line 168) | private void UpdateOpcodeStats(OpCode opcode, TimeSpan elapsed)
    method PrintOpcodeStats (line 181) | private void PrintOpcodeStats()
    method ComposeJumpTable (line 193) | private static JumpTable ComposeJumpTable()
    method OnSysCall (line 200) | private static void OnSysCall(ExecutionEngine engine, Instruction inst...

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkMode.cs
  type BenchmarkMode (line 14) | public enum BenchmarkMode

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmarks_StackOps.cs
  class Benchmarks_StackOps (line 16) | [MemoryDiagnoser]
    method GlobalSetup (line 43) | [GlobalSetup]
    method BuildScript (line 93) | private static byte[] BuildScript(Action<ScriptBuilder> build)
    method SetupEngine (line 100) | private void SetupEngine(byte[] script)
    method Setup_SWAP_Shallow (line 108) | [IterationSetup(Target = nameof(Bench_SWAP_Shallow))]
    method Bench_SWAP_Shallow (line 111) | [Benchmark(Description = SwapShallowDescription)]
    method Setup_SWAP_Deep (line 117) | [IterationSetup(Target = nameof(Bench_SWAP_Deep))]
    method Bench_SWAP_Deep (line 120) | [Benchmark(Description = SwapDeepDescription)]
    method Setup_SWAP_Multiple (line 126) | [IterationSetup(Target = nameof(Bench_SWAP_Multiple))]
    method Bench_SWAP_Multiple (line 129) | [Benchmark(Description = SwapMultipleDescription)]
    method Setup_ROT_Shallow (line 139) | [IterationSetup(Target = nameof(Bench_ROT_Shallow))]
    method Bench_ROT_Shallow (line 142) | [Benchmark(Description = RotShallowDescription)]
    method Setup_ROT_Deep (line 148) | [IterationSetup(Target = nameof(Bench_ROT_Deep))]
    method Bench_ROT_Deep (line 151) | [Benchmark(Description = RotDeepDescription)]
    method Setup_ROT_Multiple (line 157) | [IterationSetup(Target = nameof(Bench_ROT_Multiple))]
    method Bench_ROT_Multiple (line 160) | [Benchmark(Description = RotMultipleDescription)]

FILE: benchmarks/Neo.VM.Benchmarks/OpCodes/OpCodeBase.cs
  class OpCodeBase (line 16) | public abstract class OpCodeBase
    method Setup (line 24) | [GlobalSetup]
    method Bench_BaseLine (line 32) | [Benchmark(Baseline = true)]
    method Bench_OneOpCode (line 35) | [Benchmark]
    method Bench_OneGAS (line 41) | [Benchmark]
    method CreateScript (line 44) | protected abstract byte[] CreateScript(BenchmarkMode benchmarkMode);

FILE: benchmarks/Neo.VM.Benchmarks/TestArray.cs
  class TestArray (line 17) | public class TestArray : CompoundType, IReadOnlyList<StackItem>
    method TestArray (line 50) | public TestArray(IEnumerable<StackItem>? items = null)
    method TestArray (line 60) | public TestArray(IReferenceCounter? referenceCounter, IEnumerable<Stac...
    method Add (line 78) | public void Add(StackItem item)
    method Clear (line 85) | public override void Clear()
    method ConvertTo (line 94) | public override StackItem ConvertTo(StackItemType type)
    method DeepCopy (line 101) | internal sealed override StackItem DeepCopy(Dictionary<StackItem, Stac...
    method GetEnumerator (line 112) | IEnumerator IEnumerable.GetEnumerator()
    method GetEnumerator (line 117) | public IEnumerator<StackItem> GetEnumerator()
    method RemoveAt (line 126) | public void RemoveAt(int index)
    method Reverse (line 136) | public void Reverse()

FILE: benchmarks/Neo.VM.Benchmarks/TestStruct.cs
  class TestStruct (line 16) | public class TestStruct : TestArray
    method TestStruct (line 24) | public TestStruct(IEnumerable<StackItem>? fields = null)
    method TestStruct (line 34) | public TestStruct(IReferenceCounter? referenceCounter, IEnumerable<Sta...
    method Clone (line 44) | public TestStruct Clone(ExecutionEngineLimits limits)
    method ConvertTo (line 75) | public override StackItem ConvertTo(StackItemType type)
    method Equals (line 82) | public override bool Equals(StackItem? other)
    method Equals (line 87) | internal override bool Equals(StackItem? other, ExecutionEngineLimits ...

FILE: benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_Convert.cs
  class Benchmarks_Convert (line 19) | public class Benchmarks_Convert
    method Setup (line 23) | [GlobalSetup]
    method BenchConvertTo (line 29) | [Benchmark]
    method GetTypeConversionPairs (line 49) | public static IEnumerable<object[]> GetTypeConversionPairs()
    method CreateTestItemsByType (line 61) | private static Dictionary<StackItemType, List<StackItem>> CreateTestIt...

FILE: benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_DeepCopy.cs
  class Benchmarks_DeepCopy (line 17) | public class Benchmarks_DeepCopy
    method ParamSource (line 19) | public static IEnumerable<(int Depth, int ElementsPerLevel)> ParamSour...
    method BenchNestedArrayDeepCopy (line 39) | [Benchmark]
    method BenchNestedArrayDeepCopyWithReferenceCounter (line 47) | [Benchmark]
    method BenchNestedTestArrayDeepCopy (line 56) | [Benchmark]
    method BenchNestedTestArrayDeepCopyWithReferenceCounter (line 64) | [Benchmark]
    method CreateNestedArray (line 73) | private static void CreateNestedArray(Array? rootArray, int depth, int...
    method CreateNestedTestArray (line 95) | private static void CreateNestedTestArray(TestArray rootArray, int dep...

FILE: src/Neo.VM/BadScriptException.cs
  class BadScriptException (line 19) | public class BadScriptException : Exception
    method BadScriptException (line 24) | public BadScriptException() { }
    method BadScriptException (line 30) | public BadScriptException(string message) : base(message) { }

FILE: src/Neo.VM/CatchableException.cs
  class CatchableException (line 16) | public class CatchableException : Exception
    method CatchableException (line 18) | public CatchableException(string message) : base(message)

FILE: src/Neo.VM/Collections/OrderedDictionary.cs
  class OrderedDictionary (line 22) | class OrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue> where ...
    class TItem (line 24) | private class TItem
      method TItem (line 29) | public TItem(TKey key, TValue value)
    class InternalCollection (line 36) | private class InternalCollection : KeyedCollection<TKey, TItem>
      method GetKeyForItem (line 38) | protected override TKey GetKeyForItem(TItem item)
    method Add (line 66) | public void Add(TKey key, TValue value)
    method ContainsKey (line 71) | public bool ContainsKey(TKey key)
    method Remove (line 76) | public bool Remove(TKey key)
    method TryGetValue (line 81) | public bool TryGetValue(TKey key, out TValue value)
    method Add (line 92) | void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TV...
    method Clear (line 97) | public void Clear()
    method Contains (line 102) | bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKe...
    method CopyTo (line 107) | void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey,...
    method Remove (line 113) | bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey,...
    method GetEnumerator (line 118) | IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey,...
    method GetEnumerator (line 123) | IEnumerator IEnumerable.GetEnumerator()

FILE: src/Neo.VM/Debugger.cs
  class Debugger (line 19) | public class Debugger
    method Debugger (line 28) | public Debugger(ExecutionEngine engine)
    method AddBreakPoint (line 39) | public void AddBreakPoint(Script script, uint position)
    method Execute (line 53) | public VMState Execute()
    method ExecuteAndCheckBreakPoints (line 62) | private void ExecuteAndCheckBreakPoints()
    method RemoveBreakPoint (line 84) | public bool RemoveBreakPoint(Script script, uint position)
    method StepInto (line 98) | public VMState StepInto()
    method StepOut (line 112) | public VMState StepOut()
    method StepOver (line 129) | public VMState StepOver()

FILE: src/Neo.VM/EvaluationStack.cs
  class EvaluationStack (line 24) | public sealed class EvaluationStack : IReadOnlyList<StackItem>
    method EvaluationStack (line 31) | internal EvaluationStack(IReferenceCounter referenceCounter)
    method Clear (line 62) | internal void Clear()
    method CopyTo (line 69) | internal void CopyTo(EvaluationStack stack, int count = -1)
    method GetEnumerator (line 80) | public IEnumerator<StackItem> GetEnumerator()
    method GetEnumerator (line 85) | IEnumerator IEnumerable.GetEnumerator()
    method Insert (line 90) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method MoveTo (line 99) | internal void MoveTo(EvaluationStack stack, int count = -1)
    method Peek (line 114) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push (line 131) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Reverse (line 138) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Swap (line 154) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pop (line 170) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pop (line 181) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Remove (line 187) | internal T Remove<T>(int index) where T : StackItem
    method ToString (line 205) | public override string ToString()

FILE: src/Neo.VM/ExceptionHandlingContext.cs
  class ExceptionHandlingContext (line 19) | [DebuggerDisplay("State={State}, CatchPointer={CatchPointer}, FinallyPoi...
    method ExceptionHandlingContext (line 52) | internal ExceptionHandlingContext(int catchPointer, int finallyPointer)

FILE: src/Neo.VM/ExceptionHandlingState.cs
  type ExceptionHandlingState (line 17) | public enum ExceptionHandlingState : byte

FILE: src/Neo.VM/ExecutionContext.SharedStates.cs
  class ExecutionContext (line 17) | partial class ExecutionContext
    class SharedStates (line 19) | private class SharedStates
      method SharedStates (line 26) | public SharedStates(Script script, IReferenceCounter referenceCounter)

FILE: src/Neo.VM/ExecutionContext.cs
  class ExecutionContext (line 22) | [DebuggerDisplay("InstructionPointer={InstructionPointer}")]
    method ExecutionContext (line 110) | internal ExecutionContext(Script script, int rvcount, IReferenceCounte...
    method ExecutionContext (line 115) | private ExecutionContext(SharedStates sharedStates, int rvcount, int i...
    method Clone (line 128) | public ExecutionContext Clone()
    method Clone (line 138) | public ExecutionContext Clone(int initialPosition)
    method GetInstruction (line 143) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetState (line 152) | public T GetState<T>(Func<T>? factory = null) where T : class, new()
    method MoveNext (line 162) | internal bool MoveNext()

FILE: src/Neo.VM/ExecutionEngine.cs
  class ExecutionEngine (line 22) | public class ExecutionEngine : IDisposable
    method ExecutionEngine (line 88) | public ExecutionEngine(JumpTable? jumpTable = null)
    method ExecutionEngine (line 98) | internal ExecutionEngine(JumpTable? jumpTable, IReferenceCounter refer...
    method Dispose (line 106) | public void Dispose()
    method Dispose (line 112) | protected virtual void Dispose(bool disposing)
    method Execute (line 124) | public virtual VMState Execute()
    method ExecuteNext (line 136) | protected internal void ExecuteNext()
    method LoadContext (line 182) | public virtual void LoadContext(ExecutionContext context)
    method ContextUnloaded (line 195) | internal protected virtual void ContextUnloaded(ExecutionContext context)
    method CreateContext (line 221) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LoadScript (line 237) | public ExecutionContext LoadScript(Script script, int rvcount = -1, in...
    method OnFault (line 248) | protected virtual void OnFault(Exception ex)
    method OnStateChanged (line 263) | protected virtual void OnStateChanged()
    method Peek (line 272) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pop (line 282) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pop (line 293) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PostExecuteInstruction (line 302) | protected virtual void PostExecuteInstruction(Instruction instruction)
    method PreExecuteInstruction (line 310) | protected virtual void PreExecuteInstruction(Instruction instruction) { }
    method Push (line 316) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/ExecutionEngineLimits.cs
  type ExecutionEngineLimits (line 20) | public sealed record ExecutionEngineLimits

FILE: src/Neo.VM/IReferenceCounter.cs
  type IReferenceCounter (line 19) | public interface IReferenceCounter
    method AddZeroReferred (line 40) | void AddZeroReferred(StackItem item);
    method AddReference (line 52) | void AddReference(StackItem item, CompoundType parent);
    method AddStackReference (line 64) | void AddStackReference(StackItem item, int count = 1);
    method RemoveReference (line 76) | void RemoveReference(StackItem item, CompoundType parent);
    method RemoveStackReference (line 87) | void RemoveStackReference(StackItem item);
    method CheckZeroReferred (line 94) | int CheckZeroReferred();
    method CheckPostExecution (line 99) | void CheckPostExecution();

FILE: src/Neo.VM/Instruction.cs
  class Instruction (line 24) | [DebuggerDisplay("OpCode={OpCode}")]
    method Instruction (line 180) | static Instruction()
    method Instruction (line 192) | private Instruction(OpCode opcode)
    method Instruction (line 202) | internal Instruction(ReadOnlyMemory<byte> script, int ip) : this((OpCo...

FILE: src/Neo.VM/IsExternalInit.cs
  class IsExternalInit (line 24) | [EditorBrowsable(EditorBrowsableState.Never)]

FILE: src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs
  class JumpTable (line 16) | partial class JumpTable
    method Invert (line 25) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method And (line 39) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Or (line 54) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method XOr (line 69) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Equal (line 84) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NotEqual (line 99) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Compound.cs
  class JumpTable (line 23) | partial class JumpTable
    method PackMap (line 32) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PackStruct (line 55) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pack (line 77) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Unpack (line 99) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewArray0 (line 134) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewArray (line 147) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewArray_T (line 165) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewStruct0 (line 199) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewStruct (line 212) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NewMap (line 231) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Size (line 244) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method HasKey (line 272) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Keys (line 325) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Values (line 339) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PickItem (line 366) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Append (line 417) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method SetItem (line 435) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ReverseItems (line 500) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Remove (line 524) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ClearItems (line 563) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PopItem (line 584) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Control.cs
  class JumpTable (line 19) | partial class JumpTable
    method Nop (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Jmp (line 39) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Jmp_L (line 52) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpIf (line 67) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpIf_L (line 83) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpIfNot (line 99) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpIfNot_L (line 115) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpEq (line 131) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpEq_L (line 149) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpNe (line 167) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpNe_L (line 185) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpGt (line 203) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpGt_L (line 221) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpGe (line 239) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpGe_L (line 257) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpLt (line 275) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpLt_L (line 293) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpLe (line 311) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method JmpLe_L (line 329) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Call (line 345) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Call_L (line 358) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method CallA (line 372) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method CallT (line 387) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Abort (line 399) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Assert (line 412) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Throw (line 427) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Try (line 442) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Try_L (line 459) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method EndTry (line 475) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method EndTry_L (line 490) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method EndFinally (line 505) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Ret (line 527) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Syscall (line 554) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteCall (line 567) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteEndTry (line 578) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteJump (line 608) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteJumpOffset (line 622) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteTry (line 634) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteThrow (line 653) | public virtual void ExecuteThrow(ExecutionEngine engine, StackItem? ex)

FILE: src/Neo.VM/JumpTable/JumpTable.Numeric.cs
  class JumpTable (line 17) | partial class JumpTable
    method Sign (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Abs (line 41) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Negate (line 55) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Inc (line 69) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Dec (line 83) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Add (line 97) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Sub (line 112) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Mul (line 127) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Div (line 142) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Mod (line 157) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pow (line 172) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Sqrt (line 188) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ModMul (line 201) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ModPow (line 217) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Shl (line 236) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Shr (line 252) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Not (line 268) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method BoolAnd (line 282) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method BoolOr (line 297) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Nz (line 312) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NumEqual (line 326) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method NumNotEqual (line 341) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Lt (line 356) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Le (line 374) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Gt (line 392) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Ge (line 410) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Min (line 428) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Max (line 443) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Within (line 459) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Push.cs
  class JumpTable (line 19) | partial class JumpTable
    method PushInt8 (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushInt16 (line 39) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushInt32 (line 51) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushInt64 (line 63) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushInt128 (line 75) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushInt256 (line 87) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushT (line 99) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushF (line 111) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushA (line 123) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushNull (line 138) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushData1 (line 151) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushData2 (line 165) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushData4 (line 179) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method PushM1 (line 192) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push0 (line 204) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push1 (line 216) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push2 (line 228) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push3 (line 240) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push4 (line 252) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push5 (line 264) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push6 (line 276) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push7 (line 288) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push8 (line 300) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push9 (line 312) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push10 (line 324) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push11 (line 336) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push12 (line 348) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push13 (line 360) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push14 (line 372) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push15 (line 384) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Push16 (line 396) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Slot.cs
  class JumpTable (line 18) | partial class JumpTable
    method InitSSlot (line 26) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method InitSlot (line 42) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld0 (line 70) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld1 (line 82) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld2 (line 94) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld3 (line 106) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld4 (line 118) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld5 (line 130) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld6 (line 142) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdSFld (line 155) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld0 (line 167) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld1 (line 179) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld2 (line 191) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld3 (line 203) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld4 (line 215) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld5 (line 227) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld6 (line 239) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StSFld (line 252) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc0 (line 264) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc1 (line 276) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc2 (line 288) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc3 (line 300) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc4 (line 312) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc5 (line 324) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc6 (line 336) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdLoc (line 349) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc0 (line 361) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc1 (line 373) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc2 (line 385) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc3 (line 397) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc4 (line 409) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc5 (line 421) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc6 (line 433) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StLoc (line 446) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg0 (line 458) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg1 (line 470) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg2 (line 482) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg3 (line 494) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg4 (line 506) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg5 (line 518) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg6 (line 530) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method LdArg (line 543) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg0 (line 555) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg1 (line 567) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg2 (line 579) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg3 (line 591) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg4 (line 603) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg5 (line 615) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg6 (line 627) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method StArg (line 640) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ExecuteStoreToSlot (line 654) | public virtual void ExecuteStoreToSlot(ExecutionEngine engine, Slot? s...
    method ExecuteLoadFromSlot (line 669) | public virtual void ExecuteLoadFromSlot(ExecutionEngine engine, Slot? ...

FILE: src/Neo.VM/JumpTable/JumpTable.Splice.cs
  class JumpTable (line 18) | partial class JumpTable
    method NewBuffer (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Memcpy (line 42) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Cat (line 72) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method SubStr (line 92) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Left (line 116) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Right (line 137) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Stack.cs
  class JumpTable (line 18) | partial class JumpTable
    method Depth (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Drop (line 40) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Nip (line 52) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method XDrop (line 65) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Clear (line 80) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Dup (line 93) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Over (line 106) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Pick (line 119) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Tuck (line 134) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Swap (line 147) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Rot (line 163) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Roll (line 182) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Reverse3 (line 199) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Reverse4 (line 211) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ReverseN (line 224) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.Types.cs
  class JumpTable (line 18) | partial class JumpTable
    method IsNull (line 27) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method IsType (line 41) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method Convert (line 62) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method AbortMsg (line 76) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method AssertMsg (line 90) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/JumpTable/JumpTable.cs
  class JumpTable (line 17) | public partial class JumpTable
    method JumpTable (line 39) | public JumpTable()
    method InvalidOpcode (line 70) | public virtual void InvalidOpcode(ExecutionEngine engine, Instruction ...

FILE: src/Neo.VM/OpCode.cs
  type OpCode (line 19) | public enum OpCode : byte

FILE: src/Neo.VM/OperandSizeAttribute.cs
  class OperandSizeAttribute (line 19) | [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]

FILE: src/Neo.VM/RCVersion.cs
  type RCVersion (line 14) | public enum RCVersion

FILE: src/Neo.VM/ReferenceCounter.cs
  class ReferenceCounter (line 23) | public sealed class ReferenceCounter : IReferenceCounter
    method ReferenceCounter (line 47) | public ReferenceCounter(ExecutionEngineLimits? limits = null)
    method NeedTrack (line 57) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method AddReference (line 71) | public void AddReference(StackItem item, CompoundType parent)
    method AddStackReference (line 99) | public void AddStackReference(StackItem item, int count = 1)
    method AddZeroReferred (line 119) | public void AddZeroReferred(StackItem item)
    method CheckPostExecution (line 133) | public void CheckPostExecution()
    method CheckZeroReferred (line 149) | public int CheckZeroReferred()
    method RemoveReference (line 233) | public void RemoveReference(StackItem item, CompoundType parent)
    method RemoveStackReference (line 253) | public void RemoveStackReference(StackItem item)

FILE: src/Neo.VM/ReferenceCounterV2.cs
  class ReferenceCounterV2 (line 20) | public sealed class ReferenceCounterV2 : IReferenceCounter
    method ReferenceCounterV2 (line 32) | public ReferenceCounterV2(ExecutionEngineLimits? limits = null)
    method AddReference (line 38) | public void AddReference(StackItem item, CompoundType parent)
    method AddStackReference (line 44) | public void AddStackReference(StackItem item, int count = 1)
    method AddZeroReferred (line 65) | public void AddZeroReferred(StackItem item)
    method CheckPostExecution (line 71) | public void CheckPostExecution()
    method CheckZeroReferred (line 78) | public int CheckZeroReferred()
    method RemoveReference (line 84) | public void RemoveReference(StackItem item, CompoundType parent)
    method RemoveStackReference (line 90) | public void RemoveStackReference(StackItem item)

FILE: src/Neo.VM/ReferenceEqualityComparer.cs
  class ReferenceEqualityComparer (line 19) | public sealed class ReferenceEqualityComparer : IEqualityComparer<object...
    method ReferenceEqualityComparer (line 21) | private ReferenceEqualityComparer() { }
    method Equals (line 25) | public new bool Equals(object? x, object? y) => ReferenceEquals(x, y);
    method GetHashCode (line 27) | public int GetHashCode(object? obj) => RuntimeHelpers.GetHashCode(obj!);

FILE: src/Neo.VM/Script.cs
  class Script (line 23) | [DebuggerDisplay("Length={Length}")]
    method Script (line 59) | public Script(ReadOnlyMemory<byte> script) : this(script, false)
    method Script (line 72) | public Script(ReadOnlyMemory<byte> script, bool strictMode)
    method GetInstruction (line 149) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetHashCode (line 170) | public override int GetHashCode()

FILE: src/Neo.VM/ScriptBuilder.cs
  class ScriptBuilder (line 21) | public class ScriptBuilder : IDisposable
    method ScriptBuilder (line 38) | public ScriptBuilder(int initialCapacity = 0)
    method Dispose (line 46) | public void Dispose()
    method Emit (line 59) | public ScriptBuilder Emit(OpCode opcode, ReadOnlySpan<byte> operand = ...
    method EmitCall (line 71) | public ScriptBuilder EmitCall(int offset)
    method EmitJump (line 85) | public ScriptBuilder EmitJump(OpCode opcode, int offset)
    method EmitPush (line 102) | public ScriptBuilder EmitPush(BigInteger value)
    method EmitPush (line 125) | public ScriptBuilder EmitPush(bool value)
    method EmitPush (line 135) | public ScriptBuilder EmitPush(ReadOnlySpan<byte> data)
    method EmitPush (line 163) | public ScriptBuilder EmitPush(string data)
    method EmitRaw (line 173) | public ScriptBuilder EmitRaw(ReadOnlySpan<byte> script = default)
    method EmitSysCall (line 184) | public ScriptBuilder EmitSysCall(uint api)
    method ToArray (line 193) | public byte[] ToArray()
    method PadRight (line 199) | private static ReadOnlySpan<byte> PadRight(Span<byte> buffer, int data...

FILE: src/Neo.VM/Slot.cs
  class Slot (line 22) | public class Slot : IReadOnlyList<StackItem>
    method Slot (line 57) | public Slot(StackItem[] items, IReferenceCounter referenceCounter)
    method Slot (line 70) | public Slot(int count, IReferenceCounter referenceCounter)
    method ClearReferences (line 78) | internal void ClearReferences()
    method GetEnumerator (line 84) | IEnumerator<StackItem> IEnumerable<StackItem>.GetEnumerator()
    method GetEnumerator (line 89) | IEnumerator IEnumerable.GetEnumerator()

FILE: src/Neo.VM/StronglyConnectedComponents/Tarjan.cs
  class Tarjan (line 18) | class Tarjan
    method Tarjan (line 25) | public Tarjan(IEnumerable<T> vertexs)
    method Invoke (line 30) | public LinkedList<HashSet<T>> Invoke()
    method StrongConnect (line 42) | private void StrongConnect(T v)
    method StrongConnectNonRecursive (line 75) | private void StrongConnectNonRecursive(T v)

FILE: src/Neo.VM/Types/Array.cs
  class Array (line 22) | public class Array : CompoundType, IReadOnlyList<StackItem>
    method Array (line 61) | public Array(IEnumerable<StackItem>? items = null)
    method Array (line 71) | public Array(IReferenceCounter? referenceCounter, IEnumerable<StackIte...
    method Add (line 98) | public void Add(StackItem item)
    method Clear (line 112) | public override void Clear()
    method ConvertTo (line 121) | public override StackItem ConvertTo(StackItemType type)
    method DeepCopy (line 128) | internal sealed override StackItem DeepCopy(Dictionary<StackItem, Stac...
    method GetEnumerator (line 139) | IEnumerator IEnumerable.GetEnumerator()
    method GetEnumerator (line 144) | public IEnumerator<StackItem> GetEnumerator()
    method RemoveAt (line 153) | public void RemoveAt(int index)
    method Reverse (line 163) | public void Reverse()

FILE: src/Neo.VM/Types/Boolean.cs
  class Boolean (line 22) | [DebuggerDisplay("Type={GetType().Name}, Value={value}")]
    method Boolean (line 38) | internal Boolean(bool value)
    method Equals (line 43) | public override bool Equals(StackItem? other)
    method GetBoolean (line 50) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetHashCode (line 56) | public override int GetHashCode()
    method GetInteger (line 61) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ToString (line 73) | public override string ToString()

FILE: src/Neo.VM/Types/Buffer.cs
  class Buffer (line 23) | [DebuggerDisplay("Type={GetType().Name}, Value={System.Convert.ToHexStri...
    method Buffer (line 45) | public Buffer(int size, bool zeroInitialize = true)
    method Buffer (line 56) | public Buffer(ReadOnlySpan<byte> data) : this(data.Length, false)
    method Cleanup (line 61) | internal override void Cleanup()
    method KeepAlive (line 67) | public void KeepAlive()
    method ConvertTo (line 72) | public override StackItem ConvertTo(StackItemType type)
    method DeepCopy (line 93) | internal override StackItem DeepCopy(Dictionary<StackItem, StackItem> ...
    method GetBoolean (line 101) | public override bool GetBoolean()
    method GetSpan (line 106) | public override ReadOnlySpan<byte> GetSpan()
    method ToString (line 111) | public override string ToString()
    method GetHashCode (line 118) | public override int GetHashCode() => throw new NotSupportedException("...

FILE: src/Neo.VM/Types/ByteString.cs
  class ByteString (line 22) | [DebuggerDisplay("Type={GetType().Name}, Value={System.Convert.ToHexStri...
    method ByteString (line 37) | public ByteString(ReadOnlyMemory<byte> data)
    method Equals (line 42) | private bool Equals(ByteString other)
    method Equals (line 47) | public override bool Equals(StackItem? other)
    method Equals (line 54) | internal override bool Equals(StackItem? other, ExecutionEngineLimits ...
    method Equals (line 60) | internal bool Equals(StackItem? other, ref uint limits)
    method GetBoolean (line 80) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetInteger (line 87) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ToString (line 124) | public override string ToString()

FILE: src/Neo.VM/Types/CompoundType.cs
  class CompoundType (line 21) | [DebuggerDisplay("Type={GetType().Name}, Count={Count}, Id={System.Colle...
    method CompoundType (line 33) | protected CompoundType(IReferenceCounter? referenceCounter = null)
    method Clear (line 60) | public abstract void Clear();
    method DeepCopy (line 62) | internal abstract override StackItem DeepCopy(Dictionary<StackItem, St...
    method GetBoolean (line 64) | public sealed override bool GetBoolean()
    method GetHashCode (line 69) | public override int GetHashCode() => throw new NotSupportedException("...
    method ToString (line 71) | public override string ToString()

FILE: src/Neo.VM/Types/Integer.cs
  class Integer (line 22) | [DebuggerDisplay("Type={GetType().Name}, Value={value}")]
    method Integer (line 44) | public Integer(BigInteger value)
    method Equals (line 58) | public override bool Equals(StackItem? other)
    method GetBoolean (line 65) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetHashCode (line 71) | public override int GetHashCode()
    method GetInteger (line 76) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ToString (line 136) | public override string ToString()

FILE: src/Neo.VM/Types/InteropInterface.cs
  class InteropInterface (line 20) | [DebuggerDisplay("Type={GetType().Name}, Value={_object}")]
    method InteropInterface (line 31) | public InteropInterface(object value)
    method Equals (line 36) | public override bool Equals(StackItem? other)
    method GetBoolean (line 43) | public override bool GetBoolean()
    method GetHashCode (line 48) | public override int GetHashCode()
    method GetInterface (line 53) | public override T GetInterface<T>()
    method ToString (line 59) | public override string ToString()

FILE: src/Neo.VM/Types/Map.cs
  class Map (line 24) | public class Map : CompoundType, IReadOnlyDictionary<PrimitiveType, Stac...
    method Map (line 94) | public Map(IReferenceCounter? referenceCounter = null)
    method Map (line 104) | public Map(IEnumerable<KeyValuePair<PrimitiveType, StackItem>> diction...
    method Clear (line 113) | public override void Clear()
    method ContainsKey (line 133) | public bool ContainsKey(PrimitiveType key)
    method DeepCopy (line 140) | internal override StackItem DeepCopy(Dictionary<StackItem, StackItem> ...
    method GetEnumerator (line 151) | IEnumerator<KeyValuePair<PrimitiveType, StackItem>> IEnumerable<KeyVal...
    method GetEnumerator (line 156) | IEnumerator IEnumerable.GetEnumerator()
    method Remove (line 169) | public StackItem? Remove(PrimitiveType key)
    method TryGetValue (line 194) | public bool TryGetValue(PrimitiveType key, [MaybeNullWhen(false)] out ...
    method TryGetValue (line 196) | public bool TryGetValue(PrimitiveType key, out StackItem value)

FILE: src/Neo.VM/Types/Null.cs
  class Null (line 21) | public class Null : StackItem
    method Null (line 25) | internal Null() { }
    method ConvertTo (line 27) | public override StackItem ConvertTo(StackItemType type)
    method Equals (line 38) | public override bool Equals(StackItem? other)
    method GetBoolean (line 44) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetHashCode (line 50) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method GetInterface (line 56) | [return: MaybeNull]
    method GetString (line 62) | public override string? GetString()
    method ToString (line 67) | public override string ToString()

FILE: src/Neo.VM/Types/Pointer.cs
  class Pointer (line 20) | [DebuggerDisplay("Type={GetType().Name}, Position={Position}")]
    method Pointer (line 40) | public Pointer(Script script, int position)
    method Equals (line 46) | public override bool Equals(StackItem? other)
    method GetBoolean (line 53) | public override bool GetBoolean()
    method GetHashCode (line 58) | public override int GetHashCode()
    method ToString (line 63) | public override string ToString()

FILE: src/Neo.VM/Types/PrimitiveType.cs
  class PrimitiveType (line 22) | public abstract class PrimitiveType : StackItem
    method ConvertTo (line 31) | public override StackItem ConvertTo(StackItemType type)
    method DeepCopy (line 43) | internal sealed override StackItem DeepCopy(Dictionary<StackItem, Stac...
    method Equals (line 48) | public abstract override bool Equals(StackItem? other);
    method GetSpan (line 50) | public sealed override ReadOnlySpan<byte> GetSpan()

FILE: src/Neo.VM/Types/StackItem.Vertex.cs
  class StackItem (line 18) | partial class StackItem
    class ObjectReferenceEntry (line 32) | internal class ObjectReferenceEntry
      method ObjectReferenceEntry (line 48) | public ObjectReferenceEntry(StackItem item) => Item = item;
    method Reset (line 122) | internal void Reset() => (DFN, LowLink, OnStack) = (-1, 0, false);
    method GetHashCode (line 133) | public override int GetHashCode()

FILE: src/Neo.VM/Types/StackItem.cs
  class StackItem (line 23) | public abstract partial class StackItem : IEquatable<StackItem>
    method ConvertTo (line 85) | public virtual StackItem ConvertTo(StackItemType type)
    method Cleanup (line 92) | internal virtual void Cleanup()
    method DeepCopy (line 100) | public StackItem DeepCopy(bool asImmutable = false)
    method DeepCopy (line 105) | internal virtual StackItem DeepCopy(Dictionary<StackItem, StackItem> r...
    method Equals (line 110) | public sealed override bool Equals(object? obj)
    method Equals (line 117) | public virtual bool Equals(StackItem? other)
    method Equals (line 122) | internal virtual bool Equals(StackItem? other, ExecutionEngineLimits l...
    method FromInterface (line 132) | public static StackItem FromInterface(object? value)
    method GetBoolean (line 142) | public abstract bool GetBoolean();
    method GetInteger (line 148) | public virtual BigInteger GetInteger()
    method GetInterface (line 158) | [return: MaybeNull]
    method GetSpan (line 168) | public virtual ReadOnlySpan<byte> GetSpan()
    method GetString (line 177) | public virtual string? GetString()

FILE: src/Neo.VM/Types/StackItemType.cs
  type StackItemType (line 17) | public enum StackItemType : byte

FILE: src/Neo.VM/Types/Struct.cs
  class Struct (line 20) | public class Struct : Array
    method Struct (line 28) | public Struct(IEnumerable<StackItem>? fields = null)
    method Struct (line 38) | public Struct(IReferenceCounter? referenceCounter, IEnumerable<StackIt...
    method Clone (line 48) | public Struct Clone(ExecutionEngineLimits limits)
    method ConvertTo (line 79) | public override StackItem ConvertTo(StackItemType type)
    method Equals (line 86) | public override bool Equals(StackItem? other)
    method Equals (line 91) | internal override bool Equals(StackItem? other, ExecutionEngineLimits ...

FILE: src/Neo.VM/Unsafe.cs
  class Unsafe (line 17) | unsafe static class Unsafe
    method NotZero (line 19) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/Utility.cs
  class Utility (line 21) | static class Utility
    method Utility (line 27) | static Utility()
    method TryToStrictUtf8String (line 40) | public static bool TryToStrictUtf8String(this ReadOnlySpan<byte> bytes...
    method ToStrictUtf8String (line 59) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ToStrictUtf8Bytes (line 67) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method XxHash3_32 (line 76) | [MethodImpl(MethodImplOptions.AggressiveInlining)]
    method ModInverse (line 82) | public static BigInteger ModInverse(this BigInteger value, BigInteger ...
    method Sqrt (line 104) | public static BigInteger Sqrt(this BigInteger value)
    method GetBitLength (line 122) | static int GetBitLength(this BigInteger i)
    method BitLen (line 128) | [MethodImpl(MethodImplOptions.AggressiveInlining)]

FILE: src/Neo.VM/VMState.cs
  type VMState (line 17) | public enum VMState : byte

FILE: src/Neo.VM/VMUnhandledException.cs
  class VMUnhandledException (line 23) | public class VMUnhandledException : Exception
    method VMUnhandledException (line 34) | public VMUnhandledException(StackItem ex) : base(GetExceptionMessage(ex))
    method GetExceptionMessage (line 39) | private static string GetExceptionMessage(StackItem e)

FILE: tests/Neo.VM.Tests/Converters/ScriptConverter.cs
  class ScriptConverter (line 22) | internal class ScriptConverter : JsonConverter
    method CanConvert (line 24) | public override bool CanConvert(Type objectType)
    method ReadJson (line 29) | public override object ReadJson(JsonReader reader, Type objectType, ob...
    method WriteJson (line 80) | public override void WriteJson(JsonWriter writer, object value, JsonSe...

FILE: tests/Neo.VM.Tests/Converters/UppercaseEnum.cs
  class UppercaseEnum (line 17) | internal class UppercaseEnum : JsonConverter
    method CanConvert (line 19) | public override bool CanConvert(Type objectType)
    method ReadJson (line 24) | public override object ReadJson(JsonReader reader, Type objectType, ob...
    method WriteJson (line 29) | public override void WriteJson(JsonWriter writer, object value, JsonSe...

FILE: tests/Neo.VM.Tests/Extensions/JsonExtensions.cs
  class JsonExtensions (line 18) | public static class JsonExtensions
    method JsonExtensions (line 25) | static JsonExtensions()
    method DeserializeJson (line 43) | public static T DeserializeJson<T>(this string input)
    method ToJson (line 53) | public static string ToJson(this object ut)

FILE: tests/Neo.VM.Tests/Extensions/StringExtensions.cs
  class StringExtensions (line 17) | internal static class StringExtensions
    method ToHexString (line 24) | public static string ToHexString(this byte[] data)
    method FromHexString (line 52) | public static byte[] FromHexString(this string value)

FILE: tests/Neo.VM.Tests/Helpers/RandomHelper.cs
  class RandomHelper (line 17) | public class RandomHelper
    method RandBuffer (line 28) | public static byte[] RandBuffer(int length)
    method RandString (line 40) | public static string RandString(int length)

FILE: tests/Neo.VM.Tests/Types/TestEngine.cs
  class TestEngine (line 18) | public class TestEngine : ExecutionEngine
    method TestEngine (line 22) | public TestEngine() : base(ComposeJumpTable()) { }
    method TestEngine (line 24) | public TestEngine(IReferenceCounter referenceCounter, ExecutionEngineL...
    method ComposeJumpTable (line 26) | private static JumpTable ComposeJumpTable()
    method OnSysCall (line 33) | private static void OnSysCall(ExecutionEngine engine, Instruction inst...
    method OnFault (line 52) | protected override void OnFault(Exception ex)

FILE: tests/Neo.VM.Tests/Types/VMUT.cs
  class VMUT (line 16) | public class VMUT

FILE: tests/Neo.VM.Tests/Types/VMUTActionType.cs
  type VMUTActionType (line 14) | public enum VMUTActionType

FILE: tests/Neo.VM.Tests/Types/VMUTEntry.cs
  class VMUTEntry (line 17) | public class VMUTEntry

FILE: tests/Neo.VM.Tests/Types/VMUTExecutionContextState.cs
  class VMUTExecutionContextState (line 18) | public class VMUTExecutionContextState

FILE: tests/Neo.VM.Tests/Types/VMUTExecutionEngineState.cs
  class VMUTExecutionEngineState (line 18) | public class VMUTExecutionEngineState

FILE: tests/Neo.VM.Tests/Types/VMUTStackItem.cs
  class VMUTStackItem (line 17) | public class VMUTStackItem

FILE: tests/Neo.VM.Tests/Types/VMUTStackItemType.cs
  type VMUTStackItemType (line 14) | public enum VMUTStackItemType

FILE: tests/Neo.VM.Tests/Types/VMUTStep.cs
  class VMUTStep (line 16) | public class VMUTStep

FILE: tests/Neo.VM.Tests/UT_Debugger.cs
  class UT_Debugger (line 17) | [TestClass]
    method TestBreakPoint (line 20) | [TestMethod]
    method TestWithoutBreakPoints (line 53) | [TestMethod]
    method TestWithoutDebugger (line 75) | [TestMethod]
    method TestStepOver (line 95) | [TestMethod]
    method TestStepInto (line 132) | [TestMethod]
    method TestBreakPointStepOver (line 183) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_EvaluationStack.cs
  class UT_EvaluationStack (line 22) | [TestClass]
    method CreateOrderedStack (line 25) | private static EvaluationStack CreateOrderedStack(int count)
    method GetEnumerable (line 42) | public static IEnumerable GetEnumerable(IEnumerator enumerator)
    method TestClear (line 47) | [TestMethod]
    method TestCopyTo (line 55) | [TestMethod]
    method TestMoveTo (line 92) | [TestMethod]
    method TestInsertPeek (line 126) | [TestMethod]
    method TestPopPush (line 147) | [TestMethod]
    method TestRemove (line 167) | [TestMethod]
    method TestReverse (line 180) | [TestMethod]
    method TestEvaluationStackPrint (line 203) | [TestMethod]
    method TestPrintInvalidUTF8 (line 216) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_ExecutionContext.cs
  class UT_ExecutionContext (line 19) | [TestClass]
    class TestState (line 22) | class TestState
    method TestStateTest (line 27) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_ReferenceCounter.cs
  class UT_ReferenceCounter (line 22) | [TestClass]
    method TestCircularReferences (line 25) | [TestMethod]
    method TestRemoveReferrer (line 125) | [TestMethod]
    method TestCheckZeroReferredWithArray (line 168) | [TestMethod]
    method TestCheckZeroReferred (line 201) | [TestMethod]
    method TestCheckZeroReferred_PopItemArray (line 234) | [TestMethod]
    method TestCheckZeroReferred_Append (line 259) | [TestMethod]
    method TestCheckZeroReferred_DupAppend (line 280) | [TestMethod]
    method TestCheckZeroReferred_SetItemMap (line 306) | [TestMethod]
    method TestCheckZeroReferred_DupSetItemMap (line 329) | [TestMethod]
    method TestCheckZeroReferred_SetItemArray (line 357) | [TestMethod]
    method TestCheckZeroReferred_RemoveArray (line 380) | [TestMethod]
    method TestCheckZeroReferred_RemoveStruct (line 402) | [TestMethod]
    method TestCheckZeroReferred_RemoveMap (line 424) | [TestMethod]
    method TestCheckZeroReferred_DupRemoveArray (line 446) | [TestMethod]
    method TestCheckZeroReferred_DupRemoveStruct (line 470) | [TestMethod]
    method TestCheckZeroReferred_DupRemoveMap (line 494) | [TestMethod]
    method TestCheckZeroReferred_ClearItemsArray (line 517) | [TestMethod]
    method TestCheckZeroReferred_ClearItemsStruct (line 538) | [TestMethod]
    method TestCheckZeroReferred_ClearItemsMap (line 559) | [TestMethod]
    method TestCheckZeroReferred_DupClearItemsArray (line 580) | [TestMethod]
    method TestCheckZeroReferred_DupClearItemsStruct (line 602) | [TestMethod]
    method TestCheckZeroReferred_DupClearItemsMap (line 624) | [TestMethod]
    method TestArrayNoPush (line 646) | [TestMethod]
    method TestInvalidReferenceStackItem (line 660) | [TestMethod]
    method TestCheckPostExecution (line 675) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_ReferenceCounterComprehensive.cs
  class UT_ReferenceCounterComprehensive (line 34) | [TestClass]
    method TestAddStackReference_SingleItem_CountIncreases (line 39) | [TestMethod]
    method TestAddStackReference_MultipleCount_CountIncreasesCorrectly (line 50) | [TestMethod]
    method TestRemoveStackReference_SingleItem_CountDecreases (line 60) | [TestMethod]
    method TestStackReference_NonTrackedType_CountStillChanges (line 73) | [TestMethod]
    method TestStackReference_Buffer_IsTracked (line 86) | [TestMethod]
    method TestAddReference_ParentChild_CountIncreases (line 103) | [TestMethod]
    method TestRemoveReference_ParentChild_CountDecreases (line 117) | [TestMethod]
    method TestAddReference_MultipleParents_TracksCorrectly (line 132) | [TestMethod]
    method TestAddReference_SameParentMultipleTimes_TracksCorrectly (line 148) | [TestMethod]
    method TestAddReference_NonTrackedChild_CountStillIncreases (line 163) | [TestMethod]
    method TestAddZeroReferred_AddsToTracking (line 180) | [TestMethod]
    method TestCheckZeroReferred_WithStackReference_NotCleaned (line 192) | [TestMethod]
    method TestCheckZeroReferred_NoZeroItems_ReturnsCurrentCount (line 204) | [TestMethod]
    method TestRemoveStackReference_ToZero_AddsToZeroReferred (line 217) | [TestMethod]
    method TestCircularReference_SelfReference_CleanedUp (line 236) | [TestMethod]
    method TestCircularReference_TwoItems_CleanedUp (line 254) | [TestMethod]
    method TestCircularReference_ThreeItems_CleanedUp (line 276) | [TestMethod]
    method TestCircularReference_PartiallyReachable_NotCleanedUp (line 296) | [TestMethod]
    method TestCircularReference_ComplexGraph_CleanedUpCorrectly (line 314) | [TestMethod]
    method TestMixedReferences_StackAndObject (line 348) | [TestMethod]
    method TestMixedReferences_RemoveParentFirst (line 368) | [TestMethod]
    method TestMixedReferences_NestedArrays (line 385) | [TestMethod]
    method TestEmptyReferenceCounter_CountIsZero (line 409) | [TestMethod]
    method TestCheckZeroReferred_EmptyCounter_ReturnsZero (line 416) | [TestMethod]
    method TestCheckZeroReferred_CalledMultipleTimes_Idempotent (line 424) | [TestMethod]
    method TestLargeNumberOfItems (line 440) | [TestMethod]
    method TestDeepNesting (line 463) | [TestMethod]
    method TestArray_TrackedCorrectly (line 490) | [TestMethod]
    method TestMap_TrackedCorrectly (line 506) | [TestMethod]
    method TestStruct_TrackedCorrectly (line 522) | [TestMethod]
    method TestBuffer_TrackedCorrectly (line 537) | [TestMethod]
    method TestNestedCompoundTypes (line 552) | [TestMethod]
    method TestArray_Clear_RemovesReferences (line 570) | [TestMethod]
    method TestArray_RemoveAt_RemovesReference (line 587) | [TestMethod]
    method TestArray_SetItem_UpdatesReferences (line 604) | [TestMethod]
    method TestMap_RemoveKey_RemovesReferences (line 619) | [TestMethod]
    method TestMap_Clear_RemovesAllReferences (line 634) | [TestMethod]
    method TestCacheInvalidation_AddReference (line 654) | [TestMethod]
    method TestCacheInvalidation_RemoveReference (line 677) | [TestMethod]
    method TestVMIntegration_SimpleScript (line 702) | [TestMethod]
    method TestVMIntegration_ArrayWithItems (line 718) | [TestMethod]
    method TestVMIntegration_NestedArrays (line 733) | [TestMethod]
    method TestVMIntegration_MapOperations (line 753) | [TestMethod]
    method TestVMIntegration_StructClone (line 771) | [TestMethod]
    method TestSlot_InitializesWithNullReferences (line 798) | [TestMethod]
    method TestSlot_SetAndGet (line 813) | [TestMethod]
    method TestStaticSlot_PersistsAcrossContexts (line 833) | [TestMethod]
    method TestStress_ManySmallArrays (line 855) | [TestMethod]
    method TestStress_ComplexInterconnectedGraph (line 878) | [TestMethod]
    method TestStress_RepeatedCheckZeroReferred (line 907) | [TestMethod]
    method TestBehavior_AddRemoveSymmetry (line 926) | [TestMethod]
    method TestBehavior_ObjectReferenceSymmetry (line 948) | [TestMethod]
    method TestBehavior_CountNeverNegative (line 975) | [TestMethod]
    method TestBehavior_DeterministicCleanup (line 992) | [TestMethod]
    method TestAddStackReference_ExistingItem_CachedComponentsNotNull (line 1023) | [TestMethod]
    method TestAddStackReference_RemovesFromZeroReferred (line 1047) | [TestMethod]
    method TestAddZeroReferred_NonTrackedType (line 1071) | [TestMethod]
    method TestAddZeroReferred_WithCachedComponents (line 1088) | [TestMethod]
    method TestRemoveReference_NonTrackedType (line 1115) | [TestMethod]
    method TestRemoveReference_ItemStillHasStackReferences (line 1135) | [TestMethod]
    method TestRemoveStackReference_ItemStillHasStackReferences (line 1161) | [TestMethod]
    method TestCheckZeroReferred_ReusesCachedComponents (line 1181) | [TestMethod]
    method TestCheckZeroReferred_CompoundTypeWithNonTrackedSubitems (line 1204) | [TestMethod]
    method TestCheckZeroReferred_BufferCleanup (line 1227) | [TestMethod]
    method TestCheckZeroReferred_SubitemsInSameComponent (line 1246) | [TestMethod]
    method TestCheckZeroReferred_OnStackPropagation (line 1271) | [TestMethod]
    method TestCheckZeroReferred_MultipleSCCs (line 1297) | [TestMethod]
    method TestCheckZeroReferred_MapWithCompoundValues (line 1331) | [TestMethod]
    method TestCheckZeroReferred_NestedStructs (line 1354) | [TestMethod]
    method TestAddReference_InitializesObjectReferences (line 1378) | [TestMethod]
    method TestInterleavedOperations (line 1407) | [TestMethod]
    method TestCheckZeroReferred_ResetsAllItems (line 1447) | [TestMethod]
    method TestRemoveReference_LastParentTriggersCleanup (line 1479) | [TestMethod]
    method TestMultipleReferencesFromSameParentRequireAllRemovals (line 1507) | [TestMethod]
    method TestBufferUsedAsMapValueCleanup (line 1537) | [TestMethod]
    method TestSlotUpdateReplacesReferences (line 1560) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_Script.cs
  class UT_Script (line 19) | [TestClass]
    method TestConversion (line 22) | [TestMethod]
    method TestStrictMode (line 41) | [TestMethod]
    method TestParse (line 60) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_ScriptBuilder.cs
  class UT_ScriptBuilder (line 23) | [TestClass]
    method TestEmit (line 26) | [TestMethod]
    method TestNullAndEmpty (line 45) | [TestMethod]
    method TestBigInteger (line 59) | [TestMethod]
    method TestEmitSysCall (line 81) | [TestMethod]
    method TestEmitCall (line 89) | [TestMethod]
    method TestEmitJump (line 109) | [TestMethod]
    method TestEmitPushBigInteger (line 157) | [TestMethod]
    method TestEmitPushBool (line 218) | [TestMethod]
    method TestEmitPushReadOnlySpan (line 234) | [TestMethod]
    method TestEmitPushByteArray (line 244) | [TestMethod]
    method TestEmitPushString (line 278) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_Slot.cs
  class UT_Slot (line 23) | [TestClass]
    method CreateOrderedSlot (line 26) | private static Slot CreateOrderedSlot(int count)
    method GetEnumerable (line 43) | public static IEnumerable GetEnumerable(IEnumerator enumerator)
    method TestGet (line 48) | [TestMethod]
    method TestEnumerable (line 59) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_StackItem.cs
  class UT_StackItem (line 19) | [TestClass]
    method TestCircularReference (line 22) | [TestMethod]
    method TestHashCode (line 37) | [TestMethod]
    method TestNull (line 131) | [TestMethod]
    method TestEqual (line 141) | [TestMethod]
    method TestCast (line 157) | [TestMethod]
    method TestDeepCopy (line 238) | [TestMethod]
    method TestMapRemove (line 259) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_Struct.cs
  class UT_Struct (line 19) | [TestClass]
    method UT_Struct (line 24) | public UT_Struct()
    method TestClone (line 31) | [TestMethod]
    method TestEquals (line 43) | [TestMethod]
    method TestEqualsDos (line 54) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_Unsafe.cs
  class UT_Unsafe (line 17) | [TestClass]
    method NotZero (line 20) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_Utility.cs
  class UT_Utility (line 19) | [TestClass]
    method SqrtTest (line 22) | [TestMethod]
    method ModInverseTest (line 35) | [TestMethod]

FILE: tests/Neo.VM.Tests/UT_VMJson.cs
  class UT_VMJson (line 21) | [TestClass]
    method TestOthers (line 24) | [TestMethod]
    method TestOpCodesArrays (line 27) | [TestMethod]
    method TestOpCodesStack (line 30) | [TestMethod]
    method TestOpCodesSlot (line 33) | [TestMethod]
    method TestOpCodesSplice (line 36) | [TestMethod]
    method TestOpCodesControl (line 39) | [TestMethod]
    method TestOpCodesPush (line 42) | [TestMethod]
    method TestOpCodesArithmetic (line 45) | [TestMethod]
    method TestOpCodesBitwiseLogic (line 48) | [TestMethod]
    method TestOpCodesTypes (line 51) | [TestMethod]
    method TestJson (line 54) | private static void TestJson(string path)

FILE: tests/Neo.VM.Tests/VMJsonTestBase.cs
  class VMJsonTestBase (line 28) | public abstract class VMJsonTestBase
    method ExecuteTest (line 34) | public static void ExecuteTest(VMUT ut)
    method AssertResult (line 86) | private static void AssertResult(VMUTExecutionEngineState result, Test...
    method AssertResult (line 109) | private static void AssertResult(VMUTExecutionContextState[] result, S...
    method AssertResult (line 141) | private static void AssertResult(VMUTStackItem[] result, EvaluationSta...
    method AssertResult (line 157) | private static void AssertResult(VMUTStackItem[] result, Slot slot, st...
    method PrepareJsonItem (line 167) | private static JObject PrepareJsonItem(VMUTStackItem item)
    method ItemToJson (line 242) | private static JObject ItemToJson(StackItem item)
    method AssertAreEqual (line 319) | private static void AssertAreEqual(object expected, object actual, str...
Condensed preview — 270 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,655K chars).
[
  {
    "path": ".editorconfig",
    "chars": 10444,
    "preview": "###############################\n# Core EditorConfig Options   #\n###############################\n\n# dotnet-format require"
  },
  {
    "path": ".github/workflows/main.yml",
    "chars": 3415,
    "preview": "name: .NET Core Test and Publish\n\non:\n  push:\n    branches: [master]\n  pull_request:\n\nenv:\n  DOTNET_VERSION: 10.0.x\n\njob"
  },
  {
    "path": ".gitignore",
    "chars": 4239,
    "preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
  },
  {
    "path": "LICENSE",
    "chars": 1057,
    "preview": "MIT License\n\nCopyright (c) 2016 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this s"
  },
  {
    "path": "README.md",
    "chars": 2068,
    "preview": "<a href=\"https://neo.org/\"><img src=\"https://neo3.azureedge.net/images/logo%20files-dark.svg\" width=\"250px\" alt=\"neo-log"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Benchmarks.POC.cs",
    "chars": 9278,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmarks.POC.cs file belongs to the neo project and is free\n// softw"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Benchmarks_VMHotPaths.cs",
    "chars": 4743,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmarks_VMHotPaths.cs file belongs to the neo project and is free\n/"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Builders/Helper.cs",
    "chars": 2928,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Helper.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Builders/Instruction.cs",
    "chars": 1802,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Instruction.cs file belongs to the neo project and is free\n// software"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Builders/InstructionBuilder.cs",
    "chars": 7454,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// InstructionBuilder.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Builders/JumpTarget.cs",
    "chars": 529,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTarget.cs file belongs to the neo project and is free\n// software "
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Neo.VM.Benchmarks.csproj",
    "chars": 487,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <OutputType>Exe</OutputType>\r\n    <TargetFramework>net10.0</"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/Arrays/OpCode.ReverseN.cs",
    "chars": 11112,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// OpCode.ReverseN.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmark.Opcode.cs",
    "chars": 7754,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmark.Opcode.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkEngine.cs",
    "chars": 6466,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// BenchmarkEngine.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/BenchmarkMode.cs",
    "chars": 538,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// BenchmarkMode.cs file belongs to the neo project and is free\n// softwa"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/Benchmarks_StackOps.cs",
    "chars": 5022,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmarks_StackOps.cs file belongs to the neo project and is free\n// "
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/OpCodes/OpCodeBase.cs",
    "chars": 1519,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// OpCodeBase.cs file belongs to the neo project and is free\n// software "
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/Program.cs",
    "chars": 1349,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Program.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/TestArray.cs",
    "chars": 4872,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// TestArray.cs file belongs to the neo project and is free\n// software d"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/TestStruct.cs",
    "chars": 4532,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// TestStruct.cs file belongs to the neo project and is free\n// software "
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_Convert.cs",
    "chars": 14913,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmarks_Convert.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "benchmarks/Neo.VM.Benchmarks/VMTypes/Benchmarks_DeepCopy.cs",
    "chars": 3561,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Benchmarks_DeepCopy.cs file belongs to the neo project and is free\n// "
  },
  {
    "path": "neo-vm.sln",
    "chars": 2780,
    "preview": "Microsoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.2.32505."
  },
  {
    "path": "src/Neo.VM/BadScriptException.cs",
    "chars": 1058,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// BadScriptException.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "src/Neo.VM/CatchableException.cs",
    "chars": 588,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// CatchableException.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "src/Neo.VM/Collections/OrderedDictionary.cs",
    "chars": 3430,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// OrderedDictionary.cs file belongs to the neo project and is free\n// so"
  },
  {
    "path": "src/Neo.VM/Debugger.cs",
    "chars": 5217,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Debugger.cs file belongs to the neo project and is free\n// software di"
  },
  {
    "path": "src/Neo.VM/EvaluationStack.cs",
    "chars": 7270,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// EvaluationStack.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "src/Neo.VM/ExceptionHandlingContext.cs",
    "chars": 1909,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExceptionHandlingContext.cs file belongs to the neo project and is fre"
  },
  {
    "path": "src/Neo.VM/ExceptionHandlingState.cs",
    "chars": 974,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExceptionHandlingState.cs file belongs to the neo project and is free\n"
  },
  {
    "path": "src/Neo.VM/ExecutionContext.SharedStates.cs",
    "chars": 987,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExecutionContext.SharedStates.cs file belongs to the neo project and i"
  },
  {
    "path": "src/Neo.VM/ExecutionContext.cs",
    "chars": 5489,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExecutionContext.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "src/Neo.VM/ExecutionEngine.cs",
    "chars": 10484,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExecutionEngine.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "src/Neo.VM/ExecutionEngineLimits.cs",
    "chars": 2974,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ExecutionEngineLimits.cs file belongs to the neo project and is free\n/"
  },
  {
    "path": "src/Neo.VM/IReferenceCounter.cs",
    "chars": 4084,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// IReferenceCounter.cs file belongs to the neo project and is free\n// so"
  },
  {
    "path": "src/Neo.VM/Instruction.cs",
    "chars": 6942,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Instruction.cs file belongs to the neo project and is free\n// software"
  },
  {
    "path": "src/Neo.VM/IsExternalInit.cs",
    "chars": 810,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// IsExternalInit.cs file belongs to the neo project and is free\n// softw"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Bitwisee.cs",
    "chars": 3938,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Bitwisee.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Compound.cs",
    "chars": 25153,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Compound.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Control.cs",
    "chars": 32798,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Control.cs file belongs to the neo project and is free\n// so"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Numeric.cs",
    "chars": 18169,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Numeric.cs file belongs to the neo project and is free\n// so"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Push.cs",
    "chars": 15404,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Push.cs file belongs to the neo project and is free\n// softw"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Slot.cs",
    "chars": 29463,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Slot.cs file belongs to the neo project and is free\n// softw"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Splice.cs",
    "chars": 7291,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Splice.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Stack.cs",
    "chars": 9254,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Stack.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.Types.cs",
    "chars": 3802,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.Types.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "src/Neo.VM/JumpTable/JumpTable.cs",
    "chars": 2238,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JumpTable.cs file belongs to the neo project and is free\n// software d"
  },
  {
    "path": "src/Neo.VM/Neo.VM.csproj",
    "chars": 1102,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <Copyright>2015-2025 The Neo Project</Copyright>\n    <Descript"
  },
  {
    "path": "src/Neo.VM/OpCode.cs",
    "chars": 78135,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// OpCode.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/OperandSizeAttribute.cs",
    "chars": 968,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// OperandSizeAttribute.cs file belongs to the neo project and is free\n//"
  },
  {
    "path": "src/Neo.VM/RCVersion.cs",
    "chars": 492,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// RCVersion.cs file belongs to the neo project and is free\n// software d"
  },
  {
    "path": "src/Neo.VM/ReferenceCounter.cs",
    "chars": 10303,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ReferenceCounter.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "src/Neo.VM/ReferenceCounterV2.cs",
    "chars": 2955,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ReferenceCounterV2.cs file belongs to the neo project and is free\n// s"
  },
  {
    "path": "src/Neo.VM/ReferenceEqualityComparer.cs",
    "chars": 1119,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ReferenceEqualityComparer.cs file belongs to the neo project and is fr"
  },
  {
    "path": "src/Neo.VM/Script.cs",
    "chars": 7210,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Script.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/ScriptBuilder.cs",
    "chars": 7920,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ScriptBuilder.cs file belongs to the neo project and is free\n// softwa"
  },
  {
    "path": "src/Neo.VM/Slot.cs",
    "chars": 2916,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Slot.cs file belongs to the neo project and is free\n// software distri"
  },
  {
    "path": "src/Neo.VM/StronglyConnectedComponents/Tarjan.cs",
    "chars": 3578,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Tarjan.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/Types/Array.cs",
    "chars": 5850,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Array.cs file belongs to the neo project and is free\n// software distr"
  },
  {
    "path": "src/Neo.VM/Types/Boolean.cs",
    "chars": 2213,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Boolean.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "src/Neo.VM/Types/Buffer.cs",
    "chars": 3735,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Buffer.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/Types/ByteString.cs",
    "chars": 4250,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ByteString.cs file belongs to the neo project and is free\n// software "
  },
  {
    "path": "src/Neo.VM/Types/CompoundType.cs",
    "chars": 2317,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// CompoundType.cs file belongs to the neo project and is free\n// softwar"
  },
  {
    "path": "src/Neo.VM/Types/Integer.cs",
    "chars": 3817,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Integer.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "src/Neo.VM/Types/InteropInterface.cs",
    "chars": 1833,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// InteropInterface.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "src/Neo.VM/Types/Map.cs",
    "chars": 7756,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Map.cs file belongs to the neo project and is free\n// software distrib"
  },
  {
    "path": "src/Neo.VM/Types/Null.cs",
    "chars": 1775,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Null.cs file belongs to the neo project and is free\n// software distri"
  },
  {
    "path": "src/Neo.VM/Types/Pointer.cs",
    "chars": 1921,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Pointer.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "src/Neo.VM/Types/PrimitiveType.cs",
    "chars": 3666,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// PrimitiveType.cs file belongs to the neo project and is free\n// softwa"
  },
  {
    "path": "src/Neo.VM/Types/StackItem.Vertex.cs",
    "chars": 5403,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// StackItem.Vertex.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "src/Neo.VM/Types/StackItem.cs",
    "chars": 7086,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// StackItem.cs file belongs to the neo project and is free\n// software d"
  },
  {
    "path": "src/Neo.VM/Types/StackItemType.cs",
    "chars": 1685,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// StackItemType.cs file belongs to the neo project and is free\n// softwa"
  },
  {
    "path": "src/Neo.VM/Types/Struct.cs",
    "chars": 4615,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Struct.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/Unsafe.cs",
    "chars": 1114,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Unsafe.cs file belongs to the neo project and is free\n// software dist"
  },
  {
    "path": "src/Neo.VM/Utility.cs",
    "chars": 5292,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// Utility.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "src/Neo.VM/VMState.cs",
    "chars": 1062,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// VMState.cs file belongs to the neo project and is free\n// software dis"
  },
  {
    "path": "src/Neo.VM/VMUnhandledException.cs",
    "chars": 1634,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// VMUnhandledException.cs file belongs to the neo project and is free\n//"
  },
  {
    "path": "tests/Neo.VM.Tests/Converters/ScriptConverter.cs",
    "chars": 5159,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// ScriptConverter.cs file belongs to the neo project and is free\n// soft"
  },
  {
    "path": "tests/Neo.VM.Tests/Converters/UppercaseEnum.cs",
    "chars": 1021,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// UppercaseEnum.cs file belongs to the neo project and is free\n// softwa"
  },
  {
    "path": "tests/Neo.VM.Tests/Extensions/JsonExtensions.cs",
    "chars": 1695,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// JsonExtensions.cs file belongs to the neo project and is free\n// softw"
  },
  {
    "path": "tests/Neo.VM.Tests/Extensions/StringExtensions.cs",
    "chars": 1868,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// StringExtensions.cs file belongs to the neo project and is free\n// sof"
  },
  {
    "path": "tests/Neo.VM.Tests/Helpers/RandomHelper.cs",
    "chars": 1452,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// RandomHelper.cs file belongs to the neo project and is free\n// softwar"
  },
  {
    "path": "tests/Neo.VM.Tests/Neo.VM.Tests.csproj",
    "chars": 588,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net10.0</TargetFramework>\n    <RootNamespace>N"
  },
  {
    "path": "tests/Neo.VM.Tests/Properties/AssemblyInfo.cs",
    "chars": 539,
    "preview": "// Copyright (C) 2015-2026 The Neo Project.\n//\n// AssemblyInfo.cs file belongs to the neo project and is free\n// softwar"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/GE.json",
    "chars": 9837,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"GE same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/GT.json",
    "chars": 9839,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"GT same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/LE.json",
    "chars": 9837,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"LE same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/LT.json",
    "chars": 9839,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"LT same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/MODMUL.json",
    "chars": 8456,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"MODMUL\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Without items\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/MODPOW.json",
    "chars": 11015,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"MODPOW\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Without items\",\n      \"scri"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/NOT.json",
    "chars": 11972,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"NOT\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/NUMEQUAL.json",
    "chars": 24482,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"NUMEQUAL same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n     "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/NUMNOTEQUAL.json",
    "chars": 24590,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"NUMNOTEQUAL same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/POW.json",
    "chars": 4107,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"POW\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Without items\",\n      \"script\""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/SHL.json",
    "chars": 6256,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"SHL\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Above the limit 0 << 257\",\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/SHR.json",
    "chars": 6302,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"SHR\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Above the limit 0 >> 257\",\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/SIGN.json",
    "chars": 10739,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"SIGN\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arithmetic/SQRT.json",
    "chars": 4505,
    "preview": "{\n  \"category\": \"Numeric\",\n  \"name\": \"SQRT\",\n  \"tests\": [\n    {\n      \"name\": \"Exception - Without items\",\n      \"script"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/APPEND.json",
    "chars": 16608,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"APPEND\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n       "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/CLEARITEMS.json",
    "chars": 2457,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"CLEARITEMS\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/HASKEY.json",
    "chars": 8401,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"HASKEY\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n       "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/KEYS.json",
    "chars": 1151,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"KEYS\",\n  \"tests\": [\n    {\n      \"name\": \"Keys in map\",\n      \"script\": [\n        \"N"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWARRAY.json",
    "chars": 3374,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWARRAY\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n     "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWARRAY0.json",
    "chars": 479,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWARRAY0\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n       "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWARRAY_T.json",
    "chars": 5836,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWARRAY_T\",\n  \"tests\": [\n    {\n      \"name\": \"Real test [Any]\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWMAP.json",
    "chars": 963,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWMAP\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \"N"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWSTRUCT.json",
    "chars": 3381,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWSTRUCT\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/NEWSTRUCT0.json",
    "chars": 482,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"NEWSTRUCT0\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/PACK.json",
    "chars": 2161,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"PACK\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \"PUS"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/PACKMAP.json",
    "chars": 2147,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"PACKMAP\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/PACKSTRUCT.json",
    "chars": 2198,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"PACK\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \"PUS"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/PICKITEM.json",
    "chars": 16476,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"PICKITEM\",\n  \"tests\": [\n    {\n      \"name\": \"Wrong array\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/POPITEM.json",
    "chars": 3073,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"POPITEM\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/REMOVE.json",
    "chars": 6471,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"REMOVE\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n       "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/REVERSEITEMS.json",
    "chars": 2803,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"REVERSEITEMS\",\n  \"tests\": [\n    {\n      \"name\": \"Without push\",\n      \"script\": [\n "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/SETITEM.json",
    "chars": 29541,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"SETITEM\",\n  \"tests\": [\n    {\n      \"name\": \"Map in key\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/SIZE.json",
    "chars": 5544,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"SIZE\",\n  \"tests\": [\n    {\n      \"name\": \"Wrong type SYSCALL[0x77777777]+SIZE\",\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/UNPACK.json",
    "chars": 3513,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"UNPACK\",\n  \"tests\": [\n    {\n      \"name\": \"Without array\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Arrays/VALUES.json",
    "chars": 3841,
    "preview": "{\n  \"category\": \"Arrays\",\n  \"name\": \"VALUES\",\n  \"tests\": [\n    {\n      \"name\": \"No StackItem\",\n      \"script\": [\n       "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/AND.json",
    "chars": 18704,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"AND\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"script\":"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/EQUAL.json",
    "chars": 33689,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"EQUAL same types\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/INVERT.json",
    "chars": 14792,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"INVERT\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scrip"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/NOTEQUAL.json",
    "chars": 30399,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"NOTEQUAL\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"scr"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/OR.json",
    "chars": 18800,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"OR\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"script\": "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/BitwiseLogic/XOR.json",
    "chars": 18701,
    "preview": "{\n  \"category\": \"Bitwise Logic\",\n  \"name\": \"XOR\",\n  \"tests\": [\n    {\n      \"name\": \"Without two pushes\",\n      \"script\":"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/ABORT.json",
    "chars": 315,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"ABORT\",\n  \"tests\": [\n    {\n      \"name\": \"Basic Test\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/ABORTMSG.json",
    "chars": 446,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"ABORTMSG\",\n  \"tests\": [\n    {\n      \"name\": \"Basic Test\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/ASSERT.json",
    "chars": 671,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"ASSERT\",\n  \"tests\": [\n    {\n      \"name\": \"Fault Test\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/ASSERTMSG.json",
    "chars": 838,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"ASSERTMSG\",\n  \"tests\": [\n    {\n      \"name\": \"Fault Test\",\n      \"script\": [\n     "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/CALL.json",
    "chars": 2796,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"CALL\",\n  \"tests\": [\n    {\n      \"name\": \"Error negative\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/CALLA.json",
    "chars": 3534,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"CALLA\",\n  \"tests\": [\n    {\n      \"name\": \"Wrong type\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/CALL_L.json",
    "chars": 2820,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"CALL_L\",\n  \"tests\": [\n    {\n      \"name\": \"Error negative\",\n      \"script\": [\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMP.json",
    "chars": 1270,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMP\",\n  \"tests\": [\n    {\n      \"name\": \"Out of range [<0]\",\n      \"script\": [\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPEQ.json",
    "chars": 6665,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPEQ\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPEQ_L.json",
    "chars": 6713,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPEQ_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPGE.json",
    "chars": 6337,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPGE\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPGE_L.json",
    "chars": 6385,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPGE_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPGT.json",
    "chars": 6665,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPGT\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPGT_L.json",
    "chars": 6713,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPGT_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPIF.json",
    "chars": 2988,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPIF\",\n  \"tests\": [\n    {\n      \"name\": \"Without items\",\n      \"script\": [\n      "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPIFNOT.json",
    "chars": 3006,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPIFNOT\",\n  \"tests\": [\n    {\n      \"name\": \"Without items\",\n      \"script\": [\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPIFNOT_L.json",
    "chars": 3036,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPIFNOT_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without items\",\n      \"script\": [\n "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPIF_L.json",
    "chars": 3018,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPIF_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without items\",\n      \"script\": [\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPLE.json",
    "chars": 6337,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPLE\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPLE_L.json",
    "chars": 6385,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPLE_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPLT.json",
    "chars": 6665,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPLT\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPLT_L.json",
    "chars": 6713,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPLT_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPNE.json",
    "chars": 6337,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPNE\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMPNE_L.json",
    "chars": 6385,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMPNE_L\",\n  \"tests\": [\n    {\n      \"name\": \"Without all items\",\n      \"script\": [\n"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/JMP_L.json",
    "chars": 1296,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"JMP_L\",\n  \"tests\": [\n    {\n      \"name\": \"Out of range [<0]\",\n      \"script\": [\n  "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/NOP.json",
    "chars": 2032,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"NOP\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \"NOP"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/RET.json",
    "chars": 332,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"RET\",\n  \"tests\": [\n    {\n      \"name\": \"Real test\",\n      \"script\": [\n        \"RET"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/SYSCALL.json",
    "chars": 2654,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"SYSCALL\",\n  \"tests\": [\n    {\n      \"name\": \"Syscall that does not exist\",\n      \"s"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/THROW.json",
    "chars": 356,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"THROW\",\n  \"tests\": [\n    {\n      \"name\": \"Fault Test\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH.json",
    "chars": 3837,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH\",\n  \"tests\": [\n    {\n      \"name\": \"try catch with syscall exception\",\n "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY.json",
    "chars": 1575,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try catch finally without ex"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY10.json",
    "chars": 407,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try + finally without ENDTRY"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY2.json",
    "chars": 2344,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try catch finally with excep"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY3.json",
    "chars": 2509,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ try{ throw }catch{ }}ca"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY4.json",
    "chars": 2667,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ try{ throw }catch{ thro"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY5.json",
    "chars": 604,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ assert false }catch{ pu"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY6.json",
    "chars": 555,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ abort }catch{ push2 }fi"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY7.json",
    "chars": 1092,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ throw }catch{ abort }fi"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY8.json",
    "chars": 2243,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ throw }catch{ throw }fi"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_CATCH_FINALLY9.json",
    "chars": 2245,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_CATCH_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try{ PUSH0, call A: PUSH1 { "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Control/TRY_FINALLY.json",
    "chars": 910,
    "preview": "{\n  \"category\": \"Control\",\n  \"name\": \"TRY_FINALLY\",\n  \"tests\": [\n    {\n      \"name\": \"try finally with exception\",\n     "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHA.json",
    "chars": 1496,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHA\",\n  \"tests\": [\n    {\n      \"name\": \"Out of range [-1]\",\n      \"script\": [\n     "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHDATA1.json",
    "chars": 825,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHDATA1\",\n  \"tests\": [\n    {\n      \"name\": \"Good definition\",\n      \"script\": [\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHDATA2.json",
    "chars": 829,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHDATA2\",\n  \"tests\": [\n    {\n      \"name\": \"Good definition\",\n      \"script\": [\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHDATA4.json",
    "chars": 1725,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHDATA4\",\n  \"tests\": [\n    {\n      \"name\": \"More length than script\",\n      \"script"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHINT8_to_PUSHINT256.json",
    "chars": 1289,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHINT8 to PUSHINT256\",\n  \"tests\": [\n    {\n      \"name\": \"Basic Test\",\n      \"script"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHM1_to_PUSH16.json",
    "chars": 5233,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"From PUSHM1 to PUSH16 [-1 to 16]\",\n  \"tests\": [\n    {\n      \"name\": \"Basic Test\",\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Push/PUSHNULL.json",
    "chars": 911,
    "preview": "{\n  \"category\": \"Push\",\n  \"name\": \"PUSHNULL\",\n  \"tests\": [\n    {\n      \"name\": \"Good definition\",\n      \"script\": [\n    "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/INITSLOT.json",
    "chars": 4196,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"INITSLOT\",\n  \"tests\": [\n    {\n      \"name\": \"Without enough items\",\n      \"script\": ["
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/INITSSLOT.json",
    "chars": 1863,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"INITSSLOT\",\n  \"tests\": [\n    {\n      \"name\": \"Without 0 items\",\n      \"script\": [\n   "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG.json",
    "chars": 1138,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \"L"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG0.json",
    "chars": 780,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG0\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG1.json",
    "chars": 1111,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG1\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG2.json",
    "chars": 1128,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG2\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG3.json",
    "chars": 1145,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG3\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG4.json",
    "chars": 1162,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG4\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG5.json",
    "chars": 1179,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG5\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDARG6.json",
    "chars": 1196,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDARG6\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC.json",
    "chars": 1154,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \"L"
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC0.json",
    "chars": 798,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC0\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC1.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC1\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC2.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC2\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC3.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC3\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC4.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC4\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC5.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC5\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDLOC6.json",
    "chars": 1095,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDLOC6\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD.json",
    "chars": 1157,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        \""
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD0.json",
    "chars": 801,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD0\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD1.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD1\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD2.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD2\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD3.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD3\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD4.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD4\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD5.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD5\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  },
  {
    "path": "tests/Neo.VM.Tests/Tests/OpCodes/Slot/LDSFLD6.json",
    "chars": 1098,
    "preview": "{\n  \"category\": \"Slot\",\n  \"name\": \"LDSFLD6\",\n  \"tests\": [\n    {\n      \"name\": \"Without slot\",\n      \"script\": [\n        "
  }
]

// ... and 70 more files (download for full content)

About this extraction

This page contains the full source code of the neo-project/neo-vm GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 270 files (1.4 MB), approximately 358.8k tokens, and a symbol index with 848 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!