Rename EWasm/ewasm/eWasm to Ewasm

This commit is contained in:
Alex Beregszaszi 2019-12-09 16:36:12 +00:00
parent 8511012e95
commit 65e59ecd06
12 changed files with 76 additions and 77 deletions

View File

@ -77,7 +77,7 @@ CompilerStack::CompilerStack(ReadCallback::Callback const& _readFile):
m_readFile{_readFile}, m_readFile{_readFile},
m_enabledSMTSolvers{smt::SMTSolverChoice::All()}, m_enabledSMTSolvers{smt::SMTSolverChoice::All()},
m_generateIR{false}, m_generateIR{false},
m_generateEWasm{false}, m_generateEwasm{false},
m_errorList{}, m_errorList{},
m_errorReporter{m_errorList} m_errorReporter{m_errorList}
{ {
@ -200,7 +200,7 @@ void CompilerStack::reset(bool _keepSettings)
m_evmVersion = langutil::EVMVersion(); m_evmVersion = langutil::EVMVersion();
m_enabledSMTSolvers = smt::SMTSolverChoice::All(); m_enabledSMTSolvers = smt::SMTSolverChoice::All();
m_generateIR = false; m_generateIR = false;
m_generateEWasm = false; m_generateEwasm = false;
m_revertStrings = RevertStrings::Default; m_revertStrings = RevertStrings::Default;
m_optimiserSettings = OptimiserSettings::minimal(); m_optimiserSettings = OptimiserSettings::minimal();
m_metadataLiteralSources = false; m_metadataLiteralSources = false;
@ -463,10 +463,10 @@ bool CompilerStack::compile()
if (isRequestedContract(*contract)) if (isRequestedContract(*contract))
{ {
compileContract(*contract, otherCompilers); compileContract(*contract, otherCompilers);
if (m_generateIR || m_generateEWasm) if (m_generateIR || m_generateEwasm)
generateIR(*contract); generateIR(*contract);
if (m_generateEWasm) if (m_generateEwasm)
generateEWasm(*contract); generateEwasm(*contract);
} }
m_stackState = CompilationSuccessful; m_stackState = CompilationSuccessful;
this->link(); this->link();
@ -592,20 +592,20 @@ string const& CompilerStack::yulIROptimized(string const& _contractName) const
return contract(_contractName).yulIROptimized; return contract(_contractName).yulIROptimized;
} }
string const& CompilerStack::eWasm(string const& _contractName) const string const& CompilerStack::ewasm(string const& _contractName) const
{ {
if (m_stackState != CompilationSuccessful) if (m_stackState != CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));
return contract(_contractName).eWasm; return contract(_contractName).ewasm;
} }
eth::LinkerObject const& CompilerStack::eWasmObject(string const& _contractName) const eth::LinkerObject const& CompilerStack::ewasmObject(string const& _contractName) const
{ {
if (m_stackState != CompilationSuccessful) if (m_stackState != CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));
return contract(_contractName).eWasmObject; return contract(_contractName).ewasmObject;
} }
eth::LinkerObject const& CompilerStack::object(string const& _contractName) const eth::LinkerObject const& CompilerStack::object(string const& _contractName) const
@ -1069,15 +1069,15 @@ void CompilerStack::generateIR(ContractDefinition const& _contract)
tie(compiledContract.yulIR, compiledContract.yulIROptimized) = generator.run(_contract); tie(compiledContract.yulIR, compiledContract.yulIROptimized) = generator.run(_contract);
} }
void CompilerStack::generateEWasm(ContractDefinition const& _contract) void CompilerStack::generateEwasm(ContractDefinition const& _contract)
{ {
solAssert(m_stackState >= AnalysisPerformed, ""); solAssert(m_stackState >= AnalysisPerformed, "");
if (m_hasError) if (m_hasError)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Called generateEWasm with errors.")); BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Called generateEwasm with errors."));
Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
solAssert(!compiledContract.yulIROptimized.empty(), ""); solAssert(!compiledContract.yulIROptimized.empty(), "");
if (!compiledContract.eWasm.empty()) if (!compiledContract.ewasm.empty())
return; return;
// Re-parse the Yul IR in EVM dialect // Re-parse the Yul IR in EVM dialect
@ -1085,15 +1085,15 @@ void CompilerStack::generateEWasm(ContractDefinition const& _contract)
stack.parseAndAnalyze("", compiledContract.yulIROptimized); stack.parseAndAnalyze("", compiledContract.yulIROptimized);
stack.optimize(); stack.optimize();
stack.translate(yul::AssemblyStack::Language::EWasm); stack.translate(yul::AssemblyStack::Language::Ewasm);
stack.optimize(); stack.optimize();
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl; //cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
// Turn into eWasm text representation. // Turn into Ewasm text representation.
auto result = stack.assemble(yul::AssemblyStack::Machine::eWasm); auto result = stack.assemble(yul::AssemblyStack::Machine::Ewasm);
compiledContract.eWasm = std::move(result.assembly); compiledContract.ewasm = std::move(result.assembly);
compiledContract.eWasmObject = std::move(*result.bytecode); compiledContract.ewasmObject = std::move(*result.bytecode);
} }
CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const

