|
@ -179,10 +179,14 @@ void State::ensureCached(Address _a, bool _requireMemory, bool _forceCreate) con |
|
|
TrieDB<h256, Overlay> memdb(const_cast<Overlay*>(&m_db), it->second.oldRoot()); // promise we won't alter the overlay! :)
|
|
|
TrieDB<h256, Overlay> memdb(const_cast<Overlay*>(&m_db), it->second.oldRoot()); // promise we won't alter the overlay! :)
|
|
|
map<u256, u256>& mem = it->second.setHaveMemory(); |
|
|
map<u256, u256>& mem = it->second.setHaveMemory(); |
|
|
for (auto const& i: memdb) |
|
|
for (auto const& i: memdb) |
|
|
|
|
|
#ifdef __clang__ |
|
|
if (mem.find(i.first) == mem.end()) |
|
|
if (mem.find(i.first) == mem.end()) |
|
|
mem.insert(make_pair(i.first, RLP(i.second).toInt<u256>())); |
|
|
mem.insert(make_pair(i.first, RLP(i.second).toInt<u256>())); |
|
|
else |
|
|
else |
|
|
mem.at(i.first) = RLP(i.second).toInt<u256>(); |
|
|
mem.at(i.first) = RLP(i.second).toInt<u256>(); |
|
|
|
|
|
#else |
|
|
|
|
|
mem[i.first] = RLP(i.second).toInt<u256>(); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -707,10 +711,14 @@ void State::executeBare(Transaction const& _t, Address _sender) |
|
|
m_cache[newAddress] = AddressState(0, 0, AddressType::Contract); |
|
|
m_cache[newAddress] = AddressState(0, 0, AddressType::Contract); |
|
|
auto& mem = m_cache[newAddress].memory(); |
|
|
auto& mem = m_cache[newAddress].memory(); |
|
|
for (uint i = 0; i < _t.data.size(); ++i) |
|
|
for (uint i = 0; i < _t.data.size(); ++i) |
|
|
|
|
|
#ifdef __clang__ |
|
|
if (mem.find(i) == mem.end()) |
|
|
if (mem.find(i) == mem.end()) |
|
|
mem.insert(make_pair(i, _t.data[i])); |
|
|
mem.insert(make_pair(i, _t.data[i])); |
|
|
else |
|
|
else |
|
|
mem.at(i) = _t.data[i]; |
|
|
mem.at(i) = _t.data[i]; |
|
|
|
|
|
#else |
|
|
|
|
|
mem[i] = _t.data[i]; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if ETH_SENDER_PAYS_SETUP |
|
|
#if ETH_SENDER_PAYS_SETUP |
|
|
subBalance(_sender, _t.value + fee); |
|
|
subBalance(_sender, _t.value + fee); |
|
@ -752,11 +760,15 @@ void State::execute(Address _myAddress, Address _txSender, u256 _txValue, u256s |
|
|
{ |
|
|
{ |
|
|
if (_v) |
|
|
if (_v) |
|
|
{ |
|
|
{ |
|
|
|
|
|
#ifdef __clang__ |
|
|
auto it = myStore.find(_n); |
|
|
auto it = myStore.find(_n); |
|
|
if (it == myStore.end()) |
|
|
if (it == myStore.end()) |
|
|
myStore.insert(make_pair(_n, _v)); |
|
|
myStore.insert(make_pair(_n, _v)); |
|
|
else |
|
|
else |
|
|
myStore.at(_n) = _v; |
|
|
myStore.at(_n) = _v; |
|
|
|
|
|
#else |
|
|
|
|
|
myStore[_n] = _v; |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
myStore.erase(_n); |
|
|
myStore.erase(_n); |
|
@ -1160,21 +1172,29 @@ void State::execute(Address _myAddress, Address _txSender, u256 _txValue, u256s |
|
|
case Instruction::MLOAD: |
|
|
case Instruction::MLOAD: |
|
|
{ |
|
|
{ |
|
|
require(1); |
|
|
require(1); |
|
|
|
|
|
#ifdef __clang__ |
|
|
auto mFinder = tempMem.find(stack.back()); |
|
|
auto mFinder = tempMem.find(stack.back()); |
|
|
if (mFinder != tempMem.end()) |
|
|
if (mFinder != tempMem.end()) |
|
|
stack.back() = mFinder->second; |
|
|
stack.back() = mFinder->second; |
|
|
else |
|
|
else |
|
|
throw BadInstruction(); |
|
|
stack.back() = 0; |
|
|
|
|
|
#else |
|
|
|
|
|
stack.back() = tempMem[stack.back()]; |
|
|
|
|
|
#endif |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case Instruction::MSTORE: |
|
|
case Instruction::MSTORE: |
|
|
{ |
|
|
{ |
|
|
require(2); |
|
|
require(2); |
|
|
|
|
|
#ifdef __clang__ |
|
|
auto mFinder = tempMem.find(stack.back()); |
|
|
auto mFinder = tempMem.find(stack.back()); |
|
|
if (mFinder == tempMem.end()) |
|
|
if (mFinder == tempMem.end()) |
|
|
tempMem.insert(std::pair<u256,u256>(stack.back(), stack[stack.size() - 2])); |
|
|
tempMem.insert(std::pair<u256,u256>(stack.back(), stack[stack.size() - 2])); |
|
|
else |
|
|
else |
|
|
mFinder->second = stack[stack.size() - 2]; |
|
|
mFinder->second = stack[stack.size() - 2]; |
|
|
|
|
|
#else |
|
|
|
|
|
tempMem[stack.back()] = stack[stack.size() - 2]; |
|
|
|
|
|
#endif |
|
|
stack.pop_back(); |
|
|
stack.pop_back(); |
|
|
stack.pop_back(); |
|
|
stack.pop_back(); |
|
|
break; |
|
|
break; |
|
|