forked from TrueCloudLab/neoneo-go
vm: don't allocate another stack for entry scripts
vm.New() creates a new stack, then we load an entry script with LoadScriptWithFlags and it creates another one which doesn't make much sense. rvcount is -1 for it, so all elements are to be copied down anyway and it's clear so a new loaded script can't dig down to anything it shouldn't be able to.
This commit is contained in:
parent
ac7e922606
commit
53cfde62de
1 changed files with 3 additions and 1 deletions
|
@ -317,7 +317,9 @@ func (v *VM) loadScriptWithCallingHash(b []byte, exe *nef.File, caller util.Uint
|
||||||
|
|
||||||
v.checkInvocationStackSize()
|
v.checkInvocationStackSize()
|
||||||
ctx := NewContextWithParams(b, rvcount, offset)
|
ctx := NewContextWithParams(b, rvcount, offset)
|
||||||
v.estack = newStack("evaluation", &v.refs)
|
if rvcount != -1 || v.estack.Len() != 0 {
|
||||||
|
v.estack = newStack("evaluation", &v.refs)
|
||||||
|
}
|
||||||
ctx.estack = v.estack
|
ctx.estack = v.estack
|
||||||
initStack(&ctx.tryStack, "exception", nil)
|
initStack(&ctx.tryStack, "exception", nil)
|
||||||
ctx.callFlag = f
|
ctx.callFlag = f
|
||||||
|
|
Loading…
Reference in a new issue