vm: remove istack redirection in VM

VM always has istack and it doesn't even change, so doing this microallocation
makes no sense. Notice that estack is a bit harder to change we do replace it
in some cases and we compare pointers to it as well.
This commit is contained in:
Roman Khimov 2021-08-11 14:40:41 +03:00
parent ff7d594bef
commit bdb2d24a5a
2 changed files with 12 additions and 10 deletions

View file

@ -162,13 +162,15 @@ func NewStack(n string) *Stack {
}
func newStack(n string, refc *refCounter) *Stack {
s := &Stack{
name: n,
refs: refc,
}
s := new(Stack)
initStack(s, n, refc)
return s
}
func initStack(s *Stack, n string, refc *refCounter) {
s.name = n
s.refs = refc
s.top.next = &s.top
s.top.prev = &s.top
return s
}
// Clear clears all elements on the stack and set its length to 0.