aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-14 00:23:48 +0800
committerobscuren <geffobscura@gmail.com>2015-02-14 00:23:48 +0800
commit7336dfad02833989037440fb22e01566444d0100 (patch)
tree8f7dc62676e519236b69a977c7af00d81b1e0406 /vm/common.go
parentc9985bf563888d5f346408d2ff174167e8b65880 (diff)
parent00fca409398172811e71158e0ca9f6229e0f815b (diff)
downloaddexon-7336dfad02833989037440fb22e01566444d0100.tar
dexon-7336dfad02833989037440fb22e01566444d0100.tar.gz
dexon-7336dfad02833989037440fb22e01566444d0100.tar.bz2
dexon-7336dfad02833989037440fb22e01566444d0100.tar.lz
dexon-7336dfad02833989037440fb22e01566444d0100.tar.xz
dexon-7336dfad02833989037440fb22e01566444d0100.tar.zst
dexon-7336dfad02833989037440fb22e01566444d0100.zip
Merge branch 'develop' into poc8
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/vm/common.go b/vm/common.go
index acf18eede..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)
@@ -49,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 {