Renaming namespace dev::julia to dev::yul.

This commit is contained in:
Christian Parpart 2018-10-15 11:58:51 +02:00
parent 9a4bec7e47
commit 1304361b9c
No known key found for this signature in database
GPG Key ID: 19BC8DD20312C929
71 changed files with 100 additions and 100 deletions

View File

@ -269,8 +269,8 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
// external references.
ErrorList errors;
ErrorReporter errorsIgnored(errors);
julia::ExternalIdentifierAccess::Resolver resolver =
[&](assembly::Identifier const& _identifier, julia::IdentifierContext, bool _crossesFunctionBoundary) {
yul::ExternalIdentifierAccess::Resolver resolver =
[&](assembly::Identifier const& _identifier, yul::IdentifierContext, bool _crossesFunctionBoundary) {
auto declarations = m_resolver.nameFromCurrentScope(_identifier.name);
bool isSlot = boost::algorithm::ends_with(_identifier.name, "_slot");
bool isOffset = boost::algorithm::ends_with(_identifier.name, "_offset");

View File

@ -952,9 +952,9 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
{
// External references have already been resolved in a prior stage and stored in the annotation.
// We run the resolve step again regardless.
julia::ExternalIdentifierAccess::Resolver identifierAccess = [&](
yul::ExternalIdentifierAccess::Resolver identifierAccess = [&](
assembly::Identifier const& _identifier,
julia::IdentifierContext _context,
yul::IdentifierContext _context,
bool
)
{
@ -978,7 +978,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
return size_t(-1);
}
else if (_context != julia::IdentifierContext::RValue)
else if (_context != yul::IdentifierContext::RValue)
{
m_errorReporter.typeError(_identifier.location, "Storage variables cannot be assigned to.");
return size_t(-1);
@ -1008,13 +1008,13 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
return size_t(-1);
}
else if (_context == julia::IdentifierContext::LValue)
else if (_context == yul::IdentifierContext::LValue)
{
m_errorReporter.typeError(_identifier.location, "Only local variables can be assigned to in inline assembly.");
return size_t(-1);
}
if (_context == julia::IdentifierContext::RValue)
if (_context == yul::IdentifierContext::RValue)
{
solAssert(!!declaration->type(), "Type of declaration required but not yet determined.");
if (dynamic_cast<FunctionDefinition const*>(declaration))

View File

@ -318,10 +318,10 @@ void CompilerContext::appendInlineAssembly(
{
int startStackHeight = stackHeight();
julia::ExternalIdentifierAccess identifierAccess;
yul::ExternalIdentifierAccess identifierAccess;
identifierAccess.resolve = [&](
assembly::Identifier const& _identifier,
julia::IdentifierContext,
yul::IdentifierContext,
bool
)
{
@ -330,15 +330,15 @@ void CompilerContext::appendInlineAssembly(
};
identifierAccess.generateCode = [&](
assembly::Identifier const& _identifier,
julia::IdentifierContext _context,
julia::AbstractAssembly& _assembly
yul::IdentifierContext _context,
yul::AbstractAssembly& _assembly
)
{
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name);
solAssert(it != _localVariables.end(), "");
int stackDepth = _localVariables.end() - it;
int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth;
if (_context == julia::IdentifierContext::LValue)
if (_context == yul::IdentifierContext::LValue)
stackDiff -= 1;
if (stackDiff < 1 || stackDiff > 16)
BOOST_THROW_EXCEPTION(
@ -346,7 +346,7 @@ void CompilerContext::appendInlineAssembly(
errinfo_sourceLocation(_identifier.location) <<
errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.")
);
if (_context == julia::IdentifierContext::RValue)
if (_context == yul::IdentifierContext::RValue)
_assembly.appendInstruction(dupInstruction(stackDiff));
else
{

View File

@ -494,21 +494,21 @@ bool ContractCompiler::visit(FunctionDefinition const& _function)
bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
{
unsigned startStackHeight = m_context.stackHeight();
julia::ExternalIdentifierAccess identifierAccess;
identifierAccess.resolve = [&](assembly::Identifier const& _identifier, julia::IdentifierContext, bool)
yul::ExternalIdentifierAccess identifierAccess;
identifierAccess.resolve = [&](assembly::Identifier const& _identifier, yul::IdentifierContext, bool)
{
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
if (ref == _inlineAssembly.annotation().externalReferences.end())
return size_t(-1);
return ref->second.valueSize;
};
identifierAccess.generateCode = [&](assembly::Identifier const& _identifier, julia::IdentifierContext _context, julia::AbstractAssembly& _assembly)
identifierAccess.generateCode = [&](assembly::Identifier const& _identifier, yul::IdentifierContext _context, yul::AbstractAssembly& _assembly)
{
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
solAssert(ref != _inlineAssembly.annotation().externalReferences.end(), "");
Declaration const* decl = ref->second.declaration;
solAssert(!!decl, "");
if (_context == julia::IdentifierContext::RValue)
if (_context == yul::IdentifierContext::RValue)
{
int const depositBefore = _assembly.stackHeight();
solAssert(!!decl->type(), "Type of declaration required but not yet determined.");

View File

@ -145,7 +145,7 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
if (m_resolver)
{
bool insideFunction = m_currentScope->insideFunction();
stackSize = m_resolver(_identifier, julia::IdentifierContext::RValue, insideFunction);
stackSize = m_resolver(_identifier, yul::IdentifierContext::RValue, insideFunction);
}
if (stackSize == size_t(-1))
{
@ -512,7 +512,7 @@ bool AsmAnalyzer::checkAssignment(assembly::Identifier const& _variable, size_t
else if (m_resolver)
{
bool insideFunction = m_currentScope->insideFunction();
variableSize = m_resolver(_variable, julia::IdentifierContext::LValue, insideFunction);
variableSize = m_resolver(_variable, yul::IdentifierContext::LValue, insideFunction);
}
if (variableSize == size_t(-1))
{

View File

@ -59,7 +59,7 @@ public:
EVMVersion _evmVersion,
boost::optional<Error::Type> _errorTypeForLoose,
AsmFlavour _flavour = AsmFlavour::Loose,
julia::ExternalIdentifierAccess::Resolver const& _resolver = julia::ExternalIdentifierAccess::Resolver()
yul::ExternalIdentifierAccess::Resolver const& _resolver = yul::ExternalIdentifierAccess::Resolver()
):
m_resolver(_resolver),
m_info(_analysisInfo),
@ -106,7 +106,7 @@ private:
void checkLooseFeature(SourceLocation const& _location, std::string const& _description);
int m_stackHeight = 0;
julia::ExternalIdentifierAccess::Resolver m_resolver;
yul::ExternalIdentifierAccess::Resolver m_resolver;
Scope* m_currentScope = nullptr;
/// Variables that are active at the current point in assembly (as opposed to
/// "part of the scope but not yet declared")

View File

@ -49,7 +49,7 @@ using namespace dev;
using namespace dev::solidity;
using namespace dev::solidity::assembly;
class EthAssemblyAdapter: public julia::AbstractAssembly
class EthAssemblyAdapter: public yul::AbstractAssembly
{
public:
explicit EthAssemblyAdapter(eth::Assembly& _assembly):
@ -145,12 +145,12 @@ void assembly::CodeGenerator::assemble(
Block const& _parsedData,
AsmAnalysisInfo& _analysisInfo,
eth::Assembly& _assembly,
julia::ExternalIdentifierAccess const& _identifierAccess,
yul::ExternalIdentifierAccess const& _identifierAccess,
bool _useNamedLabelsForFunctions
)
{
EthAssemblyAdapter assemblyAdapter(_assembly);
julia::CodeTransform(
yul::CodeTransform(
assemblyAdapter,
_analysisInfo,
false,

View File

@ -46,7 +46,7 @@ public:
Block const& _parsedData,
AsmAnalysisInfo& _analysisInfo,
eth::Assembly& _assembly,
julia::ExternalIdentifierAccess const& _identifierAccess = julia::ExternalIdentifierAccess(),
yul::ExternalIdentifierAccess const& _identifierAccess = yul::ExternalIdentifierAccess(),
bool _useNamedLabelsForFunctions = false
);
};

View File

@ -116,8 +116,8 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
case Machine::EVM15:
{
MachineAssemblyObject object;
julia::EVMAssembly assembly(true);
julia::CodeTransform(assembly, *m_analysisInfo, m_language == Language::Yul, true)(*m_parserResult);
yul::EVMAssembly assembly(true);
yul::CodeTransform(assembly, *m_analysisInfo, m_language == Language::Yul, true)(*m_parserResult);
object.bytecode = make_shared<eth::LinkerObject>(assembly.finalize());
/// TODO: fill out text representation
return object;

View File

@ -25,7 +25,7 @@
namespace dev
{
namespace julia
namespace yul
{
using Instruction = solidity::assembly::Instruction;

View File

@ -25,7 +25,7 @@
namespace dev
{
namespace julia
namespace yul
{
struct YulException: virtual Exception {};

View File

@ -38,7 +38,7 @@ struct Instruction;
struct Identifier;
}
}
namespace julia
namespace yul
{
///
@ -106,7 +106,7 @@ struct ExternalIdentifierAccess
/// Resolve an external reference given by the identifier in the given context.
/// @returns the size of the value (number of stack slots) or size_t(-1) if not found.
Resolver resolve;
using CodeGenerator = std::function<void(solidity::assembly::Identifier const&, IdentifierContext, julia::AbstractAssembly&)>;
using CodeGenerator = std::function<void(solidity::assembly::Identifier const&, IdentifierContext, yul::AbstractAssembly&)>;
/// Generate code for retrieving the value (rvalue context) or storing the value (lvalue context)
/// of an identifier. The code should be appended to the assembly. In rvalue context, the value is supposed
/// to be put onto the stack, in lvalue context, the value is assumed to be at the top of the stack.

View File

@ -26,7 +26,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
namespace
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
class EVMAssembly: public AbstractAssembly

View File

@ -29,7 +29,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
using Scope = dev::solidity::assembly::Scope;

View File

@ -37,7 +37,7 @@ namespace assembly
struct AsmAnalysisInfo;
}
}
namespace julia
namespace yul
{
class EVMAssembly;
@ -47,7 +47,7 @@ public:
/// Create the code transformer.
/// @param _identifierAccess used to resolve identifiers external to the inline assembly
CodeTransform(
julia::AbstractAssembly& _assembly,
yul::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _yul = false,
bool _evm15 = false,
@ -76,7 +76,7 @@ protected:
};
CodeTransform(
julia::AbstractAssembly& _assembly,
yul::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _yul,
bool _evm15,
@ -139,7 +139,7 @@ private:
void checkStackHeight(void const* _astElement) const;
julia::AbstractAssembly& m_assembly;
yul::AbstractAssembly& m_assembly;
solidity::assembly::AsmAnalysisInfo& m_info;
solidity::assembly::Scope* m_scope = nullptr;
bool m_yul = false;

View File

@ -28,7 +28,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
Statement ASTCopier::operator()(Instruction const&)
{

View File

@ -31,7 +31,7 @@
namespace dev
{
namespace julia
namespace yul
{
class ExpressionCopier: public boost::static_visitor<Expression>

View File

@ -26,7 +26,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;

View File

@ -33,7 +33,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -29,7 +29,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void CommonSubexpressionEliminator::visit(Expression& _e)
{

View File

@ -25,7 +25,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -34,7 +34,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void DataFlowAnalyzer::operator()(Assignment& _assignment)
{

View File

@ -30,7 +30,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -27,7 +27,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
using Scope = dev::solidity::assembly::Scope;

View File

@ -34,7 +34,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -30,7 +30,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void ExpressionInliner::run()

View File

@ -30,7 +30,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -33,7 +33,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void ExpressionJoiner::operator()(FunctionalInstruction& _instruction)

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
class NameCollector;

View File

@ -29,7 +29,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;

View File

@ -26,7 +26,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -31,7 +31,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void ExpressionSplitter::operator()(FunctionalInstruction& _instruction)

View File

@ -29,7 +29,7 @@
namespace dev
{
namespace julia
namespace yul
{
class NameCollector;

View File

@ -34,7 +34,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
FullInliner::FullInliner(Block& _ast):

View File

@ -35,7 +35,7 @@
namespace dev
{
namespace julia
namespace yul
{
class NameCollector;

View File

@ -27,7 +27,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;

View File

@ -25,7 +25,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -29,7 +29,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void FunctionHoister::operator()(Block& _block)

View File

@ -27,7 +27,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -26,7 +26,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void InlinableExpressionFunctionFinder::operator()(Identifier const& _identifier)
{

View File

@ -27,7 +27,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -30,7 +30,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void MainFunction::operator()(Block& _block)

View File

@ -25,7 +25,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -23,7 +23,7 @@
#include <libsolidity/inlineasm/AsmData.h>
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
size_t CodeSize::codeSize(Statement const& _statement)
{

View File

@ -24,7 +24,7 @@
namespace dev
{
namespace julia
namespace yul
{
class CodeSize: public ASTWalker

View File

@ -24,7 +24,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void NameCollector::operator()(VariableDeclaration const& _varDecl)
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -22,7 +22,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
string NameDispenser::newName(string const& _prefix)
{

View File

@ -24,7 +24,7 @@
namespace dev
{
namespace julia
namespace yul
{
struct NameDispenser

View File

@ -28,7 +28,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void Rematerialiser::visit(Expression& _e)
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -30,7 +30,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
MovableChecker::MovableChecker(Expression const& _expression)
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -31,7 +31,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(Expression const& _expr)

View File

@ -34,7 +34,7 @@
namespace dev
{
namespace julia
namespace yul
{
class Pattern;

View File

@ -24,7 +24,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
Expression Substitution::translate(Expression const& _expression)
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -28,7 +28,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
bool SyntacticalEqualityChecker::equal(Expression const& _e1, Expression const& _e2)
{

View File

@ -26,7 +26,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -31,7 +31,7 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
UnusedPruner::UnusedPruner(Block& _ast)
{

View File

@ -28,7 +28,7 @@
namespace dev
{
namespace julia
namespace yul
{
/**

View File

@ -28,9 +28,9 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
void dev::julia::removeEmptyBlocks(Block& _block)
void dev::yul::removeEmptyBlocks(Block& _block)
{
auto isEmptyBlock = [](Statement const& _st) -> bool {
return _st.type() == typeid(Block) && boost::get<Block>(_st).statements.empty();

View File

@ -24,7 +24,7 @@
namespace dev
{
namespace julia
namespace yul
{
/// Removes statements that are just empty blocks (non-recursive).

View File

@ -143,7 +143,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
master,
dev::test::Options::get().testPath / "libyul",
"yulOptimizerTests",
dev::julia::test::YulOptimizerTest::create
dev::yul::test::YulOptimizerTest::create
) > 0, "no Yul Optimizer tests found");
if (dev::test::Options::get().disableIPC)
{

View File

@ -37,10 +37,10 @@
#include <boost/test/unit_test.hpp>
using namespace std;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;
void dev::julia::test::printErrors(ErrorList const& _errors, Scanner const& _scanner)
void dev::yul::test::printErrors(ErrorList const& _errors, Scanner const& _scanner)
{
SourceReferenceFormatter formatter(cout, [&](std::string const&) -> Scanner const& { return _scanner; });
@ -52,7 +52,7 @@ void dev::julia::test::printErrors(ErrorList const& _errors, Scanner const& _sca
}
pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test::parse(string const& _source, bool _yul)
pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::yul::test::parse(string const& _source, bool _yul)
{
auto flavour = _yul ? assembly::AsmFlavour::Yul : assembly::AsmFlavour::Strict;
ErrorList errors;
@ -83,13 +83,13 @@ pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test:
return {};
}
assembly::Block dev::julia::test::disambiguate(string const& _source, bool _yul)
assembly::Block dev::yul::test::disambiguate(string const& _source, bool _yul)
{
auto result = parse(_source, _yul);
return boost::get<Block>(Disambiguator(*result.second)(*result.first));
}
string dev::julia::test::format(string const& _source, bool _yul)
string dev::yul::test::format(string const& _source, bool _yul)
{
return assembly::AsmPrinter(_yul)(*parse(_source, _yul).first);
}

View File

@ -39,7 +39,7 @@ namespace assembly
struct AsmAnalysisInfo;
}
}
namespace julia
namespace yul
{
namespace test
{

View File

@ -36,8 +36,8 @@
using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::julia::test;
using namespace dev::yul;
using namespace dev::yul::test;
using namespace dev::solidity;
namespace

View File

@ -48,8 +48,8 @@
#include <fstream>
using namespace dev;
using namespace dev::julia;
using namespace dev::julia::test;
using namespace dev::yul;
using namespace dev::yul::test;
using namespace dev::solidity;
using namespace dev::solidity::test;
using namespace std;

View File

@ -33,7 +33,7 @@ struct AsmAnalysisInfo;
struct Block;
}
}
namespace julia
namespace yul
{
namespace test
{

View File

@ -388,7 +388,7 @@ Allowed options)",
"Yul Optimizer",
testPath / "libyul",
"yulOptimizerTests",
julia::test::YulOptimizerTest::create,
yul::test::YulOptimizerTest::create,
formatted
))
global_stats += *stats;