diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index cb62cc292..7c76f8344 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -95,9 +95,9 @@ pair IRGenerator::run( { string ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources)); - yul::AssemblyStack asmStack( + yul::YulStack asmStack( m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, + yul::YulStack::Language::StrictAssembly, m_optimiserSettings, m_context.debugInfoSelection() ); diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index de5bea137..6560b0be5 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include @@ -1382,9 +1382,9 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract) return; // Re-parse the Yul IR in EVM dialect - yul::AssemblyStack stack( + yul::YulStack stack( m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, + yul::YulStack::Language::StrictAssembly, m_optimiserSettings, m_debugInfoSelection ); @@ -1414,22 +1414,22 @@ void CompilerStack::generateEwasm(ContractDefinition const& _contract) return; // Re-parse the Yul IR in EVM dialect - yul::AssemblyStack stack( + yul::YulStack stack( m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, + yul::YulStack::Language::StrictAssembly, m_optimiserSettings, m_debugInfoSelection ); stack.parseAndAnalyze("", compiledContract.yulIROptimized); stack.optimize(); - stack.translate(yul::AssemblyStack::Language::Ewasm); + stack.translate(yul::YulStack::Language::Ewasm); stack.optimize(); //cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl; // Turn into Ewasm text representation. - auto result = stack.assemble(yul::AssemblyStack::Machine::Ewasm); + auto result = stack.assemble(yul::YulStack::Machine::Ewasm); compiledContract.ewasm = std::move(result.assembly); compiledContract.ewasmObject = std::move(*result.bytecode); } diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 31400ccad..9ca8de3ea 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -1407,9 +1407,9 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings) return output; } - AssemblyStack stack( + YulStack stack( _inputsAndSettings.evmVersion, - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, _inputsAndSettings.optimiserSettings, _inputsAndSettings.debugInfoSelection.has_value() ? _inputsAndSettings.debugInfoSelection.value() : diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index 806f094fe..cc7033a0b 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -30,8 +30,8 @@ add_library(yul AsmParser.h AsmPrinter.cpp AsmPrinter.h - AssemblyStack.h - AssemblyStack.cpp + YulStack.h + YulStack.cpp CompilabilityChecker.cpp CompilabilityChecker.h ControlFlowSideEffects.h diff --git a/libyul/AssemblyStack.cpp b/libyul/YulStack.cpp similarity index 89% rename from libyul/AssemblyStack.cpp rename to libyul/YulStack.cpp index 3fefb9caf..3bca7288c 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/YulStack.cpp @@ -21,7 +21,7 @@ */ -#include +#include #include #include @@ -48,16 +48,16 @@ using namespace solidity::langutil; namespace { -Dialect const& languageToDialect(AssemblyStack::Language _language, EVMVersion _version) +Dialect const& languageToDialect(YulStack::Language _language, EVMVersion _version) { switch (_language) { - case AssemblyStack::Language::Assembly: - case AssemblyStack::Language::StrictAssembly: + case YulStack::Language::Assembly: + case YulStack::Language::StrictAssembly: return EVMDialect::strictAssemblyForEVMObjects(_version); - case AssemblyStack::Language::Yul: + case YulStack::Language::Yul: return EVMDialectTyped::instance(_version); - case AssemblyStack::Language::Ewasm: + case YulStack::Language::Ewasm: return WasmDialect::instance(); } yulAssert(false, ""); @@ -88,14 +88,14 @@ evmasm::Assembly::OptimiserSettings translateOptimiserSettings( } -CharStream const& AssemblyStack::charStream(string const& _sourceName) const +CharStream const& YulStack::charStream(string const& _sourceName) const { yulAssert(m_charStream, ""); yulAssert(m_charStream->name() == _sourceName, ""); return *m_charStream; } -bool AssemblyStack::parseAndAnalyze(std::string const& _sourceName, std::string const& _source) +bool YulStack::parseAndAnalyze(std::string const& _sourceName, std::string const& _source) { m_errors.clear(); m_analysisSuccessful = false; @@ -110,7 +110,7 @@ bool AssemblyStack::parseAndAnalyze(std::string const& _sourceName, std::string return analyzeParsed(); } -void AssemblyStack::optimize() +void YulStack::optimize() { if (!m_optimiserSettings.runYulOptimiser) return; @@ -123,7 +123,7 @@ void AssemblyStack::optimize() yulAssert(analyzeParsed(), "Invalid source code after optimization."); } -void AssemblyStack::translate(AssemblyStack::Language _targetLanguage) +void YulStack::translate(YulStack::Language _targetLanguage) { if (m_language == _targetLanguage) return; @@ -141,14 +141,14 @@ void AssemblyStack::translate(AssemblyStack::Language _targetLanguage) m_language = _targetLanguage; } -bool AssemblyStack::analyzeParsed() +bool YulStack::analyzeParsed() { yulAssert(m_parserResult, ""); m_analysisSuccessful = analyzeParsed(*m_parserResult); return m_analysisSuccessful; } -bool AssemblyStack::analyzeParsed(Object& _object) +bool YulStack::analyzeParsed(Object& _object) { yulAssert(_object.code, ""); _object.analysisInfo = make_shared(); @@ -168,7 +168,7 @@ bool AssemblyStack::analyzeParsed(Object& _object) return success; } -void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _optimize) const +void YulStack::compileEVM(AbstractAssembly& _assembly, bool _optimize) const { EVMDialect const* dialect = nullptr; switch (m_language) @@ -188,7 +188,7 @@ void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _optimize) cons EVMObjectCompiler::compile(*m_parserResult, _assembly, *dialect, _optimize); } -void AssemblyStack::optimize(Object& _object, bool _isCreation) +void YulStack::optimize(Object& _object, bool _isCreation) { yulAssert(_object.code, ""); yulAssert(_object.analysisInfo, ""); @@ -214,7 +214,7 @@ void AssemblyStack::optimize(Object& _object, bool _isCreation) ); } -MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const +MachineAssemblyObject YulStack::assemble(Machine _machine) const { yulAssert(m_analysisSuccessful, ""); yulAssert(m_parserResult, ""); @@ -243,7 +243,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const } std::pair -AssemblyStack::assembleWithDeployed(optional _deployName) const +YulStack::assembleWithDeployed(optional _deployName) const { auto [creationAssembly, deployedAssembly] = assembleEVMWithDeployed(_deployName); yulAssert(creationAssembly, ""); @@ -277,7 +277,7 @@ AssemblyStack::assembleWithDeployed(optional _deployName) const } std::pair, std::shared_ptr> -AssemblyStack::assembleEVMWithDeployed(optional _deployName) const +YulStack::assembleEVMWithDeployed(optional _deployName) const { yulAssert(m_analysisSuccessful, ""); yulAssert(m_parserResult, ""); @@ -317,7 +317,7 @@ AssemblyStack::assembleEVMWithDeployed(optional _deployName) const return {make_shared(assembly), {}}; } -string AssemblyStack::print( +string YulStack::print( CharStreamProvider const* _soliditySourceProvider ) const { @@ -326,7 +326,7 @@ string AssemblyStack::print( return m_parserResult->toString(&languageToDialect(m_language, m_evmVersion), m_debugInfoSelection, _soliditySourceProvider) + "\n"; } -shared_ptr AssemblyStack::parserResult() const +shared_ptr YulStack::parserResult() const { yulAssert(m_analysisSuccessful, "Analysis was not successful."); yulAssert(m_parserResult, ""); diff --git a/libyul/AssemblyStack.h b/libyul/YulStack.h similarity index 97% rename from libyul/AssemblyStack.h rename to libyul/YulStack.h index 950265ca4..77d0025f1 100644 --- a/libyul/AssemblyStack.h +++ b/libyul/YulStack.h @@ -63,14 +63,14 @@ struct MachineAssemblyObject * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and * Ewasm as output. */ -class AssemblyStack: public langutil::CharStreamProvider +class YulStack: public langutil::CharStreamProvider { public: enum class Language { Yul, Assembly, StrictAssembly, Ewasm }; enum class Machine { EVM, Ewasm }; - AssemblyStack(): - AssemblyStack( + YulStack(): + YulStack( langutil::EVMVersion{}, Language::Assembly, solidity::frontend::OptimiserSettings::none(), @@ -78,7 +78,7 @@ public: ) {} - AssemblyStack( + YulStack( langutil::EVMVersion _evmVersion, Language _language, solidity::frontend::OptimiserSettings _optimiserSettings, diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 8cf3a8ebc..40a428c95 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -1014,18 +1014,18 @@ string CommandLineInterface::objectWithLinkRefsHex(evmasm::LinkerObject const& _ return out; } -void CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul::AssemblyStack::Machine _targetMachine) +void CommandLineInterface::assemble(yul::YulStack::Language _language, yul::YulStack::Machine _targetMachine) { solAssert(m_options.input.mode == InputMode::Assembler, ""); bool successful = true; - map assemblyStacks; + map yulStacks; for (auto const& src: m_fileReader.sourceUnits()) { // --no-optimize-yul option is not accepted in assembly mode. solAssert(!m_options.optimizer.noOptimizeYul, ""); - auto& stack = assemblyStacks[src.first] = yul::AssemblyStack( + auto& stack = yulStacks[src.first] = yul::YulStack( m_options.output.evmVersion, _language, m_options.optimiserSettings(), @@ -1040,7 +1040,7 @@ void CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul: stack.optimize(); } - for (auto const& sourceAndStack: assemblyStacks) + for (auto const& sourceAndStack: yulStacks) { auto const& stack = sourceAndStack.second; SourceReferenceFormatter formatter(serr(false), stack, coloredOutput(m_options), m_options.formatting.withErrorIds); @@ -1063,11 +1063,11 @@ void CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul: for (auto const& src: m_fileReader.sourceUnits()) { string machine = - _targetMachine == yul::AssemblyStack::Machine::EVM ? "EVM" : + _targetMachine == yul::YulStack::Machine::EVM ? "EVM" : "Ewasm"; sout() << endl << "======= " << src.first << " (" << machine << ") =======" << endl; - yul::AssemblyStack& stack = assemblyStacks[src.first]; + yul::YulStack& stack = yulStacks[src.first]; if (m_options.compiler.outputs.irOptimized) { @@ -1077,9 +1077,9 @@ void CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul: sout() << stack.print() << endl; } - if (_language != yul::AssemblyStack::Language::Ewasm && _targetMachine == yul::AssemblyStack::Machine::Ewasm) + if (_language != yul::YulStack::Language::Ewasm && _targetMachine == yul::YulStack::Machine::Ewasm) { - stack.translate(yul::AssemblyStack::Language::Ewasm); + stack.translate(yul::YulStack::Language::Ewasm); stack.optimize(); if (m_options.compiler.outputs.ewasmIR) @@ -1103,10 +1103,10 @@ void CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul: serr() << "No binary representation found." << endl; } - solAssert(_targetMachine == yul::AssemblyStack::Machine::Ewasm || _targetMachine == yul::AssemblyStack::Machine::EVM, ""); + solAssert(_targetMachine == yul::YulStack::Machine::Ewasm || _targetMachine == yul::YulStack::Machine::EVM, ""); if ( - (_targetMachine == yul::AssemblyStack::Machine::EVM && m_options.compiler.outputs.asm_) || - (_targetMachine == yul::AssemblyStack::Machine::Ewasm && m_options.compiler.outputs.ewasm) + (_targetMachine == yul::YulStack::Machine::EVM && m_options.compiler.outputs.asm_) || + (_targetMachine == yul::YulStack::Machine::Ewasm && m_options.compiler.outputs.ewasm) ) { sout() << endl << "Text representation:" << endl; diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 951731825..b7ab158f9 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -90,7 +90,7 @@ private: /// @returns the full object with library placeholder hints in hex. static std::string objectWithLinkRefsHex(evmasm::LinkerObject const& _obj); - void assemble(yul::AssemblyStack::Language _language, yul::AssemblyStack::Machine _targetMachine); + void assemble(yul::YulStack::Language _language, yul::YulStack::Machine _targetMachine); void outputCompilationResults(); diff --git a/solc/CommandLineParser.cpp b/solc/CommandLineParser.cpp index 4cc346737..1a3fbed0e 100644 --- a/solc/CommandLineParser.cpp +++ b/solc/CommandLineParser.cpp @@ -1132,8 +1132,8 @@ void CommandLineParser::processArgs() } // switch to assembly mode - using Input = yul::AssemblyStack::Language; - using Machine = yul::AssemblyStack::Machine; + using Input = yul::YulStack::Language; + using Machine = yul::YulStack::Machine; m_options.assembly.inputLanguage = m_args.count(g_strYul) ? Input::Yul : (m_args.count(g_strStrictAssembly) ? Input::StrictAssembly : Input::Assembly); if (m_args.count(g_strMachine)) diff --git a/solc/CommandLineParser.h b/solc/CommandLineParser.h index 9723d5e06..108a16cd2 100644 --- a/solc/CommandLineParser.h +++ b/solc/CommandLineParser.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -190,8 +190,8 @@ struct CommandLineOptions struct { - yul::AssemblyStack::Machine targetMachine = yul::AssemblyStack::Machine::EVM; - yul::AssemblyStack::Language inputLanguage = yul::AssemblyStack::Language::StrictAssembly; + yul::YulStack::Machine targetMachine = yul::YulStack::Machine::EVM; + yul::YulStack::Language inputLanguage = yul::YulStack::Language::StrictAssembly; } assembly; struct diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index f0e5e455f..314a0d760 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include #include @@ -56,11 +56,11 @@ std::optional parseAndReturnFirstError( string const& _source, bool _assemble = false, bool _allowWarnings = true, - AssemblyStack::Language _language = AssemblyStack::Language::Assembly, - AssemblyStack::Machine _machine = AssemblyStack::Machine::EVM + YulStack::Language _language = YulStack::Language::Assembly, + YulStack::Machine _machine = YulStack::Machine::EVM ) { - AssemblyStack stack( + YulStack stack( solidity::test::CommonOptions::get().evmVersion(), _language, solidity::frontend::OptimiserSettings::none(), @@ -103,24 +103,24 @@ bool successParse( string const& _source, bool _assemble = false, bool _allowWarnings = true, - AssemblyStack::Language _language = AssemblyStack::Language::Assembly, - AssemblyStack::Machine _machine = AssemblyStack::Machine::EVM + YulStack::Language _language = YulStack::Language::Assembly, + YulStack::Machine _machine = YulStack::Machine::EVM ) { return !parseAndReturnFirstError(_source, _assemble, _allowWarnings, _language, _machine); } -bool successAssemble(string const& _source, bool _allowWarnings = true, AssemblyStack::Language _language = AssemblyStack::Language::Assembly) +bool successAssemble(string const& _source, bool _allowWarnings = true, YulStack::Language _language = YulStack::Language::Assembly) { return - successParse(_source, true, _allowWarnings, _language, AssemblyStack::Machine::EVM); + successParse(_source, true, _allowWarnings, _language, YulStack::Machine::EVM); } Error expectError( std::string const& _source, bool _assemble, bool _allowWarnings = false, - AssemblyStack::Language _language = AssemblyStack::Language::Assembly + YulStack::Language _language = YulStack::Language::Assembly ) { @@ -131,9 +131,9 @@ Error expectError( void parsePrintCompare(string const& _source, bool _canWarn = false) { - AssemblyStack stack( + YulStack stack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::Assembly, + YulStack::Language::Assembly, OptimiserSettings::none(), DebugInfoSelection::None() ); @@ -157,7 +157,7 @@ do \ } while(0) #define CHECK_ERROR(text, assemble, typ, substring, warnings) \ -CHECK_ERROR_LANG(text, assemble, typ, substring, warnings, AssemblyStack::Language::Assembly) +CHECK_ERROR_LANG(text, assemble, typ, substring, warnings, YulStack::Language::Assembly) #define CHECK_PARSE_ERROR(text, type, substring) \ CHECK_ERROR(text, false, type, substring, false) @@ -169,13 +169,13 @@ CHECK_ERROR(text, false, type, substring, false) CHECK_ERROR(text, true, type, substring, false) #define CHECK_STRICT_ERROR(text, type, substring) \ -CHECK_ERROR_LANG(text, false, type, substring, false, AssemblyStack::Language::StrictAssembly) +CHECK_ERROR_LANG(text, false, type, substring, false, YulStack::Language::StrictAssembly) #define CHECK_STRICT_WARNING(text, type, substring) \ -CHECK_ERROR(text, false, type, substring, false, AssemblyStack::Language::StrictAssembly) +CHECK_ERROR(text, false, type, substring, false, YulStack::Language::StrictAssembly) #define SUCCESS_STRICT(text) \ -do { successParse((text), false, false, AssemblyStack::Language::StrictAssembly); } while (false) +do { successParse((text), false, false, YulStack::Language::StrictAssembly); } while (false) BOOST_AUTO_TEST_SUITE(SolidityInlineAssembly) @@ -221,9 +221,9 @@ BOOST_AUTO_TEST_CASE(print_string_literal_unicode) { string source = "{ let x := \"\\u1bac\" }"; string parsed = "object \"object\" {\n code { let x := \"\\xe1\\xae\\xac\" }\n}\n"; - AssemblyStack stack( + YulStack stack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::Assembly, + YulStack::Language::Assembly, OptimiserSettings::none(), DebugInfoSelection::None() ); diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 7ff226a69..70d0b2a6e 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -97,9 +97,9 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( else if (forceEnableOptimizer) optimiserSettings = OptimiserSettings::full(); - yul::AssemblyStack asmStack( + yul::YulStack asmStack( m_evmVersion, - yul::AssemblyStack::Language::StrictAssembly, + yul::YulStack::Language::StrictAssembly, optimiserSettings, DebugInfoSelection::All() ); @@ -109,7 +109,7 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( try { asmStack.optimize(); - obj = move(*asmStack.assemble(yul::AssemblyStack::Machine::EVM).bytecode); + obj = move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode); obj.link(_libraryAddresses); break; } diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 202addffa..dfa495152 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -30,7 +30,7 @@ #include #include -#include +#include namespace solidity::frontend::test { diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index fc9be2001..f40f422a8 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,9 +55,9 @@ Dialect const& defaultDialect(bool _yul) pair, shared_ptr> yul::test::parse(string const& _source, bool _yul) { - AssemblyStack stack( + YulStack stack( solidity::test::CommonOptions::get().evmVersion(), - _yul ? AssemblyStack::Language::Yul : AssemblyStack::Language::StrictAssembly, + _yul ? YulStack::Language::Yul : YulStack::Language::StrictAssembly, solidity::test::CommonOptions::get().optimize ? solidity::frontend::OptimiserSettings::standard() : solidity::frontend::OptimiserSettings::minimal(), diff --git a/test/libyul/EVMCodeTransformTest.cpp b/test/libyul/EVMCodeTransformTest.cpp index 679493f35..c1f6ae5df 100644 --- a/test/libyul/EVMCodeTransformTest.cpp +++ b/test/libyul/EVMCodeTransformTest.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -51,9 +51,9 @@ TestCase::TestResult EVMCodeTransformTest::run(ostream& _stream, string const& _ solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::none(); settings.runYulOptimiser = false; settings.optimizeStackAllocation = m_stackOpt; - AssemblyStack stack( + YulStack stack( EVMVersion{}, - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, settings, DebugInfoSelection::All() ); diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index 17b7f1868..34a714404 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -80,9 +80,9 @@ TestCase::TestResult EwasmTranslationTest::run(ostream& _stream, string const& _ bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) { - m_stack = AssemblyStack( + m_stack = YulStack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::none(), DebugInfoSelection::All() ); diff --git a/test/libyul/EwasmTranslationTest.h b/test/libyul/EwasmTranslationTest.h index eba82beee..d54b8732a 100644 --- a/test/libyul/EwasmTranslationTest.h +++ b/test/libyul/EwasmTranslationTest.h @@ -20,12 +20,12 @@ #include -#include +#include namespace solidity::yul { struct Object; -class AssemblyStack; +class YulStack; } namespace solidity::yul::test @@ -48,7 +48,7 @@ private: std::string interpret(); std::shared_ptr m_object; - AssemblyStack m_stack; + YulStack m_stack; }; } diff --git a/test/libyul/ObjectCompilerTest.cpp b/test/libyul/ObjectCompilerTest.cpp index f22870952..dcb7158c2 100644 --- a/test/libyul/ObjectCompilerTest.cpp +++ b/test/libyul/ObjectCompilerTest.cpp @@ -22,7 +22,7 @@ #include -#include +#include #include #include @@ -63,9 +63,9 @@ ObjectCompilerTest::ObjectCompilerTest(string const& _filename): TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted) { - AssemblyStack stack( + YulStack stack( EVMVersion(), - m_wasm ? AssemblyStack::Language::Ewasm : AssemblyStack::Language::StrictAssembly, + m_wasm ? YulStack::Language::Ewasm : YulStack::Language::StrictAssembly, OptimiserSettings::preset(m_optimisationPreset), DebugInfoSelection::All() ); @@ -80,7 +80,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li if (m_wasm) { - MachineAssemblyObject obj = stack.assemble(AssemblyStack::Machine::Ewasm); + MachineAssemblyObject obj = stack.assemble(YulStack::Machine::Ewasm); solAssert(obj.bytecode, ""); m_obtainedResult = "Text:\n" + obj.assembly + "\n"; @@ -88,7 +88,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li } else { - MachineAssemblyObject obj = stack.assemble(AssemblyStack::Machine::EVM); + MachineAssemblyObject obj = stack.assemble(YulStack::Machine::EVM); solAssert(obj.bytecode, ""); solAssert(obj.sourceMappings, ""); diff --git a/test/libyul/ObjectParser.cpp b/test/libyul/ObjectParser.cpp index 1d6f0bed3..bee0025af 100644 --- a/test/libyul/ObjectParser.cpp +++ b/test/libyul/ObjectParser.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -58,9 +58,9 @@ pair parse(string const& _source) { try { - AssemblyStack asmStack( + YulStack asmStack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::none(), DebugInfoSelection::All() ); @@ -180,9 +180,9 @@ BOOST_AUTO_TEST_CASE(to_string) } )"; expectation = boost::replace_all_copy(expectation, "\t", " "); - AssemblyStack asmStack( + YulStack asmStack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::none(), DebugInfoSelection::All() ); diff --git a/test/libyul/YulInterpreterTest.cpp b/test/libyul/YulInterpreterTest.cpp index 3e7de4d17..3c890972e 100644 --- a/test/libyul/YulInterpreterTest.cpp +++ b/test/libyul/YulInterpreterTest.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -65,9 +65,9 @@ TestCase::TestResult YulInterpreterTest::run(ostream& _stream, string const& _li bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) { - AssemblyStack stack( + YulStack stack( solidity::test::CommonOptions::get().evmVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::none(), DebugInfoSelection::All() ); diff --git a/test/solc/CommandLineParser.cpp b/test/solc/CommandLineParser.cpp index b4be5a83a..22b3bd835 100644 --- a/test/solc/CommandLineParser.cpp +++ b/test/solc/CommandLineParser.cpp @@ -233,23 +233,23 @@ BOOST_AUTO_TEST_CASE(via_ir_options) BOOST_AUTO_TEST_CASE(assembly_mode_options) { - static vector, AssemblyStack::Machine, AssemblyStack::Language>> const allowedCombinations = { - {{"--machine=ewasm", "--yul-dialect=ewasm", "--assemble"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=ewasm", "--yul"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=ewasm", "--strict-assembly"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=evm", "--assemble"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--yul-dialect=evm", "--yul"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--yul-dialect=evm", "--strict-assembly"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--strict-assembly"}, AssemblyStack::Machine::Ewasm, AssemblyStack::Language::Ewasm}, - {{"--machine=evm", "--yul-dialect=evm", "--assemble"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::StrictAssembly}, - {{"--machine=evm", "--yul-dialect=evm", "--yul"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::StrictAssembly}, - {{"--machine=evm", "--yul-dialect=evm", "--strict-assembly"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::StrictAssembly}, - {{"--machine=evm", "--assemble"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::Assembly}, - {{"--machine=evm", "--yul"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::Yul}, - {{"--machine=evm", "--strict-assembly"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::StrictAssembly}, - {{"--assemble"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::Assembly}, - {{"--yul"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::Yul}, - {{"--strict-assembly"}, AssemblyStack::Machine::EVM, AssemblyStack::Language::StrictAssembly}, + static vector, YulStack::Machine, YulStack::Language>> const allowedCombinations = { + {{"--machine=ewasm", "--yul-dialect=ewasm", "--assemble"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, + {{"--machine=ewasm", "--yul-dialect=ewasm", "--yul"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, + {{"--machine=ewasm", "--yul-dialect=ewasm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, + {{"--machine=ewasm", "--yul-dialect=evm", "--assemble"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, + {{"--machine=ewasm", "--yul-dialect=evm", "--yul"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, + {{"--machine=ewasm", "--yul-dialect=evm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, + {{"--machine=ewasm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, + {{"--machine=evm", "--yul-dialect=evm", "--assemble"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, + {{"--machine=evm", "--yul-dialect=evm", "--yul"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, + {{"--machine=evm", "--yul-dialect=evm", "--strict-assembly"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, + {{"--machine=evm", "--assemble"}, YulStack::Machine::EVM, YulStack::Language::Assembly}, + {{"--machine=evm", "--yul"}, YulStack::Machine::EVM, YulStack::Language::Yul}, + {{"--machine=evm", "--strict-assembly"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, + {{"--assemble"}, YulStack::Machine::EVM, YulStack::Language::Assembly}, + {{"--yul"}, YulStack::Machine::EVM, YulStack::Language::Yul}, + {{"--strict-assembly"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, }; for (auto const& [assemblyOptions, expectedMachine, expectedLanguage]: allowedCombinations) @@ -302,7 +302,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options) "--ewasm-ir", }; commandLine += assemblyOptions; - if (expectedLanguage == AssemblyStack::Language::StrictAssembly || expectedLanguage == AssemblyStack::Language::Ewasm) + if (expectedLanguage == YulStack::Language::StrictAssembly || expectedLanguage == YulStack::Language::Ewasm) commandLine += vector{ "--optimize", "--optimize-runs=1000", @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options) expectedOptions.compiler.outputs.irOptimized = true; expectedOptions.compiler.outputs.ewasm = true; expectedOptions.compiler.outputs.ewasmIR = true; - if (expectedLanguage == AssemblyStack::Language::StrictAssembly || expectedLanguage == AssemblyStack::Language::Ewasm) + if (expectedLanguage == YulStack::Language::StrictAssembly || expectedLanguage == YulStack::Language::Ewasm) { expectedOptions.optimizer.enabled = true; expectedOptions.optimizer.yulSteps = "agf"; diff --git a/test/tools/ossfuzz/SolidityEvmoneInterface.h b/test/tools/ossfuzz/SolidityEvmoneInterface.h index da0fed58f..734caf560 100644 --- a/test/tools/ossfuzz/SolidityEvmoneInterface.h +++ b/test/tools/ossfuzz/SolidityEvmoneInterface.h @@ -22,7 +22,7 @@ #include -#include +#include #include diff --git a/test/tools/ossfuzz/YulEvmoneInterface.cpp b/test/tools/ossfuzz/YulEvmoneInterface.cpp index e21a881c6..2d7ddccc1 100644 --- a/test/tools/ossfuzz/YulEvmoneInterface.cpp +++ b/test/tools/ossfuzz/YulEvmoneInterface.cpp @@ -35,7 +35,7 @@ bytes YulAssembler::assemble() if (m_optimiseYul) m_stack.optimize(); - return m_stack.assemble(AssemblyStack::Machine::EVM).bytecode->bytecode; + return m_stack.assemble(YulStack::Machine::EVM).bytecode->bytecode; } evmc::result YulEvmoneUtility::deployCode(bytes const& _input, EVMHost& _host) diff --git a/test/tools/ossfuzz/YulEvmoneInterface.h b/test/tools/ossfuzz/YulEvmoneInterface.h index 0b3384940..709e5475f 100644 --- a/test/tools/ossfuzz/YulEvmoneInterface.h +++ b/test/tools/ossfuzz/YulEvmoneInterface.h @@ -19,7 +19,7 @@ #include -#include +#include #include @@ -37,7 +37,7 @@ public: ): m_stack( _version, - solidity::yul::AssemblyStack::Language::StrictAssembly, + solidity::yul::YulStack::Language::StrictAssembly, _optSettings, langutil::DebugInfoSelection::All() ), @@ -46,7 +46,7 @@ public: {} solidity::bytes assemble(); private: - solidity::yul::AssemblyStack m_stack; + solidity::yul::YulStack m_stack; std::string m_yulProgram; bool m_optimiseYul; }; diff --git a/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp index 7142ec23c..a353ca10b 100644 --- a/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp @@ -16,7 +16,7 @@ */ // SPDX-License-Identifier: GPL-3.0 -#include +#include #include #include @@ -37,9 +37,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) YulStringRepository::reset(); string input(reinterpret_cast(_data), _size); - AssemblyStack stack( + YulStack stack( langutil::EVMVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::full(), langutil::DebugInfoSelection::All() ); @@ -49,7 +49,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) try { - MachineAssemblyObject obj = stack.assemble(AssemblyStack::Machine::EVM); + MachineAssemblyObject obj = stack.assemble(YulStack::Machine::EVM); solAssert(obj.bytecode, ""); } catch (StackTooDeepError const&) diff --git a/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp index dce6c6162..dd66102c1 100644 --- a/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_diff_ossfuzz.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -60,9 +60,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) YulStringRepository::reset(); - AssemblyStack stack( + YulStack stack( langutil::EVMVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::full(), DebugInfoSelection::All() ); diff --git a/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp b/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp index 05a0179bf..94a837d5a 100644 --- a/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/strictasm_opt_ossfuzz.cpp @@ -16,7 +16,7 @@ */ // SPDX-License-Identifier: GPL-3.0 -#include +#include #include #include @@ -38,9 +38,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) YulStringRepository::reset(); string input(reinterpret_cast(_data), _size); - AssemblyStack stack( + YulStack stack( langutil::EVMVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::full(), DebugInfoSelection::All() ); diff --git a/test/tools/ossfuzz/yulProtoFuzzer.cpp b/test/tools/ossfuzz/yulProtoFuzzer.cpp index ca15b3769..74183aa3f 100644 --- a/test/tools/ossfuzz/yulProtoFuzzer.cpp +++ b/test/tools/ossfuzz/yulProtoFuzzer.cpp @@ -25,7 +25,7 @@ #include -#include +#include #include #include @@ -61,10 +61,10 @@ DEFINE_PROTO_FUZZER(Program const& _input) YulStringRepository::reset(); - // AssemblyStack entry point - AssemblyStack stack( + // YulStack entry point + YulStack stack( version, - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::full(), DebugInfoSelection::All() ); diff --git a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp index 4cafccb28..c3ad9c9f3 100644 --- a/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp +++ b/test/tools/ossfuzz/yulProto_diff_ossfuzz.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include #include @@ -60,10 +60,10 @@ DEFINE_PROTO_FUZZER(Program const& _input) YulStringRepository::reset(); - // AssemblyStack entry point - AssemblyStack stack( + // YulStack entry point + YulStack stack( version, - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::full(), DebugInfoSelection::All() ); diff --git a/test/tools/yulrun.cpp b/test/tools/yulrun.cpp index 570299768..fd43d222d 100644 --- a/test/tools/yulrun.cpp +++ b/test/tools/yulrun.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -56,9 +56,9 @@ namespace pair, shared_ptr> parse(string const& _source) { - AssemblyStack stack( + YulStack stack( langutil::EVMVersion(), - AssemblyStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, solidity::frontend::OptimiserSettings::none(), DebugInfoSelection::Default() );