aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-21 01:13:46 +0800
committerobscuren <geffobscura@gmail.com>2015-02-21 01:13:46 +0800
commitbd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca (patch)
tree46ab5943fd5e26198067aeec4a44287452eb2a32 /vm/common.go
parent771bfe9e78f9952002a71cccc8d41c8c544fdfcb (diff)
parentd586a633ff005ac01c9f1eb33552d147cf6c883e (diff)
downloaddexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar.gz
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar.bz2
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar.lz
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar.xz
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.tar.zst
dexon-bd7ebbcd5b77ce4fdd471b44f0acda80f2b3ceca.zip
Merge branch 'release/0.9.0'
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go21
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 {