Rename JULIA/IULIA to Yul in assembly interface

This commit is contained in:
Alex Beregszaszi 2018-06-12 18:36:38 +01:00
parent baeabe1c2d
commit 782bc41dbd
6 changed files with 23 additions and 23 deletions

View File

@ -99,7 +99,7 @@ bool AsmAnalyzer::operator()(assembly::Literal const& _literal)
} }
else if (_literal.kind == assembly::LiteralKind::Boolean) else if (_literal.kind == assembly::LiteralKind::Boolean)
{ {
solAssert(m_flavour == AsmFlavour::IULIA, ""); solAssert(m_flavour == AsmFlavour::Yul, "");
solAssert(_literal.value == "true" || _literal.value == "false", ""); solAssert(_literal.value == "true" || _literal.value == "false", "");
} }
m_info.stackHeightInfo[&_literal] = m_stackHeight; m_info.stackHeightInfo[&_literal] = m_stackHeight;
@ -162,7 +162,7 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
bool AsmAnalyzer::operator()(FunctionalInstruction const& _instr) bool AsmAnalyzer::operator()(FunctionalInstruction const& _instr)
{ {
solAssert(m_flavour != AsmFlavour::IULIA, ""); solAssert(m_flavour != AsmFlavour::Yul, "");
bool success = true; bool success = true;
for (auto const& arg: _instr.arguments | boost::adaptors::reversed) for (auto const& arg: _instr.arguments | boost::adaptors::reversed)
if (!expectExpression(arg)) if (!expectExpression(arg))
@ -550,7 +550,7 @@ Scope& AsmAnalyzer::scope(Block const* _block)
} }
void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _location) void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _location)
{ {
if (m_flavour != AsmFlavour::IULIA) if (m_flavour != AsmFlavour::Yul)
return; return;
if (!builtinTypes.count(type)) if (!builtinTypes.count(type))

View File

@ -17,7 +17,7 @@
/** /**
* @author Christian <c@ethdev.com> * @author Christian <c@ethdev.com>
* @date 2016 * @date 2016
* Forward declaration of classes for inline assembly / JULIA AST * Forward declaration of classes for inline assembly / Yul AST
*/ */
#pragma once #pragma once
@ -57,7 +57,7 @@ enum class AsmFlavour
{ {
Loose, // no types, EVM instructions as function, jumps and direct stack manipulations Loose, // no types, EVM instructions as function, jumps and direct stack manipulations
Strict, // no types, EVM instructions as functions, but no jumps and no direct stack manipulations Strict, // no types, EVM instructions as functions, but no jumps and no direct stack manipulations
IULIA // same as Strict mode with types Yul // same as Strict mode with types
}; };
} }

View File

