github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/core/vm/doc.go (about)

     1  // This file is part of the go-sberex library. The go-sberex library is 
     2  // free software: you can redistribute it and/or modify it under the terms 
     3  // of the GNU Lesser General Public License as published by the Free 
     4  // Software Foundation, either version 3 of the License, or (at your option)
     5  // any later version.
     6  //
     7  // The go-sberex library is distributed in the hope that it will be useful, 
     8  // but WITHOUT ANY WARRANTY; without even the implied warranty of
     9  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 
    10  // General Public License <http://www.gnu.org/licenses/> for more details.
    11  
    12  /*
    13  Package vm implements the Sberex Virtual Machine.
    14  
    15  The vm package implements two EVMs, a byte code VM and a JIT VM. The BC
    16  (Byte Code) VM loops over a set of bytes and executes them according to the set
    17  of rules defined in the yellow paper. When the BC VM is invoked it
    18  invokes the JIT VM in a separate goroutine and compiles the byte code in JIT
    19  instructions.
    20  
    21  The JIT VM, when invoked, loops around a set of pre-defined instructions until
    22  it either runs of gas, causes an internal error, returns or stops.
    23  
    24  The JIT optimiser attempts to pre-compile instructions in to chunks or segments
    25  such as multiple PUSH operations and static JUMPs. It does this by analysing the
    26  opcodes and attempts to match certain regions to known sets. Whenever the
    27  optimiser finds said segments it creates a new instruction and replaces the
    28  first occurrence in the sequence.
    29  */
    30  package vm