mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-24 09:25:21 +00:00
vm: remove unused parameter from getJumpOffset
This commit is contained in:
parent
270377637a
commit
709f656bcf
1 changed files with 4 additions and 4 deletions
|
@ -1218,7 +1218,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
||||||
opcode.JMPEQ, opcode.JMPEQL, opcode.JMPNE, opcode.JMPNEL,
|
opcode.JMPEQ, opcode.JMPEQL, opcode.JMPNE, opcode.JMPNEL,
|
||||||
opcode.JMPGT, opcode.JMPGTL, opcode.JMPGE, opcode.JMPGEL,
|
opcode.JMPGT, opcode.JMPGTL, opcode.JMPGE, opcode.JMPGEL,
|
||||||
opcode.JMPLT, opcode.JMPLTL, opcode.JMPLE, opcode.JMPLEL:
|
opcode.JMPLT, opcode.JMPLTL, opcode.JMPLE, opcode.JMPLEL:
|
||||||
offset := v.getJumpOffset(ctx, parameter, 0)
|
offset := v.getJumpOffset(ctx, parameter)
|
||||||
cond := true
|
cond := true
|
||||||
switch op {
|
switch op {
|
||||||
case opcode.JMP, opcode.JMPL:
|
case opcode.JMP, opcode.JMPL:
|
||||||
|
@ -1240,7 +1240,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
||||||
newCtx.rvcount = -1
|
newCtx.rvcount = -1
|
||||||
v.istack.PushVal(newCtx)
|
v.istack.PushVal(newCtx)
|
||||||
|
|
||||||
offset := v.getJumpOffset(newCtx, parameter, 0)
|
offset := v.getJumpOffset(newCtx, parameter)
|
||||||
v.jumpIf(newCtx, offset, true)
|
v.jumpIf(newCtx, offset, true)
|
||||||
|
|
||||||
case opcode.CALLA:
|
case opcode.CALLA:
|
||||||
|
@ -1423,7 +1423,7 @@ func (v *VM) jumpIf(ctx *Context, offset int, cond bool) {
|
||||||
// to a which JMP should be performed.
|
// to a which JMP should be performed.
|
||||||
// parameter should have length either 1 or 4 and
|
// parameter should have length either 1 or 4 and
|
||||||
// is interpreted as little-endian.
|
// is interpreted as little-endian.
|
||||||
func (v *VM) getJumpOffset(ctx *Context, parameter []byte, mod int) int {
|
func (v *VM) getJumpOffset(ctx *Context, parameter []byte) int {
|
||||||
var rOffset int32
|
var rOffset int32
|
||||||
switch l := len(parameter); l {
|
switch l := len(parameter); l {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1433,7 +1433,7 @@ func (v *VM) getJumpOffset(ctx *Context, parameter []byte, mod int) int {
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid JMP* parameter length: %d", l))
|
panic(fmt.Sprintf("invalid JMP* parameter length: %d", l))
|
||||||
}
|
}
|
||||||
offset := ctx.ip + int(rOffset) + mod
|
offset := ctx.ip + int(rOffset)
|
||||||
if offset < 0 || offset > len(ctx.prog) {
|
if offset < 0 || offset > len(ctx.prog) {
|
||||||
panic(fmt.Sprintf("JMP: invalid offset %d ip at %d", offset, ctx.ip))
|
panic(fmt.Sprintf("JMP: invalid offset %d ip at %d", offset, ctx.ip))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue