mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Expose VM kind setting of State in FakeExtVM
This reverts commit 6ad065bb3e30b5e67283f70e84ac55368e843e6a.
This commit is contained in:
parent
878c41b3e3
commit
f73a461e13
19
vm.cpp
19
vm.cpp
@ -441,8 +441,8 @@ h160 FakeState::createNewAddress(Address _newAddress, Address _sender, u256 _end
|
|||||||
m_cache[_newAddress] = AddressState(0, balance(_newAddress) + _endowment, h256(), h256());
|
m_cache[_newAddress] = AddressState(0, balance(_newAddress) + _endowment, h256(), h256());
|
||||||
|
|
||||||
// Execute init code.
|
// Execute init code.
|
||||||
auto vmObj = VMFace::create(VMFace::Interpreter, *_gas);
|
auto vmObj = VMFace::create(getVMKind(), *_gas);
|
||||||
VMFace& vm = *vmObj;
|
auto& vm = *vmObj;
|
||||||
ExtVM evm(*this, _newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _code, o_ms, _level);
|
ExtVM evm(*this, _newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _code, o_ms, _level);
|
||||||
bool revert = false;
|
bool revert = false;
|
||||||
bytesConstRef out;
|
bytesConstRef out;
|
||||||
@ -500,7 +500,14 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
BOOST_REQUIRE(o.count("pre") > 0);
|
BOOST_REQUIRE(o.count("pre") > 0);
|
||||||
BOOST_REQUIRE(o.count("exec") > 0);
|
BOOST_REQUIRE(o.count("exec") > 0);
|
||||||
|
|
||||||
|
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
||||||
|
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
||||||
|
auto useJit = argc >= 2 && std::string(argv[1]) == "--jit";
|
||||||
|
auto vmKind = useJit ? VMFace::JIT : VMFace::Interpreter;
|
||||||
|
|
||||||
dev::test::FakeExtVM fev;
|
dev::test::FakeExtVM fev;
|
||||||
|
fev.setVMKind(vmKind);
|
||||||
|
|
||||||
fev.importEnv(o["env"].get_obj());
|
fev.importEnv(o["env"].get_obj());
|
||||||
fev.importState(o["pre"].get_obj());
|
fev.importState(o["pre"].get_obj());
|
||||||
|
|
||||||
@ -514,13 +521,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
fev.code = &fev.thisTxCode;
|
fev.code = &fev.thisTxCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto vm = VMFace::create(fev.getVMKind(), fev.gas);
|
||||||
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
|
||||||
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
|
||||||
auto useJit = argc >= 2 && std::string(argv[1]) == "--jit";
|
|
||||||
|
|
||||||
auto vmKind = useJit ? VMFace::JIT : VMFace::Interpreter;
|
|
||||||
auto vm = VMFace::create(vmKind, fev.gas);
|
|
||||||
bytes output;
|
bytes output;
|
||||||
auto outOfGas = false;
|
auto outOfGas = false;
|
||||||
try
|
try
|
||||||
|
2
vm.h
2
vm.h
@ -80,6 +80,8 @@ public:
|
|||||||
void importExec(json_spirit::mObject& _o);
|
void importExec(json_spirit::mObject& _o);
|
||||||
json_spirit::mArray exportCallCreates();
|
json_spirit::mArray exportCallCreates();
|
||||||
void importCallCreates(json_spirit::mArray& _callcreates);
|
void importCallCreates(json_spirit::mArray& _callcreates);
|
||||||
|
void setVMKind(eth::VMFace::Kind _kind) { m_s.setVMKind(_kind); }
|
||||||
|
eth::VMFace::Kind getVMKind() const { return m_s.getVMKind(); }
|
||||||
|
|
||||||
template<typename ExtVMType>
|
template<typename ExtVMType>
|
||||||
eth::OnOpFunc simpleTrace();
|
eth::OnOpFunc simpleTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user