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:
commit
529aca5cbd
@ -68,10 +68,10 @@ public:
|
||||
void appendProgramSize() { append(AssemblyItem(PushProgramSize)); }
|
||||
void appendLibraryAddress(std::string const& _identifier) { append(newPushLibraryAddress(_identifier)); }
|
||||
|
||||
AssemblyItem appendJump() { auto ret = append(newPushTag()); append(solidity::Instruction::JUMP); return ret; }
|
||||
AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(solidity::Instruction::JUMPI); return ret; }
|
||||
AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMP); return ret; }
|
||||
AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMPI); return ret; }
|
||||
AssemblyItem appendJump() { auto ret = append(newPushTag()); append(Instruction::JUMP); return ret; }
|
||||
AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(Instruction::JUMPI); return ret; }
|
||||
AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMP); return ret; }
|
||||
AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMPI); return ret; }
|
||||
|
||||
/// Adds a subroutine to the code (in the data section) and pushes its size (via a tag)
|
||||
/// on the stack. @returns the pushsub assembly item.
|
||||
|
@ -231,7 +231,7 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItem const& _item)
|
||||
{
|
||||
case Operation:
|
||||
_out << " " << instructionInfo(_item.instruction()).name;
|
||||
if (_item.instruction() == solidity::Instruction::JUMP || _item.instruction() == solidity::Instruction::JUMPI)
|
||||
if (_item.instruction() == Instruction::JUMP || _item.instruction() == Instruction::JUMPI)
|
||||
_out << "\t" << _item.getJumpTypeAsString();
|
||||
break;
|
||||
case Push:
|
||||
|
@ -21,14 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <libevmasm/Instruction.h>
|
||||
#include <libevmasm/Exceptions.h>
|
||||
#include <liblangutil/SourceLocation.h>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/Assertions.h>
|
||||
#include <libevmasm/Instruction.h>
|
||||
#include <liblangutil/SourceLocation.h>
|
||||
#include "Exceptions.h"
|
||||
using namespace dev::solidity;
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
@ -59,7 +58,7 @@ public:
|
||||
|
||||
AssemblyItem(u256 _push, langutil::SourceLocation _location = langutil::SourceLocation()):
|
||||
AssemblyItem(Push, std::move(_push), std::move(_location)) { }
|
||||
AssemblyItem(solidity::Instruction _i, langutil::SourceLocation _location = langutil::SourceLocation()):
|
||||
AssemblyItem(Instruction _i, langutil::SourceLocation _location = langutil::SourceLocation()):
|
||||
m_type(Operation),
|
||||
m_instruction(_i),
|
||||
m_location(std::move(_location))
|
||||
|
@ -19,17 +19,18 @@
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
#include "./Instruction.h"
|
||||
#include <libevmasm/Instruction.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
using namespace dev::eth;
|
||||
|
||||
std::map<std::string, Instruction> const dev::solidity::c_instructions =
|
||||
std::map<std::string, Instruction> const dev::eth::c_instructions =
|
||||
{
|
||||
{ "STOP", Instruction::STOP },
|
||||
{ "ADD", Instruction::ADD },
|
||||
@ -317,7 +318,7 @@ static std::map<Instruction, InstructionInfo> const c_instructionInfo =
|
||||
{ Instruction::SELFDESTRUCT, { "SELFDESTRUCT", 0, 1, 0, true, Tier::Special } }
|
||||
};
|
||||
|
||||
void dev::solidity::eachInstruction(
|
||||
void dev::eth::eachInstruction(
|
||||
bytes const& _mem,
|
||||
function<void(Instruction,u256 const&)> const& _onInstruction
|
||||
)
|
||||
@ -346,7 +347,7 @@ void dev::solidity::eachInstruction(
|
||||
}
|
||||
}
|
||||
|
||||
string dev::solidity::disassemble(bytes const& _mem)
|
||||
string dev::eth::disassemble(bytes const& _mem)
|
||||
{
|
||||
stringstream ret;
|
||||
eachInstruction(_mem, [&](Instruction _instr, u256 const& _data) {
|
||||
@ -363,7 +364,7 @@ string dev::solidity::disassemble(bytes const& _mem)
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
InstructionInfo dev::solidity::instructionInfo(Instruction _inst)
|
||||
InstructionInfo dev::eth::instructionInfo(Instruction _inst)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -375,7 +376,7 @@ InstructionInfo dev::solidity::instructionInfo(Instruction _inst)
|
||||
}
|
||||
}
|
||||
|
||||
bool dev::solidity::isValidInstruction(Instruction _inst)
|
||||
bool dev::eth::isValidInstruction(Instruction _inst)
|
||||
{
|
||||
return !!c_instructionInfo.count(_inst);
|
||||
}
|
||||
|
@ -21,14 +21,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <libevmasm/Exceptions.h>
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libdevcore/Assertions.h>
|
||||
#include "Exceptions.h"
|
||||
#include <functional>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace eth
|
||||
{
|
||||
|
||||
DEV_SIMPLE_EXCEPTION(InvalidDeposit);
|
||||
|
@ -21,19 +21,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/multiprecision/detail/min_max.hpp>
|
||||
|
||||
#include <libevmasm/Instruction.h>
|
||||
#include <libevmasm/SimplificationRule.h>
|
||||
|
||||
#include <libdevcore/CommonData.h>
|
||||
|
||||
#include <boost/multiprecision/detail/min_max.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace eth
|
||||
{
|
||||
|
||||
template <class S> S divWorkaround(S const& _a, S const& _b)
|
||||
|
@ -96,14 +96,14 @@ bool SemanticInformation::isDupInstruction(AssemblyItem const& _item)
|
||||
{
|
||||
if (_item.type() != Operation)
|
||||
return false;
|
||||
return solidity::isDupInstruction(_item.instruction());
|
||||
return dev::eth::isDupInstruction(_item.instruction());
|
||||
}
|
||||
|
||||
bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
|
||||
{
|
||||
if (_item.type() != Operation)
|
||||
return false;
|
||||
return solidity::isSwapInstruction(_item.instruction());
|
||||
return dev::eth::isSwapInstruction(_item.instruction());
|
||||
}
|
||||
|
||||
bool SemanticInformation::isJumpInstruction(AssemblyItem const& _item)
|
||||
|
@ -53,13 +53,13 @@ struct SemanticInformation
|
||||
/// @returns true if the instruction can be moved or copied (together with its arguments)
|
||||
/// without altering the semantics. This means it cannot depend on storage or memory,
|
||||
/// cannot have any side-effects, but it can depend on a call-constant state of the blockchain.
|
||||
static bool movable(solidity::Instruction _instruction);
|
||||
static bool movable(Instruction _instruction);
|
||||
/// @returns true if the given instruction modifies memory.
|
||||
static bool invalidatesMemory(solidity::Instruction _instruction);
|
||||
static bool invalidatesMemory(Instruction _instruction);
|
||||
/// @returns true if the given instruction modifies storage (even indirectly).
|
||||
static bool invalidatesStorage(solidity::Instruction _instruction);
|
||||
static bool invalidInPureFunctions(solidity::Instruction _instruction);
|
||||
static bool invalidInViewFunctions(solidity::Instruction _instruction);
|
||||
static bool invalidatesStorage(Instruction _instruction);
|
||||
static bool invalidInPureFunctions(Instruction _instruction);
|
||||
static bool invalidInViewFunctions(Instruction _instruction);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace eth
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::lll;
|
||||
|
||||
void CodeFragment::finalise(CompilerState const& _cs)
|
||||
@ -66,7 +67,7 @@ bool validAssemblyInstruction(string us)
|
||||
auto it = c_instructions.find(us);
|
||||
return !(
|
||||
it == c_instructions.end() ||
|
||||
solidity::isPushInstruction(it->second)
|
||||
isPushInstruction(it->second)
|
||||
);
|
||||
}
|
||||
|
||||
@ -76,10 +77,10 @@ bool validFunctionalInstruction(string us)
|
||||
auto it = c_instructions.find(us);
|
||||
return !(
|
||||
it == c_instructions.end() ||
|
||||
solidity::isPushInstruction(it->second) ||
|
||||
solidity::isDupInstruction(it->second) ||
|
||||
solidity::isSwapInstruction(it->second) ||
|
||||
it->second == solidity::Instruction::JUMPDEST
|
||||
isPushInstruction(it->second) ||
|
||||
isDupInstruction(it->second) ||
|
||||
isSwapInstruction(it->second) ||
|
||||
it->second == Instruction::JUMPDEST
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ vector<Declaration const*> NameAndTypeResolver::cleanedDeclarations(
|
||||
|
||||
void NameAndTypeResolver::warnVariablesNamedLikeInstructions()
|
||||
{
|
||||
for (auto const& instruction: c_instructions)
|
||||
for (auto const& instruction: dev::eth::c_instructions)
|
||||
{
|
||||
string const instructionName{boost::algorithm::to_lower_copy(instruction.first)};
|
||||
auto declarations = nameFromCurrentScope(instructionName, true);
|
||||
|
@ -108,11 +108,11 @@ public:
|
||||
|
||||
private:
|
||||
std::function<void(StateMutability, SourceLocation const&)> m_reportMutability;
|
||||
void checkInstruction(SourceLocation _location, solidity::Instruction _instruction)
|
||||
void checkInstruction(SourceLocation _location, dev::eth::Instruction _instruction)
|
||||
{
|
||||
if (eth::SemanticInformation::invalidInViewFunctions(_instruction))
|
||||
m_reportMutability(StateMutability::NonPayable, _location);
|
||||
else if (_instruction == Instruction::CALLVALUE)
|
||||
else if (_instruction == dev::eth::Instruction::CALLVALUE)
|
||||
m_reportMutability(StateMutability::Payable, _location);
|
||||
else if (eth::SemanticInformation::invalidInPureFunctions(_instruction))
|
||||
m_reportMutability(StateMutability::View, _location);
|
||||
|
@ -32,8 +32,9 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace langutil;
|
||||
using namespace solidity;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType const& _sourceType) const
|
||||
{
|
||||
|
@ -53,11 +53,9 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace langutil;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
{
|
||||
using namespace dev::eth;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
|
||||
void CompilerContext::addStateVariable(
|
||||
VariableDeclaration const& _declaration,
|
||||
@ -554,6 +552,3 @@ void CompilerContext::FunctionCompilationQueue::startFunction(Declaration const&
|
||||
m_functionsToCompile.pop();
|
||||
m_alreadyCompiledFunctions.insert(&_function);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public:
|
||||
|
||||
/// Append elements to the current instruction list and adjust @a m_stackOffset.
|
||||
CompilerContext& operator<<(eth::AssemblyItem const& _item) { m_asm->append(_item); return *this; }
|
||||
CompilerContext& operator<<(Instruction _instruction) { m_asm->append(_instruction); return *this; }
|
||||
CompilerContext& operator<<(dev::eth::Instruction _instruction) { m_asm->append(_instruction); return *this; }
|
||||
CompilerContext& operator<<(u256 const& _value) { m_asm->append(_value); return *this; }
|
||||
CompilerContext& operator<<(bytes const& _data) { m_asm->append(_data); return *this; }
|
||||
|
||||
|
@ -31,11 +31,9 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace langutil;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
{
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::solidity;
|
||||
|
||||
unsigned const CompilerUtils::dataStartOffset = 4;
|
||||
size_t const CompilerUtils::freeMemoryPointer = 64;
|
||||
@ -1414,6 +1412,3 @@ unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords)
|
||||
|
||||
return numBytes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace langutil;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace
|
||||
|
@ -39,11 +39,10 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace langutil;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
{
|
||||
|
||||
void ExpressionCompiler::compile(Expression const& _expression)
|
||||
{
|
||||
@ -2269,6 +2268,3 @@ CompilerUtils ExpressionCompiler::utils()
|
||||
{
|
||||
return CompilerUtils(m_context);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,9 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::eth;
|
||||
using namespace dev::solidity;
|
||||
using namespace langutil;
|
||||
using namespace solidity;
|
||||
|
||||
|
||||
StackVariable::StackVariable(CompilerContext& _compilerContext, VariableDeclaration const& _declaration):
|
||||
|
@ -239,7 +239,7 @@ Json::Value collectEVMObject(eth::LinkerObject const& _object, string const* _so
|
||||
{
|
||||
Json::Value output = Json::objectValue;
|
||||
output["object"] = _object.toHex();
|
||||
output["opcodes"] = solidity::disassemble(_object.bytecode);
|
||||
output["opcodes"] = dev::eth::disassemble(_object.bytecode);
|
||||
output["sourceMap"] = _sourceMap ? *_sourceMap : "";
|
||||
output["linkReferences"] = formatLinkReferences(_object.linkReferences);
|
||||
return output;
|
||||
|
@ -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
|
||||
|
@ -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; };
|
||||
|
@ -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);
|
||||
|
@ -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)}
|
||||
}};
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
using namespace dev::lll;
|
||||
|
||||
static string const VersionString =
|
||||
@ -130,7 +129,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
else if (mode == Disassemble)
|
||||
{
|
||||
cout << disassemble(fromHex(src)) << endl;
|
||||
cout << dev::eth::disassemble(fromHex(src)) << endl;
|
||||
}
|
||||
else if (mode == Binary || mode == Hex)
|
||||
{
|
||||
|
@ -284,11 +284,11 @@ void CommandLineInterface::handleBinary(string const& _contract)
|
||||
void CommandLineInterface::handleOpcode(string const& _contract)
|
||||
{
|
||||
if (m_args.count(g_argOutputDir))
|
||||
createFile(m_compiler->filesystemFriendlyName(_contract) + ".opcode", solidity::disassemble(m_compiler->object(_contract).bytecode));
|
||||
createFile(m_compiler->filesystemFriendlyName(_contract) + ".opcode", dev::eth::disassemble(m_compiler->object(_contract).bytecode));
|
||||
else
|
||||
{
|
||||
sout() << "Opcodes: " << endl;
|
||||
sout() << solidity::disassemble(m_compiler->object(_contract).bytecode);
|
||||
sout() << dev::eth::disassemble(m_compiler->object(_contract).bytecode);
|
||||
sout() << endl;
|
||||
}
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ void CommandLineInterface::handleCombinedJSON()
|
||||
if (requests.count(g_strBinaryRuntime))
|
||||
contractData[g_strBinaryRuntime] = m_compiler->runtimeObject(contractName).toHex();
|
||||
if (requests.count(g_strOpcodes))
|
||||
contractData[g_strOpcodes] = solidity::disassemble(m_compiler->object(contractName).bytecode);
|
||||
contractData[g_strOpcodes] = dev::eth::disassemble(m_compiler->object(contractName).bytecode);
|
||||
if (requests.count(g_strAsm))
|
||||
contractData[g_strAsm] = m_compiler->assemblyJSON(contractName, m_sourceCodes);
|
||||
if (requests.count(g_strSrcMap))
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <test/Options.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev::eth;
|
||||
using namespace langutil;
|
||||
|
||||
namespace dev
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
bytes realCode = bytecodeSansMetadata(_bytecode);
|
||||
BOOST_REQUIRE_MESSAGE(!realCode.empty(), "Invalid or missing metadata in bytecode.");
|
||||
size_t instructions = 0;
|
||||
solidity::eachInstruction(realCode, [&](Instruction _instr, u256 const&) {
|
||||
dev::eth::eachInstruction(realCode, [&](Instruction _instr, u256 const&) {
|
||||
if (!_which || *_which == _instr)
|
||||
instructions++;
|
||||
});
|
||||
|
@ -40,7 +40,6 @@
|
||||
using namespace std;
|
||||
using namespace langutil;
|
||||
using namespace yul;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -37,7 +37,6 @@ using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
using namespace yul::test;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ bool ObjectCompilerTest::run(ostream& _stream, string const& _linePrefix, bool c
|
||||
"Bytecode: " +
|
||||
toHex(obj.bytecode->bytecode) +
|
||||
"\nOpcodes: " +
|
||||
boost::trim_copy(solidity::disassemble(obj.bytecode->bytecode)) +
|
||||
boost::trim_copy(dev::eth::disassemble(obj.bytecode->bytecode)) +
|
||||
"\n";
|
||||
|
||||
if (m_expectation != m_obtainedResult)
|
||||
|
@ -36,7 +36,7 @@ string assemble(string const& _input)
|
||||
{
|
||||
AssemblyStack asmStack;
|
||||
BOOST_REQUIRE_MESSAGE(asmStack.parseAndAnalyze("", _input), "Source did not parse: " + _input);
|
||||
return dev::solidity::disassemble(asmStack.assemble(AssemblyStack::Machine::EVM, true).bytecode->bytecode);
|
||||
return dev::eth::disassemble(asmStack.assemble(AssemblyStack::Machine::EVM, true).bytecode->bytecode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,13 +92,14 @@ void copyZeroExtended(
|
||||
using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
|
||||
|
||||
u256 EVMInstructionInterpreter::eval(
|
||||
solidity::Instruction _instruction,
|
||||
dev::eth::Instruction _instruction,
|
||||
vector<u256> const& _arguments
|
||||
)
|
||||
{
|
||||
using dev::solidity::Instruction;
|
||||
using namespace dev::eth;
|
||||
using dev::eth::Instruction;
|
||||
|
||||
auto info = solidity::instructionInfo(_instruction);
|
||||
auto info = instructionInfo(_instruction);
|
||||
yulAssert(size_t(info.args) == _arguments.size(), "");
|
||||
|
||||
auto const& arg = _arguments;
|
||||
@ -474,9 +475,9 @@ bool EVMInstructionInterpreter::logMemory(bool _write, u256 const& _offset, u256
|
||||
return false;
|
||||
}
|
||||
|
||||
void EVMInstructionInterpreter::logTrace(solidity::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
void EVMInstructionInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
{
|
||||
logTrace(solidity::instructionInfo(_instruction).name, _arguments, _data);
|
||||
logTrace(dev::eth::instructionInfo(_instruction).name, _arguments, _data);
|
||||
}
|
||||
|
||||
void EVMInstructionInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
namespace eth
|
||||
{
|
||||
enum class Instruction: uint8_t;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public:
|
||||
explicit EVMInstructionInterpreter(InterpreterState& _state):
|
||||
m_state(_state)
|
||||
{}
|
||||
dev::u256 eval(dev::solidity::Instruction _instruction, std::vector<dev::u256> const& _arguments);
|
||||
dev::u256 eval(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments);
|
||||
|
||||
private:
|
||||
/// Record a memory read in the trace. Also updates m_state.msize
|
||||
@ -78,7 +78,7 @@ private:
|
||||
|
||||
bool logMemory(bool _write, dev::u256 const& _offset, dev::u256 const& _size = 32, dev::bytes const& _data = {});
|
||||
|
||||
void logTrace(dev::solidity::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
void logTrace(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
/// Appends a log to the trace representing an instruction or similar operation by string,
|
||||
/// with arguments and auxiliary data (if nonempty).
|
||||
void logTrace(std::string const& _pseudoInstruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
|
Loading…
Reference in New Issue
Block a user