mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
evmjit: Use EVMJIT instead of Interpreter
This commit is contained in:
parent
c7322532af
commit
88aa0db42b
2 changed files with 8 additions and 5 deletions
|
|
@ -100,7 +100,7 @@ type EVM struct {
|
||||||
vmConfig Config
|
vmConfig Config
|
||||||
// global (to this context) ethereum virtual machine
|
// global (to this context) ethereum virtual machine
|
||||||
// used throughout the execution of the tx.
|
// used throughout the execution of the tx.
|
||||||
interpreter *Interpreter
|
interpreter *EVMJIT
|
||||||
// abort is used to abort the EVM calling operations
|
// abort is used to abort the EVM calling operations
|
||||||
// NOTE: must be set atomically
|
// NOTE: must be set atomically
|
||||||
abort int32
|
abort int32
|
||||||
|
|
@ -121,7 +121,7 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon
|
||||||
chainRules: chainConfig.Rules(ctx.BlockNumber),
|
chainRules: chainConfig.Rules(ctx.BlockNumber),
|
||||||
}
|
}
|
||||||
|
|
||||||
evm.interpreter = NewInterpreter(evm, vmConfig)
|
evm.interpreter = NewJit(evm, vmConfig)
|
||||||
return evm
|
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 }
|
func (evm *EVM) ChainConfig() *params.ChainConfig { return evm.chainConfig }
|
||||||
|
|
||||||
// Interpreter returns the EVM interpreter
|
// Interpreter returns the EVM interpreter
|
||||||
func (evm *EVM) Interpreter() *Interpreter { return evm.interpreter }
|
func (evm *EVM) Interpreter() *EVMJIT { return evm.interpreter }
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,9 @@ import (
|
||||||
type EVMJIT struct {
|
type EVMJIT struct {
|
||||||
jit *C.struct_evm_instance
|
jit *C.struct_evm_instance
|
||||||
env *EVM
|
env *EVM
|
||||||
|
intPool *intPool
|
||||||
|
readOnly bool
|
||||||
|
returnData []byte // Last CALL's return data for subsequent reuse
|
||||||
}
|
}
|
||||||
|
|
||||||
type EVMCContext struct {
|
type EVMCContext struct {
|
||||||
|
|
@ -113,7 +116,7 @@ type ContextWrapper struct {
|
||||||
|
|
||||||
func NewJit(env *EVM, cfg Config) *EVMJIT {
|
func NewJit(env *EVM, cfg Config) *EVMJIT {
|
||||||
// FIXME: Destroy the jit later.
|
// 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
|
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++
|
evm.env.depth++
|
||||||
defer func() { evm.env.depth-- }()
|
defer func() { evm.env.depth-- }()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue