aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/evm
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-08 21:36:26 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-08 21:36:26 +0800
commitc93f0b9f4ba84933110435a80055cdaabd078159 (patch)
treec51e0d5704aa08595ebdd7e03b61309fe69fe848 /cmd/evm
parent312128384b1c32306123f8ad3be1be32bbd8235c (diff)
parentac697326a6045eaa760b159e4bda37c57be61cbf (diff)
downloadgo-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar.gz
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar.bz2
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar.lz
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar.xz
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.tar.zst
go-tangerine-c93f0b9f4ba84933110435a80055cdaabd078159.zip
Merge pull request #1490 from obscuren/jit-vm
core/vm: jit vm
Diffstat (limited to 'cmd/evm')
-rw-r--r--cmd/evm/main.go29
1 files changed, 23 insertions, 6 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index 965994382..be6546c95 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/logger/glog"
)
var (
@@ -40,6 +41,14 @@ var (
Name: "debug",
Usage: "output full trace logs",
}
+ ForceJitFlag = cli.BoolFlag{
+ Name: "forcejit",
+ Usage: "forces jit compilation",
+ }
+ DisableJitFlag = cli.BoolFlag{
+ Name: "nojit",
+ Usage: "disabled jit compilation",
+ }
CodeFlag = cli.StringFlag{
Name: "code",
Usage: "EVM code",
@@ -77,6 +86,8 @@ func init() {
app = utils.NewApp("0.2", "the evm command line interface")
app.Flags = []cli.Flag{
DebugFlag,
+ ForceJitFlag,
+ DisableJitFlag,
SysStatFlag,
CodeFlag,
GasFlag,
@@ -90,6 +101,10 @@ func init() {
func run(ctx *cli.Context) {
vm.Debug = ctx.GlobalBool(DebugFlag.Name)
+ vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name)
+ vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name)
+
+ glog.SetToStderr(true)
db, _ := ethdb.NewMemDatabase()
statedb := state.New(common.Hash{}, db)
@@ -110,11 +125,6 @@ func run(ctx *cli.Context) {
)
vmdone := time.Since(tstart)
- if e != nil {
- fmt.Println(e)
- os.Exit(1)
- }
-
if ctx.GlobalBool(DumpFlag.Name) {
fmt.Println(string(statedb.Dump()))
}
@@ -133,7 +143,11 @@ num gc: %d
`, mem.Alloc, mem.TotalAlloc, mem.Mallocs, mem.HeapAlloc, mem.HeapObjects, mem.NumGC)
}
- fmt.Printf("OUT: 0x%x\n", ret)
+ fmt.Printf("OUT: 0x%x", ret)
+ if e != nil {
+ fmt.Printf(" error: %v", e)
+ }
+ fmt.Println()
}
func main() {
@@ -192,6 +206,9 @@ func (self *VMEnv) StructLogs() []vm.StructLog {
func (self *VMEnv) AddLog(log *state.Log) {
self.state.AddLog(log)
}
+func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool {
+ return from.Balance().Cmp(balance) >= 0
+}
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}