Skip to content

Commit

Permalink
Renaming namespace dev::julia to dev::yul.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Parpart committed Oct 15, 2018
1 parent 9a4bec7 commit 1304361
Show file tree
Hide file tree
Showing 71 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions libsolidity/analysis/ReferencesResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 5 additions & 5 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
{
Expand All @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions libsolidity/codegen/CompilerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
{
Expand All @@ -330,23 +330,23 @@ 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(
CompilerError() <<
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
{
Expand Down
8 changes: 4 additions & 4 deletions libsolidity/codegen/ContractCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/inlineasm/AsmAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/inlineasm/AsmAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AsmAnalyzer: public boost::static_visitor<bool>
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),
Expand Down Expand Up @@ -106,7 +106,7 @@ class AsmAnalyzer: public boost::static_visitor<bool>
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")
Expand Down
6 changes: 3 additions & 3 deletions libsolidity/inlineasm/AsmCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion libsolidity/inlineasm/AsmCodeGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CodeGenerator
Block const& _parsedData,
AsmAnalysisInfo& _analysisInfo,
eth::Assembly& _assembly,
julia::ExternalIdentifierAccess const& _identifierAccess = julia::ExternalIdentifierAccess(),
yul::ExternalIdentifierAccess const& _identifierAccess = yul::ExternalIdentifierAccess(),
bool _useNamedLabelsForFunctions = false
);
};
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/interface/AssemblyStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libyul/ASTDataForward.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace dev
{
namespace julia
namespace yul
{

using Instruction = solidity::assembly::Instruction;
Expand Down
2 changes: 1 addition & 1 deletion libyul/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace dev
{
namespace julia
namespace yul
{

struct YulException: virtual Exception {};
Expand Down
4 changes: 2 additions & 2 deletions libyul/backends/evm/AbstractAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Instruction;
struct Identifier;
}
}
namespace julia
namespace yul
{

///
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libyul/backends/evm/EVMAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;

namespace
{
Expand Down
2 changes: 1 addition & 1 deletion libyul/backends/evm/EVMAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

namespace dev
{
namespace julia
namespace yul
{

class EVMAssembly: public AbstractAssembly
Expand Down
2 changes: 1 addition & 1 deletion libyul/backends/evm/EVMCodeTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions libyul/backends/evm/EVMCodeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace assembly
struct AsmAnalysisInfo;
}
}
namespace julia
namespace yul
{
class EVMAssembly;

Expand All @@ -47,7 +47,7 @@ class CodeTransform: public boost::static_visitor<>
/// 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,
Expand Down Expand Up @@ -76,7 +76,7 @@ class CodeTransform: public boost::static_visitor<>
};

CodeTransform(
julia::AbstractAssembly& _assembly,
yul::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _yul,
bool _evm15,
Expand Down Expand Up @@ -139,7 +139,7 @@ class CodeTransform: public boost::static_visitor<>

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;
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/ASTCopier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;

Statement ASTCopier::operator()(Instruction const&)
{
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/ASTCopier.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace dev
{
namespace julia
namespace yul
{

class ExpressionCopier: public boost::static_visitor<Expression>
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/ASTWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;
using namespace dev::solidity;


Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/ASTWalker.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

namespace dev
{
namespace julia
namespace yul
{

/**
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/CommonSubexpressionEliminator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;

void CommonSubexpressionEliminator::visit(Expression& _e)
{
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/CommonSubexpressionEliminator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace dev
{
namespace julia
namespace yul
{

/**
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/DataFlowAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

using namespace std;
using namespace dev;
using namespace dev::julia;
using namespace dev::yul;

void DataFlowAnalyzer::operator()(Assignment& _assignment)
{
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/DataFlowAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace dev
{
namespace julia
namespace yul
{

/**
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/Disambiguator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/Disambiguator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace dev
{
namespace julia
namespace yul
{

/**
Expand Down
2 changes: 1 addition & 1 deletion libyul/optimiser/ExpressionInliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit 1304361

Please sign in to comment.