View File

@ -178,8 +178,8 @@ public:
/// Enable experimental generation of Yul IR code. /// Enable experimental generation of Yul IR code.
void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; } void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; }
/// Enable experimental generation of eWasm code. If enabled, IR is also generated. /// Enable experimental generation of Ewasm code. If enabled, IR is also generated.
void enableEWasmGeneration(bool _enable = true) { m_generateEWasm = _enable; } void enableEwasmGeneration(bool _enable = true) { m_generateEwasm = _enable; }
/// @arg _metadataLiteralSources When true, store sources as literals in the contract metadata. /// @arg _metadataLiteralSources When true, store sources as literals in the contract metadata.
/// Must be set before parsing. /// Must be set before parsing.
@ -251,11 +251,11 @@ public:
/// @returns the optimized IR representation of a contract. /// @returns the optimized IR representation of a contract.
std::string const& yulIROptimized(std::string const& _contractName) const; std::string const& yulIROptimized(std::string const& _contractName) const;
/// @returns the eWasm text representation of a contract. /// @returns the Ewasm text representation of a contract.
std::string const& eWasm(std::string const& _contractName) const; std::string const& ewasm(std::string const& _contractName) const;
/// @returns the eWasm representation of a contract. /// @returns the Ewasm representation of a contract.
eth::LinkerObject const& eWasmObject(std::string const& _contractName) const; eth::LinkerObject const& ewasmObject(std::string const& _contractName) const;
/// @returns the assembled object for a contract. /// @returns the assembled object for a contract.
eth::LinkerObject const& object(std::string const& _contractName) const; eth::LinkerObject const& object(std::string const& _contractName) const;
@ -338,8 +338,8 @@ private:
eth::LinkerObject runtimeObject; ///< Runtime object. eth::LinkerObject runtimeObject; ///< Runtime object.
std::string yulIR; ///< Experimental Yul IR code. std::string yulIR; ///< Experimental Yul IR code.
std::string yulIROptimized; ///< Optimized experimental Yul IR code. std::string yulIROptimized; ///< Optimized experimental Yul IR code.
std::string eWasm; ///< Experimental eWasm text representation std::string ewasm; ///< Experimental Ewasm text representation
eth::LinkerObject eWasmObject; ///< Experimental eWasm code eth::LinkerObject ewasmObject; ///< Experimental Ewasm code
mutable std::unique_ptr<std::string const> metadata; ///< The metadata json that will be hashed into the chain. mutable std::unique_ptr<std::string const> metadata; ///< The metadata json that will be hashed into the chain.
mutable std::unique_ptr<Json::Value const> abi; mutable std::unique_ptr<Json::Value const> abi;
mutable std::unique_ptr<Json::Value const> storageLayout; mutable std::unique_ptr<Json::Value const> storageLayout;
@ -374,8 +374,8 @@ private:
/// The IR is stored but otherwise unused. /// The IR is stored but otherwise unused.
void generateIR(ContractDefinition const& _contract); void generateIR(ContractDefinition const& _contract);
/// Generate eWasm representation for a single contract. /// Generate Ewasm representation for a single contract.
void generateEWasm(ContractDefinition const& _contract); void generateEwasm(ContractDefinition const& _contract);
/// Links all the known library addresses in the available objects. Any unknown /// Links all the known library addresses in the available objects. Any unknown
/// library will still be kept as an unlinked placeholder in the objects. /// library will still be kept as an unlinked placeholder in the objects.
@ -436,7 +436,7 @@ private:
smt::SMTSolverChoice m_enabledSMTSolvers; smt::SMTSolverChoice m_enabledSMTSolvers;
std::map<std::string, std::set<std::string>> m_requestedContractNames; std::map<std::string, std::set<std::string>> m_requestedContractNames;
bool m_generateIR; bool m_generateIR;
bool m_generateEWasm; bool m_generateEwasm;
std::map<std::string, h160> m_libraries; std::map<std::string, h160> m_libraries;
/// list of path prefix remappings, e.g. mylibrary: github.com/ethereum = /usr/local/ethereum /// list of path prefix remappings, e.g. mylibrary: github.com/ethereum = /usr/local/ethereum
/// "context:prefix=target" /// "context:prefix=target"

