mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
* Implement the ewasm module and the EEI. * Add an ewasm standalone binary to test standalone files * use reflection to declare EEI module exports * check the module name when importing EEI functions * make eeiFuncs a function to avoid an init loop issue in call * Add a reference to the ewasm tests * wagon implementation of the Interpreter interface * update to wagon's PR #59 and uses the Process structure * Adapt to endianness change * All tests but 1 passing * CanRun only checks for the header * Add a "debug" module to support "printHex" in contracts Notes: * There are very little checks, e.g. of the call depths and so on.
40 lines
739 B
Go
40 lines
739 B
Go
// Copyright 2017 The go-interpreter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package stack implements a growable uint64 stack
|
|
package stack
|
|
|
|
type Stack struct {
|
|
slice []uint64
|
|
}
|
|
|
|
func (s *Stack) Push(b uint64) {
|
|
s.slice = append(s.slice, b)
|
|
}
|
|
|
|
func (s *Stack) Pop() uint64 {
|
|
v := s.Top()
|
|
s.slice = s.slice[:len(s.slice)-1]
|
|
return v
|
|
}
|
|
|
|
func (s *Stack) SetTop(v uint64) {
|
|
s.slice[len(s.slice)-1] = v
|
|
}
|
|
|
|
func (s *Stack) Top() uint64 {
|
|
return s.slice[len(s.slice)-1]
|
|
}
|
|
|
|
func (s *Stack) Get(i int) uint64 {
|
|
return s.slice[i]
|
|
}
|
|
|
|
func (s *Stack) Set(i int, v uint64) {
|
|
s.slice[i] = v
|
|
}
|
|
|
|
func (s *Stack) Len() int {
|
|
return len(s.slice)
|
|
}
|