cmd/evm, core/vm, tests: changed DisableVm to EnableVm

pull/1638/head
Jeffrey Wilcke 9 years ago
parent 32395ddb89
commit 9cacec70f9
  1. 2
      cmd/evm/main.go
  2. 2
      cmd/utils/flags.go
  3. 12
      core/block_processor.go
  4. 2
      core/vm/jit_test.go
  5. 6
      core/vm/settings.go
  6. 2
      core/vm/vm.go
  7. 5
      tests/state_test.go
  8. 6
      tests/state_test_util.go
  9. 5
      tests/vm_test.go
  10. 8
      tests/vm_test_util.go

@ -102,7 +102,7 @@ func init() {
func run(ctx *cli.Context) { func run(ctx *cli.Context) {
vm.Debug = ctx.GlobalBool(DebugFlag.Name) vm.Debug = ctx.GlobalBool(DebugFlag.Name)
vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name)
vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name) vm.EnableJit = !ctx.GlobalBool(DisableJitFlag.Name)
glog.SetToStderr(true) glog.SetToStderr(true)

@ -452,7 +452,7 @@ func SetupLogger(ctx *cli.Context) {
// SetupVM configured the VM package's global settings // SetupVM configured the VM package's global settings
func SetupVM(ctx *cli.Context) { func SetupVM(ctx *cli.Context) {
vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name) vm.EnableJit = ctx.GlobalBool(VMEnableJitFlag.Name)
vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name) vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name)
vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name)) vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name))
} }

@ -354,18 +354,8 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
for _, receipt := range receipts { for _, receipt := range receipts {
logs = append(logs, receipt.Logs()...) logs = append(logs, receipt.Logs()...)
} }
return
} }
return logs, nil
// TODO: remove backward compatibility
var (
parent = sm.bc.GetBlock(block.ParentHash())
state = state.New(parent.Root(), sm.chainDb)
)
sm.TransitionState(state, parent, block, true)
return state.Logs(), nil
} }
// See YP section 4.3.4. "Block Header Validity" // See YP section 4.3.4. "Block Header Validity"

@ -46,7 +46,7 @@ func runVmBench(test vmBench, b *testing.B) {
} }
env := NewEnv() env := NewEnv()
DisableJit = test.nojit EnableJit = !test.nojit
ForceJit = test.forcejit ForceJit = test.forcejit
b.ResetTimer() b.ResetTimer()

@ -17,9 +17,9 @@
package vm package vm
var ( var (
DisableJit bool = true // Disable the JIT VM EnableJit bool // Enables the JIT VM
ForceJit bool // Force the JIT, skip byte VM ForceJit bool // Force the JIT, skip byte VM
MaxProgSize int // Max cache size for JIT Programs MaxProgSize int // Max cache size for JIT Programs
) )
const defaultJitMaxCache int = 64 const defaultJitMaxCache int = 64

@ -64,7 +64,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) {
codehash = crypto.Sha3Hash(context.Code) // codehash is used when doing jump dest caching codehash = crypto.Sha3Hash(context.Code) // codehash is used when doing jump dest caching
program *Program program *Program
) )
if !DisableJit { if EnableJit {
// Fetch program status. // Fetch program status.
// * If ready run using JIT // * If ready run using JIT
// * If unknown, compile in a seperate goroutine // * If unknown, compile in a seperate goroutine

@ -27,14 +27,13 @@ import (
func init() { func init() {
if os.Getenv("JITVM") == "true" { if os.Getenv("JITVM") == "true" {
vm.ForceJit = true vm.ForceJit = true
} else { vm.EnableJit = true
vm.DisableJit = true
} }
} }
func BenchmarkStateCall1024(b *testing.B) { func BenchmarkStateCall1024(b *testing.B) {
fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json")
if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, false}, b); err != nil { if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, os.Getenv("JITVM") == "true"}, b); err != nil {
b.Error(err) b.Error(err)
} }
} }

@ -71,8 +71,8 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error {
return fmt.Errorf("test not found: %s", conf.name) return fmt.Errorf("test not found: %s", conf.name)
} }
pNoJit := vm.DisableJit pJit := vm.EnableJit
vm.DisableJit = conf.nojit vm.EnableJit = conf.jit
pForceJit := vm.ForceJit pForceJit := vm.ForceJit
vm.ForceJit = conf.precomp vm.ForceJit = conf.precomp
@ -94,7 +94,7 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error {
benchStateTest(test, env, b) benchStateTest(test, env, b)
} }
vm.DisableJit = pNoJit vm.EnableJit = pJit
vm.ForceJit = pForceJit vm.ForceJit = pForceJit
return nil return nil

@ -17,20 +17,21 @@
package tests package tests
import ( import (
"os"
"path/filepath" "path/filepath"
"testing" "testing"
) )
func BenchmarkVmAckermann32Tests(b *testing.B) { func BenchmarkVmAckermann32Tests(b *testing.B) {
fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") fn := filepath.Join(vmTestDir, "vmPerformanceTest.json")
if err := BenchVmTest(fn, bconf{"ackermann32", true, false}, b); err != nil { if err := BenchVmTest(fn, bconf{"ackermann32", true, os.Getenv("JITVM") == "true"}, b); err != nil {
b.Error(err) b.Error(err)
} }
} }
func BenchmarkVmFibonacci16Tests(b *testing.B) { func BenchmarkVmFibonacci16Tests(b *testing.B) {
fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") fn := filepath.Join(vmTestDir, "vmPerformanceTest.json")
if err := BenchVmTest(fn, bconf{"fibonacci16", true, false}, b); err != nil { if err := BenchVmTest(fn, bconf{"fibonacci16", true, os.Getenv("JITVM") == "true"}, b); err != nil {
b.Error(err) b.Error(err)
} }
} }

@ -52,7 +52,7 @@ func RunVmTestWithReader(r io.Reader, skipTests []string) error {
type bconf struct { type bconf struct {
name string name string
precomp bool precomp bool
nojit bool jit bool
} }
func BenchVmTest(p string, conf bconf, b *testing.B) error { func BenchVmTest(p string, conf bconf, b *testing.B) error {
@ -67,8 +67,8 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error {
return fmt.Errorf("test not found: %s", conf.name) return fmt.Errorf("test not found: %s", conf.name)
} }
pNoJit := vm.DisableJit pJit := vm.EnableJit
vm.DisableJit = conf.nojit vm.EnableJit = conf.jit
pForceJit := vm.ForceJit pForceJit := vm.ForceJit
vm.ForceJit = conf.precomp vm.ForceJit = conf.precomp
@ -99,7 +99,7 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error {
benchVmTest(test, env, b) benchVmTest(test, env, b)
} }
vm.DisableJit = pNoJit vm.EnableJit = pJit
vm.ForceJit = pForceJit vm.ForceJit = pForceJit
return nil return nil

Loading…
Cancel
Save