aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-23 23:59:09 +0800
committerobscuren <geffobscura@gmail.com>2015-03-23 23:59:09 +0800
commit0330077d76b48934ab024a309000f83c78047d8a (patch)
tree2a3ffbcd5bd941b30ed28d0eb5c30553a25324e0 /vm/common.go
parentd7eaa97a297151637af090ecb05bbd6d260d90b8 (diff)
downloaddexon-0330077d76b48934ab024a309000f83c78047d8a.tar
dexon-0330077d76b48934ab024a309000f83c78047d8a.tar.gz
dexon-0330077d76b48934ab024a309000f83c78047d8a.tar.bz2
dexon-0330077d76b48934ab024a309000f83c78047d8a.tar.lz
dexon-0330077d76b48934ab024a309000f83c78047d8a.tar.xz
dexon-0330077d76b48934ab024a309000f83c78047d8a.tar.zst
dexon-0330077d76b48934ab024a309000f83c78047d8a.zip
moved state and vm to core
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go82
1 files changed, 0 insertions, 82 deletions
diff --git a/vm/common.go b/vm/common.go
deleted file mode 100644
index 8d8f4253f..000000000
--- a/vm/common.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package vm
-
-import (
- "math"
- "math/big"
-
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/logger"
-)
-
-var vmlogger = logger.NewLogger("VM")
-
-// Global Debug flag indicating Debug VM (full logging)
-var Debug bool
-
-type Type byte
-
-const (
- StdVmTy Type = iota
- JitVmTy
- MaxVmTy
-
- MaxCallDepth = 1025
-
- LogTyPretty byte = 0x1
- LogTyDiff byte = 0x2
-)
-
-var (
- Pow256 = common.BigPow(2, 256)
-
- U256 = common.U256
- S256 = common.S256
-
- Zero = common.Big0
-
- max = big.NewInt(math.MaxInt64)
-)
-
-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)
- }
-}
-
-func calcMemSize(off, l *big.Int) *big.Int {
- if l.Cmp(common.Big0) == 0 {
- return common.Big0
- }
-
- return new(big.Int).Add(off, l)
-}
-
-// Simple helper
-func u256(n int64) *big.Int {
- return big.NewInt(n)
-}
-
-// Mainly used for print variables and passing to Print*
-func toValue(val *big.Int) interface{} {
- // Let's assume a string on right padded zero's
- b := val.Bytes()
- if b[0] != 0 && b[len(b)-1] == 0x0 && b[len(b)-2] == 0x0 {
- return string(b)
- }
-
- return val
-}
-
-func getData(data []byte, start, size *big.Int) []byte {
- dlen := big.NewInt(int64(len(data)))
-
- s := common.BigMin(start, dlen)
- e := common.BigMin(new(big.Int).Add(s, size), dlen)
- return common.RightPadBytes(data[s.Uint64():e.Uint64()], int(size.Uint64()))
-}