View File

@ -247,9 +247,9 @@ bool isBinaryRequested(Json::Value const& _outputSelection)
return false; return false;
} }
/// @returns true if any eWasm code was requested. Note that as an exception, '*' does not /// @returns true if any Ewasm code was requested. Note that as an exception, '*' does not
/// yet match "ewasm.wast" or "ewasm" /// yet match "ewasm.wast" or "ewasm"
bool isEWasmRequested(Json::Value const& _outputSelection) bool isEwasmRequested(Json::Value const& _outputSelection)
{ {
if (!_outputSelection.isObject()) if (!_outputSelection.isObject())
return false; return false;
@ -267,7 +267,7 @@ bool isEWasmRequested(Json::Value const& _outputSelection)
/// yet match "ir" or "irOptimized" /// yet match "ir" or "irOptimized"
bool isIRRequested(Json::Value const& _outputSelection) bool isIRRequested(Json::Value const& _outputSelection)
{ {
if (isEWasmRequested(_outputSelection)) if (isEwasmRequested(_outputSelection))
return true; return true;
if (!_outputSelection.isObject()) if (!_outputSelection.isObject())
@ -780,7 +780,7 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
compilerStack.enableIRGeneration(isIRRequested(_inputsAndSettings.outputSelection)); compilerStack.enableIRGeneration(isIRRequested(_inputsAndSettings.outputSelection));
compilerStack.enableEWasmGeneration(isEWasmRequested(_inputsAndSettings.outputSelection)); compilerStack.enableEwasmGeneration(isEwasmRequested(_inputsAndSettings.outputSelection));
Json::Value errors = std::move(_inputsAndSettings.errors); Json::Value errors = std::move(_inputsAndSettings.errors);
@ -956,11 +956,11 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irOptimized", wildcardMatchesExperimental)) if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irOptimized", wildcardMatchesExperimental))
contractData["irOptimized"] = compilerStack.yulIROptimized(contractName); contractData["irOptimized"] = compilerStack.yulIROptimized(contractName);
// eWasm // Ewasm
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wast", wildcardMatchesExperimental)) if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wast", wildcardMatchesExperimental))
contractData["ewasm"]["wast"] = compilerStack.eWasm(contractName); contractData["ewasm"]["wast"] = compilerStack.ewasm(contractName);
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wasm", wildcardMatchesExperimental)) if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wasm", wildcardMatchesExperimental))
contractData["ewasm"]["wasm"] = compilerStack.eWasmObject(contractName).toHex(); contractData["ewasm"]["wasm"] = compilerStack.ewasmObject(contractName).toHex();
// EVM // EVM
Json::Value evmData(Json::objectValue); Json::Value evmData(Json::objectValue);

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* Full assembly stack that can support EVM-assembly and Yul 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.
*/ */
@ -59,7 +59,7 @@ Dialect const& languageToDialect(AssemblyStack::Language _language, EVMVersion _
return EVMDialect::strictAssemblyForEVMObjects(_version); return EVMDialect::strictAssemblyForEVMObjects(_version);
case AssemblyStack::Language::Yul: case AssemblyStack::Language::Yul:
return Dialect::yul(); return Dialect::yul();
case AssemblyStack::Language::EWasm: case AssemblyStack::Language::Ewasm:
return WasmDialect::instance(); return WasmDialect::instance();
} }
yulAssert(false, ""); yulAssert(false, "");
@ -108,7 +108,7 @@ void AssemblyStack::translate(AssemblyStack::Language _targetLanguage)
return; return;
solAssert( solAssert(
m_language == Language::StrictAssembly && _targetLanguage == Language::EWasm, m_language == Language::StrictAssembly && _targetLanguage == Language::Ewasm,
"Invalid language combination" "Invalid language combination"
); );
@ -214,9 +214,9 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
/// TODO: fill out text representation /// TODO: fill out text representation
return object; return object;
} }
case Machine::eWasm: case Machine::Ewasm:
{ {
yulAssert(m_language == Language::EWasm, ""); yulAssert(m_language == Language::Ewasm, "");
Dialect const& dialect = languageToDialect(m_language, EVMVersion{}); Dialect const& dialect = languageToDialect(m_language, EVMVersion{});
MachineAssemblyObject object; MachineAssemblyObject object;

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* Full assembly stack that can support EVM-assembly and Yul 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.
*/ */
#pragma once #pragma once
@ -52,13 +52,13 @@ struct MachineAssemblyObject
/* /*
* Full assembly stack that can support EVM-assembly and Yul 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 { Yul, Assembly, StrictAssembly, EWasm }; enum class Language { Yul, Assembly, StrictAssembly, Ewasm };
enum class Machine { EVM, EVM15, eWasm }; enum class Machine { EVM, EVM15, Ewasm };
AssemblyStack(): AssemblyStack():
AssemblyStack(langutil::EVMVersion{}, Language::Assembly, dev::solidity::OptimiserSettings::none()) AssemblyStack(langutil::EVMVersion{}, Language::Assembly, dev::solidity::OptimiserSettings::none())

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/>.
*/ */
/** /**
* EWasm to binary encoder. * Component that transforms internal Wasm representation to binary.
*/ */
#include <libyul/backends/wasm/BinaryTransform.h> #include <libyul/backends/wasm/BinaryTransform.h>

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/>.
*/ */
/** /**
* EWasm to binary encoder. * Component that transforms internal Wasm representation to binary.
*/ */
#pragma once #pragma once

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/>.
*/ */
/** /**
* Component that transforms interval Wasm representation to text. * Component that transforms internal Wasm representation to text.
*/ */
#include <libyul/backends/wasm/TextTransform.h> #include <libyul/backends/wasm/TextTransform.h>

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/>.
*/ */
/** /**
* Component that transforms interval Wasm representation to text. * Component that transforms internal Wasm representation to text.
*/ */
#pragma once #pragma once

View File

@ -116,7 +116,7 @@ static string const g_strErrorRecovery = "error-recovery";
static string const g_strEVM = "evm"; static string const g_strEVM = "evm";
static string const g_strEVM15 = "evm15"; static string const g_strEVM15 = "evm15";
static string const g_strEVMVersion = "evm-version"; static string const g_strEVMVersion = "evm-version";
static string const g_streWasm = "ewasm"; static string const g_strEwasm = "ewasm";
static string const g_strGas = "gas"; static string const g_strGas = "gas";
static string const g_strHelp = "help"; static string const g_strHelp = "help";
static string const g_strInputFile = "input-file"; static string const g_strInputFile = "input-file";
@ -125,7 +125,6 @@ static string const g_strYul = "yul";
static string const g_strYulDialect = "yul-dialect"; static string const g_strYulDialect = "yul-dialect";
static string const g_strIR = "ir"; static string const g_strIR = "ir";
static string const g_strIPFS = "ipfs"; static string const g_strIPFS = "ipfs";
static string const g_strEWasm = "ewasm";
static string const g_strLicense = "license"; static string const g_strLicense = "license";
static string const g_strLibraries = "libraries"; static string const g_strLibraries = "libraries";
static string const g_strLink = "link"; static string const g_strLink = "link";
@ -187,7 +186,7 @@ static string const g_argHelp = g_strHelp;
static string const g_argInputFile = g_strInputFile; static string const g_argInputFile = g_strInputFile;
static string const g_argYul = g_strYul; static string const g_argYul = g_strYul;
static string const g_argIR = g_strIR; static string const g_argIR = g_strIR;
static string const g_argEWasm = g_strEWasm; static string const g_argEwasm = g_strEwasm;
static string const g_argLibraries = g_strLibraries; static string const g_argLibraries = g_strLibraries;
static string const g_argLink = g_strLink; static string const g_argLink = g_strLink;
static string const g_argMachine = g_strMachine; static string const g_argMachine = g_strMachine;
@ -234,14 +233,14 @@ static set<string> const g_machineArgs
{ {
g_strEVM, g_strEVM,
g_strEVM15, g_strEVM15,
g_streWasm g_strEwasm
}; };
/// Possible arguments to for --yul-dialect /// Possible arguments to for --yul-dialect
static set<string> const g_yulDialectArgs static set<string> const g_yulDialectArgs
{ {
g_strEVM, g_strEVM,
g_streWasm g_strEwasm
}; };
/// Possible arguments to for --metadata-hash /// Possible arguments to for --metadata-hash
@ -345,23 +344,23 @@ void CommandLineInterface::handleIR(string const& _contractName)
} }
} }
void CommandLineInterface::handleEWasm(string const& _contractName) void CommandLineInterface::handleEwasm(string const& _contractName)
{ {
if (m_args.count(g_argEWasm)) if (m_args.count(g_argEwasm))
{ {
if (m_args.count(g_argOutputDir)) if (m_args.count(g_argOutputDir))
{ {
createFile(m_compiler->filesystemFriendlyName(_contractName) + ".wast", m_compiler->eWasm(_contractName)); createFile(m_compiler->filesystemFriendlyName(_contractName) + ".wast", m_compiler->ewasm(_contractName));
createFile( createFile(
m_compiler->filesystemFriendlyName(_contractName) + ".wasm", m_compiler->filesystemFriendlyName(_contractName) + ".wasm",
asString(m_compiler->eWasmObject(_contractName).bytecode) asString(m_compiler->ewasmObject(_contractName).bytecode)
); );
} }
else else
{ {
sout() << "EWasm text:" << endl; sout() << "Ewasm text:" << endl;
sout() << m_compiler->eWasm(_contractName) << endl; sout() << m_compiler->ewasm(_contractName) << endl;
sout() << "EWasm binary (hex): " << m_compiler->eWasmObject(_contractName).toHex() << endl; sout() << "Ewasm binary (hex): " << m_compiler->ewasmObject(_contractName).toHex() << endl;
} }
} }
} }
@ -776,7 +775,7 @@ Allowed options)",
(g_argBinaryRuntime.c_str(), "Binary of the runtime part of the contracts in hex.") (g_argBinaryRuntime.c_str(), "Binary of the runtime part of the contracts in hex.")
(g_argAbi.c_str(), "ABI specification of the contracts.") (g_argAbi.c_str(), "ABI specification of the contracts.")
(g_argIR.c_str(), "Intermediate Representation (IR) of all contracts (EXPERIMENTAL).") (g_argIR.c_str(), "Intermediate Representation (IR) of all contracts (EXPERIMENTAL).")
(g_argEWasm.c_str(), "EWasm text representation of all contracts (EXPERIMENTAL).") (g_argEwasm.c_str(), "Ewasm text representation of all contracts (EXPERIMENTAL).")
(g_argSignatureHashes.c_str(), "Function signature hashes of the contracts.") (g_argSignatureHashes.c_str(), "Function signature hashes of the contracts.")
(g_argNatspecUser.c_str(), "Natspec user documentation of all contracts.") (g_argNatspecUser.c_str(), "Natspec user documentation of all contracts.")
(g_argNatspecDev.c_str(), "Natspec developer documentation of all contracts.") (g_argNatspecDev.c_str(), "Natspec developer documentation of all contracts.")
@ -981,27 +980,27 @@ bool CommandLineInterface::processInput()
targetMachine = Machine::EVM; targetMachine = Machine::EVM;
else if (machine == g_strEVM15) else if (machine == g_strEVM15)
targetMachine = Machine::EVM15; targetMachine = Machine::EVM15;
else if (machine == g_streWasm) else if (machine == g_strEwasm)
targetMachine = Machine::eWasm; targetMachine = Machine::Ewasm;
else else
{ {
serr() << "Invalid option for --machine: " << machine << endl; serr() << "Invalid option for --machine: " << machine << endl;
return false; return false;
} }
} }
if (targetMachine == Machine::eWasm && inputLanguage == Input::StrictAssembly) if (targetMachine == Machine::Ewasm && inputLanguage == Input::StrictAssembly)
inputLanguage = Input::EWasm; inputLanguage = Input::Ewasm;
if (m_args.count(g_strYulDialect)) if (m_args.count(g_strYulDialect))
{ {
string dialect = m_args[g_strYulDialect].as<string>(); string dialect = m_args[g_strYulDialect].as<string>();
if (dialect == g_strEVM) if (dialect == g_strEVM)
inputLanguage = Input::StrictAssembly; inputLanguage = Input::StrictAssembly;
else if (dialect == g_streWasm) else if (dialect == g_strEwasm)
{ {
inputLanguage = Input::EWasm; inputLanguage = Input::Ewasm;
if (targetMachine != Machine::eWasm) if (targetMachine != Machine::Ewasm)
{ {
serr() << "If you select eWasm as --yul-dialect, --machine has to be eWasm as well." << endl; serr() << "If you select Ewasm as --yul-dialect, --machine has to be Ewasm as well." << endl;
return false; return false;
} }
} }
@ -1011,7 +1010,7 @@ bool CommandLineInterface::processInput()
return false; return false;
} }
} }
if (optimize && (inputLanguage != Input::StrictAssembly && inputLanguage != Input::EWasm)) if (optimize && (inputLanguage != Input::StrictAssembly && inputLanguage != Input::Ewasm))
{ {
serr() << serr() <<
"Optimizer can only be used for strict assembly. Use --" << "Optimizer can only be used for strict assembly. Use --" <<
@ -1074,7 +1073,7 @@ bool CommandLineInterface::processInput()
// TODO: Perhaps we should not compile unless requested // TODO: Perhaps we should not compile unless requested
m_compiler->enableIRGeneration(m_args.count(g_argIR)); m_compiler->enableIRGeneration(m_args.count(g_argIR));
m_compiler->enableEWasmGeneration(m_args.count(g_argEWasm)); m_compiler->enableEwasmGeneration(m_args.count(g_argEwasm));
OptimiserSettings settings = m_args.count(g_argOptimize) ? OptimiserSettings::standard() : OptimiserSettings::minimal(); OptimiserSettings settings = m_args.count(g_argOptimize) ? OptimiserSettings::standard() : OptimiserSettings::minimal();
settings.expectedExecutionsPerDeployment = m_args[g_argOptimizeRuns].as<unsigned>(); settings.expectedExecutionsPerDeployment = m_args[g_argOptimizeRuns].as<unsigned>();
@ -1453,7 +1452,7 @@ bool CommandLineInterface::assemble(
string machine = string machine =
_targetMachine == yul::AssemblyStack::Machine::EVM ? "EVM" : _targetMachine == yul::AssemblyStack::Machine::EVM ? "EVM" :
_targetMachine == yul::AssemblyStack::Machine::EVM15 ? "EVM 1.5" : _targetMachine == yul::AssemblyStack::Machine::EVM15 ? "EVM 1.5" :
"eWasm"; "Ewasm";
sout() << endl << "======= " << src.first << " (" << machine << ") =======" << endl; sout() << endl << "======= " << src.first << " (" << machine << ") =======" << endl;
yul::AssemblyStack& stack = assemblyStacks[src.first]; yul::AssemblyStack& stack = assemblyStacks[src.first];
@ -1461,9 +1460,9 @@ bool CommandLineInterface::assemble(
sout() << endl << "Pretty printed source:" << endl; sout() << endl << "Pretty printed source:" << endl;
sout() << stack.print() << endl; sout() << stack.print() << endl;
if (_language != yul::AssemblyStack::Language::EWasm && _targetMachine == yul::AssemblyStack::Machine::eWasm) if (_language != yul::AssemblyStack::Language::Ewasm && _targetMachine == yul::AssemblyStack::Machine::Ewasm)
{ {
stack.translate(yul::AssemblyStack::Language::EWasm); stack.translate(yul::AssemblyStack::Language::Ewasm);
stack.optimize(); stack.optimize();
sout() << endl << "==========================" << endl; sout() << endl << "==========================" << endl;
@ -1554,7 +1553,7 @@ void CommandLineInterface::outputCompilationResults()
handleBytecode(contract); handleBytecode(contract);
handleIR(contract); handleIR(contract);
handleEWasm(contract); handleEwasm(contract);
handleSignatureHashes(contract); handleSignatureHashes(contract);
handleMetadata(contract); handleMetadata(contract);
handleABI(contract); handleABI(contract);

View File

@ -67,7 +67,7 @@ private:
void handleBinary(std::string const& _contract); void handleBinary(std::string const& _contract);
void handleOpcode(std::string const& _contract); void handleOpcode(std::string const& _contract);
void handleIR(std::string const& _contract); void handleIR(std::string const& _contract);
void handleEWasm(std::string const& _contract); void handleEwasm(std::string const& _contract);
void handleBytecode(std::string const& _contract); void handleBytecode(std::string const& _contract);
void handleSignatureHashes(std::string const& _contract); void handleSignatureHashes(std::string const& _contract);
void handleMetadata(std::string const& _contract); void handleMetadata(std::string const& _contract);

View File

@ -1,5 +1,5 @@
======= evm_to_wasm/input.sol (eWasm) ======= ======= evm_to_wasm/input.sol (Ewasm) =======
Pretty printed source: Pretty printed source:
object "object" { object "object" {