Change interpreter memory to be non-contiguous.

This commit is contained in:
chriseth
2019-09-02 13:51:47 +02:00
parent a988b64597
commit bdf29277a2
8 changed files with 49 additions and 36 deletions
+6 -7
View File
@@ -47,13 +47,12 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const
for (auto const& line: trace)
_out << " " << line << endl;
_out << "Memory dump:\n";
for (size_t i = 0; i < memory.size(); i += 0x20)
{
bytesConstRef data(memory.data() + i, 0x20);
if (boost::algorithm::all_of_equal(data, 0))
continue;
_out << " " << std::hex << std::setw(4) << i << ": " << toHex(data.toBytes()) << endl;
}
map<u256, u256> words;
for (auto const& [offset, value]: memory)
words[(offset / 0x20) * 0x20] |= u256(uint32_t(value)) << (256 - 8 - 8 * size_t(offset % 0x20));
for (auto const& [offset, value]: words)
if (value != 0)
_out << " " << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl;
_out << "Storage dump:" << endl;
for (auto const& slot: storage)
if (slot.second != h256(0))