Added dumps
This commit is contained in:
parent
d30571a7a8
commit
ebb7db263f
|
@ -32,6 +32,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/state"
|
"github.com/ethereum/go-ethereum/state"
|
||||||
|
@ -64,13 +65,18 @@ func main() {
|
||||||
|
|
||||||
tstart := time.Now()
|
tstart := time.Now()
|
||||||
|
|
||||||
ret, _, e := closure.Call(vm.New(NewVmEnv(), vm.DebugVmTy), nil)
|
env := NewVmEnv()
|
||||||
|
ret, _, e := closure.Call(vm.New(env, vm.DebugVmTy), nil)
|
||||||
|
|
||||||
logger.Flush()
|
logger.Flush()
|
||||||
if e != nil {
|
if e != nil {
|
||||||
perr(e)
|
perr(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *dump {
|
||||||
|
fmt.Println(string(env.state.Dump()))
|
||||||
|
}
|
||||||
|
|
||||||
var mem runtime.MemStats
|
var mem runtime.MemStats
|
||||||
runtime.ReadMemStats(&mem)
|
runtime.ReadMemStats(&mem)
|
||||||
fmt.Printf("vm took %v\n", time.Since(tstart))
|
fmt.Printf("vm took %v\n", time.Since(tstart))
|
||||||
|
@ -90,7 +96,8 @@ type VmEnv struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVmEnv() *VmEnv {
|
func NewVmEnv() *VmEnv {
|
||||||
return &VmEnv{state.New(trie.New(nil, ""))}
|
db, _ := ethdb.NewMemDatabase()
|
||||||
|
return &VmEnv{state.New(trie.New(db, ""))}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (VmEnv) Origin() []byte { return nil }
|
func (VmEnv) Origin() []byte { return nil }
|
||||||
|
|
Loading…
Reference in New Issue