aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-18 05:09:36 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-07 18:52:17 +0800
commit846f34f78b5f76233655d0cf3611706e99f2efe2 (patch)
tree4e25f0320e30c0ed45b706835fd4377632bdcb45 /cmd
parent698e98d9814605bfea98ba3ad2fe7fda073cb2b1 (diff)
downloaddexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar.gz
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar.bz2
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar.lz
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar.xz
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.tar.zst
dexon-846f34f78b5f76233655d0cf3611706e99f2efe2.zip
core/vm, tests: implemented semi-jit vm
* changed stack and removed stack ptr. Let go decide on slice reuse.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/evm/main.go26
-rw-r--r--cmd/geth/main.go3
-rw-r--r--cmd/utils/flags.go31
3 files changed, 50 insertions, 10 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index 965994382..7dd375b14 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() {
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 74f4e90c3..68c66a4ab 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -307,6 +307,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.ExecFlag,
utils.WhisperEnabledFlag,
utils.VMDebugFlag,
+ utils.VMForceJitFlag,
+ utils.VMJitCacheFlag,
+ utils.VMEnableJitFlag,
utils.NetworkIdFlag,
utils.RPCCORSDomainFlag,
utils.VerbosityFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index cf969805d..e7b30cfa0 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -27,6 +27,7 @@ import (
"runtime"
"strconv"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/metrics"
"github.com/codegangsta/cli"
@@ -172,6 +173,25 @@ var (
Value: "",
}
+ // vm flags
+ VMDebugFlag = cli.BoolFlag{
+ Name: "vmdebug",
+ Usage: "Virtual Machine debug output",
+ }
+ VMForceJitFlag = cli.BoolFlag{
+ Name: "forcejit",
+ Usage: "Force the JIT VM to take precedence",
+ }
+ VMJitCacheFlag = cli.IntFlag{
+ Name: "jitcache",
+ Usage: "Amount of cached JIT VM programs",
+ Value: 64,
+ }
+ VMEnableJitFlag = cli.BoolFlag{
+ Name: "jitvm",
+ Usage: "Enable the JIT VM",
+ }
+
// logging and debug settings
LogFileFlag = cli.StringFlag{
Name: "logfile",
@@ -196,10 +216,6 @@ var (
Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.",
Value: glog.GetVModule(),
}
- VMDebugFlag = cli.BoolFlag{
- Name: "vmdebug",
- Usage: "Virtual Machine debug output",
- }
BacktraceAtFlag = cli.GenericFlag{
Name: "backtrace_at",
Usage: "If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged",
@@ -434,6 +450,13 @@ func SetupLogger(ctx *cli.Context) {
glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name))
}
+// SetupVM configured the VM package's global settings
+func SetupVM(ctx *cli.Context) {
+ vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name)
+ vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name)
+ vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name))
+}
+
// MakeChain creates a chain manager from set command line flags.
func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) {
datadir := ctx.GlobalString(DataDirFlag.Name)