mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6407 from ethereum/changeNamespace
Remove "using namespace" from header and move Instruction to dev::eth.
This commit is contained in:
+17
-13
@@ -41,9 +41,9 @@ using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
|
||||
set<string> const builtinTypes{"bool", "u8", "s8", "u32", "s32", "u64", "s64", "u128", "s128", "u256", "s256"};
|
||||
|
||||
@@ -86,7 +86,7 @@ bool AsmAnalyzer::operator()(Label const& _label)
|
||||
"The use of labels is disallowed. Please use \"if\", \"switch\", \"for\" or function calls instead."
|
||||
);
|
||||
m_info.stackHeightInfo[&_label] = m_stackHeight;
|
||||
warnOnInstructions(solidity::Instruction::JUMPDEST, _label.location);
|
||||
warnOnInstructions(dev::eth::Instruction::JUMPDEST, _label.location);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _loc
|
||||
);
|
||||
}
|
||||
|
||||
void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocation const& _location)
|
||||
void AsmAnalyzer::warnOnInstructions(dev::eth::Instruction _instr, SourceLocation const& _location)
|
||||
{
|
||||
// We assume that returndatacopy, returndatasize and staticcall are either all available
|
||||
// or all not available.
|
||||
@@ -677,33 +677,37 @@ void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocatio
|
||||
};
|
||||
|
||||
if ((
|
||||
_instr == solidity::Instruction::RETURNDATACOPY ||
|
||||
_instr == solidity::Instruction::RETURNDATASIZE
|
||||
_instr == dev::eth::Instruction::RETURNDATACOPY ||
|
||||
_instr == dev::eth::Instruction::RETURNDATASIZE
|
||||
) && !m_evmVersion.supportsReturndata())
|
||||
{
|
||||
errorForVM("only available for Byzantium-compatible");
|
||||
}
|
||||
else if (_instr == solidity::Instruction::STATICCALL && !m_evmVersion.hasStaticCall())
|
||||
else if (_instr == dev::eth::Instruction::STATICCALL && !m_evmVersion.hasStaticCall())
|
||||
{
|
||||
errorForVM("only available for Byzantium-compatible");
|
||||
}
|
||||
else if ((
|
||||
_instr == solidity::Instruction::SHL ||
|
||||
_instr == solidity::Instruction::SHR ||
|
||||
_instr == solidity::Instruction::SAR
|
||||
_instr == dev::eth::Instruction::SHL ||
|
||||
_instr == dev::eth::Instruction::SHR ||
|
||||
_instr == dev::eth::Instruction::SAR
|
||||
) && !m_evmVersion.hasBitwiseShifting())
|
||||
{
|
||||
errorForVM("only available for Constantinople-compatible");
|
||||
}
|
||||
else if (_instr == solidity::Instruction::CREATE2 && !m_evmVersion.hasCreate2())
|
||||
else if (_instr == dev::eth::Instruction::CREATE2 && !m_evmVersion.hasCreate2())
|
||||
{
|
||||
errorForVM("only available for Constantinople-compatible");
|
||||
}
|
||||
else if (_instr == solidity::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash())
|
||||
else if (_instr == dev::eth::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash())
|
||||
{
|
||||
errorForVM("only available for Constantinople-compatible");
|
||||
}
|
||||
else if (_instr == solidity::Instruction::JUMP || _instr == solidity::Instruction::JUMPI || _instr == solidity::Instruction::JUMPDEST)
|
||||
else if (
|
||||
_instr == dev::eth::Instruction::JUMP ||
|
||||
_instr == dev::eth::Instruction::JUMPI ||
|
||||
_instr == dev::eth::Instruction::JUMPDEST
|
||||
)
|
||||
{
|
||||
if (m_dialect->flavour == AsmFlavour::Loose)
|
||||
m_errorReporter.error(
|
||||
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
|
||||
Scope& scope(Block const* _block);
|
||||
void expectValidType(std::string const& type, langutil::SourceLocation const& _location);
|
||||
void warnOnInstructions(dev::solidity::Instruction _instr, langutil::SourceLocation const& _location);
|
||||
void warnOnInstructions(dev::eth::Instruction _instr, langutil::SourceLocation const& _location);
|
||||
|
||||
/// Depending on @a m_flavour and @a m_errorTypeForLoose, throws an internal compiler
|
||||
/// exception (if the flavour is not Loose), reports an error/warning
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ struct TypedName { langutil::SourceLocation location; YulString name; Type type;
|
||||
using TypedNameList = std::vector<TypedName>;
|
||||
|
||||
/// Direct EVM instruction (except PUSHi and JUMPDEST)
|
||||
struct Instruction { langutil::SourceLocation location; dev::solidity::Instruction instruction; };
|
||||
struct Instruction { langutil::SourceLocation location; dev::eth::Instruction instruction; };
|
||||
/// Literal number or string (up to 32 bytes)
|
||||
enum class LiteralKind { Number, Boolean, String };
|
||||
struct Literal { langutil::SourceLocation location; LiteralKind kind; YulString value; Type type; };
|
||||
@@ -61,7 +61,7 @@ struct StackAssignment { langutil::SourceLocation location; Identifier variableN
|
||||
/// the same amount of items as the number of variables.
|
||||
struct Assignment { langutil::SourceLocation location; std::vector<Identifier> variableNames; std::unique_ptr<Expression> value; };
|
||||
/// Functional instruction, e.g. "mul(mload(20:u256), add(2:u256, x))"
|
||||
struct FunctionalInstruction { langutil::SourceLocation location; dev::solidity::Instruction instruction; std::vector<Expression> arguments; };
|
||||
struct FunctionalInstruction { langutil::SourceLocation location; dev::eth::Instruction instruction; std::vector<Expression> arguments; };
|
||||
struct FunctionCall { langutil::SourceLocation location; Identifier functionName; std::vector<Expression> arguments; };
|
||||
/// Statement that contains only a single expression
|
||||
struct ExpressionStatement { langutil::SourceLocation location; Expression expression; };
|
||||
|
||||
+14
-15
@@ -34,7 +34,6 @@ using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
shared_ptr<Block> Parser::parse(std::shared_ptr<Scanner> const& _scanner, bool _reuseScanner)
|
||||
{
|
||||
@@ -341,17 +340,17 @@ Expression Parser::parseExpression()
|
||||
}
|
||||
}
|
||||
|
||||
std::map<string, dev::solidity::Instruction> const& Parser::instructions()
|
||||
std::map<string, dev::eth::Instruction> const& Parser::instructions()
|
||||
{
|
||||
// Allowed instructions, lowercase names.
|
||||
static map<string, dev::solidity::Instruction> s_instructions;
|
||||
static map<string, dev::eth::Instruction> s_instructions;
|
||||
if (s_instructions.empty())
|
||||
{
|
||||
for (auto const& instruction: solidity::c_instructions)
|
||||
for (auto const& instruction: dev::eth::c_instructions)
|
||||
{
|
||||
if (
|
||||
instruction.second == solidity::Instruction::JUMPDEST ||
|
||||
solidity::isPushInstruction(instruction.second)
|
||||
instruction.second == dev::eth::Instruction::JUMPDEST ||
|
||||
dev::eth::isPushInstruction(instruction.second)
|
||||
)
|
||||
continue;
|
||||
string name = instruction.first;
|
||||
@@ -362,16 +361,16 @@ std::map<string, dev::solidity::Instruction> const& Parser::instructions()
|
||||
return s_instructions;
|
||||
}
|
||||
|
||||
std::map<dev::solidity::Instruction, string> const& Parser::instructionNames()
|
||||
std::map<dev::eth::Instruction, string> const& Parser::instructionNames()
|
||||
{
|
||||
static map<dev::solidity::Instruction, string> s_instructionNames;
|
||||
static map<dev::eth::Instruction, string> s_instructionNames;
|
||||
if (s_instructionNames.empty())
|
||||
{
|
||||
for (auto const& instr: instructions())
|
||||
s_instructionNames[instr.second] = instr.first;
|
||||
// set the ambiguous instructions to a clear default
|
||||
s_instructionNames[solidity::Instruction::SELFDESTRUCT] = "selfdestruct";
|
||||
s_instructionNames[solidity::Instruction::KECCAK256] = "keccak256";
|
||||
s_instructionNames[dev::eth::Instruction::SELFDESTRUCT] = "selfdestruct";
|
||||
s_instructionNames[dev::eth::Instruction::KECCAK256] = "keccak256";
|
||||
}
|
||||
return s_instructionNames;
|
||||
}
|
||||
@@ -401,7 +400,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
|
||||
ret = Identifier{location(), literal};
|
||||
else if (m_dialect->flavour != AsmFlavour::Yul && instructions().count(literal.str()))
|
||||
{
|
||||
dev::solidity::Instruction const& instr = instructions().at(literal.str());
|
||||
dev::eth::Instruction const& instr = instructions().at(literal.str());
|
||||
ret = Instruction{location(), instr};
|
||||
}
|
||||
else
|
||||
@@ -530,11 +529,11 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp)
|
||||
FunctionalInstruction ret;
|
||||
ret.instruction = instruction.instruction;
|
||||
ret.location = std::move(instruction.location);
|
||||
solidity::Instruction instr = ret.instruction;
|
||||
InstructionInfo instrInfo = instructionInfo(instr);
|
||||
if (solidity::isDupInstruction(instr))
|
||||
dev::eth::Instruction instr = ret.instruction;
|
||||
dev::eth::InstructionInfo instrInfo = instructionInfo(instr);
|
||||
if (dev::eth::isDupInstruction(instr))
|
||||
fatalParserError("DUPi instructions not allowed for functional notation");
|
||||
if (solidity::isSwapInstruction(instr))
|
||||
if (dev::eth::isSwapInstruction(instr))
|
||||
fatalParserError("SWAPi instructions not allowed for functional notation");
|
||||
expectToken(Token::LParen);
|
||||
unsigned args = unsigned(instrInfo.args);
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ protected:
|
||||
ForLoop parseForLoop();
|
||||
/// Parses a functional expression that has to push exactly one stack element
|
||||
Expression parseExpression();
|
||||
static std::map<std::string, dev::solidity::Instruction> const& instructions();
|
||||
static std::map<dev::solidity::Instruction, std::string> const& instructionNames();
|
||||
static std::map<std::string, dev::eth::Instruction> const& instructions();
|
||||
static std::map<dev::eth::Instruction, std::string> const& instructionNames();
|
||||
/// Parses an elementary operation, i.e. a literal, identifier or instruction.
|
||||
/// This will parse instructions even in strict mode as part of the full parser
|
||||
/// for FunctionalInstruction.
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
//@TODO source locations
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
ScopeFiller::ScopeFiller(AsmAnalysisInfo& _info, ErrorReporter& _errorReporter):
|
||||
m_info(_info), m_errorReporter(_errorReporter)
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
using namespace std;
|
||||
using namespace yul;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
|
||||
map<YulString, int> CompilabilityChecker::run(
|
||||
shared_ptr<Dialect> _dialect,
|
||||
|
||||
@@ -35,7 +35,7 @@ struct SourceLocation;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace eth
|
||||
{
|
||||
enum class Instruction: uint8_t;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
/// at the beginning.
|
||||
virtual int stackHeight() const = 0;
|
||||
/// Append an EVM instruction.
|
||||
virtual void appendInstruction(dev::solidity::Instruction _instruction) = 0;
|
||||
virtual void appendInstruction(dev::eth::Instruction _instruction) = 0;
|
||||
/// Append a constant.
|
||||
virtual void appendConstant(dev::u256 const& _constant) = 0;
|
||||
/// Append a label.
|
||||
|
||||
@@ -57,7 +57,7 @@ int EthAssemblyAdapter::stackHeight() const
|
||||
return m_assembly.deposit();
|
||||
}
|
||||
|
||||
void EthAssemblyAdapter::appendInstruction(solidity::Instruction _instruction)
|
||||
void EthAssemblyAdapter::appendInstruction(dev::eth::Instruction _instruction)
|
||||
{
|
||||
m_assembly.append(_instruction);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void EthAssemblyAdapter::appendLinkerSymbol(std::string const& _linkerSymbol)
|
||||
|
||||
void EthAssemblyAdapter::appendJump(int _stackDiffAfter)
|
||||
{
|
||||
appendInstruction(solidity::Instruction::JUMP);
|
||||
appendInstruction(dev::eth::Instruction::JUMP);
|
||||
m_assembly.adjustDeposit(_stackDiffAfter);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ void EthAssemblyAdapter::appendJumpTo(LabelID _labelId, int _stackDiffAfter)
|
||||
void EthAssemblyAdapter::appendJumpToIf(LabelID _labelId)
|
||||
{
|
||||
appendLabelReference(_labelId);
|
||||
appendInstruction(solidity::Instruction::JUMPI);
|
||||
appendInstruction(dev::eth::Instruction::JUMPI);
|
||||
}
|
||||
|
||||
void EthAssemblyAdapter::appendBeginsub(LabelID, int)
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
explicit EthAssemblyAdapter(dev::eth::Assembly& _assembly);
|
||||
void setSourceLocation(langutil::SourceLocation const& _location) override;
|
||||
int stackHeight() const override;
|
||||
void appendInstruction(dev::solidity::Instruction _instruction) override;
|
||||
void appendInstruction(dev::eth::Instruction _instruction) override;
|
||||
void appendConstant(dev::u256 const& _constant) override;
|
||||
void appendLabel(LabelID _labelId) override;
|
||||
void appendLabelReference(LabelID _labelId) override;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
|
||||
@@ -43,23 +44,23 @@ void EVMAssembly::setSourceLocation(SourceLocation const&)
|
||||
// Ignored for now;
|
||||
}
|
||||
|
||||
void EVMAssembly::appendInstruction(solidity::Instruction _instr)
|
||||
void EVMAssembly::appendInstruction(dev::eth::Instruction _instr)
|
||||
{
|
||||
m_bytecode.push_back(uint8_t(_instr));
|
||||
m_stackHeight += solidity::instructionInfo(_instr).ret - solidity::instructionInfo(_instr).args;
|
||||
m_stackHeight += instructionInfo(_instr).ret - instructionInfo(_instr).args;
|
||||
}
|
||||
|
||||
void EVMAssembly::appendConstant(u256 const& _constant)
|
||||
{
|
||||
bytes data = toCompactBigEndian(_constant, 1);
|
||||
appendInstruction(solidity::pushInstruction(data.size()));
|
||||
appendInstruction(pushInstruction(data.size()));
|
||||
m_bytecode += data;
|
||||
}
|
||||
|
||||
void EVMAssembly::appendLabel(LabelID _labelId)
|
||||
{
|
||||
setLabelToCurrentPosition(_labelId);
|
||||
appendInstruction(solidity::Instruction::JUMPDEST);
|
||||
appendInstruction(dev::eth::Instruction::JUMPDEST);
|
||||
}
|
||||
|
||||
void EVMAssembly::appendLabelReference(LabelID _labelId)
|
||||
@@ -67,7 +68,7 @@ void EVMAssembly::appendLabelReference(LabelID _labelId)
|
||||
solAssert(!m_evm15, "Cannot use plain label references in EMV1.5 mode.");
|
||||
// @TODO we now always use labelReferenceSize for all labels, it could be shortened
|
||||
// for some of them.
|
||||
appendInstruction(solidity::pushInstruction(labelReferenceSize));
|
||||
appendInstruction(dev::eth::pushInstruction(labelReferenceSize));
|
||||
m_labelReferences[m_bytecode.size()] = _labelId;
|
||||
m_bytecode += bytes(labelReferenceSize);
|
||||
}
|
||||
@@ -94,7 +95,7 @@ void EVMAssembly::appendLinkerSymbol(string const&)
|
||||
void EVMAssembly::appendJump(int _stackDiffAfter)
|
||||
{
|
||||
solAssert(!m_evm15, "Plain JUMP used for EVM 1.5");
|
||||
appendInstruction(solidity::Instruction::JUMP);
|
||||
appendInstruction(dev::eth::Instruction::JUMP);
|
||||
m_stackHeight += _stackDiffAfter;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ void EVMAssembly::appendJumpTo(LabelID _labelId, int _stackDiffAfter)
|
||||
{
|
||||
if (m_evm15)
|
||||
{
|
||||
m_bytecode.push_back(uint8_t(solidity::Instruction::JUMPTO));
|
||||
m_bytecode.push_back(uint8_t(dev::eth::Instruction::JUMPTO));
|
||||
appendLabelReferenceInternal(_labelId);
|
||||
m_stackHeight += _stackDiffAfter;
|
||||
}
|
||||
@@ -117,14 +118,14 @@ void EVMAssembly::appendJumpToIf(LabelID _labelId)
|
||||
{
|
||||
if (m_evm15)
|
||||
{
|
||||
m_bytecode.push_back(uint8_t(solidity::Instruction::JUMPIF));
|
||||
m_bytecode.push_back(uint8_t(dev::eth::Instruction::JUMPIF));
|
||||
appendLabelReferenceInternal(_labelId);
|
||||
m_stackHeight--;
|
||||
}
|
||||
else
|
||||
{
|
||||
appendLabelReference(_labelId);
|
||||
appendInstruction(solidity::Instruction::JUMPI);
|
||||
appendInstruction(dev::eth::Instruction::JUMPI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ void EVMAssembly::appendBeginsub(LabelID _labelId, int _arguments)
|
||||
solAssert(m_evm15, "BEGINSUB used for EVM 1.0");
|
||||
solAssert(_arguments >= 0, "");
|
||||
setLabelToCurrentPosition(_labelId);
|
||||
m_bytecode.push_back(uint8_t(solidity::Instruction::BEGINSUB));
|
||||
m_bytecode.push_back(uint8_t(dev::eth::Instruction::BEGINSUB));
|
||||
m_stackHeight += _arguments;
|
||||
}
|
||||
|
||||
@@ -141,7 +142,7 @@ void EVMAssembly::appendJumpsub(LabelID _labelId, int _arguments, int _returns)
|
||||
{
|
||||
solAssert(m_evm15, "JUMPSUB used for EVM 1.0");
|
||||
solAssert(_arguments >= 0 && _returns >= 0, "");
|
||||
m_bytecode.push_back(uint8_t(solidity::Instruction::JUMPSUB));
|
||||
m_bytecode.push_back(uint8_t(dev::eth::Instruction::JUMPSUB));
|
||||
appendLabelReferenceInternal(_labelId);
|
||||
m_stackHeight += _returns - _arguments;
|
||||
}
|
||||
@@ -150,7 +151,7 @@ void EVMAssembly::appendReturnsub(int _returns, int _stackDiffAfter)
|
||||
{
|
||||
solAssert(m_evm15, "RETURNSUB used for EVM 1.0");
|
||||
solAssert(_returns >= 0, "");
|
||||
m_bytecode.push_back(uint8_t(solidity::Instruction::RETURNSUB));
|
||||
m_bytecode.push_back(uint8_t(dev::eth::Instruction::RETURNSUB));
|
||||
m_stackHeight += _stackDiffAfter - _returns;
|
||||
}
|
||||
|
||||
@@ -189,7 +190,7 @@ void EVMAssembly::appendLabelReferenceInternal(LabelID _labelId)
|
||||
|
||||
void EVMAssembly::appendAssemblySize()
|
||||
{
|
||||
appendInstruction(solidity::pushInstruction(assemblySizeReferenceSize));
|
||||
appendInstruction(dev::eth::pushInstruction(assemblySizeReferenceSize));
|
||||
m_assemblySizePositions.push_back(m_bytecode.size());
|
||||
m_bytecode += bytes(assemblySizeReferenceSize);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/// at the beginning.
|
||||
int stackHeight() const override { return m_stackHeight; }
|
||||
/// Append an EVM instruction.
|
||||
void appendInstruction(dev::solidity::Instruction _instruction) override;
|
||||
void appendInstruction(dev::eth::Instruction _instruction) override;
|
||||
/// Append a constant.
|
||||
void appendConstant(dev::u256 const& _constant) override;
|
||||
/// Append a label.
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void VariableReferenceCounter::operator()(Identifier const& _identifier)
|
||||
{
|
||||
@@ -155,7 +154,7 @@ void CodeTransform::freeUnusedVariables()
|
||||
while (m_unusedStackSlots.count(m_assembly.stackHeight() - 1))
|
||||
{
|
||||
solAssert(m_unusedStackSlots.erase(m_assembly.stackHeight() - 1), "");
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
--m_stackAdjustment;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +202,7 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
|
||||
{
|
||||
m_context->variableStackHeights.erase(&var);
|
||||
m_assembly.setSourceLocation(_varDecl.location);
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
--m_stackAdjustment;
|
||||
}
|
||||
else
|
||||
@@ -218,8 +217,8 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
|
||||
m_context->variableStackHeights[&var] = slot;
|
||||
m_assembly.setSourceLocation(_varDecl.location);
|
||||
if (int heightDiff = variableHeightDiff(var, varName, true))
|
||||
m_assembly.appendInstruction(solidity::swapInstruction(heightDiff - 1));
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::swapInstruction(heightDiff - 1));
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
--m_stackAdjustment;
|
||||
}
|
||||
}
|
||||
@@ -228,10 +227,10 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
|
||||
|
||||
void CodeTransform::stackError(StackTooDeepError _error, int _targetStackHeight)
|
||||
{
|
||||
m_assembly.appendInstruction(solidity::Instruction::INVALID);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::INVALID);
|
||||
// Correct the stack.
|
||||
while (m_assembly.stackHeight() > _targetStackHeight)
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
while (m_assembly.stackHeight() < _targetStackHeight)
|
||||
m_assembly.appendConstant(u256(0));
|
||||
// Store error.
|
||||
@@ -324,11 +323,11 @@ void CodeTransform::operator()(FunctionCall const& _call)
|
||||
void CodeTransform::operator()(FunctionalInstruction const& _instruction)
|
||||
{
|
||||
if (m_evm15 && (
|
||||
_instruction.instruction == solidity::Instruction::JUMP ||
|
||||
_instruction.instruction == solidity::Instruction::JUMPI
|
||||
_instruction.instruction == dev::eth::Instruction::JUMP ||
|
||||
_instruction.instruction == dev::eth::Instruction::JUMPI
|
||||
))
|
||||
{
|
||||
bool const isJumpI = _instruction.instruction == solidity::Instruction::JUMPI;
|
||||
bool const isJumpI = _instruction.instruction == dev::eth::Instruction::JUMPI;
|
||||
if (isJumpI)
|
||||
{
|
||||
solAssert(_instruction.arguments.size() == 2, "");
|
||||
@@ -366,7 +365,7 @@ void CodeTransform::operator()(Identifier const& _identifier)
|
||||
// TODO: opportunity for optimization: Do not DUP if this is the last reference
|
||||
// to the top most element of the stack
|
||||
if (int heightDiff = variableHeightDiff(_var, _identifier.name, false))
|
||||
m_assembly.appendInstruction(solidity::dupInstruction(heightDiff));
|
||||
m_assembly.appendInstruction(dev::eth::dupInstruction(heightDiff));
|
||||
else
|
||||
// Store something to balance the stack
|
||||
m_assembly.appendConstant(u256(0));
|
||||
@@ -403,8 +402,8 @@ void CodeTransform::operator()(Literal const& _literal)
|
||||
void CodeTransform::operator()(yul::Instruction const& _instruction)
|
||||
{
|
||||
solAssert(!m_allowStackOpt, "");
|
||||
solAssert(!m_evm15 || _instruction.instruction != solidity::Instruction::JUMP, "Bare JUMP instruction used for EVM1.5");
|
||||
solAssert(!m_evm15 || _instruction.instruction != solidity::Instruction::JUMPI, "Bare JUMPI instruction used for EVM1.5");
|
||||
solAssert(!m_evm15 || _instruction.instruction != dev::eth::Instruction::JUMP, "Bare JUMP instruction used for EVM1.5");
|
||||
solAssert(!m_evm15 || _instruction.instruction != dev::eth::Instruction::JUMPI, "Bare JUMPI instruction used for EVM1.5");
|
||||
m_assembly.setSourceLocation(_instruction.location);
|
||||
m_assembly.appendInstruction(_instruction.instruction);
|
||||
checkStackHeight(&_instruction);
|
||||
@@ -414,7 +413,7 @@ void CodeTransform::operator()(If const& _if)
|
||||
{
|
||||
visitExpression(*_if.condition);
|
||||
m_assembly.setSourceLocation(_if.location);
|
||||
m_assembly.appendInstruction(solidity::Instruction::ISZERO);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::ISZERO);
|
||||
AbstractAssembly::LabelID end = m_assembly.newLabelId();
|
||||
m_assembly.appendJumpToIf(end);
|
||||
(*this)(_if.body);
|
||||
@@ -440,8 +439,8 @@ void CodeTransform::operator()(Switch const& _switch)
|
||||
AbstractAssembly::LabelID bodyLabel = m_assembly.newLabelId();
|
||||
caseBodies[&c] = bodyLabel;
|
||||
solAssert(m_assembly.stackHeight() == expressionHeight + 1, "");
|
||||
m_assembly.appendInstruction(solidity::dupInstruction(2));
|
||||
m_assembly.appendInstruction(solidity::Instruction::EQ);
|
||||
m_assembly.appendInstruction(dev::eth::dupInstruction(2));
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::EQ);
|
||||
m_assembly.appendJumpToIf(bodyLabel);
|
||||
}
|
||||
else
|
||||
@@ -467,7 +466,7 @@ void CodeTransform::operator()(Switch const& _switch)
|
||||
|
||||
m_assembly.setSourceLocation(_switch.location);
|
||||
m_assembly.appendLabel(end);
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
checkStackHeight(&_switch);
|
||||
}
|
||||
|
||||
@@ -573,12 +572,12 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
|
||||
while (!stackLayout.empty() && stackLayout.back() != int(stackLayout.size() - 1))
|
||||
if (stackLayout.back() < 0)
|
||||
{
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
stackLayout.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_assembly.appendInstruction(swapInstruction(stackLayout.size() - stackLayout.back() - 1));
|
||||
m_assembly.appendInstruction(dev::eth::swapInstruction(stackLayout.size() - stackLayout.back() - 1));
|
||||
swap(stackLayout[stackLayout.back()], stackLayout.back());
|
||||
}
|
||||
for (int i = 0; size_t(i) < stackLayout.size(); ++i)
|
||||
@@ -612,7 +611,7 @@ void CodeTransform::operator()(ForLoop const& _forLoop)
|
||||
|
||||
visitExpression(*_forLoop.condition);
|
||||
m_assembly.setSourceLocation(_forLoop.location);
|
||||
m_assembly.appendInstruction(solidity::Instruction::ISZERO);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::ISZERO);
|
||||
m_assembly.appendJumpToIf(loopEnd);
|
||||
|
||||
int const stackHeightBody = m_assembly.stackHeight();
|
||||
@@ -732,7 +731,7 @@ void CodeTransform::finalizeBlock(Block const& _block, int blockStartStackHeight
|
||||
m_stackAdjustment++;
|
||||
}
|
||||
else
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
}
|
||||
|
||||
int deposit = m_assembly.stackHeight() - blockStartStackHeight;
|
||||
@@ -754,8 +753,8 @@ void CodeTransform::generateAssignment(Identifier const& _variableName)
|
||||
{
|
||||
Scope::Variable const& _var = boost::get<Scope::Variable>(*var);
|
||||
if (int heightDiff = variableHeightDiff(_var, _variableName.name, true))
|
||||
m_assembly.appendInstruction(solidity::swapInstruction(heightDiff - 1));
|
||||
m_assembly.appendInstruction(solidity::Instruction::POP);
|
||||
m_assembly.appendInstruction(dev::eth::swapInstruction(heightDiff - 1));
|
||||
m_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
decreaseReference(_variableName.name, _var);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
|
||||
EVMDialect::EVMDialect(AsmFlavour _flavour, bool _objectAccess, langutil::EVMVersion _evmVersion):
|
||||
Dialect{_flavour}, m_objectAccess(_objectAccess), m_evmVersion(_evmVersion)
|
||||
@@ -84,7 +82,7 @@ EVMDialect::EVMDialect(AsmFlavour _flavour, bool _objectAccess, langutil::EVMVer
|
||||
std::function<void()> _visitArguments
|
||||
) {
|
||||
_visitArguments();
|
||||
_assembly.appendInstruction(solidity::Instruction::CODECOPY);
|
||||
_assembly.appendInstruction(dev::eth::Instruction::CODECOPY);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -30,25 +30,25 @@ using namespace langutil;
|
||||
using namespace yul;
|
||||
|
||||
|
||||
void NoOutputAssembly::appendInstruction(solidity::Instruction _instr)
|
||||
void NoOutputAssembly::appendInstruction(dev::eth::Instruction _instr)
|
||||
{
|
||||
m_stackHeight += solidity::instructionInfo(_instr).ret - solidity::instructionInfo(_instr).args;
|
||||
m_stackHeight += instructionInfo(_instr).ret - instructionInfo(_instr).args;
|
||||
}
|
||||
|
||||
void NoOutputAssembly::appendConstant(u256 const&)
|
||||
{
|
||||
appendInstruction(solidity::pushInstruction(1));
|
||||
appendInstruction(dev::eth::pushInstruction(1));
|
||||
}
|
||||
|
||||
void NoOutputAssembly::appendLabel(LabelID)
|
||||
{
|
||||
appendInstruction(solidity::Instruction::JUMPDEST);
|
||||
appendInstruction(dev::eth::Instruction::JUMPDEST);
|
||||
}
|
||||
|
||||
void NoOutputAssembly::appendLabelReference(LabelID)
|
||||
{
|
||||
solAssert(!m_evm15, "Cannot use plain label references in EMV1.5 mode.");
|
||||
appendInstruction(solidity::pushInstruction(1));
|
||||
appendInstruction(dev::eth::pushInstruction(1));
|
||||
}
|
||||
|
||||
NoOutputAssembly::LabelID NoOutputAssembly::newLabelId()
|
||||
@@ -69,7 +69,7 @@ void NoOutputAssembly::appendLinkerSymbol(string const&)
|
||||
void NoOutputAssembly::appendJump(int _stackDiffAfter)
|
||||
{
|
||||
solAssert(!m_evm15, "Plain JUMP used for EVM 1.5");
|
||||
appendInstruction(solidity::Instruction::JUMP);
|
||||
appendInstruction(dev::eth::Instruction::JUMP);
|
||||
m_stackHeight += _stackDiffAfter;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void NoOutputAssembly::appendJumpToIf(LabelID _labelId)
|
||||
else
|
||||
{
|
||||
appendLabelReference(_labelId);
|
||||
appendInstruction(solidity::Instruction::JUMPI);
|
||||
appendInstruction(dev::eth::Instruction::JUMPI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ void NoOutputAssembly::appendReturnsub(int _returns, int _stackDiffAfter)
|
||||
|
||||
void NoOutputAssembly::appendAssemblySize()
|
||||
{
|
||||
appendInstruction(solidity::Instruction::PUSH1);
|
||||
appendInstruction(dev::eth::Instruction::PUSH1);
|
||||
}
|
||||
|
||||
pair<shared_ptr<AbstractAssembly>, AbstractAssembly::SubID> NoOutputAssembly::createSubAssembly()
|
||||
@@ -129,12 +129,12 @@ pair<shared_ptr<AbstractAssembly>, AbstractAssembly::SubID> NoOutputAssembly::cr
|
||||
|
||||
void NoOutputAssembly::appendDataOffset(AbstractAssembly::SubID)
|
||||
{
|
||||
appendInstruction(solidity::Instruction::PUSH1);
|
||||
appendInstruction(dev::eth::Instruction::PUSH1);
|
||||
}
|
||||
|
||||
void NoOutputAssembly::appendDataSize(AbstractAssembly::SubID)
|
||||
{
|
||||
appendInstruction(solidity::Instruction::PUSH1);
|
||||
appendInstruction(dev::eth::Instruction::PUSH1);
|
||||
}
|
||||
|
||||
AbstractAssembly::SubID NoOutputAssembly::appendData(bytes const&)
|
||||
@@ -153,7 +153,7 @@ NoOutputEVMDialect::NoOutputEVMDialect(shared_ptr<EVMDialect> const& _copyFrom):
|
||||
{
|
||||
_visitArguments();
|
||||
for (size_t i = 0; i < parameters; i++)
|
||||
_assembly.appendInstruction(dev::solidity::Instruction::POP);
|
||||
_assembly.appendInstruction(dev::eth::Instruction::POP);
|
||||
|
||||
for (size_t i = 0; i < returns; i++)
|
||||
_assembly.appendConstant(u256(0));
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
void setSourceLocation(langutil::SourceLocation const&) override {}
|
||||
int stackHeight() const override { return m_stackHeight; }
|
||||
void appendInstruction(dev::solidity::Instruction _instruction) override;
|
||||
void appendInstruction(dev::eth::Instruction _instruction) override;
|
||||
void appendConstant(dev::u256 const& _constant) override;
|
||||
void appendLabel(LabelID _labelId) override;
|
||||
void appendLabelReference(LabelID _labelId) override;
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
|
||||
void ASTWalker::operator()(FunctionalInstruction const& _instr)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
YulString Disambiguator::translateIdentifier(YulString _originalName)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void EquivalentFunctionCombiner::run(Block& _ast)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace solidity;
|
||||
|
||||
void EquivalentFunctionDetector::operator()(FunctionDefinition const& _fun)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void ExpressionInliner::run()
|
||||
{
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void ExpressionJoiner::operator()(FunctionalInstruction& _instruction)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
|
||||
void ExpressionSimplifier::visit(Expression& _expression)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void ExpressionSplitter::operator()(FunctionalInstruction& _instruction)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
FullInliner::FullInliner(Block& _ast, NameDispenser& _dispenser):
|
||||
m_ast(_ast), m_nameDispenser(_dispenser)
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
|
||||
void FunctionGrouper::operator()(Block& _block)
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void FunctionHoister::operator()(Block& _block)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void MainFunction::operator()(Block& _block)
|
||||
{
|
||||
|
||||
@@ -99,12 +99,11 @@ void CodeCost::operator()(FunctionCall const& _funCall)
|
||||
|
||||
void CodeCost::operator()(FunctionalInstruction const& _instr)
|
||||
{
|
||||
using namespace dev::solidity;
|
||||
yulAssert(m_cost >= 1, "Should assign cost one in visit(Expression).");
|
||||
Tier gasPriceTier = instructionInfo(_instr.instruction).gasPriceTier;
|
||||
if (gasPriceTier < Tier::VeryLow)
|
||||
dev::eth::Tier gasPriceTier = dev::eth::instructionInfo(_instr.instruction).gasPriceTier;
|
||||
if (gasPriceTier < dev::eth::Tier::VeryLow)
|
||||
m_cost -= 1;
|
||||
else if (gasPriceTier < Tier::High)
|
||||
else if (gasPriceTier < dev::eth::Tier::High)
|
||||
m_cost += 1;
|
||||
else
|
||||
m_cost += 49;
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void RedundantAssignEliminator::operator()(Identifier const& _identifier)
|
||||
{
|
||||
|
||||
@@ -27,12 +27,10 @@
|
||||
|
||||
#include <libdevcore/CommonData.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void SSATransform::operator()(Identifier& _identifier)
|
||||
{
|
||||
|
||||
@@ -30,11 +30,12 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
|
||||
|
||||
SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(
|
||||
SimplificationRule<yul::Pattern> const* SimplificationRules::findFirstMatch(
|
||||
Expression const& _expr,
|
||||
Dialect const& _dialect,
|
||||
map<YulString, Expression const*> const& _ssaValues
|
||||
@@ -59,7 +60,7 @@ SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(
|
||||
|
||||
bool SimplificationRules::isInitialized() const
|
||||
{
|
||||
return !m_rules[uint8_t(solidity::Instruction::ADD)].empty();
|
||||
return !m_rules[uint8_t(dev::eth::Instruction::ADD)].empty();
|
||||
}
|
||||
|
||||
void SimplificationRules::addRules(vector<SimplificationRule<Pattern>> const& _rules)
|
||||
@@ -93,7 +94,7 @@ SimplificationRules::SimplificationRules()
|
||||
assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized.");
|
||||
}
|
||||
|
||||
Pattern::Pattern(solidity::Instruction _instruction, vector<Pattern> const& _arguments):
|
||||
yul::Pattern::Pattern(dev::eth::Instruction _instruction, vector<Pattern> const& _arguments):
|
||||
m_kind(PatternKind::Operation),
|
||||
m_instruction(_instruction),
|
||||
m_arguments(_arguments)
|
||||
@@ -187,7 +188,7 @@ bool Pattern::matches(
|
||||
return true;
|
||||
}
|
||||
|
||||
solidity::Instruction Pattern::instruction() const
|
||||
dev::eth::Instruction Pattern::instruction() const
|
||||
{
|
||||
assertThrow(m_kind == PatternKind::Operation, OptimizerException, "");
|
||||
return m_instruction;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libevmasm/ExpressionClasses.h>
|
||||
#include <libevmasm/SimplificationRule.h>
|
||||
|
||||
#include <libyul/AsmDataForward.h>
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
/// @returns a pointer to the first matching pattern and sets the match
|
||||
/// groups accordingly.
|
||||
/// @param _ssaValues values of variables that are assigned exactly once.
|
||||
static SimplificationRule<Pattern> const* findFirstMatch(
|
||||
static dev::eth::SimplificationRule<Pattern> const* findFirstMatch(
|
||||
Expression const& _expr,
|
||||
Dialect const& _dialect,
|
||||
std::map<YulString, Expression const*> const& _ssaValues
|
||||
@@ -57,13 +56,13 @@ public:
|
||||
/// by the constructor, but we had some issues with static initialization.
|
||||
bool isInitialized() const;
|
||||
private:
|
||||
void addRules(std::vector<SimplificationRule<Pattern>> const& _rules);
|
||||
void addRule(SimplificationRule<Pattern> const& _rule);
|
||||
void addRules(std::vector<dev::eth::SimplificationRule<Pattern>> const& _rules);
|
||||
void addRule(dev::eth::SimplificationRule<Pattern> const& _rule);
|
||||
|
||||
void resetMatchGroups() { m_matchGroups.clear(); }
|
||||
|
||||
std::map<unsigned, Expression const*> m_matchGroups;
|
||||
std::vector<SimplificationRule<Pattern>> m_rules[256];
|
||||
std::vector<dev::eth::SimplificationRule<Pattern>> m_rules[256];
|
||||
};
|
||||
|
||||
enum class PatternKind
|
||||
@@ -88,7 +87,7 @@ public:
|
||||
// Matches a specific constant value.
|
||||
Pattern(dev::u256 const& _value): m_kind(PatternKind::Constant), m_data(std::make_shared<dev::u256>(_value)) {}
|
||||
// Matches a given instruction with given arguments
|
||||
Pattern(dev::solidity::Instruction _instruction, std::vector<Pattern> const& _arguments = {});
|
||||
Pattern(dev::eth::Instruction _instruction, std::vector<Pattern> const& _arguments = {});
|
||||
/// Sets this pattern to be part of the match group with the identifier @a _group.
|
||||
/// Inside one rule, all patterns in the same match group have to match expressions from the
|
||||
/// same expression equivalence class.
|
||||
@@ -105,7 +104,7 @@ public:
|
||||
/// @returns the data of the matched expression if this pattern is part of a match group.
|
||||
dev::u256 d() const;
|
||||
|
||||
dev::solidity::Instruction instruction() const;
|
||||
dev::eth::Instruction instruction() const;
|
||||
|
||||
/// Turns this pattern into an actual expression. Should only be called
|
||||
/// for patterns resulting from an action, i.e. with match groups assigned.
|
||||
@@ -115,7 +114,7 @@ private:
|
||||
Expression const& matchGroupValue() const;
|
||||
|
||||
PatternKind m_kind = PatternKind::Any;
|
||||
dev::solidity::Instruction m_instruction; ///< Only valid if m_kind is Operation
|
||||
dev::eth::Instruction m_instruction; ///< Only valid if m_kind is Operation
|
||||
std::shared_ptr<dev::u256> m_data; ///< Only valid if m_kind is Constant
|
||||
std::vector<Pattern> m_arguments;
|
||||
unsigned m_matchGroup = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ ExpressionStatement makePopExpressionStatement(langutil::SourceLocation const& _
|
||||
{
|
||||
return {_location, FunctionalInstruction{
|
||||
_location,
|
||||
solidity::Instruction::POP,
|
||||
dev::eth::Instruction::POP,
|
||||
{std::move(_expression)}
|
||||
}};
|
||||
}
|
||||
@@ -105,7 +105,7 @@ OptionalStatements reduceSingleCaseSwitch(Switch& _switchStmt)
|
||||
std::move(_switchStmt.location),
|
||||
make_unique<Expression>(FunctionalInstruction{
|
||||
std::move(loc),
|
||||
solidity::Instruction::EQ,
|
||||
dev::eth::Instruction::EQ,
|
||||
{std::move(*switchCase.value), std::move(*_switchStmt.expression)}
|
||||
}),
|
||||
std::move(switchCase.body)
|
||||
|
||||
@@ -85,7 +85,7 @@ void UnusedPruner::operator()(Block& _block)
|
||||
// instead of `pop`.
|
||||
statement = ExpressionStatement{varDecl.location, FunctionalInstruction{
|
||||
varDecl.location,
|
||||
solidity::Instruction::POP,
|
||||
dev::eth::Instruction::POP,
|
||||
{*std::move(varDecl.value)}
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user