From 8258a0a15231bfc5ca78ba9af9a0cd6c6d700b9e Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Fri, 25 Mar 2022 00:16:04 -0500 Subject: [PATCH] Rename Instruction::MSIZE to Instruction::_MSIZE. --- libevmasm/Assembly.cpp | 2 +- libevmasm/Instruction.cpp | 4 ++-- libevmasm/Instruction.h | 2 +- libevmasm/SemanticInformation.cpp | 10 +++++----- libevmasm/SimplificationRule.h | 2 +- libyul/backends/evm/EVMDialect.cpp | 2 +- test/libevmasm/Optimiser.cpp | 4 ++-- .../tools/yulInterpreter/EVMInstructionInterpreter.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 43e06ef9b..e79574b74 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -426,7 +426,7 @@ map 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(); diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp index e2ce48b7f..4227e9bee 100644 --- a/libevmasm/Instruction.cpp +++ b/libevmasm/Instruction.cpp @@ -90,7 +90,7 @@ std::map 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 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 } }, diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h index 52bda8bf1..02a6b2c67 100644 --- a/libevmasm/Instruction.h +++ b/libevmasm/Instruction.h @@ -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 diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp index acbcaa5c0..a005f1d6d 100644 --- a/libevmasm/SemanticInformation.cpp +++ b/libevmasm/SemanticInformation.cpp @@ -141,7 +141,7 @@ vector 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{}; 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: diff --git a/libevmasm/SimplificationRule.h b/libevmasm/SimplificationRule.h index d548a00df..97ebeece8 100644 --- a/libevmasm/SimplificationRule.h +++ b/libevmasm/SimplificationRule.h @@ -134,7 +134,7 @@ struct EVMBuiltins static auto constexpr SLOAD = PatternGenerator{}; static auto constexpr SSTORE = PatternGenerator{}; static auto constexpr PC = PatternGenerator{}; - static auto constexpr MSIZE = PatternGenerator{}; + static auto constexpr MSIZE = PatternGenerator{}; static auto constexpr GAS = PatternGenerator{}; static auto constexpr LOG0 = PatternGenerator{}; static auto constexpr LOG1 = PatternGenerator{}; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 35fa5f88e..c26d666da 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -71,7 +71,7 @@ pair 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]( diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 44fbde927..4ffd8c49c 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -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(); diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 810cf9d18..66c562320 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -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;