mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Renaming namespace dev::julia to dev::yul.
This commit is contained in:
parent
9a4bec7e47
commit
1304361b9c
@ -269,8 +269,8 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
// external references.
|
// external references.
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
ErrorReporter errorsIgnored(errors);
|
ErrorReporter errorsIgnored(errors);
|
||||||
julia::ExternalIdentifierAccess::Resolver resolver =
|
yul::ExternalIdentifierAccess::Resolver resolver =
|
||||||
[&](assembly::Identifier const& _identifier, julia::IdentifierContext, bool _crossesFunctionBoundary) {
|
[&](assembly::Identifier const& _identifier, yul::IdentifierContext, bool _crossesFunctionBoundary) {
|
||||||
auto declarations = m_resolver.nameFromCurrentScope(_identifier.name);
|
auto declarations = m_resolver.nameFromCurrentScope(_identifier.name);
|
||||||
bool isSlot = boost::algorithm::ends_with(_identifier.name, "_slot");
|
bool isSlot = boost::algorithm::ends_with(_identifier.name, "_slot");
|
||||||
bool isOffset = boost::algorithm::ends_with(_identifier.name, "_offset");
|
bool isOffset = boost::algorithm::ends_with(_identifier.name, "_offset");
|
||||||
|
@ -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.
|
// External references have already been resolved in a prior stage and stored in the annotation.
|
||||||
// We run the resolve step again regardless.
|
// We run the resolve step again regardless.
|
||||||
julia::ExternalIdentifierAccess::Resolver identifierAccess = [&](
|
yul::ExternalIdentifierAccess::Resolver identifierAccess = [&](
|
||||||
assembly::Identifier const& _identifier,
|
assembly::Identifier const& _identifier,
|
||||||
julia::IdentifierContext _context,
|
yul::IdentifierContext _context,
|
||||||
bool
|
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.");
|
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
|
||||||
return size_t(-1);
|
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.");
|
m_errorReporter.typeError(_identifier.location, "Storage variables cannot be assigned to.");
|
||||||
return size_t(-1);
|
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.");
|
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
|
||||||
return size_t(-1);
|
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.");
|
m_errorReporter.typeError(_identifier.location, "Only local variables can be assigned to in inline assembly.");
|
||||||
return size_t(-1);
|
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.");
|
solAssert(!!declaration->type(), "Type of declaration required but not yet determined.");
|
||||||
if (dynamic_cast<FunctionDefinition const*>(declaration))
|
if (dynamic_cast<FunctionDefinition const*>(declaration))
|
||||||
|
@ -318,10 +318,10 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
{
|
{
|
||||||
int startStackHeight = stackHeight();
|
int startStackHeight = stackHeight();
|
||||||
|
|
||||||
julia::ExternalIdentifierAccess identifierAccess;
|
yul::ExternalIdentifierAccess identifierAccess;
|
||||||
identifierAccess.resolve = [&](
|
identifierAccess.resolve = [&](
|
||||||
assembly::Identifier const& _identifier,
|
assembly::Identifier const& _identifier,
|
||||||
julia::IdentifierContext,
|
yul::IdentifierContext,
|
||||||
bool
|
bool
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -330,15 +330,15 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
};
|
};
|
||||||
identifierAccess.generateCode = [&](
|
identifierAccess.generateCode = [&](
|
||||||
assembly::Identifier const& _identifier,
|
assembly::Identifier const& _identifier,
|
||||||
julia::IdentifierContext _context,
|
yul::IdentifierContext _context,
|
||||||
julia::AbstractAssembly& _assembly
|
yul::AbstractAssembly& _assembly
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name);
|
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name);
|
||||||
solAssert(it != _localVariables.end(), "");
|
solAssert(it != _localVariables.end(), "");
|
||||||
int stackDepth = _localVariables.end() - it;
|
int stackDepth = _localVariables.end() - it;
|
||||||
int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth;
|
int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth;
|
||||||
if (_context == julia::IdentifierContext::LValue)
|
if (_context == yul::IdentifierContext::LValue)
|
||||||
stackDiff -= 1;
|
stackDiff -= 1;
|
||||||
if (stackDiff < 1 || stackDiff > 16)
|
if (stackDiff < 1 || stackDiff > 16)
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
@ -346,7 +346,7 @@ void CompilerContext::appendInlineAssembly(
|
|||||||
errinfo_sourceLocation(_identifier.location) <<
|
errinfo_sourceLocation(_identifier.location) <<
|
||||||
errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.")
|
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));
|
_assembly.appendInstruction(dupInstruction(stackDiff));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -494,21 +494,21 @@ bool ContractCompiler::visit(FunctionDefinition const& _function)
|
|||||||
bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
||||||
{
|
{
|
||||||
unsigned startStackHeight = m_context.stackHeight();
|
unsigned startStackHeight = m_context.stackHeight();
|
||||||
julia::ExternalIdentifierAccess identifierAccess;
|
yul::ExternalIdentifierAccess identifierAccess;
|
||||||
identifierAccess.resolve = [&](assembly::Identifier const& _identifier, julia::IdentifierContext, bool)
|
identifierAccess.resolve = [&](assembly::Identifier const& _identifier, yul::IdentifierContext, bool)
|
||||||
{
|
{
|
||||||
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
|
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
|
||||||
if (ref == _inlineAssembly.annotation().externalReferences.end())
|
if (ref == _inlineAssembly.annotation().externalReferences.end())
|
||||||
return size_t(-1);
|
return size_t(-1);
|
||||||
return ref->second.valueSize;
|
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);
|
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
|
||||||
solAssert(ref != _inlineAssembly.annotation().externalReferences.end(), "");
|
solAssert(ref != _inlineAssembly.annotation().externalReferences.end(), "");
|
||||||
Declaration const* decl = ref->second.declaration;
|
Declaration const* decl = ref->second.declaration;
|
||||||
solAssert(!!decl, "");
|
solAssert(!!decl, "");
|
||||||
if (_context == julia::IdentifierContext::RValue)
|
if (_context == yul::IdentifierContext::RValue)
|
||||||
{
|
{
|
||||||
int const depositBefore = _assembly.stackHeight();
|
int const depositBefore = _assembly.stackHeight();
|
||||||
solAssert(!!decl->type(), "Type of declaration required but not yet determined.");
|
solAssert(!!decl->type(), "Type of declaration required but not yet determined.");
|
||||||
|
@ -145,7 +145,7 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
|
|||||||
if (m_resolver)
|
if (m_resolver)
|
||||||
{
|
{
|
||||||
bool insideFunction = m_currentScope->insideFunction();
|
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))
|
if (stackSize == size_t(-1))
|
||||||
{
|
{
|
||||||
@ -512,7 +512,7 @@ bool AsmAnalyzer::checkAssignment(assembly::Identifier const& _variable, size_t
|
|||||||
else if (m_resolver)
|
else if (m_resolver)
|
||||||
{
|
{
|
||||||
bool insideFunction = m_currentScope->insideFunction();
|
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))
|
if (variableSize == size_t(-1))
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
EVMVersion _evmVersion,
|
EVMVersion _evmVersion,
|
||||||
boost::optional<Error::Type> _errorTypeForLoose,
|
boost::optional<Error::Type> _errorTypeForLoose,
|
||||||
AsmFlavour _flavour = AsmFlavour::Loose,
|
AsmFlavour _flavour = AsmFlavour::Loose,
|
||||||
julia::ExternalIdentifierAccess::Resolver const& _resolver = julia::ExternalIdentifierAccess::Resolver()
|
yul::ExternalIdentifierAccess::Resolver const& _resolver = yul::ExternalIdentifierAccess::Resolver()
|
||||||
):
|
):
|
||||||
m_resolver(_resolver),
|
m_resolver(_resolver),
|
||||||
m_info(_analysisInfo),
|
m_info(_analysisInfo),
|
||||||
@ -106,7 +106,7 @@ private:
|
|||||||
void checkLooseFeature(SourceLocation const& _location, std::string const& _description);
|
void checkLooseFeature(SourceLocation const& _location, std::string const& _description);
|
||||||
|
|
||||||
int m_stackHeight = 0;
|
int m_stackHeight = 0;
|
||||||
julia::ExternalIdentifierAccess::Resolver m_resolver;
|
yul::ExternalIdentifierAccess::Resolver m_resolver;
|
||||||
Scope* m_currentScope = nullptr;
|
Scope* m_currentScope = nullptr;
|
||||||
/// Variables that are active at the current point in assembly (as opposed to
|
/// Variables that are active at the current point in assembly (as opposed to
|
||||||
/// "part of the scope but not yet declared")
|
/// "part of the scope but not yet declared")
|
||||||
|
@ -49,7 +49,7 @@ using namespace dev;
|
|||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
using namespace dev::solidity::assembly;
|
using namespace dev::solidity::assembly;
|
||||||
|
|
||||||
class EthAssemblyAdapter: public julia::AbstractAssembly
|
class EthAssemblyAdapter: public yul::AbstractAssembly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit EthAssemblyAdapter(eth::Assembly& _assembly):
|
explicit EthAssemblyAdapter(eth::Assembly& _assembly):
|
||||||
@ -145,12 +145,12 @@ void assembly::CodeGenerator::assemble(
|
|||||||
Block const& _parsedData,
|
Block const& _parsedData,
|
||||||
AsmAnalysisInfo& _analysisInfo,
|
AsmAnalysisInfo& _analysisInfo,
|
||||||
eth::Assembly& _assembly,
|
eth::Assembly& _assembly,
|
||||||
julia::ExternalIdentifierAccess const& _identifierAccess,
|
yul::ExternalIdentifierAccess const& _identifierAccess,
|
||||||
bool _useNamedLabelsForFunctions
|
bool _useNamedLabelsForFunctions
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EthAssemblyAdapter assemblyAdapter(_assembly);
|
EthAssemblyAdapter assemblyAdapter(_assembly);
|
||||||
julia::CodeTransform(
|
yul::CodeTransform(
|
||||||
assemblyAdapter,
|
assemblyAdapter,
|
||||||
_analysisInfo,
|
_analysisInfo,
|
||||||
false,
|
false,
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
Block const& _parsedData,
|
Block const& _parsedData,
|
||||||
AsmAnalysisInfo& _analysisInfo,
|
AsmAnalysisInfo& _analysisInfo,
|
||||||
eth::Assembly& _assembly,
|
eth::Assembly& _assembly,
|
||||||
julia::ExternalIdentifierAccess const& _identifierAccess = julia::ExternalIdentifierAccess(),
|
yul::ExternalIdentifierAccess const& _identifierAccess = yul::ExternalIdentifierAccess(),
|
||||||
bool _useNamedLabelsForFunctions = false
|
bool _useNamedLabelsForFunctions = false
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -116,8 +116,8 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
|
|||||||
case Machine::EVM15:
|
case Machine::EVM15:
|
||||||
{
|
{
|
||||||
MachineAssemblyObject object;
|
MachineAssemblyObject object;
|
||||||
julia::EVMAssembly assembly(true);
|
yul::EVMAssembly assembly(true);
|
||||||
julia::CodeTransform(assembly, *m_analysisInfo, m_language == Language::Yul, true)(*m_parserResult);
|
yul::CodeTransform(assembly, *m_analysisInfo, m_language == Language::Yul, true)(*m_parserResult);
|
||||||
object.bytecode = make_shared<eth::LinkerObject>(assembly.finalize());
|
object.bytecode = make_shared<eth::LinkerObject>(assembly.finalize());
|
||||||
/// TODO: fill out text representation
|
/// TODO: fill out text representation
|
||||||
return object;
|
return object;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
using Instruction = solidity::assembly::Instruction;
|
using Instruction = solidity::assembly::Instruction;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
struct YulException: virtual Exception {};
|
struct YulException: virtual Exception {};
|
||||||
|
@ -38,7 +38,7 @@ struct Instruction;
|
|||||||
struct Identifier;
|
struct Identifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -106,7 +106,7 @@ struct ExternalIdentifierAccess
|
|||||||
/// Resolve an external reference given by the identifier in the given context.
|
/// 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.
|
/// @returns the size of the value (number of stack slots) or size_t(-1) if not found.
|
||||||
Resolver resolve;
|
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)
|
/// 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
|
/// 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.
|
/// to be put onto the stack, in lvalue context, the value is assumed to be at the top of the stack.
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class EVMAssembly: public AbstractAssembly
|
class EVMAssembly: public AbstractAssembly
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
using Scope = dev::solidity::assembly::Scope;
|
using Scope = dev::solidity::assembly::Scope;
|
||||||
|
@ -37,7 +37,7 @@ namespace assembly
|
|||||||
struct AsmAnalysisInfo;
|
struct AsmAnalysisInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
class EVMAssembly;
|
class EVMAssembly;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
/// Create the code transformer.
|
/// Create the code transformer.
|
||||||
/// @param _identifierAccess used to resolve identifiers external to the inline assembly
|
/// @param _identifierAccess used to resolve identifiers external to the inline assembly
|
||||||
CodeTransform(
|
CodeTransform(
|
||||||
julia::AbstractAssembly& _assembly,
|
yul::AbstractAssembly& _assembly,
|
||||||
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
|
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
|
||||||
bool _yul = false,
|
bool _yul = false,
|
||||||
bool _evm15 = false,
|
bool _evm15 = false,
|
||||||
@ -76,7 +76,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
CodeTransform(
|
CodeTransform(
|
||||||
julia::AbstractAssembly& _assembly,
|
yul::AbstractAssembly& _assembly,
|
||||||
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
|
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
|
||||||
bool _yul,
|
bool _yul,
|
||||||
bool _evm15,
|
bool _evm15,
|
||||||
@ -139,7 +139,7 @@ private:
|
|||||||
|
|
||||||
void checkStackHeight(void const* _astElement) const;
|
void checkStackHeight(void const* _astElement) const;
|
||||||
|
|
||||||
julia::AbstractAssembly& m_assembly;
|
yul::AbstractAssembly& m_assembly;
|
||||||
solidity::assembly::AsmAnalysisInfo& m_info;
|
solidity::assembly::AsmAnalysisInfo& m_info;
|
||||||
solidity::assembly::Scope* m_scope = nullptr;
|
solidity::assembly::Scope* m_scope = nullptr;
|
||||||
bool m_yul = false;
|
bool m_yul = false;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
Statement ASTCopier::operator()(Instruction const&)
|
Statement ASTCopier::operator()(Instruction const&)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class ExpressionCopier: public boost::static_visitor<Expression>
|
class ExpressionCopier: public boost::static_visitor<Expression>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
void CommonSubexpressionEliminator::visit(Expression& _e)
|
void CommonSubexpressionEliminator::visit(Expression& _e)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
void DataFlowAnalyzer::operator()(Assignment& _assignment)
|
void DataFlowAnalyzer::operator()(Assignment& _assignment)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
using Scope = dev::solidity::assembly::Scope;
|
using Scope = dev::solidity::assembly::Scope;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
void ExpressionInliner::run()
|
void ExpressionInliner::run()
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
void ExpressionJoiner::operator()(FunctionalInstruction& _instruction)
|
void ExpressionJoiner::operator()(FunctionalInstruction& _instruction)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class NameCollector;
|
class NameCollector;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
void ExpressionSplitter::operator()(FunctionalInstruction& _instruction)
|
void ExpressionSplitter::operator()(FunctionalInstruction& _instruction)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class NameCollector;
|
class NameCollector;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
FullInliner::FullInliner(Block& _ast):
|
FullInliner::FullInliner(Block& _ast):
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class NameCollector;
|
class NameCollector;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
void FunctionHoister::operator()(Block& _block)
|
void FunctionHoister::operator()(Block& _block)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
void InlinableExpressionFunctionFinder::operator()(Identifier const& _identifier)
|
void InlinableExpressionFunctionFinder::operator()(Identifier const& _identifier)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
void MainFunction::operator()(Block& _block)
|
void MainFunction::operator()(Block& _block)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <libsolidity/inlineasm/AsmData.h>
|
#include <libsolidity/inlineasm/AsmData.h>
|
||||||
|
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
size_t CodeSize::codeSize(Statement const& _statement)
|
size_t CodeSize::codeSize(Statement const& _statement)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class CodeSize: public ASTWalker
|
class CodeSize: public ASTWalker
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
void NameCollector::operator()(VariableDeclaration const& _varDecl)
|
void NameCollector::operator()(VariableDeclaration const& _varDecl)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
string NameDispenser::newName(string const& _prefix)
|
string NameDispenser::newName(string const& _prefix)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
struct NameDispenser
|
struct NameDispenser
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
void Rematerialiser::visit(Expression& _e)
|
void Rematerialiser::visit(Expression& _e)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
MovableChecker::MovableChecker(Expression const& _expression)
|
MovableChecker::MovableChecker(Expression const& _expression)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
|
|
||||||
SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(Expression const& _expr)
|
SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(Expression const& _expr)
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
class Pattern;
|
class Pattern;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
Expression Substitution::translate(Expression const& _expression)
|
Expression Substitution::translate(Expression const& _expression)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
bool SyntacticalEqualityChecker::equal(Expression const& _e1, Expression const& _e2)
|
bool SyntacticalEqualityChecker::equal(Expression const& _e1, Expression const& _e2)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
|
|
||||||
UnusedPruner::UnusedPruner(Block& _ast)
|
UnusedPruner::UnusedPruner(Block& _ast)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
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 {
|
auto isEmptyBlock = [](Statement const& _st) -> bool {
|
||||||
return _st.type() == typeid(Block) && boost::get<Block>(_st).statements.empty();
|
return _st.type() == typeid(Block) && boost::get<Block>(_st).statements.empty();
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Removes statements that are just empty blocks (non-recursive).
|
/// Removes statements that are just empty blocks (non-recursive).
|
||||||
|
@ -143,7 +143,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
|||||||
master,
|
master,
|
||||||
dev::test::Options::get().testPath / "libyul",
|
dev::test::Options::get().testPath / "libyul",
|
||||||
"yulOptimizerTests",
|
"yulOptimizerTests",
|
||||||
dev::julia::test::YulOptimizerTest::create
|
dev::yul::test::YulOptimizerTest::create
|
||||||
) > 0, "no Yul Optimizer tests found");
|
) > 0, "no Yul Optimizer tests found");
|
||||||
if (dev::test::Options::get().disableIPC)
|
if (dev::test::Options::get().disableIPC)
|
||||||
{
|
{
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::solidity;
|
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; });
|
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;
|
auto flavour = _yul ? assembly::AsmFlavour::Yul : assembly::AsmFlavour::Strict;
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
@ -83,13 +83,13 @@ pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test:
|
|||||||
return {};
|
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);
|
auto result = parse(_source, _yul);
|
||||||
return boost::get<Block>(Disambiguator(*result.second)(*result.first));
|
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);
|
return assembly::AsmPrinter(_yul)(*parse(_source, _yul).first);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace assembly
|
|||||||
struct AsmAnalysisInfo;
|
struct AsmAnalysisInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::julia::test;
|
using namespace dev::yul::test;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::yul;
|
||||||
using namespace dev::julia::test;
|
using namespace dev::yul::test;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
using namespace dev::solidity::test;
|
using namespace dev::solidity::test;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -33,7 +33,7 @@ struct AsmAnalysisInfo;
|
|||||||
struct Block;
|
struct Block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace julia
|
namespace yul
|
||||||
{
|
{
|
||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
@ -388,7 +388,7 @@ Allowed options)",
|
|||||||
"Yul Optimizer",
|
"Yul Optimizer",
|
||||||
testPath / "libyul",
|
testPath / "libyul",
|
||||||
"yulOptimizerTests",
|
"yulOptimizerTests",
|
||||||
julia::test::YulOptimizerTest::create,
|
yul::test::YulOptimizerTest::create,
|
||||||
formatted
|
formatted
|
||||||
))
|
))
|
||||||
global_stats += *stats;
|
global_stats += *stats;
|
||||||
|
Loading…
Reference in New Issue
Block a user