mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
vm: remove rvcount
It isn't used anymore.
This commit is contained in:
parent
261ff3c655
commit
58a594e3d4
2 changed files with 2 additions and 14 deletions
|
@ -26,9 +26,6 @@ type Context struct {
|
|||
// Breakpoints.
|
||||
breakPoints []int
|
||||
|
||||
// Return value count, -1 is unspecified.
|
||||
rvcount int
|
||||
|
||||
// Evaluation stack pointer.
|
||||
estack *Stack
|
||||
|
||||
|
@ -53,7 +50,6 @@ func NewContext(b []byte) *Context {
|
|||
return &Context{
|
||||
prog: b,
|
||||
breakPoints: []int{},
|
||||
rvcount: -1,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
pkg/vm/vm.go
12
pkg/vm/vm.go
|
@ -1233,7 +1233,6 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
newCtx := ctx.Copy()
|
||||
newCtx.local = nil
|
||||
newCtx.arguments = nil
|
||||
newCtx.rvcount = -1
|
||||
v.istack.PushVal(newCtx)
|
||||
|
||||
offset := v.getJumpOffset(newCtx, parameter)
|
||||
|
@ -1248,7 +1247,6 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
newCtx := ctx.Copy()
|
||||
newCtx.local = nil
|
||||
newCtx.arguments = nil
|
||||
newCtx.rvcount = -1
|
||||
v.istack.PushVal(newCtx)
|
||||
v.jumpIf(newCtx, ptr.Position(), true)
|
||||
|
||||
|
@ -1270,13 +1268,9 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
}
|
||||
|
||||
case opcode.RET:
|
||||
oldCtx := v.istack.Pop().Value().(*Context)
|
||||
rvcount := oldCtx.rvcount
|
||||
v.istack.Pop()
|
||||
oldEstack := v.estack
|
||||
|
||||
if rvcount > 0 && oldEstack.Len() < rvcount {
|
||||
panic("missing some return elements")
|
||||
}
|
||||
if v.istack.Len() == 0 {
|
||||
v.state = haltState
|
||||
break
|
||||
|
@ -1284,9 +1278,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
|
||||
newEstack := v.Context().estack
|
||||
if oldEstack != newEstack {
|
||||
if rvcount < 0 {
|
||||
rvcount = oldEstack.Len()
|
||||
}
|
||||
rvcount := oldEstack.Len()
|
||||
for i := rvcount; i > 0; i-- {
|
||||
elem := oldEstack.RemoveAt(i - 1)
|
||||
newEstack.Push(elem)
|
||||
|
|
Loading…
Reference in a new issue