2019-03-15 22:36:16 +00:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import "github.com/CityOfZion/neo-go/pkg/vm/stack"
|
|
|
|
|
2019-03-18 21:13:08 +00:00
|
|
|
type stackInfo func(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rstack *stack.RandomAccess) (Vmstate, error)
|
|
|
|
|
|
|
|
var opFunc = map[stack.Instruction]stackInfo{
|
2019-04-10 22:07:17 +00:00
|
|
|
stack.XDROP: XDROP,
|
|
|
|
stack.FROMALTSTACK: FROMALTSTACK,
|
|
|
|
stack.TOALTSTACK: TOALTSTACK,
|
|
|
|
stack.DUPFROMALTSTACK: DUPFROMALTSTACK,
|
|
|
|
stack.NUMEQUAL: NumEqual,
|
|
|
|
stack.NUMNOTEQUAL: NumNotEqual,
|
|
|
|
stack.BOOLAND: BoolAnd,
|
|
|
|
stack.BOOLOR: BoolOr,
|
|
|
|
stack.LT: Lt,
|
|
|
|
stack.LTE: Lte,
|
|
|
|
stack.GT: Gt,
|
|
|
|
stack.GTE: Gte,
|
|
|
|
stack.SHR: Shr,
|
|
|
|
stack.SHL: Shl,
|
|
|
|
stack.INC: Inc,
|
|
|
|
stack.DEC: Dec,
|
|
|
|
stack.DIV: Div,
|
|
|
|
stack.MOD: Mod,
|
|
|
|
stack.NZ: Nz,
|
|
|
|
stack.MUL: Mul,
|
|
|
|
stack.ABS: Abs,
|
|
|
|
stack.NOT: Not,
|
|
|
|
stack.SIGN: Sign,
|
|
|
|
stack.NEGATE: Negate,
|
|
|
|
stack.ADD: Add,
|
|
|
|
stack.SUB: Sub,
|
|
|
|
stack.PUSHBYTES1: PushNBytes,
|
|
|
|
stack.PUSHBYTES75: PushNBytes,
|
|
|
|
stack.RET: RET,
|
|
|
|
stack.EQUAL: EQUAL,
|
|
|
|
stack.THROWIFNOT: THROWIFNOT,
|
|
|
|
stack.THROW: THROW,
|
2019-03-15 23:37:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
for i := int(stack.PUSHBYTES1); i <= int(stack.PUSHBYTES75); i++ {
|
|
|
|
opFunc[stack.Instruction(i)] = PushNBytes
|
|
|
|
}
|
2019-03-15 22:36:16 +00:00
|
|
|
}
|