Adapt EVMHost for EVMC7

This commit is contained in:
Alex Beregszaszi 2019-11-07 12:17:38 +00:00
parent 92745c7bfc
commit 1432f0ad28
3 changed files with 9 additions and 9 deletions

View File

@ -35,17 +35,17 @@ using namespace dev;
using namespace dev::test; using namespace dev::test;
evmc::vm* EVMHost::getVM(string const& _path) evmc::VM* EVMHost::getVM(string const& _path)
{ {
static unique_ptr<evmc::vm> theVM; static unique_ptr<evmc::VM> theVM;
if (!theVM && !_path.empty()) if (!theVM && !_path.empty())
{ {
evmc_loader_error_code errorCode = {}; evmc_loader_error_code errorCode = {};
evmc_instance* vm = evmc_load_and_configure(_path.c_str(), &errorCode); evmc_vm* vm = evmc_load_and_configure(_path.c_str(), &errorCode);
if (vm && errorCode == EVMC_LOADER_SUCCESS) if (vm && errorCode == EVMC_LOADER_SUCCESS)
{ {
if (evmc_vm_has_capability(vm, EVMC_CAPABILITY_EVM1)) if (evmc_vm_has_capability(vm, EVMC_CAPABILITY_EVM1))
theVM = make_unique<evmc::vm>(vm); theVM = make_unique<evmc::VM>(vm);
else else
{ {
evmc_destroy(vm); evmc_destroy(vm);
@ -63,7 +63,7 @@ evmc::vm* EVMHost::getVM(string const& _path)
return theVM.get(); return theVM.get();
} }
EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::vm* _vm): EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM* _vm):
m_vm(_vm) m_vm(_vm)
{ {
if (!m_vm) if (!m_vm)

View File

@ -40,9 +40,9 @@ public:
/// Tries to dynamically load libevmone. @returns nullptr on failure. /// Tries to dynamically load libevmone. @returns nullptr on failure.
/// The path has to be provided for the first successful run and will be ignored /// The path has to be provided for the first successful run and will be ignored
/// afterwards. /// afterwards.
static evmc::vm* getVM(std::string const& _path = {}); static evmc::VM* getVM(std::string const& _path = {});
explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::vm* _vm = getVM()); explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::VM* _vm = getVM());
struct Account struct Account
{ {
@ -179,7 +179,7 @@ private:
/// @note The return value is only valid as long as @a _data is alive! /// @note The return value is only valid as long as @a _data is alive!
static evmc::result resultWithGas(evmc_message const& _message, bytes const& _data) noexcept; static evmc::result resultWithGas(evmc_message const& _message, bytes const& _data) noexcept;
evmc::vm* m_vm = nullptr; evmc::VM* m_vm = nullptr;
evmc_revision m_evmVersion; evmc_revision m_evmVersion;
}; };

View File

@ -24,7 +24,7 @@
#include <fstream> #include <fstream>
static evmc::vm evmone = evmc::vm{evmc_create_evmone()}; static evmc::VM evmone = evmc::VM{evmc_create_evmone()};
using namespace dev::test::abiv2fuzzer; using namespace dev::test::abiv2fuzzer;
using namespace dev::test; using namespace dev::test;