mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 23:33:37 +00:00
vm: implement CALLT opcode
This commit is contained in:
parent
8fad05c5bb
commit
bb706aa55b
2 changed files with 10 additions and 1 deletions
|
@ -144,7 +144,7 @@ func (c *Context) Next() (opcode.Opcode, []byte, error) {
|
|||
opcode.ENDTRY,
|
||||
opcode.INITSSLOT, opcode.LDSFLD, opcode.STSFLD, opcode.LDARG, opcode.STARG, opcode.LDLOC, opcode.STLOC:
|
||||
numtoread = 1
|
||||
case opcode.INITSLOT, opcode.TRY:
|
||||
case opcode.INITSLOT, opcode.TRY, opcode.CALLT:
|
||||
numtoread = 2
|
||||
case opcode.JMPL, opcode.JMPIFL, opcode.JMPIFNOTL, opcode.JMPEQL, opcode.JMPNEL,
|
||||
opcode.JMPGTL, opcode.JMPGEL, opcode.JMPLTL, opcode.JMPLEL,
|
||||
|
|
|
@ -80,6 +80,9 @@ type VM struct {
|
|||
// SyscallHandler handles SYSCALL opcode.
|
||||
SyscallHandler func(v *VM, id uint32) error
|
||||
|
||||
// LoadToken handles CALLT opcode.
|
||||
LoadToken func(id int32) error
|
||||
|
||||
trigger trigger.Type
|
||||
|
||||
// Invocations is a script invocation counter.
|
||||
|
@ -1276,6 +1279,12 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
|
||||
v.call(ctx, ptr.Position())
|
||||
|
||||
case opcode.CALLT:
|
||||
id := int32(binary.LittleEndian.Uint16(parameter))
|
||||
if err := v.LoadToken(id); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
case opcode.SYSCALL:
|
||||
interopID := GetInteropID(parameter)
|
||||
err := v.SyscallHandler(v, interopID)
|
||||
|
|
Loading…
Reference in a new issue