diff options
Diffstat (limited to 'vm/common.go')
-rw-r--r-- | vm/common.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/vm/common.go b/vm/common.go index 529bbdeb1..45a7187a9 100644 --- a/vm/common.go +++ b/vm/common.go @@ -9,15 +9,27 @@ import ( var vmlogger = logger.NewLogger("VM") -type Type int +type Type byte const ( - StandardVmTy Type = iota - DebugVmTy + StdVmTy Type = iota + JitVmTy MaxVmTy ) +func NewVm(env Environment) VirtualMachine { + switch env.VmType() { + case JitVmTy: + return NewJitVm(env) + default: + vmlogger.Infoln("unsupported vm type %d", env.VmType()) + fallthrough + case StdVmTy: + return New(env) + } +} + var ( GasStep = big.NewInt(1) GasSha = big.NewInt(10) @@ -38,6 +50,7 @@ var ( GasSha256 = big.NewInt(50) GasRipemd = big.NewInt(50) GasEcrecover = big.NewInt(500) + GasMemCpy = big.NewInt(1) Pow256 = ethutil.BigPow(2, 256) @@ -48,7 +61,7 @@ var ( S256 = ethutil.S256 ) -const MaxCallDepth = 1024 +const MaxCallDepth = 1025 func calcMemSize(off, l *big.Int) *big.Int { if l.Cmp(ethutil.Big0) == 0 { |