diff options
author | Guillaume Ballet <gballet@gmail.com> | 2018-09-20 15:44:35 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-09-20 15:44:35 +0800 |
commit | da29332c5f4c368ff03ec4e7132eefac48fed1ae (patch) | |
tree | fc9a9d2bd594ef22f7b9d9fca8bd410c28304f99 /core/vm/evm.go | |
parent | 3fec73500b60c82a827b36bb03f8ae011b861e72 (diff) | |
download | dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar.gz dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar.bz2 dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar.lz dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar.xz dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.tar.zst dexon-da29332c5f4c368ff03ec4e7132eefac48fed1ae.zip |
core/vm: add switches to select evm+ewasm interpreters (#17687)
Interpreter initialization is left to the PRs implementing them.
Options for external interpreters are passed after a colon in the
`--vm.ewasm` and `--vm.evm` switches.
Diffstat (limited to 'core/vm/evm.go')
-rw-r--r-- | core/vm/evm.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/vm/evm.go b/core/vm/evm.go index 58618f811..fc040c621 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -136,10 +136,28 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon vmConfig: vmConfig, chainConfig: chainConfig, chainRules: chainConfig.Rules(ctx.BlockNumber), - interpreters: make([]Interpreter, 1), + interpreters: make([]Interpreter, 0, 1), } - evm.interpreters[0] = NewEVMInterpreter(evm, vmConfig) + if chainConfig.IsEWASM(ctx.BlockNumber) { + // to be implemented by EVM-C and Wagon PRs. + // if vmConfig.EWASMInterpreter != "" { + // extIntOpts := strings.Split(vmConfig.EWASMInterpreter, ":") + // path := extIntOpts[0] + // options := []string{} + // if len(extIntOpts) > 1 { + // options = extIntOpts[1..] + // } + // evm.interpreters = append(evm.interpreters, NewEVMVCInterpreter(evm, vmConfig, options)) + // } else { + // evm.interpreters = append(evm.interpreters, NewEWASMInterpreter(evm, vmConfig)) + // } + panic("No supported ewasm interpreter yet.") + } + + // vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here + // as we always want to have the built-in EVM as the failover option. + evm.interpreters = append(evm.interpreters, NewEVMInterpreter(evm, vmConfig)) evm.interpreter = evm.interpreters[0] return evm |