@ -173,7 +173,7 @@ assembly::Statement Parser::parseStatement()
if (currentToken() == Token::Assign && peekNextToken() != Token::Colon) if (currentToken() == Token::Assign && peekNextToken() != Token::Colon)
{ {
assembly::Assignment assignment = createWithLocation<assembly::Assignment>(identifier.location); assembly::Assignment assignment = createWithLocation<assembly::Assignment>(identifier.location);
if (m_flavour != AsmFlavour::IULIA && instructions().count(identifier.name)) if (m_flavour != AsmFlavour::Yul && instructions().count(identifier.name))
fatalParserError("Cannot use instruction names for identifier names."); fatalParserError("Cannot use instruction names for identifier names.");
advance(); advance();
assignment.variableNames.emplace_back(identifier); assignment.variableNames.emplace_back(identifier);
@ -357,7 +357,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
else else
literal = currentLiteral(); literal = currentLiteral();
// first search the set of instructions. // first search the set of instructions.
if (m_flavour != AsmFlavour::IULIA && instructions().count(literal)) if (m_flavour != AsmFlavour::Yul && instructions().count(literal))
{ {
dev::solidity::Instruction const& instr = instructions().at(literal); dev::solidity::Instruction const& instr = instructions().at(literal);
ret = Instruction{location(), instr}; ret = Instruction{location(), instr};
@ -398,7 +398,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
"" ""
}; };
advance(); advance();
if (m_flavour == AsmFlavour::IULIA) if (m_flavour == AsmFlavour::Yul)
{ {
expectToken(Token::Colon); expectToken(Token::Colon);
literal.location.end = endPosition(); literal.location.end = endPosition();
@ -411,7 +411,7 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
} }
default: default:
fatalParserError( fatalParserError(
m_flavour == AsmFlavour::IULIA ? m_flavour == AsmFlavour::Yul ?
"Literal or identifier expected." : "Literal or identifier expected." :
"Literal, identifier or instruction expected." "Literal, identifier or instruction expected."
); );
@ -481,7 +481,7 @@ assembly::Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp)
RecursionGuard recursionGuard(*this); RecursionGuard recursionGuard(*this);
if (_initialOp.type() == typeid(Instruction)) if (_initialOp.type() == typeid(Instruction))
{ {
solAssert(m_flavour != AsmFlavour::IULIA, "Instructions are invalid in JULIA"); solAssert(m_flavour != AsmFlavour::Yul, "Instructions are invalid in Yul");
Instruction& instruction = boost::get<Instruction>(_initialOp); Instruction& instruction = boost::get<Instruction>(_initialOp);
FunctionalInstruction ret; FunctionalInstruction ret;
ret.instruction = instruction.instruction; ret.instruction = instruction.instruction;
@ -552,7 +552,7 @@ assembly::Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp)
} }
else else
fatalParserError( fatalParserError(
m_flavour == AsmFlavour::IULIA ? m_flavour == AsmFlavour::Yul ?
"Function name expected." : "Function name expected." :
"Assembly instruction or function name required in front of \"(\")" "Assembly instruction or function name required in front of \"(\")"
); );
@ -565,7 +565,7 @@ TypedName Parser::parseTypedName()
RecursionGuard recursionGuard(*this); RecursionGuard recursionGuard(*this);
TypedName typedName = createWithLocation<TypedName>(); TypedName typedName = createWithLocation<TypedName>();
typedName.name = expectAsmIdentifier(); typedName.name = expectAsmIdentifier();
if (m_flavour == AsmFlavour::IULIA) if (m_flavour == AsmFlavour::Yul)
{ {
expectToken(Token::Colon); expectToken(Token::Colon);
typedName.location.end = endPosition(); typedName.location.end = endPosition();
@ -577,7 +577,7 @@ TypedName Parser::parseTypedName()
string Parser::expectAsmIdentifier() string Parser::expectAsmIdentifier()
{ {
string name = currentLiteral(); string name = currentLiteral();
if (m_flavour == AsmFlavour::IULIA) if (m_flavour == AsmFlavour::Yul)
{ {
switch (currentToken()) switch (currentToken())
{ {

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/>.
*/ */
/** /**
* Full assembly stack that can support EVM-assembly and JULIA as input and EVM, EVM1.5 and * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and
* eWasm as output. * eWasm as output.
*/ */
@ -48,11 +48,11 @@ assembly::AsmFlavour languageToAsmFlavour(AssemblyStack::Language _language)
return assembly::AsmFlavour::Loose; return assembly::AsmFlavour::Loose;
case AssemblyStack::Language::StrictAssembly: case AssemblyStack::Language::StrictAssembly:
return assembly::AsmFlavour::Strict; return assembly::AsmFlavour::Strict;
case AssemblyStack::Language::JULIA: case AssemblyStack::Language::Yul:
return assembly::AsmFlavour::IULIA; return assembly::AsmFlavour::Yul;
} }
solAssert(false, ""); solAssert(false, "");
return assembly::AsmFlavour::IULIA; return assembly::AsmFlavour::Yul;
} }
} }
@ -117,7 +117,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
{ {
MachineAssemblyObject object; MachineAssemblyObject object;
julia::EVMAssembly assembly(true); julia::EVMAssembly assembly(true);
julia::CodeTransform(assembly, *m_analysisInfo, m_language == Language::JULIA, true)(*m_parserResult); julia::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());
/// TOOD: fill out text representation /// TOOD: fill out text representation
return object; return object;
@ -132,5 +132,5 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
string AssemblyStack::print() const string AssemblyStack::print() const
{ {
solAssert(m_parserResult, ""); solAssert(m_parserResult, "");
return assembly::AsmPrinter(m_language == Language::JULIA)(*m_parserResult); return assembly::AsmPrinter(m_language == Language::Yul)(*m_parserResult);
} }

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/>.
*/ */
/** /**
* Full assembly stack that can support EVM-assembly and JULIA as input and EVM, EVM1.5 and * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and
* eWasm as output. * eWasm as output.
*/ */
@ -47,13 +47,13 @@ struct MachineAssemblyObject
}; };
/* /*
* Full assembly stack that can support EVM-assembly and JULIA as input and EVM, EVM1.5 and * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and
* eWasm as output. * eWasm as output.
*/ */
class AssemblyStack class AssemblyStack
{ {
public: public:
enum class Language { JULIA, Assembly, StrictAssembly }; enum class Language { Yul, Assembly, StrictAssembly };
enum class Machine { EVM, EVM15, eWasm }; enum class Machine { EVM, EVM15, eWasm };
explicit AssemblyStack(EVMVersion _evmVersion = EVMVersion(), Language _language = Language::Assembly): explicit AssemblyStack(EVMVersion _evmVersion = EVMVersion(), Language _language = Language::Assembly):

View File

@ -787,7 +787,7 @@ bool CommandLineInterface::processInput()
m_onlyAssemble = true; m_onlyAssemble = true;
using Input = AssemblyStack::Language; using Input = AssemblyStack::Language;
using Machine = AssemblyStack::Machine; using Machine = AssemblyStack::Machine;
Input inputLanguage = m_args.count(g_argYul) ? Input::JULIA : (m_args.count(g_argStrictAssembly) ? Input::StrictAssembly : Input::Assembly); Input inputLanguage = m_args.count(g_argYul) ? Input::Yul : (m_args.count(g_argStrictAssembly) ? Input::StrictAssembly : Input::Assembly);
Machine targetMachine = Machine::EVM; Machine targetMachine = Machine::EVM;
if (m_args.count(g_argMachine)) if (m_args.count(g_argMachine))
{ {