Rename Instruction::MSIZE to Instruction::_MSIZE.

This commit is contained in:
Alexander Arlt 2022-03-25 00:16:04 -05:00
parent a14a7b23ee
commit 8258a0a152
8 changed files with 14 additions and 14 deletions

View File

@ -426,7 +426,7 @@ map<u256, u256> const& Assembly::optimiseInternal(
AssemblyItems optimisedItems;
bool usesMSize = ranges::any_of(m_items, [](AssemblyItem const& _i) {
return _i == AssemblyItem{Instruction::MSIZE} || _i.type() == VerbatimBytecode;
return _i == AssemblyItem{Instruction::_MSIZE} || _i.type() == VerbatimBytecode;
});
auto iter = m_items.begin();

View File

@ -90,7 +90,7 @@ std::map<std::string, Instruction> const solidity::evmasm::c_instructions =
{ "JUMP", Instruction::JUMP },
{ "JUMPI", Instruction::JUMPI },
{ "PC", Instruction::PC },
{ "MSIZE", Instruction::MSIZE },
{ "MSIZE", Instruction::_MSIZE},
{ "GAS", Instruction::GAS },
{ "JUMPDEST", Instruction::JUMPDEST },
{ "PUSH1", Instruction::PUSH1 },
@ -237,7 +237,7 @@ static std::map<Instruction, InstructionInfo> const c_instructionInfo =
{ Instruction::JUMP, { "JUMP", 0, 1, 0, true, Tier::Mid } },
{ Instruction::JUMPI, { "JUMPI", 0, 2, 0, true, Tier::High } },
{ Instruction::PC, { "PC", 0, 0, 1, false, Tier::Base } },
{ Instruction::MSIZE, { "MSIZE", 0, 0, 1, false, Tier::Base } },
{ Instruction::_MSIZE, { "MSIZE", 0, 0, 1, false, Tier::Base } },
{ Instruction::GAS, { "GAS", 0, 0, 1, false, Tier::Base } },
{ Instruction::JUMPDEST, { "JUMPDEST", 0, 0, 0, true, Tier::Special } },
{ Instruction::PUSH1, { "PUSH1", 1, 0, 1, false, Tier::VeryLow } },

View File

@ -98,7 +98,7 @@ enum class Instruction: uint8_t
JUMP, ///< alter the program counter
JUMPI, ///< conditionally alter the program counter
PC, ///< get the program counter
MSIZE, ///< get the size of active memory
_MSIZE, ///< get the size of active memory
GAS, ///< get the amount of available gas
JUMPDEST, ///< set a potential jump destination

View File

@ -141,7 +141,7 @@ vector<SemanticInformation::Operation> SemanticInformation::readWriteOperations(
Operation{Location::Storage, Effect::Read, {}, {}, {}},
Operation{Location::Storage, Effect::Write, {}, {}, {}}
};
case Instruction::MSIZE:
case Instruction::_MSIZE:
// This is just to satisfy the assert below.
return vector<Operation>{};
default:
@ -176,7 +176,7 @@ bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item, bool
return false;
if (_item.instruction() == Instruction::GAS || _item.instruction() == Instruction::PC)
return true; // GAS and PC assume a specific order of opcodes
if (_item.instruction() == Instruction::MSIZE)
if (_item.instruction() == Instruction::_MSIZE)
return true; // msize is modified already by memory access, avoid that for now
InstructionInfo info = instructionInfo(_item.instruction());
if (_item.instruction() == Instruction::SSTORE)
@ -300,7 +300,7 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
case Instruction::CREATE2:
case Instruction::GAS:
case Instruction::PC:
case Instruction::MSIZE: // depends on previous writes and reads, not only on content
case Instruction::_MSIZE: // depends on previous writes and reads, not only on content
case Instruction::BALANCE: // depends on previous calls
case Instruction::SELFBALANCE: // depends on previous calls
case Instruction::EXTCODESIZE:
@ -331,7 +331,7 @@ bool SemanticInformation::movable(Instruction _instruction)
case Instruction::RETURNDATASIZE:
case Instruction::SLOAD:
case Instruction::PC:
case Instruction::MSIZE:
case Instruction::_MSIZE:
case Instruction::GAS:
return false;
default:
@ -376,7 +376,7 @@ SemanticInformation::Effect SemanticInformation::memory(Instruction _instruction
case Instruction::CREATE2:
case Instruction::KECCAK256:
case Instruction::MLOAD:
case Instruction::MSIZE:
case Instruction::_MSIZE:
case Instruction::RETURN:
case Instruction::REVERT:
case Instruction::LOG0:

View File

@ -134,7 +134,7 @@ struct EVMBuiltins
static auto constexpr SLOAD = PatternGenerator<Instruction::SLOAD>{};
static auto constexpr SSTORE = PatternGenerator<Instruction::SSTORE>{};
static auto constexpr PC = PatternGenerator<Instruction::PC>{};
static auto constexpr MSIZE = PatternGenerator<Instruction::MSIZE>{};
static auto constexpr MSIZE = PatternGenerator<Instruction::_MSIZE>{};
static auto constexpr GAS = PatternGenerator<Instruction::GAS>{};
static auto constexpr LOG0 = PatternGenerator<Instruction::LOG0>{};
static auto constexpr LOG1 = PatternGenerator<Instruction::LOG1>{};

View File

@ -71,7 +71,7 @@ pair<YulString, BuiltinFunctionForEVM> createEVMFunction(
f.controlFlowSideEffects.canRevert = false;
}
}
f.isMSize = _instruction == evmasm::Instruction::MSIZE;
f.isMSize = _instruction == evmasm::Instruction::_MSIZE;
f.literalArguments.clear();
f.instruction = _instruction;
f.generateCode = [_instruction](

View File

@ -70,7 +70,7 @@ namespace
AssemblyItems input = addDummyLocations(_input);
bool usesMsize = ranges::any_of(_input, [](AssemblyItem const& _i) {
return _i == AssemblyItem{Instruction::MSIZE} || _i.type() == VerbatimBytecode;
return _i == AssemblyItem{Instruction::_MSIZE} || _i.type() == VerbatimBytecode;
});
evmasm::CommonSubexpressionEliminator cse(_state);
BOOST_REQUIRE(cse.feedItems(input.begin(), input.end(), usesMsize) == input.end());
@ -100,7 +100,7 @@ namespace
AssemblyItems optimisedItems;
bool usesMSize = ranges::any_of(_input, [](AssemblyItem const& _i) {
return _i == AssemblyItem{Instruction::MSIZE} || _i.type() == VerbatimBytecode;
return _i == AssemblyItem{Instruction::_MSIZE} || _i.type() == VerbatimBytecode;
});
auto iter = _input.begin();

View File

@ -287,7 +287,7 @@ u256 EVMInstructionInterpreter::eval(
return 0;
case Instruction::PC:
return 0x77;
case Instruction::MSIZE:
case Instruction::_MSIZE:
return m_state.msize;
case Instruction::GAS:
return 0x99;