evmjit: Use EVMJIT instead of Interpreter

This commit is contained in:
Paweł Bylica 2017-12-12 14:34:26 +01:00
parent c7322532af
commit 88aa0db42b
No known key found for this signature in database
GPG key ID: 7A0C037434FE77EF
2 changed files with 8 additions and 5 deletions

View file

@ -100,7 +100,7 @@ type EVM struct {
vmConfig Config
// global (to this context) ethereum virtual machine
// used throughout the execution of the tx.
interpreter *Interpreter
interpreter *EVMJIT
// abort is used to abort the EVM calling operations
// NOTE: must be set atomically
abort int32
@ -121,7 +121,7 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon
chainRules: chainConfig.Rules(ctx.BlockNumber),
}
evm.interpreter = NewInterpreter(evm, vmConfig)
evm.interpreter = NewJit(evm, vmConfig)
return evm
}
@ -374,4 +374,4 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
func (evm *EVM) ChainConfig() *params.ChainConfig { return evm.chainConfig }
// Interpreter returns the EVM interpreter
func (evm *EVM) Interpreter() *Interpreter { return evm.interpreter }
func (evm *EVM) Interpreter() *EVMJIT { return evm.interpreter }

View file

@ -99,6 +99,9 @@ import (
type EVMJIT struct {
jit *C.struct_evm_instance
env *EVM
intPool *intPool
readOnly bool
returnData []byte // Last CALL's return data for subsequent reuse
}
type EVMCContext struct {
@ -113,7 +116,7 @@ type ContextWrapper struct {
func NewJit(env *EVM, cfg Config) *EVMJIT {
// FIXME: Destroy the jit later.
return &EVMJIT{C.evmjit_create(), env}
return &EVMJIT{C.evmjit_create(), env, nil, false, nil}
}
@ -428,7 +431,7 @@ func getRevision(env *EVM) C.enum_evm_revision {
return C.EVM_FRONTIER
}
func (evm *EVMJIT) Run(contract *Contract, input []byte) (ret []byte, err error) {
func (evm *EVMJIT) Run(snapshot int, contract *Contract, input []byte) (ret []byte, err error) {
evm.env.depth++
defer func() { evm.env.depth-- }()