aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/stack.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/stack.go')
-rw-r--r--core/vm/stack.go21
1 files changed, 8 insertions, 13 deletions
diff --git a/core/vm/stack.go b/core/vm/stack.go
index 3d669b2f2..23c109455 100644
--- a/core/vm/stack.go
+++ b/core/vm/stack.go
@@ -27,32 +27,27 @@ func newstack() *stack {
type stack struct {
data []*big.Int
- ptr int
}
func (st *stack) Data() []*big.Int {
- return st.data[:st.ptr]
+ return st.data
}
func (st *stack) push(d *big.Int) {
// NOTE push limit (1024) is checked in baseCheck
- stackItem := new(big.Int).Set(d)
- if len(st.data) > st.ptr {
- st.data[st.ptr] = stackItem
- } else {
- st.data = append(st.data, stackItem)
- }
- st.ptr++
+ //stackItem := new(big.Int).Set(d)
+ //st.data = append(st.data, stackItem)
+ st.data = append(st.data, d)
}
func (st *stack) pop() (ret *big.Int) {
- st.ptr--
- ret = st.data[st.ptr]
+ ret = st.data[len(st.data)-1]
+ st.data = st.data[:len(st.data)-1]
return
}
func (st *stack) len() int {
- return st.ptr
+ return len(st.data)
}
func (st *stack) swap(n int) {
@@ -60,7 +55,7 @@ func (st *stack) swap(n int) {
}
func (st *stack) dup(n int) {
- st.push(st.data[st.len()-n])
+ st.push(new(big.Int).Set(st.data[st.len()-n]))
}
func (st *stack) peek() *big.Int {