Merge pull request #4318 from ethereum/yul-internal

Rename some internal constructs from Julia/Iulia to Yul
This commit is contained in:
chriseth 2018-06-26 12:24:07 +02:00 committed by GitHub
commit e6595d8806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 41 additions and 41 deletions

View File

@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>. along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* Exceptions in Julia. * Exceptions in Yul.
*/ */
#pragma once #pragma once
@ -28,8 +28,8 @@ namespace dev
namespace julia namespace julia
{ {
struct IuliaException: virtual Exception {}; struct YulException: virtual Exception {};
struct OptimizerException: virtual IuliaException {}; struct OptimizerException: virtual YulException {};
} }
} }

View File

@ -42,7 +42,7 @@ namespace julia
{ {
/// ///
/// Assembly class that abstracts both the libevmasm assembly and the new julia evm assembly. /// Assembly class that abstracts both the libevmasm assembly and the new Yul assembly.
/// ///
class AbstractAssembly class AbstractAssembly
{ {

View File

@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>. along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* Common code generator for translating Julia / inline assembly to EVM and EVM1.5. * Common code generator for translating Yul / inline assembly to EVM and EVM1.5.
*/ */
#include <libjulia/backends/evm/EVMCodeTransform.h> #include <libjulia/backends/evm/EVMCodeTransform.h>
@ -331,7 +331,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
CodeTransform( CodeTransform(
m_assembly, m_assembly,
m_info, m_info,
m_julia, m_yul,
m_evm15, m_evm15,
m_identifierAccess, m_identifierAccess,
m_useNamedLabelsForFunctions, m_useNamedLabelsForFunctions,

View File

@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>. along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* Common code generator for translating Julia / inline assembly to EVM and EVM1.5. * Common code generator for translating Yul / inline assembly to EVM and EVM1.5.
*/ */
#include <libjulia/backends/evm/EVMAssembly.h> #include <libjulia/backends/evm/EVMAssembly.h>
@ -49,14 +49,14 @@ public:
CodeTransform( CodeTransform(
julia::AbstractAssembly& _assembly, julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo, solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _julia = false, bool _yul = false,
bool _evm15 = false, bool _evm15 = false,
ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess(), ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess(),
bool _useNamedLabelsForFunctions = false bool _useNamedLabelsForFunctions = false
): CodeTransform( ): CodeTransform(
_assembly, _assembly,
_analysisInfo, _analysisInfo,
_julia, _yul,
_evm15, _evm15,
_identifierAccess, _identifierAccess,
_useNamedLabelsForFunctions, _useNamedLabelsForFunctions,
@ -78,7 +78,7 @@ protected:
CodeTransform( CodeTransform(
julia::AbstractAssembly& _assembly, julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo, solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _julia, bool _yul,
bool _evm15, bool _evm15,
ExternalIdentifierAccess const& _identifierAccess, ExternalIdentifierAccess const& _identifierAccess,
bool _useNamedLabelsForFunctions, bool _useNamedLabelsForFunctions,
@ -87,7 +87,7 @@ protected:
): ):
m_assembly(_assembly), m_assembly(_assembly),
m_info(_analysisInfo), m_info(_analysisInfo),
m_julia(_julia), m_yul(_yul),
m_evm15(_evm15), m_evm15(_evm15),
m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions), m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions),
m_identifierAccess(_identifierAccess), m_identifierAccess(_identifierAccess),
@ -142,7 +142,7 @@ private:
julia::AbstractAssembly& m_assembly; julia::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_julia = false; bool m_yul = false;
bool m_evm15 = false; bool m_evm15 = false;
bool m_useNamedLabelsForFunctions = false; bool m_useNamedLabelsForFunctions = false;
ExternalIdentifierAccess m_identifierAccess; ExternalIdentifierAccess m_identifierAccess;

View File

@ -62,7 +62,7 @@ public:
}; };
/** /**
* Creates a copy of a iulia AST potentially replacing identifier names. * Creates a copy of a Yul AST potentially replacing identifier names.
* Base class to be extended. * Base class to be extended.
*/ */
class ASTCopier: public ExpressionCopier, public StatementCopier class ASTCopier: public ExpressionCopier, public StatementCopier

View File

@ -38,7 +38,7 @@ namespace julia
{ {
/** /**
* Creates a copy of a iulia AST replacing all identifiers by unique names. * Creates a copy of a Yul AST replacing all identifiers by unique names.
*/ */
class Disambiguator: public ASTCopier class Disambiguator: public ASTCopier
{ {

View File

@ -1,6 +1,6 @@
## IULIA Optimiser ## Yul Optimiser
The iulia optimiser consists of several stages and components that all transform The Yul optimiser consists of several stages and components that all transform
the AST in a semantically equivalent way. The goal is to end up either with code the AST in a semantically equivalent way. The goal is to end up either with code
that is shorter or at least only marginally longer but will allow further that is shorter or at least only marginally longer but will allow further
optimisation steps. optimisation steps.
@ -81,7 +81,7 @@ a loop or conditional, the first one is not inside), the first assignment is rem
## Expression Simplifier ## Expression Simplifier
This step can only be applied for the EVM-flavoured dialect of iulia. It applies This step can only be applied for the EVM-flavoured dialect of Yul. It applies
simple rules like ``x + 0 == x`` to simplify expressions. simple rules like ``x + 0 == x`` to simplify expressions.
## Ineffective Statement Remover ## Ineffective Statement Remover

View File

@ -59,7 +59,7 @@ void UnusedPruner::operator()(Block& _block)
// Multi-variable declarations are special. We can only remove it // Multi-variable declarations are special. We can only remove it
// if all vairables are unused and the right-hand-side is either // if all vairables are unused and the right-hand-side is either
// movable or it return a single value. In the latter case, we // movable or it return a single value. In the latter case, we
// replace `let a := f()` by `pop(f())` (in pure IULIA, this will be // replace `let a := f()` by `pop(f())` (in pure Yul, this will be
// `drop(f())`). // `drop(f())`).
if (boost::algorithm::none_of( if (boost::algorithm::none_of(
varDecl.variables, varDecl.variables,
@ -74,7 +74,7 @@ void UnusedPruner::operator()(Block& _block)
statement = Block{std::move(varDecl.location), {}}; statement = Block{std::move(varDecl.location), {}};
} }
else if (varDecl.variables.size() == 1) else if (varDecl.variables.size() == 1)
// In pure IULIA, this should be replaced by a function call to `drop` // In pure Yul, this should be replaced by a function call to `drop`
// instead of `pop`. // instead of `pop`.
statement = ExpressionStatement{varDecl.location, FunctionalInstruction{ statement = ExpressionStatement{varDecl.location, FunctionalInstruction{
varDecl.location, varDecl.location,

View File

@ -47,7 +47,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaCSE) BOOST_AUTO_TEST_SUITE(YulCSE)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -39,7 +39,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaDisambiguator) BOOST_AUTO_TEST_SUITE(YulDisambiguator)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* @date 2017 * @date 2017
* Unit tests for the iulia function grouper. * Unit tests for the Yul function grouper.
*/ */
#include <test/libjulia/Common.h> #include <test/libjulia/Common.h>
@ -43,7 +43,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaFunctionGrouper) BOOST_AUTO_TEST_SUITE(YulFunctionGrouper)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* @date 2017 * @date 2017
* Unit tests for the iulia function hoister. * Unit tests for the Yul function hoister.
*/ */
#include <test/libjulia/Common.h> #include <test/libjulia/Common.h>
@ -43,7 +43,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaFunctionHoister) BOOST_AUTO_TEST_SUITE(YulFunctionHoister)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* @date 2017 * @date 2017
* Unit tests for the iulia function inliner. * Unit tests for the Yul function inliner.
*/ */
#include <test/libjulia/Common.h> #include <test/libjulia/Common.h>
@ -55,24 +55,24 @@ string inlinableFunctions(string const& _source)
); );
} }
string inlineFunctions(string const& _source, bool _julia = true) string inlineFunctions(string const& _source, bool _yul = true)
{ {
auto ast = disambiguate(_source, _julia); auto ast = disambiguate(_source, _yul);
ExpressionInliner(ast).run(); ExpressionInliner(ast).run();
return assembly::AsmPrinter(_julia)(ast); return assembly::AsmPrinter(_yul)(ast);
} }
string fullInline(string const& _source, bool _julia = true) string fullInline(string const& _source, bool _yul = true)
{ {
Block ast = disambiguate(_source, _julia); Block ast = disambiguate(_source, _yul);
(FunctionHoister{})(ast); (FunctionHoister{})(ast);
(FunctionGrouper{})(ast);\ (FunctionGrouper{})(ast);\
FullInliner(ast).run(); FullInliner(ast).run();
return assembly::AsmPrinter(_julia)(ast); return assembly::AsmPrinter(_yul)(ast);
} }
} }
BOOST_AUTO_TEST_SUITE(IuliaInlinableFunctionFilter) BOOST_AUTO_TEST_SUITE(YulInlinableFunctionFilter)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {
@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(negative)
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(IuliaFunctionInliner) BOOST_AUTO_TEST_SUITE(YulFunctionInliner)
BOOST_AUTO_TEST_CASE(simple) BOOST_AUTO_TEST_CASE(simple)
{ {
@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(double_recursive_calls)
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(IuliaFullInliner) BOOST_AUTO_TEST_SUITE(YulFullInliner)
BOOST_AUTO_TEST_CASE(simple) BOOST_AUTO_TEST_CASE(simple)
{ {

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* @date 2018 * @date 2018
* Unit tests for the Julia MainFunction transformation. * Unit tests for the Yul MainFunction transformation.
*/ */
#include <test/libjulia/Common.h> #include <test/libjulia/Common.h>
@ -45,7 +45,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(JuliaMainFunction) BOOST_AUTO_TEST_SUITE(YulMainFunction)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -119,7 +119,7 @@ do \
BOOST_CHECK(searchErrorMessage(err, (substring))); \ BOOST_CHECK(searchErrorMessage(err, (substring))); \
} while(0) } while(0)
BOOST_AUTO_TEST_SUITE(JuliaParser) BOOST_AUTO_TEST_SUITE(YulParser)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -48,7 +48,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaRematerialiser) BOOST_AUTO_TEST_SUITE(YulRematerialiser)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -48,7 +48,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaSimplifier) BOOST_AUTO_TEST_SUITE(YulSimplifier)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {

View File

@ -48,7 +48,7 @@ do\
}\ }\
while(false) while(false)
BOOST_AUTO_TEST_SUITE(IuliaUnusedPruner) BOOST_AUTO_TEST_SUITE(YulUnusedPruner)
BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(smoke_test)
{ {