diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-01-21 22:29:58 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-03-23 07:04:00 +0800 |
commit | 342ae7ce7dfd7a0eab2dd06bfa65199825279f05 (patch) | |
tree | 4d90314e50e137bcd8ee837cbb396fee40e2bb4b /core/vm/jit_test.go | |
parent | 2855a93ede6e9437d05a82c2397d48744621db9b (diff) | |
download | dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.gz dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.bz2 dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.lz dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.xz dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.zst dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.zip |
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.
Diffstat (limited to 'core/vm/jit_test.go')
-rw-r--r-- | core/vm/jit_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index 19261827b..5fac0156f 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -154,7 +154,7 @@ func runVmBench(test vmBench, b *testing.B) { context := NewContract(sender, sender, big.NewInt(100), big.NewInt(10000), big.NewInt(0)) context.Code = test.code context.CodeAddr = &common.Address{} - _, err := New(env).Run(context, test.input) + _, err := env.Vm().Run(context, test.input) if err != nil { b.Error(err) b.FailNow() @@ -165,12 +165,16 @@ func runVmBench(test vmBench, b *testing.B) { type Env struct { gasLimit *big.Int depth int + evm *Vm } func NewEnv() *Env { - return &Env{big.NewInt(10000), 0} + env := &Env{gasLimit: big.NewInt(10000), depth: 0} + env.evm = EVM(env) + return env } +func (self *Env) Vm() *Vm { return self.evm } func (self *Env) Origin() common.Address { return common.Address{} } func (self *Env) BlockNumber() *big.Int { return big.NewInt(0) } func (self *Env) AddStructLog(log StructLog) { |