mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove "using namespace" from header and move Instruction to dev::eth.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user