core, core/vm, tests: changed the initialisation behaviour of the EVM

The EVM was previously initialised and created for every CALL, CALLCODE,
DELEGATECALL and CREATE. This PR changes this behaviour so that the same
EVM can be used through the session and beyond as long as the
Environment sticks around.
This commit is contained in:
Jeffrey Wilcke
2016-01-21 15:29:58 +01:00
committed by Jeffrey Wilcke
parent 2855a93ede
commit 342ae7ce7d
13 changed files with 49 additions and 44 deletions

View File

@ -21,7 +21,6 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
)
@ -51,19 +50,6 @@ var (
max = big.NewInt(math.MaxInt64) // Maximum 64 bit integer
)
// NewVm returns a new VM based on the Environment
func NewVm(env Environment) VirtualMachine {
switch env.VmType() {
case JitVmTy:
return NewJitVm(env)
default:
glog.V(0).Infoln("unsupported vm type %d", env.VmType())
fallthrough
case StdVmTy:
return New(env)
}
}
// calculates the memory size required for a step
func calcMemSize(off, l *big.Int) *big.Int {
if l.Cmp(common.Big0) == 0 {