aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-11 18:32:39 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-11 18:32:39 +0800
commit6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920 (patch)
tree5cb56f1a9ce712178bd19886c389166562f6f328 /cmd
parent13bd452fafae000b5b3d5769af5554de7c5f9779 (diff)
parent37111aa4bd215cfc8bcfb97cdc7e223649306196 (diff)
downloaddexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar.gz
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar.bz2
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar.lz
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar.xz
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.tar.zst
dexon-6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920.zip
Merge pull request #1228 from obscuren/vm-optimisations
core/vm: optimisations
Diffstat (limited to 'cmd')
-rw-r--r--cmd/evm/main.go10
-rw-r--r--cmd/geth/admin.go7
2 files changed, 15 insertions, 2 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index 561f1a943..7c9d27fac 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -59,6 +59,7 @@ func main() {
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(*loglevel)))
+ vm.Debug = true
db, _ := ethdb.NewMemDatabase()
statedb := state.New(common.Hash{}, db)
sender := statedb.CreateAccount(common.StringToAddress("sender"))
@@ -80,6 +81,8 @@ func main() {
fmt.Println(string(statedb.Dump()))
}
+ vm.StdErrFormat(vmenv.StructLogs())
+
var mem runtime.MemStats
runtime.ReadMemStats(&mem)
fmt.Printf("vm took %v\n", time.Since(tstart))
@@ -104,6 +107,7 @@ type VMEnv struct {
depth int
Gas *big.Int
time int64
+ logs []vm.StructLog
}
func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int) *VMEnv {
@@ -133,6 +137,12 @@ func (self *VMEnv) GetHash(n uint64) common.Hash {
}
return common.Hash{}
}
+func (self *VMEnv) AddStructLog(log vm.StructLog) {
+ self.logs = append(self.logs, log)
+}
+func (self *VMEnv) StructLogs() []vm.StructLog {
+ return self.logs
+}
func (self *VMEnv) AddLog(log *state.Log) {
self.state.AddLog(log)
}
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index 4f22110ad..33ef69792 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -271,9 +271,12 @@ func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value {
}
tstart := time.Now()
-
old := vm.Debug
- vm.Debug = true
+
+ if len(call.ArgumentList) > 1 {
+ vm.Debug, _ = call.Argument(1).ToBoolean()
+ }
+
_, err = js.ethereum.BlockProcessor().RetryProcess(block)
if err != nil {
fmt.Println(err)