aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/stack.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-07 05:06:47 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-07 18:52:23 +0800
commitac697326a6045eaa760b159e4bda37c57be61cbf (patch)
tree9f26ac6308b7ae0b9d0a6daab772aae796ee7a54 /core/vm/stack.go
parent184e9ae9a81df2db6381e18d3daa035d913ae341 (diff)
downloadgo-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar.gz
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar.bz2
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar.lz
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar.xz
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.tar.zst
go-tangerine-ac697326a6045eaa760b159e4bda37c57be61cbf.zip
core/vm: reduced big int allocations
Reduced big int allocation by making stack items modifiable. Instead of adding items such as `common.Big0` to the stack, `new(big.Int)` is added instead. One must expect that any item that is added to the stack might change.
Diffstat (limited to 'core/vm/stack.go')
-rw-r--r--core/vm/stack.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/vm/stack.go b/core/vm/stack.go
index 23c109455..009ac9e1b 100644
--- a/core/vm/stack.go
+++ b/core/vm/stack.go
@@ -21,14 +21,17 @@ import (
"math/big"
)
-func newstack() *stack {
- return &stack{}
-}
-
+// stack is an object for basic stack operations. Items popped to the stack are
+// expected to be changed and modified. stack does not take care of adding newly
+// initialised objects.
type stack struct {
data []*big.Int
}
+func newstack() *stack {
+ return &stack{}
+}
+
func (st *stack) Data() []*big.Int {
return st.data
}