mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make msize constant in yul interpreter.
This commit is contained in:
parent
195a7ff61a
commit
afa81ec562
@ -19,4 +19,4 @@
|
|||||||
// Memory dump:
|
// Memory dump:
|
||||||
// 0: 0001000000000000000000000000000000000000000000000000000000000000
|
// 0: 0001000000000000000000000000000000000000000000000000000000000000
|
||||||
// Storage dump:
|
// Storage dump:
|
||||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000002
|
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||||
|
@ -284,7 +284,7 @@ u256 EVMInstructionInterpreter::eval(
|
|||||||
case Instruction::PC:
|
case Instruction::PC:
|
||||||
return 0x77;
|
return 0x77;
|
||||||
case Instruction::MSIZE:
|
case Instruction::MSIZE:
|
||||||
return m_state.msize;
|
return 569;
|
||||||
case Instruction::GAS:
|
case Instruction::GAS:
|
||||||
return 0x99;
|
return 0x99;
|
||||||
case Instruction::LOG0:
|
case Instruction::LOG0:
|
||||||
@ -468,7 +468,6 @@ bool EVMInstructionInterpreter::accessMemory(u256 const& _offset, u256 const& _s
|
|||||||
if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size)))
|
if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size)))
|
||||||
{
|
{
|
||||||
u256 newSize = (_offset + _size + 0x1f) & ~u256(0x1f);
|
u256 newSize = (_offset + _size + 0x1f) & ~u256(0x1f);
|
||||||
m_state.msize = max(m_state.msize, newSize);
|
|
||||||
if (newSize < m_state.maxMemSize)
|
if (newSize < m_state.maxMemSize)
|
||||||
{
|
{
|
||||||
if (m_state.memory.size() < newSize)
|
if (m_state.memory.size() < newSize)
|
||||||
@ -476,8 +475,6 @@ bool EVMInstructionInterpreter::accessMemory(u256 const& _offset, u256 const& _s
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
m_state.msize = u256(-1);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,6 @@ struct InterpreterState
|
|||||||
dev::bytes returndata;
|
dev::bytes returndata;
|
||||||
/// TODO turn this into "vector with holes" for the randomized testing
|
/// TODO turn this into "vector with holes" for the randomized testing
|
||||||
dev::bytes memory;
|
dev::bytes memory;
|
||||||
/// This is different than memory.size() because we ignore gas.
|
|
||||||
dev::u256 msize;
|
|
||||||
std::map<dev::h256, dev::h256> storage;
|
std::map<dev::h256, dev::h256> storage;
|
||||||
dev::u160 address = 0x11111111;
|
dev::u160 address = 0x11111111;
|
||||||
dev::u256 balance = 0x22222222;
|
dev::u256 balance = 0x22222222;
|
||||||
|
Loading…
Reference in New Issue
Block a user