diff --git a/.circleci/config.yml b/.circleci/config.yml index 0224ac93b..6a7a03a61 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,9 @@ defaults: paths: - test/tools/ossfuzz/abiv2_proto_ossfuzz - test/tools/ossfuzz/const_opt_ossfuzz + - test/tools/ossfuzz/solc_noopt_mutator_ossfuzz - test/tools/ossfuzz/solc_noopt_ossfuzz + - test/tools/ossfuzz/solc_opt_mutator_ossfuzz - test/tools/ossfuzz/solc_opt_ossfuzz - test/tools/ossfuzz/strictasm_assembly_ossfuzz - test/tools/ossfuzz/strictasm_diff_ossfuzz diff --git a/Changelog.md b/Changelog.md index 0f22b00e0..72a8fe513 100644 --- a/Changelog.md +++ b/Changelog.md @@ -44,6 +44,7 @@ Compiler Features: * SMTChecker: Support struct constructor. Bugfixes: + * Code generator: Do not pad empty string literals with a single 32-byte zero field in the ABI coder v1. * SMTChecker: Fix internal compiler error when doing bitwise compound assignment with string literals. ### 0.7.5 (2020-11-18) diff --git a/libsolidity/analysis/ControlFlowBuilder.cpp b/libsolidity/analysis/ControlFlowBuilder.cpp index c1de720f9..975e4ec6d 100644 --- a/libsolidity/analysis/ControlFlowBuilder.cpp +++ b/libsolidity/analysis/ControlFlowBuilder.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include -#include +#include #include using namespace solidity; diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 3cdb6245c..930534924 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index e50e33ada..0e8e7684e 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 46b0b04f2..4d58a77fc 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -2318,11 +2318,19 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) functionType = dynamic_cast(expressionType); funcCallAnno.kind = FunctionCallKind::FunctionCall; + if (auto memberAccess = dynamic_cast(&_functionCall.expression())) + { + if (dynamic_cast(memberAccess->annotation().referencedDeclaration)) + _functionCall.expression().annotation().calledDirectly = true; + } + else if (auto identifier = dynamic_cast(&_functionCall.expression())) + if (dynamic_cast(identifier->annotation().referencedDeclaration)) + _functionCall.expression().annotation().calledDirectly = true; + // Purity for function calls also depends upon the callee and its FunctionType funcCallAnno.isPure = argumentsArePure && *_functionCall.expression().annotation().isPure && - functionType && functionType->isPure(); if ( diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index c3c068ca8..5dba65f2c 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index b5b1ae9f5..cff1b512d 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -45,7 +45,7 @@ namespace solidity::yul { -// Forward-declaration to +// Forward-declaration to struct Block; struct Dialect; } diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index dcc1e3bc4..d1167a1e3 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -262,6 +262,15 @@ struct ExpressionAnnotation: ASTAnnotation /// Types and - if given - names of arguments if the expr. is a function /// that is called, used for overload resolution std::optional arguments; + + /// True if the expression consists solely of the name of the function and the function is called immediately + /// instead of being stored or processed. The name may be qualified with the name of a contract, library + /// module, etc., that clarifies the scope. For example: `m.L.f()`, where `m` is a module, `L` is a library + /// and `f` is a function is a direct call. This means that the function to be called is known at compilation + /// time and it's not necessary to rely on any runtime dispatch mechanism to resolve it. + /// Note that even the simplest expressions, like `(f)()`, result in an indirect call even if they consist of + /// values known at compilation time. + bool calledDirectly = false; }; struct IdentifierAnnotation: ExpressionAnnotation diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index ef066a803..68bc5367f 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -26,8 +26,8 @@ #include #include -#include #include +#include #include #include diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 313fb2e10..29b8961e5 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 319ec5e80..1c15e4c2d 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 639641a2c..b3f40eb62 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -531,10 +531,15 @@ void CompilerUtils::encodeToMemory( if (_givenTypes[i]->category() == Type::Category::StringLiteral) { auto const& strType = dynamic_cast(*_givenTypes[i]); - m_context << u256(strType.value().size()); + auto const size = strType.value().size(); + m_context << u256(size); storeInMemoryDynamic(*TypeProvider::uint256(), true); // stack: ... - storeInMemoryDynamic(strType, _padToWordBoundaries); + + // Do not output empty padding for zero-length strings. + // TODO: handle this in storeInMemoryDynamic + if (size != 0) + storeInMemoryDynamic(strType, _padToWordBoundaries); } else { diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index 64ab84fe7..7bc26d971 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -104,12 +104,13 @@ public: /// Stores a 256 bit integer from stack in memory. /// @param _offset offset in memory void storeInMemory(unsigned _offset); + /// Dynamic version of @see storeInMemory, expects the memory offset below the value on the stack /// and also updates that. For reference types, only copies the data pointer. Fails for - /// non-memory-references. + /// non-memory-references. For string literals no value is available on the stack. /// @param _padToWords if true, adds zeros to pad to multiple of 32 bytes. Array elements + /// are always padded (except for byte arrays), regardless of this parameter. /// @param _cleanup if true, adds code to cleanup the value before storing it. - /// are always padded (except for byte arrays), regardless of this parameter. /// Stack pre: memory_offset value... /// Stack post: (memory_offset+length) void storeInMemoryDynamic(Type const& _type, bool _padToWords = true, bool _cleanup = true); diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index bab2e588b..08d0fa7af 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/libsolidity/codegen/ir/IRGenerationContext.cpp b/libsolidity/codegen/ir/IRGenerationContext.cpp index 7476dd90e..99e5fb887 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.cpp +++ b/libsolidity/codegen/ir/IRGenerationContext.cpp @@ -128,7 +128,7 @@ void IRGenerationContext::initializeInternalDispatch(InternalDispatchMap _intern { solAssert(internalDispatchClean(), ""); - for (set const& functions: _internalDispatch | boost::adaptors::map_values) + for (DispatchSet const& functions: _internalDispatch | boost::adaptors::map_values) for (auto function: functions) enqueueFunctionForCodeGeneration(*function); @@ -137,38 +137,26 @@ void IRGenerationContext::initializeInternalDispatch(InternalDispatchMap _intern InternalDispatchMap IRGenerationContext::consumeInternalDispatchMap() { - m_directInternalFunctionCalls.clear(); - InternalDispatchMap internalDispatch = move(m_internalDispatchMap); m_internalDispatchMap.clear(); return internalDispatch; } -void IRGenerationContext::internalFunctionCalledDirectly(Expression const& _expression) +void IRGenerationContext::addToInternalDispatch(FunctionDefinition const& _function) { - solAssert(m_directInternalFunctionCalls.count(&_expression) == 0, ""); + FunctionType const* functionType = TypeProvider::function(_function, FunctionType::Kind::Internal); + solAssert(functionType, ""); - m_directInternalFunctionCalls.insert(&_expression); + YulArity arity = YulArity::fromType(*functionType); + + if (m_internalDispatchMap.count(arity) != 0 && m_internalDispatchMap[arity].count(&_function) != 0) + // Note that m_internalDispatchMap[arity] is a set with a custom comparator, which looks at function IDs not definitions + solAssert(*m_internalDispatchMap[arity].find(&_function) == &_function, "Different definitions with the same function ID"); + + m_internalDispatchMap[arity].insert(&_function); + enqueueFunctionForCodeGeneration(_function); } -void IRGenerationContext::internalFunctionAccessed(Expression const& _expression, FunctionDefinition const& _function) -{ - solAssert( - IRHelpers::referencedFunctionDeclaration(_expression) && - _function.resolveVirtual(mostDerivedContract()) == - IRHelpers::referencedFunctionDeclaration(_expression)->resolveVirtual(mostDerivedContract()), - "Function definition does not match the expression" - ); - - if (m_directInternalFunctionCalls.count(&_expression) == 0) - { - FunctionType const* functionType = TypeProvider::function(_function, FunctionType::Kind::Internal); - solAssert(functionType, ""); - - m_internalDispatchMap[YulArity::fromType(*functionType)].insert(&_function); - enqueueFunctionForCodeGeneration(_function); - } -} void IRGenerationContext::internalFunctionCalledThroughDispatch(YulArity const& _arity) { diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index d044a6d4a..398953de0 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -44,7 +44,20 @@ namespace solidity::frontend class YulUtilFunctions; class ABIFunctions; -using InternalDispatchMap = std::map>; +struct AscendingFunctionIDCompare +{ + bool operator()(FunctionDefinition const* _f1, FunctionDefinition const* _f2) const + { + // NULLs always first. + if (_f1 != nullptr && _f2 != nullptr) + return _f1->id() < _f2->id(); + else + return _f1 == nullptr; + } +}; + +using DispatchSet = std::set; +using InternalDispatchMap = std::map; /** * Class that contains contextual information during IR generation. @@ -108,7 +121,7 @@ public: void initializeInternalDispatch(InternalDispatchMap _internalDispatchMap); InternalDispatchMap consumeInternalDispatchMap(); - bool internalDispatchClean() const { return m_internalDispatchMap.empty() && m_directInternalFunctionCalls.empty(); } + bool internalDispatchClean() const { return m_internalDispatchMap.empty(); } /// Notifies the context that a function call that needs to go through internal dispatch was /// encountered while visiting the AST. This ensures that the corresponding dispatch function @@ -116,16 +129,8 @@ public: /// the code contains a call to an uninitialized function variable). void internalFunctionCalledThroughDispatch(YulArity const& _arity); - /// Notifies the context that a direct function call (i.e. not through internal dispatch) was - /// encountered while visiting the AST. This lets the context know that the function should - /// not be added to the dispatch (unless there are also indirect calls to it elsewhere else). - void internalFunctionCalledDirectly(Expression const& _expression); - - /// Notifies the context that a name representing an internal function has been found while - /// visiting the AST. If the name has not been reported as a direct call using - /// @a internalFunctionCalledDirectly(), it's assumed to represent function variable access - /// and the function gets added to internal dispatch. - void internalFunctionAccessed(Expression const& _expression, FunctionDefinition const& _function); + /// Adds a function to the internal dispatch. + void addToInternalDispatch(FunctionDefinition const& _function); /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); @@ -177,14 +182,13 @@ private: /// The order and duplicates are irrelevant here (hence std::set rather than std::queue) as /// long as the order of Yul functions in the generated code is deterministic and the same on /// all platforms - which is a property guaranteed by MultiUseYulFunctionCollector. - std::set m_functionGenerationQueue; + DispatchSet m_functionGenerationQueue; /// Collection of functions that need to be callable via internal dispatch. /// Note that having a key with an empty set of functions is a valid situation. It means that /// the code contains a call via a pointer even though a specific function is never assigned to it. /// It will fail at runtime but the code must still compile. InternalDispatchMap m_internalDispatchMap; - std::set m_directInternalFunctionCalls; std::set m_subObjects; }; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 8b2b8e65b..93f4cf279 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include @@ -829,20 +829,6 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp) return false; } -bool IRGeneratorForStatements::visit(FunctionCall const& _functionCall) -{ - setLocation(_functionCall); - FunctionTypePointer functionType = dynamic_cast(&type(_functionCall.expression())); - if ( - functionType && - functionType->kind() == FunctionType::Kind::Internal && - IRHelpers::referencedFunctionDeclaration(_functionCall.expression()) - ) - m_context.internalFunctionCalledDirectly(_functionCall.expression()); - - return true; -} - void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) { setLocation(_functionCall); @@ -1558,6 +1544,7 @@ void IRGeneratorForStatements::endVisit(FunctionCallOptions const& _options) void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) { setLocation(_memberAccess); + ASTString const& member = _memberAccess.memberName(); auto memberFunctionType = dynamic_cast(_memberAccess.annotation().type); Type::Category objectCategory = _memberAccess.expression().annotation().type->category(); @@ -1583,7 +1570,8 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) if (memberFunctionType->kind() == FunctionType::Kind::Internal) { define(IRVariable(_memberAccess).part("functionIdentifier")) << to_string(functionDefinition.id()) << "\n"; - m_context.internalFunctionAccessed(_memberAccess, functionDefinition); + if (!_memberAccess.annotation().calledDirectly) + m_context.addToInternalDispatch(functionDefinition); } else { @@ -1875,7 +1863,8 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) define(_memberAccess) << to_string(resolvedFunctionDef.id()) << "\n"; solAssert(resolvedFunctionDef.functionType(true), ""); solAssert(resolvedFunctionDef.functionType(true)->kind() == FunctionType::Kind::Internal, ""); - m_context.internalFunctionAccessed(_memberAccess, resolvedFunctionDef); + if (!_memberAccess.annotation().calledDirectly) + m_context.addToInternalDispatch(resolvedFunctionDef); } else if (auto const* variable = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) handleVariableReference(*variable, _memberAccess); @@ -1889,7 +1878,8 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) if (auto const* function = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) { define(_memberAccess) << to_string(function->id()) << "\n"; - m_context.internalFunctionAccessed(_memberAccess, *function); + if (!_memberAccess.annotation().calledDirectly) + m_context.addToInternalDispatch(*function); } else solAssert(false, "Function not found in member access"); @@ -1964,7 +1954,9 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) solAssert(*_memberAccess.annotation().requiredLookup == VirtualLookup::Static, ""); define(_memberAccess) << to_string(function->id()) << "\n"; - m_context.internalFunctionAccessed(_memberAccess, *function); + + if (!_memberAccess.annotation().calledDirectly) + m_context.addToInternalDispatch(*function); } break; } @@ -2208,7 +2200,8 @@ void IRGeneratorForStatements::endVisit(Identifier const& _identifier) solAssert(resolvedFunctionDef.functionType(true), ""); solAssert(resolvedFunctionDef.functionType(true)->kind() == FunctionType::Kind::Internal, ""); - m_context.internalFunctionAccessed(_identifier, resolvedFunctionDef); + if (!_identifier.annotation().calledDirectly) + m_context.addToInternalDispatch(resolvedFunctionDef); } else if (VariableDeclaration const* varDecl = dynamic_cast(declaration)) handleVariableReference(*varDecl, _identifier); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.h b/libsolidity/codegen/ir/IRGeneratorForStatements.h index ce6532ef2..24ac8a61e 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.h +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.h @@ -76,7 +76,6 @@ public: void endVisit(Return const& _return) override; void endVisit(UnaryOperation const& _unaryOperation) override; bool visit(BinaryOperation const& _binOp) override; - bool visit(FunctionCall const& _funCall) override; void endVisit(FunctionCall const& _funCall) override; void endVisit(FunctionCallOptions const& _funCallOptions) override; void endVisit(MemberAccess const& _memberAccess) override; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 874be0a00..5228d995b 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #include #include diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 70275cda7..f68040a37 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/libyul/AsmData.h b/libyul/AST.h similarity index 99% rename from libyul/AsmData.h rename to libyul/AST.h index c4040f320..09d39832f 100644 --- a/libyul/AsmData.h +++ b/libyul/AST.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/AsmDataForward.h b/libyul/ASTForward.h similarity index 98% rename from libyul/AsmDataForward.h rename to libyul/ASTForward.h index 02216fd01..a4dc5be3f 100644 --- a/libyul/AsmDataForward.h +++ b/libyul/ASTForward.h @@ -28,6 +28,7 @@ namespace solidity::yul { +enum class LiteralKind; struct Literal; struct Label; struct Identifier; diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 631d0881c..b6eba1119 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include @@ -668,3 +668,8 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio return true; } + +bool AsmAnalyzer::validateInstructions(FunctionCall const& _functionCall) +{ + return validateInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); +} diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 9906c66e2..d362c963a 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -114,10 +114,7 @@ private: bool validateInstructions(evmasm::Instruction _instr, langutil::SourceLocation const& _location); bool validateInstructions(std::string const& _instrIdentifier, langutil::SourceLocation const& _location); - bool validateInstructions(FunctionCall const& _functionCall) - { - return validateInstructions(_functionCall.functionName.name.str(), _functionCall.functionName.location); - } + bool validateInstructions(FunctionCall const& _functionCall); yul::ExternalIdentifierAccess::Resolver m_resolver; Scope* m_currentScope = nullptr; diff --git a/libyul/AsmAnalysisInfo.h b/libyul/AsmAnalysisInfo.h index 9ac179ad8..120228d2e 100644 --- a/libyul/AsmAnalysisInfo.h +++ b/libyul/AsmAnalysisInfo.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index 58b11338d..019a5c4ce 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include diff --git a/libyul/AsmJsonConverter.h b/libyul/AsmJsonConverter.h index 3436523b7..fe0c4685c 100644 --- a/libyul/AsmJsonConverter.h +++ b/libyul/AsmJsonConverter.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include #include #include diff --git a/libyul/AsmJsonImporter.cpp b/libyul/AsmJsonImporter.cpp index 5940d055c..bbcd1b9a7 100644 --- a/libyul/AsmJsonImporter.cpp +++ b/libyul/AsmJsonImporter.cpp @@ -23,8 +23,7 @@ */ #include -#include -#include +#include #include #include diff --git a/libyul/AsmJsonImporter.h b/libyul/AsmJsonImporter.h index 65f549dc5..e491430b6 100644 --- a/libyul/AsmJsonImporter.h +++ b/libyul/AsmJsonImporter.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 2baefa16f..00cdb4a22 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -22,6 +22,7 @@ */ #include +#include #include #include #include diff --git a/libyul/AsmParser.h b/libyul/AsmParser.h index c48910064..705711b52 100644 --- a/libyul/AsmParser.h +++ b/libyul/AsmParser.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/AsmPrinter.cpp b/libyul/AsmPrinter.cpp index c5982afc9..61e01bf0f 100644 --- a/libyul/AsmPrinter.cpp +++ b/libyul/AsmPrinter.cpp @@ -22,7 +22,7 @@ */ #include -#include +#include #include #include diff --git a/libyul/AsmPrinter.h b/libyul/AsmPrinter.h index 648181cbf..63b1bd3a2 100644 --- a/libyul/AsmPrinter.h +++ b/libyul/AsmPrinter.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include diff --git a/libyul/AsmScopeFiller.cpp b/libyul/AsmScopeFiller.cpp index 0e0695410..287c0caea 100644 --- a/libyul/AsmScopeFiller.cpp +++ b/libyul/AsmScopeFiller.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include diff --git a/libyul/AsmScopeFiller.h b/libyul/AsmScopeFiller.h index f2c35118b..b43910874 100644 --- a/libyul/AsmScopeFiller.h +++ b/libyul/AsmScopeFiller.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index 14f0d6884..4dd59df2f 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -2,8 +2,8 @@ add_library(yul AsmAnalysis.cpp AsmAnalysis.h AsmAnalysisInfo.h - AsmData.h - AsmDataForward.h + AST.h + ASTForward.h AsmJsonConverter.h AsmJsonConverter.cpp AsmJsonImporter.h diff --git a/libyul/CompilabilityChecker.h b/libyul/CompilabilityChecker.h index ba9191e28..307d719e4 100644 --- a/libyul/CompilabilityChecker.h +++ b/libyul/CompilabilityChecker.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include diff --git a/libyul/Dialect.cpp b/libyul/Dialect.cpp index 6c498ce4c..847c9f1ac 100644 --- a/libyul/Dialect.cpp +++ b/libyul/Dialect.cpp @@ -20,7 +20,7 @@ */ #include -#include +#include using namespace solidity::yul; using namespace std; diff --git a/libyul/Object.h b/libyul/Object.h index deb52eb25..aa4bde629 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/ObjectParser.cpp b/libyul/ObjectParser.cpp index f1d38ad73..4385c2b3b 100644 --- a/libyul/ObjectParser.cpp +++ b/libyul/ObjectParser.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/libyul/Utilities.cpp b/libyul/Utilities.cpp index af72888fa..64009a0f3 100644 --- a/libyul/Utilities.cpp +++ b/libyul/Utilities.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include diff --git a/libyul/Utilities.h b/libyul/Utilities.h index 53913e6fd..b9077eeae 100644 --- a/libyul/Utilities.h +++ b/libyul/Utilities.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include namespace solidity::yul { diff --git a/libyul/backends/evm/AsmCodeGen.cpp b/libyul/backends/evm/AsmCodeGen.cpp index 15d646755..49665e347 100644 --- a/libyul/backends/evm/AsmCodeGen.cpp +++ b/libyul/backends/evm/AsmCodeGen.cpp @@ -21,8 +21,8 @@ #include -#include #include +#include #include #include diff --git a/libyul/backends/evm/ConstantOptimiser.cpp b/libyul/backends/evm/ConstantOptimiser.cpp index 9148b0793..d37ddade1 100644 --- a/libyul/backends/evm/ConstantOptimiser.cpp +++ b/libyul/backends/evm/ConstantOptimiser.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/backends/evm/ConstantOptimiser.h b/libyul/backends/evm/ConstantOptimiser.h index d6844bbe6..52d78be86 100644 --- a/libyul/backends/evm/ConstantOptimiser.h +++ b/libyul/backends/evm/ConstantOptimiser.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 95f787400..496a13629 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 0ddcf1703..45443ae7d 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 0f98776dd..8232e4d9c 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/libyul/backends/evm/EVMDialect.h b/libyul/backends/evm/EVMDialect.h index 8cac1e0be..a890a0ce2 100644 --- a/libyul/backends/evm/EVMDialect.h +++ b/libyul/backends/evm/EVMDialect.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/backends/evm/EVMMetrics.cpp b/libyul/backends/evm/EVMMetrics.cpp index 5fb6d863a..ce8d8f31e 100644 --- a/libyul/backends/evm/EVMMetrics.cpp +++ b/libyul/backends/evm/EVMMetrics.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index 2ddeae05d..74caf8073 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -21,6 +21,7 @@ #include +#include #include #include diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp index df700527e..c395864ec 100644 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ b/libyul/backends/wasm/BinaryTransform.cpp @@ -107,33 +107,24 @@ bytes toBytes(Export _export) return toBytes(uint8_t(_export)); } +// NOTE: This is a subset of WebAssembly opcodes. +// Those available as a builtin are listed further down. enum class Opcode: uint8_t { - Unreachable = 0x00, - Nop = 0x01, Block = 0x02, Loop = 0x03, If = 0x04, Else = 0x05, - Try = 0x06, - Catch = 0x07, - Throw = 0x08, - Rethrow = 0x09, - BrOnExn = 0x0a, End = 0x0b, Br = 0x0c, BrIf = 0x0d, - BrTable = 0x0e, + BrTable = 0x0e, // Not used yet. Return = 0x0f, Call = 0x10, - CallIndirect = 0x11, - ReturnCall = 0x12, - ReturnCallIndirect = 0x13, - Drop = 0x1a, - Select = 0x1b, + CallIndirect = 0x11, // Not used yet. LocalGet = 0x20, LocalSet = 0x21, - LocalTee = 0x22, + LocalTee = 0x22, // Not used yet. GlobalGet = 0x23, GlobalSet = 0x24, I32Const = 0x41, @@ -156,6 +147,10 @@ Opcode constOpcodeFor(ValueType _type) } static map const builtins = { + {"unreachable", 0x00}, + {"nop", 0x01}, + {"i32.drop", 0x1a}, + {"i64.drop", 0x1a}, {"i32.select", 0x1b}, {"i64.select", 0x1b}, {"i32.load", 0x28}, @@ -381,30 +376,21 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call) return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(m_subModulePosAndSize.at(name).second)); } + yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found"); + // NOTE: the dialect ensures we have the right amount of arguments bytes args = visit(_call.arguments); + bytes ret = move(args) + toBytes(builtins.at(_call.functionName)); + if ( + _call.functionName.find(".load") != string::npos || + _call.functionName.find(".store") != string::npos + ) + // Alignment hint and offset. Interpreters ignore the alignment. JITs/AOTs can take it + // into account to generate more efficient code but if the hint is invalid it could + // actually be more expensive. It's best to hint at 1-byte alignment if we don't plan + // to control the memory layout accordingly. + ret += bytes{{0, 0}}; // 2^0 == 1-byte alignment - if (_call.functionName == "unreachable") - return toBytes(Opcode::Unreachable); - else if (_call.functionName == "nop") - return toBytes(Opcode::Nop); - else if (_call.functionName == "i32.drop" || _call.functionName == "i64.drop") - return toBytes(Opcode::Drop); - else - { - yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found"); - bytes ret = move(args) + toBytes(builtins.at(_call.functionName)); - if ( - _call.functionName.find(".load") != string::npos || - _call.functionName.find(".store") != string::npos - ) - // Alignment hint and offset. Interpreters ignore the alignment. JITs/AOTs can take it - // into account to generate more efficient code but if the hint is invalid it could - // actually be more expensive. It's best to hint at 1-byte alignment if we don't plan - // to control the memory layout accordingly. - ret += bytes{{0, 0}}; // 2^0 == 1-byte alignment - - return ret; - } + return ret; } bytes BinaryTransform::operator()(FunctionCall const& _call) diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.cpp b/libyul/backends/wasm/EVMToEwasmTranslator.cpp index e6d74bd14..3ba58e73e 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.cpp +++ b/libyul/backends/wasm/EVMToEwasmTranslator.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.h b/libyul/backends/wasm/EVMToEwasmTranslator.h index ecb34ec11..251e3352b 100644 --- a/libyul/backends/wasm/EVMToEwasmTranslator.h +++ b/libyul/backends/wasm/EVMToEwasmTranslator.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp index d178003b4..65c2bbb37 100644 --- a/libyul/backends/wasm/TextTransform.cpp +++ b/libyul/backends/wasm/TextTransform.cpp @@ -122,8 +122,11 @@ string TextTransform::operator()(wasm::BuiltinCall const& _builtinCall) { string args = joinTransformed(_builtinCall.arguments); string funcName = _builtinCall.functionName; + // These are prefixed in the dialect, but are actually overloaded instructions in WebAssembly. if (funcName == "i32.drop" || funcName == "i64.drop") funcName = "drop"; + else if (funcName == "i32.select" || funcName == "i64.select") + funcName = "select"; return "(" + funcName + (args.empty() ? "" : " " + args) + ")"; } diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp index 541f1f9f8..b6bc026a4 100644 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ b/libyul/backends/wasm/WasmCodeTransform.cpp @@ -25,7 +25,7 @@ #include -#include +#include #include #include #include diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h index 79d3552c6..1e9f1fd9c 100644 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ b/libyul/backends/wasm/WasmCodeTransform.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/libyul/backends/wasm/WasmDialect.cpp b/libyul/backends/wasm/WasmDialect.cpp index 1e77e1d47..eb2d1712c 100644 --- a/libyul/backends/wasm/WasmDialect.cpp +++ b/libyul/backends/wasm/WasmDialect.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include using namespace std; diff --git a/libyul/backends/wasm/WasmDialect.h b/libyul/backends/wasm/WasmDialect.h index a9cf826ae..5abc69fc4 100644 --- a/libyul/backends/wasm/WasmDialect.h +++ b/libyul/backends/wasm/WasmDialect.h @@ -38,7 +38,7 @@ struct Object; * * Builtin functions are a subset of the wasm instructions. * - * There is a builtin function `i32.drop` that takes an i32, while `drop` takes i64. + * There is a builtin function `i32.drop` that takes an i32, while `i64.drop` takes i64. * */ struct WasmDialect: public Dialect diff --git a/libyul/backends/wasm/WordSizeTransform.cpp b/libyul/backends/wasm/WordSizeTransform.cpp index 3e322bc05..ec5e3a0de 100644 --- a/libyul/backends/wasm/WordSizeTransform.cpp +++ b/libyul/backends/wasm/WordSizeTransform.cpp @@ -16,7 +16,7 @@ */ // SPDX-License-Identifier: GPL-3.0 -#include +#include #include #include #include diff --git a/libyul/optimiser/ASTCopier.cpp b/libyul/optimiser/ASTCopier.cpp index 8dc08f6fa..358811358 100644 --- a/libyul/optimiser/ASTCopier.cpp +++ b/libyul/optimiser/ASTCopier.cpp @@ -23,7 +23,7 @@ #include -#include +#include #include diff --git a/libyul/optimiser/ASTCopier.h b/libyul/optimiser/ASTCopier.h index 8afb50d97..4cf69b0b7 100644 --- a/libyul/optimiser/ASTCopier.h +++ b/libyul/optimiser/ASTCopier.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include diff --git a/libyul/optimiser/ASTWalker.cpp b/libyul/optimiser/ASTWalker.cpp index 057f94b88..d0ce29054 100644 --- a/libyul/optimiser/ASTWalker.cpp +++ b/libyul/optimiser/ASTWalker.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include diff --git a/libyul/optimiser/ASTWalker.h b/libyul/optimiser/ASTWalker.h index c62be4844..107658dfc 100644 --- a/libyul/optimiser/ASTWalker.h +++ b/libyul/optimiser/ASTWalker.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/BlockFlattener.cpp b/libyul/optimiser/BlockFlattener.cpp index 24f57594c..e32972e66 100644 --- a/libyul/optimiser/BlockFlattener.cpp +++ b/libyul/optimiser/BlockFlattener.cpp @@ -15,10 +15,13 @@ along with solidity. If not, see . */ // SPDX-License-Identifier: GPL-3.0 + #include -#include +#include + #include #include + #include using namespace std; diff --git a/libyul/optimiser/BlockHasher.cpp b/libyul/optimiser/BlockHasher.cpp index 4fb199982..02db3bc43 100644 --- a/libyul/optimiser/BlockHasher.cpp +++ b/libyul/optimiser/BlockHasher.cpp @@ -21,7 +21,9 @@ #include #include +#include #include + #include using namespace std; diff --git a/libyul/optimiser/BlockHasher.h b/libyul/optimiser/BlockHasher.h index 36826e158..a831efa23 100644 --- a/libyul/optimiser/BlockHasher.h +++ b/libyul/optimiser/BlockHasher.h @@ -21,9 +21,8 @@ #pragma once #include -#include +#include #include -#include namespace solidity::yul { diff --git a/libyul/optimiser/CallGraphGenerator.cpp b/libyul/optimiser/CallGraphGenerator.cpp index 76f5220c8..5aeff50be 100644 --- a/libyul/optimiser/CallGraphGenerator.cpp +++ b/libyul/optimiser/CallGraphGenerator.cpp @@ -19,7 +19,7 @@ * Specific AST walker that generates the call graph. */ -#include +#include #include #include diff --git a/libyul/optimiser/CircularReferencesPruner.cpp b/libyul/optimiser/CircularReferencesPruner.cpp index 2fe6a1d80..1078779c5 100644 --- a/libyul/optimiser/CircularReferencesPruner.cpp +++ b/libyul/optimiser/CircularReferencesPruner.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include diff --git a/libyul/optimiser/CommonSubexpressionEliminator.cpp b/libyul/optimiser/CommonSubexpressionEliminator.cpp index 6a739618c..e1c7ccced 100644 --- a/libyul/optimiser/CommonSubexpressionEliminator.cpp +++ b/libyul/optimiser/CommonSubexpressionEliminator.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include using namespace std; diff --git a/libyul/optimiser/ConditionalSimplifier.cpp b/libyul/optimiser/ConditionalSimplifier.cpp index f95ef830a..0a66e28df 100644 --- a/libyul/optimiser/ConditionalSimplifier.cpp +++ b/libyul/optimiser/ConditionalSimplifier.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include #include -#include +#include #include #include #include diff --git a/libyul/optimiser/ConditionalSimplifier.h b/libyul/optimiser/ConditionalSimplifier.h index 9a48b813f..e41ee579c 100644 --- a/libyul/optimiser/ConditionalSimplifier.h +++ b/libyul/optimiser/ConditionalSimplifier.h @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/libyul/optimiser/ConditionalUnsimplifier.cpp b/libyul/optimiser/ConditionalUnsimplifier.cpp index 28bc11a0c..e51cbbf3c 100644 --- a/libyul/optimiser/ConditionalUnsimplifier.cpp +++ b/libyul/optimiser/ConditionalUnsimplifier.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include #include -#include +#include #include #include #include diff --git a/libyul/optimiser/ControlFlowSimplifier.cpp b/libyul/optimiser/ControlFlowSimplifier.cpp index 044061d9d..c617e2005 100644 --- a/libyul/optimiser/ControlFlowSimplifier.cpp +++ b/libyul/optimiser/ControlFlowSimplifier.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libyul/optimiser/DataFlowAnalyzer.cpp b/libyul/optimiser/DataFlowAnalyzer.cpp index 97cdd2062..cd1bb7da3 100644 --- a/libyul/optimiser/DataFlowAnalyzer.cpp +++ b/libyul/optimiser/DataFlowAnalyzer.cpp @@ -24,8 +24,8 @@ #include #include +#include #include -#include #include #include @@ -39,7 +39,6 @@ using namespace solidity; using namespace solidity::util; using namespace solidity::yul; - void DataFlowAnalyzer::operator()(ExpressionStatement& _statement) { if (auto vars = isSimpleStore(evmasm::Instruction::SSTORE, _statement)) diff --git a/libyul/optimiser/DataFlowAnalyzer.h b/libyul/optimiser/DataFlowAnalyzer.h index e5d868246..4da6ee1a7 100644 --- a/libyul/optimiser/DataFlowAnalyzer.h +++ b/libyul/optimiser/DataFlowAnalyzer.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include // Needed for m_zero below. #include // TODO avoid diff --git a/libyul/optimiser/DeadCodeEliminator.cpp b/libyul/optimiser/DeadCodeEliminator.cpp index 1bb4f460d..1c6818e9d 100644 --- a/libyul/optimiser/DeadCodeEliminator.cpp +++ b/libyul/optimiser/DeadCodeEliminator.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/libyul/optimiser/Disambiguator.cpp b/libyul/optimiser/Disambiguator.cpp index 2e20d4be2..8bcc07d2b 100644 --- a/libyul/optimiser/Disambiguator.cpp +++ b/libyul/optimiser/Disambiguator.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/Disambiguator.h b/libyul/optimiser/Disambiguator.h index 6d8a3775c..062173882 100644 --- a/libyul/optimiser/Disambiguator.h +++ b/libyul/optimiser/Disambiguator.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include #include diff --git a/libyul/optimiser/EquivalentFunctionCombiner.cpp b/libyul/optimiser/EquivalentFunctionCombiner.cpp index 8cea5d63e..90091f6ae 100644 --- a/libyul/optimiser/EquivalentFunctionCombiner.cpp +++ b/libyul/optimiser/EquivalentFunctionCombiner.cpp @@ -20,7 +20,7 @@ */ #include -#include +#include #include using namespace std; diff --git a/libyul/optimiser/EquivalentFunctionCombiner.h b/libyul/optimiser/EquivalentFunctionCombiner.h index d43fa3986..5337f7684 100644 --- a/libyul/optimiser/EquivalentFunctionCombiner.h +++ b/libyul/optimiser/EquivalentFunctionCombiner.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace solidity::yul { diff --git a/libyul/optimiser/EquivalentFunctionDetector.cpp b/libyul/optimiser/EquivalentFunctionDetector.cpp index 5c49ddb89..b25600c21 100644 --- a/libyul/optimiser/EquivalentFunctionDetector.cpp +++ b/libyul/optimiser/EquivalentFunctionDetector.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include using namespace std; diff --git a/libyul/optimiser/EquivalentFunctionDetector.h b/libyul/optimiser/EquivalentFunctionDetector.h index 107b355e6..d3ddc25f7 100644 --- a/libyul/optimiser/EquivalentFunctionDetector.h +++ b/libyul/optimiser/EquivalentFunctionDetector.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace solidity::yul { diff --git a/libyul/optimiser/ExpressionInliner.cpp b/libyul/optimiser/ExpressionInliner.cpp index ca29a5829..ce0d1c739 100644 --- a/libyul/optimiser/ExpressionInliner.cpp +++ b/libyul/optimiser/ExpressionInliner.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/ExpressionInliner.h b/libyul/optimiser/ExpressionInliner.h index f3a8833df..ff7da67b8 100644 --- a/libyul/optimiser/ExpressionInliner.h +++ b/libyul/optimiser/ExpressionInliner.h @@ -21,7 +21,7 @@ #pragma once #include -#include +#include #include #include diff --git a/libyul/optimiser/ExpressionJoiner.cpp b/libyul/optimiser/ExpressionJoiner.cpp index fa9aac9ce..7e97fedb2 100644 --- a/libyul/optimiser/ExpressionJoiner.cpp +++ b/libyul/optimiser/ExpressionJoiner.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include diff --git a/libyul/optimiser/ExpressionJoiner.h b/libyul/optimiser/ExpressionJoiner.h index db3217de0..eb22ad79f 100644 --- a/libyul/optimiser/ExpressionJoiner.h +++ b/libyul/optimiser/ExpressionJoiner.h @@ -21,7 +21,7 @@ */ #pragma once -#include +#include #include #include @@ -32,7 +32,6 @@ namespace solidity::yul class NameCollector; struct OptimiserStepContext; - /** * Optimiser component that modifies an AST in place, turning sequences * of variable declarations into complex expressions, if the variables diff --git a/libyul/optimiser/ExpressionSimplifier.cpp b/libyul/optimiser/ExpressionSimplifier.cpp index 623bc12b4..21107c026 100644 --- a/libyul/optimiser/ExpressionSimplifier.cpp +++ b/libyul/optimiser/ExpressionSimplifier.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/ExpressionSimplifier.h b/libyul/optimiser/ExpressionSimplifier.h index f5e1781cf..f9d4e8da5 100644 --- a/libyul/optimiser/ExpressionSimplifier.h +++ b/libyul/optimiser/ExpressionSimplifier.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include diff --git a/libyul/optimiser/ExpressionSplitter.cpp b/libyul/optimiser/ExpressionSplitter.cpp index 6ce26bf81..7aad0bd58 100644 --- a/libyul/optimiser/ExpressionSplitter.cpp +++ b/libyul/optimiser/ExpressionSplitter.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/ExpressionSplitter.h b/libyul/optimiser/ExpressionSplitter.h index ebcdd7f6d..bbde8d6a2 100644 --- a/libyul/optimiser/ExpressionSplitter.h +++ b/libyul/optimiser/ExpressionSplitter.h @@ -21,7 +21,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/ForLoopConditionIntoBody.cpp b/libyul/optimiser/ForLoopConditionIntoBody.cpp index a5b907ce7..059479757 100644 --- a/libyul/optimiser/ForLoopConditionIntoBody.cpp +++ b/libyul/optimiser/ForLoopConditionIntoBody.cpp @@ -18,7 +18,8 @@ #include #include -#include +#include + #include using namespace std; diff --git a/libyul/optimiser/ForLoopConditionOutOfBody.cpp b/libyul/optimiser/ForLoopConditionOutOfBody.cpp index f13b417e8..1ddc3c257 100644 --- a/libyul/optimiser/ForLoopConditionOutOfBody.cpp +++ b/libyul/optimiser/ForLoopConditionOutOfBody.cpp @@ -18,8 +18,9 @@ #include #include -#include +#include #include + #include using namespace std; diff --git a/libyul/optimiser/ForLoopInitRewriter.cpp b/libyul/optimiser/ForLoopInitRewriter.cpp index 62d520199..345dd1266 100644 --- a/libyul/optimiser/ForLoopInitRewriter.cpp +++ b/libyul/optimiser/ForLoopInitRewriter.cpp @@ -16,8 +16,10 @@ */ // SPDX-License-Identifier: GPL-3.0 #include -#include +#include + #include + #include using namespace std; diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp index 101b89c34..189a06164 100644 --- a/libyul/optimiser/FullInliner.cpp +++ b/libyul/optimiser/FullInliner.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/libyul/optimiser/FullInliner.h b/libyul/optimiser/FullInliner.h index c0106807a..a743bf323 100644 --- a/libyul/optimiser/FullInliner.h +++ b/libyul/optimiser/FullInliner.h @@ -20,7 +20,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/FunctionCallFinder.cpp b/libyul/optimiser/FunctionCallFinder.cpp index d5a6afcc9..4bc1998b1 100644 --- a/libyul/optimiser/FunctionCallFinder.cpp +++ b/libyul/optimiser/FunctionCallFinder.cpp @@ -16,7 +16,7 @@ */ #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/FunctionGrouper.cpp b/libyul/optimiser/FunctionGrouper.cpp index 86d59dd53..6ebab56db 100644 --- a/libyul/optimiser/FunctionGrouper.cpp +++ b/libyul/optimiser/FunctionGrouper.cpp @@ -22,7 +22,7 @@ #include -#include +#include #include diff --git a/libyul/optimiser/FunctionGrouper.h b/libyul/optimiser/FunctionGrouper.h index ead0ddc11..fa5409936 100644 --- a/libyul/optimiser/FunctionGrouper.h +++ b/libyul/optimiser/FunctionGrouper.h @@ -22,7 +22,7 @@ #pragma once -#include +#include namespace solidity::yul { diff --git a/libyul/optimiser/FunctionHoister.cpp b/libyul/optimiser/FunctionHoister.cpp index a02feeda8..aa5c373e9 100644 --- a/libyul/optimiser/FunctionHoister.cpp +++ b/libyul/optimiser/FunctionHoister.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include diff --git a/libyul/optimiser/FunctionHoister.h b/libyul/optimiser/FunctionHoister.h index 39e692c8a..04d7f64e3 100644 --- a/libyul/optimiser/FunctionHoister.h +++ b/libyul/optimiser/FunctionHoister.h @@ -22,7 +22,7 @@ #pragma once -#include +#include #include namespace solidity::yul diff --git a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp index c7830d480..8c9b80265 100644 --- a/libyul/optimiser/InlinableExpressionFunctionFinder.cpp +++ b/libyul/optimiser/InlinableExpressionFunctionFinder.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/InlinableExpressionFunctionFinder.h b/libyul/optimiser/InlinableExpressionFunctionFinder.h index 3c0b768e6..587bdca91 100644 --- a/libyul/optimiser/InlinableExpressionFunctionFinder.h +++ b/libyul/optimiser/InlinableExpressionFunctionFinder.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/KnowledgeBase.cpp b/libyul/optimiser/KnowledgeBase.cpp index 0692d0c06..623db6a70 100644 --- a/libyul/optimiser/KnowledgeBase.cpp +++ b/libyul/optimiser/KnowledgeBase.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include diff --git a/libyul/optimiser/KnowledgeBase.h b/libyul/optimiser/KnowledgeBase.h index 7d4cdfb6b..a240a108a 100644 --- a/libyul/optimiser/KnowledgeBase.h +++ b/libyul/optimiser/KnowledgeBase.h @@ -21,8 +21,9 @@ #pragma once -#include +#include #include + #include namespace solidity::yul diff --git a/libyul/optimiser/LoadResolver.cpp b/libyul/optimiser/LoadResolver.cpp index 7635f9d61..cc69b630a 100644 --- a/libyul/optimiser/LoadResolver.cpp +++ b/libyul/optimiser/LoadResolver.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/LoopInvariantCodeMotion.cpp b/libyul/optimiser/LoopInvariantCodeMotion.cpp index 3cc8397a9..fe8ddff97 100644 --- a/libyul/optimiser/LoopInvariantCodeMotion.cpp +++ b/libyul/optimiser/LoopInvariantCodeMotion.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/libyul/optimiser/MainFunction.cpp b/libyul/optimiser/MainFunction.cpp index 83968651d..646bc8faf 100644 --- a/libyul/optimiser/MainFunction.cpp +++ b/libyul/optimiser/MainFunction.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include diff --git a/libyul/optimiser/MainFunction.h b/libyul/optimiser/MainFunction.h index 92781f81c..c2f137e48 100644 --- a/libyul/optimiser/MainFunction.h +++ b/libyul/optimiser/MainFunction.h @@ -22,7 +22,7 @@ #pragma once -#include +#include namespace solidity::yul { diff --git a/libyul/optimiser/Metrics.cpp b/libyul/optimiser/Metrics.cpp index 5a7162294..0af4d4572 100644 --- a/libyul/optimiser/Metrics.cpp +++ b/libyul/optimiser/Metrics.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include #include diff --git a/libyul/optimiser/NameCollector.cpp b/libyul/optimiser/NameCollector.cpp index 5c6f2ab79..bc0fccda4 100644 --- a/libyul/optimiser/NameCollector.cpp +++ b/libyul/optimiser/NameCollector.cpp @@ -21,7 +21,7 @@ #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/NameDispenser.cpp b/libyul/optimiser/NameDispenser.cpp index eaf9b8b4b..7c9fcc6bc 100644 --- a/libyul/optimiser/NameDispenser.cpp +++ b/libyul/optimiser/NameDispenser.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/NameDispenser.h b/libyul/optimiser/NameDispenser.h index 1ef8c92e7..e379708d0 100644 --- a/libyul/optimiser/NameDispenser.h +++ b/libyul/optimiser/NameDispenser.h @@ -20,7 +20,7 @@ */ #pragma once -#include +#include #include diff --git a/libyul/optimiser/NameDisplacer.cpp b/libyul/optimiser/NameDisplacer.cpp index 81248819c..4d1a61a8e 100644 --- a/libyul/optimiser/NameDisplacer.cpp +++ b/libyul/optimiser/NameDisplacer.cpp @@ -21,8 +21,7 @@ #include -#include - +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/NameSimplifier.cpp b/libyul/optimiser/NameSimplifier.cpp index 2e1bb822a..741280edd 100644 --- a/libyul/optimiser/NameSimplifier.cpp +++ b/libyul/optimiser/NameSimplifier.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/NameSimplifier.h b/libyul/optimiser/NameSimplifier.h index 924e734f9..0edbc595f 100644 --- a/libyul/optimiser/NameSimplifier.h +++ b/libyul/optimiser/NameSimplifier.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include #include diff --git a/libyul/optimiser/OptimizerUtilities.cpp b/libyul/optimiser/OptimizerUtilities.cpp index ad46f7cb1..2a3f7db90 100644 --- a/libyul/optimiser/OptimizerUtilities.cpp +++ b/libyul/optimiser/OptimizerUtilities.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/OptimizerUtilities.h b/libyul/optimiser/OptimizerUtilities.h index 829d10b55..22191538b 100644 --- a/libyul/optimiser/OptimizerUtilities.h +++ b/libyul/optimiser/OptimizerUtilities.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include diff --git a/libyul/optimiser/ReasoningBasedSimplifier.cpp b/libyul/optimiser/ReasoningBasedSimplifier.cpp index ea464f248..f61bee321 100644 --- a/libyul/optimiser/ReasoningBasedSimplifier.cpp +++ b/libyul/optimiser/ReasoningBasedSimplifier.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/RedundantAssignEliminator.cpp b/libyul/optimiser/RedundantAssignEliminator.cpp index 170cf1d79..cd528aedf 100644 --- a/libyul/optimiser/RedundantAssignEliminator.cpp +++ b/libyul/optimiser/RedundantAssignEliminator.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include diff --git a/libyul/optimiser/RedundantAssignEliminator.h b/libyul/optimiser/RedundantAssignEliminator.h index 81e977e8d..bccc1e8ef 100644 --- a/libyul/optimiser/RedundantAssignEliminator.h +++ b/libyul/optimiser/RedundantAssignEliminator.h @@ -22,7 +22,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/Rematerialiser.cpp b/libyul/optimiser/Rematerialiser.cpp index 53974616c..abd1bcdd8 100644 --- a/libyul/optimiser/Rematerialiser.cpp +++ b/libyul/optimiser/Rematerialiser.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/SSAReverser.cpp b/libyul/optimiser/SSAReverser.cpp index e1902608d..d59a93d0e 100644 --- a/libyul/optimiser/SSAReverser.cpp +++ b/libyul/optimiser/SSAReverser.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include #include -#include +#include #include #include diff --git a/libyul/optimiser/SSATransform.cpp b/libyul/optimiser/SSATransform.cpp index 332b7af1d..f77e836f2 100644 --- a/libyul/optimiser/SSATransform.cpp +++ b/libyul/optimiser/SSATransform.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include diff --git a/libyul/optimiser/SSATransform.h b/libyul/optimiser/SSATransform.h index 74e52b62a..66015362a 100644 --- a/libyul/optimiser/SSATransform.h +++ b/libyul/optimiser/SSATransform.h @@ -21,7 +21,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/SSAValueTracker.cpp b/libyul/optimiser/SSAValueTracker.cpp index 452123447..df3c5adce 100644 --- a/libyul/optimiser/SSAValueTracker.cpp +++ b/libyul/optimiser/SSAValueTracker.cpp @@ -22,7 +22,7 @@ #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/SSAValueTracker.h b/libyul/optimiser/SSAValueTracker.h index f206cab5e..f1c93ff22 100644 --- a/libyul/optimiser/SSAValueTracker.h +++ b/libyul/optimiser/SSAValueTracker.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include // Needed for m_zero below. #include #include diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 735ed13d0..070e83c3e 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/Semantics.h b/libyul/optimiser/Semantics.h index 70ec119ac..3426f23d8 100644 --- a/libyul/optimiser/Semantics.h +++ b/libyul/optimiser/Semantics.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp index cb797975b..8e55e8c5e 100644 --- a/libyul/optimiser/SimplificationRules.cpp +++ b/libyul/optimiser/SimplificationRules.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/libyul/optimiser/SimplificationRules.h b/libyul/optimiser/SimplificationRules.h index 05e4e0d59..ca0b7a801 100644 --- a/libyul/optimiser/SimplificationRules.h +++ b/libyul/optimiser/SimplificationRules.h @@ -23,12 +23,13 @@ #include -#include -#include +#include +#include #include #include +#include #include diff --git a/libyul/optimiser/StackCompressor.cpp b/libyul/optimiser/StackCompressor.cpp index 98850f03e..a8dc9d871 100644 --- a/libyul/optimiser/StackCompressor.cpp +++ b/libyul/optimiser/StackCompressor.cpp @@ -30,7 +30,7 @@ #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/StackCompressor.h b/libyul/optimiser/StackCompressor.h index f10a6ba17..d18618667 100644 --- a/libyul/optimiser/StackCompressor.h +++ b/libyul/optimiser/StackCompressor.h @@ -22,6 +22,8 @@ #pragma once +#include + #include namespace solidity::yul diff --git a/libyul/optimiser/StackLimitEvader.cpp b/libyul/optimiser/StackLimitEvader.cpp index a78b00625..a7169f08a 100644 --- a/libyul/optimiser/StackLimitEvader.cpp +++ b/libyul/optimiser/StackLimitEvader.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libyul/optimiser/StackToMemoryMover.cpp b/libyul/optimiser/StackToMemoryMover.cpp index ccac48296..25eb25cd5 100644 --- a/libyul/optimiser/StackToMemoryMover.cpp +++ b/libyul/optimiser/StackToMemoryMover.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/StructuralSimplifier.cpp b/libyul/optimiser/StructuralSimplifier.cpp index 09fe9ca1f..4cfa0b3f1 100644 --- a/libyul/optimiser/StructuralSimplifier.cpp +++ b/libyul/optimiser/StructuralSimplifier.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include #include -#include +#include #include #include #include diff --git a/libyul/optimiser/Substitution.cpp b/libyul/optimiser/Substitution.cpp index ee2323577..e0557ad74 100644 --- a/libyul/optimiser/Substitution.cpp +++ b/libyul/optimiser/Substitution.cpp @@ -21,7 +21,7 @@ #include -#include +#include using namespace std; using namespace solidity; diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index af9c93715..8dcc45616 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -63,8 +63,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/libyul/optimiser/Suite.h b/libyul/optimiser/Suite.h index affbd37c0..9ae0ada58 100644 --- a/libyul/optimiser/Suite.h +++ b/libyul/optimiser/Suite.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include #include diff --git a/libyul/optimiser/SyntacticalEquality.cpp b/libyul/optimiser/SyntacticalEquality.cpp index 1ce5da7d1..490e1c9e7 100644 --- a/libyul/optimiser/SyntacticalEquality.cpp +++ b/libyul/optimiser/SyntacticalEquality.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/SyntacticalEquality.h b/libyul/optimiser/SyntacticalEquality.h index 774a223cc..02a6d4b39 100644 --- a/libyul/optimiser/SyntacticalEquality.h +++ b/libyul/optimiser/SyntacticalEquality.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/TypeInfo.cpp b/libyul/optimiser/TypeInfo.cpp index 740856c72..81bc7ac0b 100644 --- a/libyul/optimiser/TypeInfo.cpp +++ b/libyul/optimiser/TypeInfo.cpp @@ -23,7 +23,7 @@ #include -#include +#include #include #include diff --git a/libyul/optimiser/TypeInfo.h b/libyul/optimiser/TypeInfo.h index f458cbe44..5ed0a0d55 100644 --- a/libyul/optimiser/TypeInfo.h +++ b/libyul/optimiser/TypeInfo.h @@ -20,7 +20,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/UnusedFunctionParameterPruner.cpp b/libyul/optimiser/UnusedFunctionParameterPruner.cpp index d103e9c6f..75e8325a3 100644 --- a/libyul/optimiser/UnusedFunctionParameterPruner.cpp +++ b/libyul/optimiser/UnusedFunctionParameterPruner.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include diff --git a/libyul/optimiser/UnusedFunctionsCommon.h b/libyul/optimiser/UnusedFunctionsCommon.h index aaa8180f7..dcf9ca55b 100644 --- a/libyul/optimiser/UnusedFunctionsCommon.h +++ b/libyul/optimiser/UnusedFunctionsCommon.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/UnusedPruner.cpp b/libyul/optimiser/UnusedPruner.cpp index 3779c0d63..b0b4b794c 100644 --- a/libyul/optimiser/UnusedPruner.cpp +++ b/libyul/optimiser/UnusedPruner.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/libyul/optimiser/VarDeclInitializer.cpp b/libyul/optimiser/VarDeclInitializer.cpp index ca6c89feb..dc3e27c2a 100644 --- a/libyul/optimiser/VarDeclInitializer.cpp +++ b/libyul/optimiser/VarDeclInitializer.cpp @@ -17,7 +17,7 @@ // SPDX-License-Identifier: GPL-3.0 #include -#include +#include #include #include diff --git a/libyul/optimiser/VarDeclInitializer.h b/libyul/optimiser/VarDeclInitializer.h index 3d2d51c34..4060878b1 100644 --- a/libyul/optimiser/VarDeclInitializer.h +++ b/libyul/optimiser/VarDeclInitializer.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include diff --git a/libyul/optimiser/VarNameCleaner.cpp b/libyul/optimiser/VarNameCleaner.cpp index 85ecece46..55fc71fd6 100644 --- a/libyul/optimiser/VarNameCleaner.cpp +++ b/libyul/optimiser/VarNameCleaner.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/libyul/optimiser/VarNameCleaner.h b/libyul/optimiser/VarNameCleaner.h index 2c26cc7a6..7823e5716 100644 --- a/libyul/optimiser/VarNameCleaner.h +++ b/libyul/optimiser/VarNameCleaner.h @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include #include diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 2a70119d9..88212dd94 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -412,13 +412,13 @@ Text representation: (local.set $z (i32.const 0)) (local.set $_1 (i32.const 4294967295)) (block - (local.set $condition (i32.select (local.get $_1) (i64.ne (local.get $x1) (local.get $y1)) (i64.lt_u (local.get $x1) (local.get $y1)))) + (local.set $condition (select (local.get $_1) (i64.ne (local.get $x1) (local.get $y1)) (i64.lt_u (local.get $x1) (local.get $y1)))) (if (i32.eq (local.get $condition) (i32.const 0)) (then (block - (local.set $condition_11 (i32.select (local.get $_1) (i64.ne (local.get $x2) (local.get $y2)) (i64.lt_u (local.get $x2) (local.get $y2)))) + (local.set $condition_11 (select (local.get $_1) (i64.ne (local.get $x2) (local.get $y2)) (i64.lt_u (local.get $x2) (local.get $y2)))) (if (i32.eq (local.get $condition_11) (i32.const 0)) (then (block - (local.set $condition_12 (i32.select (local.get $_1) (i64.ne (local.get $x3) (local.get $y3)) (i64.lt_u (local.get $x3) (local.get $y3)))) + (local.set $condition_12 (select (local.get $_1) (i64.ne (local.get $x3) (local.get $y3)) (i64.lt_u (local.get $x3) (local.get $y3)))) (if (i32.eq (local.get $condition_12) (i32.const 0)) (then (local.set $z (i64.lt_u (local.get $x4) (local.get $y4))) )(else diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index 5a9f42ba2..d56912a85 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -85,9 +85,9 @@ function download_project function force_truffle_version { - local repo="$1" + local version="$1" - sed -i 's/"truffle":\s*".*"/"truffle": "^5.0.42"/g' package.json + sed -i 's/"truffle":\s*".*"/"truffle": "'"$version"'"/g' package.json } function truffle_setup diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index bdd501703..52cccdb56 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -36,6 +36,10 @@ function ens_test export CONFIG="truffle-config.js" truffle_setup https://github.com/solidity-external-tests/ens.git upgrade-0.8.0 + + # Use latest Truffle. Older versions crash on the output from 0.8.0. + force_truffle_version ^5.1.55 + run_install install_fn truffle_run_test compile_fn test_fn diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 07c34ca46..8a5ccd0c7 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -35,7 +35,7 @@ function gnosis_safe_test truffle_setup https://github.com/solidity-external-tests/safe-contracts.git development_070 - force_truffle_version + force_truffle_version ^5.0.42 sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json rm -f package-lock.json rm -rf node_modules/ diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol index 4fea0c70f..a4202fab3 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol @@ -23,12 +23,12 @@ contract C { // ABIEncoderV1Only: true // compileViaYul: false // ---- -// f1() -> 0x20, 0x60, 0x20, 0, 0 +// f1() -> 0x20, 0x40, 0x20, 0 // f2(string): 0x20, 0 -> 0x20, 0x40, 0x20, 0 // f2(string): 0x20, 0, 0 -> 0x20, 0x40, 0x20, 0 // g1() -> 32, 0 // g2(string): 0x20, 0 -> 0x20, 0 // g2(string): 0x20, 0, 0 -> 0x20, 0 -// h1() -> 0x20, 0x64, 26959946667150639794667015087019630673637144422540572481103610249216, 862718293348820473429344482784628181556388621521298319395315527974912, 0, 0 +// h1() -> 0x20, 0x44, 26959946667150639794667015087019630673637144422540572481103610249216, 862718293348820473429344482784628181556388621521298319395315527974912, 0 // h2(string): 0x20, 0 -> 0x20, 0x44, 26959946667150639794667015087019630673637144422540572481103610249216, 862718293348820473429344482784628181556388621521298319395315527974912, 0 // h2(string): 0x20, 0, 0 -> 0x20, 0x44, 26959946667150639794667015087019630673637144422540572481103610249216, 862718293348820473429344482784628181556388621521298319395315527974912, 0 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol index 6ca284908..9597a6d64 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_empty_string.sol @@ -6,6 +6,7 @@ contract C { } } // ==== +// compileViaYul: also // ABIEncoderV1Only: true // ---- -// f() -> 0x40, 0xc0, 0x60, 0x20, 0x0, 0x0, 0x0 +// f() -> 0x40, 0xa0, 0x40, 0x20, 0x0, 0x0 diff --git a/test/libsolidity/semanticTests/libraries/internal_call_bound_with_parentheses1.sol b/test/libsolidity/semanticTests/libraries/internal_call_bound_with_parentheses1.sol new file mode 100644 index 000000000..514cea6ba --- /dev/null +++ b/test/libsolidity/semanticTests/libraries/internal_call_bound_with_parentheses1.sol @@ -0,0 +1,16 @@ +library L { + function f() internal returns (uint) { + return 3; + } +} + +contract C { + function foo() public returns (uint) { + return (L.f)(); + } +} + +// ==== +// compileViaYul: also +// ---- +// foo() -> 3 diff --git a/test/libsolidity/semanticTests/revertStrings/empty_v1.sol b/test/libsolidity/semanticTests/revertStrings/empty_v1.sol index 41ba00942..4e6fffc79 100644 --- a/test/libsolidity/semanticTests/revertStrings/empty_v1.sol +++ b/test/libsolidity/semanticTests/revertStrings/empty_v1.sol @@ -13,6 +13,6 @@ contract C { // compileViaYul: false // revertStrings: debug // ---- -// f() -> FAILURE, hex"08c379a0", 0x20, 0, "" +// f() -> FAILURE, hex"08c379a0", 0x20, 0 // g(string): 0x20, 0, "" -> FAILURE, hex"08c379a0", 0x20, 0 // g(string): 0x20, 0 -> FAILURE, hex"08c379a0", 0x20, 0 diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index f5a969204..547f665b9 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp index 8f7a30563..bbadf7323 100644 --- a/test/libyul/EwasmTranslationTest.cpp +++ b/test/libyul/EwasmTranslationTest.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index 926e29811..6fc50ddc6 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include diff --git a/test/libyul/Metrics.cpp b/test/libyul/Metrics.cpp index 7ae9e44f5..e9a591b62 100644 --- a/test/libyul/Metrics.cpp +++ b/test/libyul/Metrics.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp index 5f947a6b3..6d40acdd4 100644 --- a/test/libyul/Parser.cpp +++ b/test/libyul/Parser.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/test/libyul/objectCompiler/wasm/no_main_function.yul b/test/libyul/objectCompiler/wasm/no_main_function.yul index 89a0a5779..2dd91a166 100644 --- a/test/libyul/objectCompiler/wasm/no_main_function.yul +++ b/test/libyul/objectCompiler/wasm/no_main_function.yul @@ -19,4 +19,4 @@ // ) // // Binary: -// 0061736d01000000010401600000020100030201000503010001060100070a01066d656d6f727902000a0801060002401a0b0b +// 0061736d01000000010401600000020100030201000503010001060100070a01066d656d6f727902000a0d010b000240420042017c1a0b0b diff --git a/test/libyul/objectCompiler/wasm/simple.yul b/test/libyul/objectCompiler/wasm/simple.yul index db3f0038e..b158aea52 100644 --- a/test/libyul/objectCompiler/wasm/simple.yul +++ b/test/libyul/objectCompiler/wasm/simple.yul @@ -20,4 +20,4 @@ // ) // // Binary: -// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0801060002401a0b0b +// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0d010b000240420042017c1a0b0b diff --git a/test/libyul/objectCompiler/wasm/subObject.yul b/test/libyul/objectCompiler/wasm/subObject.yul index e9252fbe2..683e64be1 100644 --- a/test/libyul/objectCompiler/wasm/subObject.yul +++ b/test/libyul/objectCompiler/wasm/subObject.yul @@ -11,7 +11,7 @@ object "a" { // (module // ;; custom section for sub-module // ;; The Keccak-256 hash of the text representation of "sub": 78ac3419d75c8d6f42f663717b8e964eeb994d77ff175145133084422dbd23d7 -// ;; (@custom "sub" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0801060002401a0b0b") +// ;; (@custom "sub" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0a0108000240420b1a0b0b") // ;; custom section for data // ;; (@custom "str" "48656c6c6f2c20576f726c6421") // (memory $memory (export "memory") 1) @@ -19,4 +19,4 @@ object "a" { // ) // // Binary: -// 0061736d010000000101000201000301000503010001060100070a01066d656d6f72790200003e037375620061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0801060002401a0b0b00110373747248656c6c6f2c20576f726c64210a0100 +// 0061736d010000000101000201000301000503010001060100070a01066d656d6f727902000040037375620061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0a0108000240420b1a0b0b00110373747248656c6c6f2c20576f726c64210a0100 diff --git a/test/libyul/objectCompiler/wasm/subObjectAccess.yul b/test/libyul/objectCompiler/wasm/subObjectAccess.yul index ca85655de..8acced97f 100644 --- a/test/libyul/objectCompiler/wasm/subObjectAccess.yul +++ b/test/libyul/objectCompiler/wasm/subObjectAccess.yul @@ -59,8 +59,8 @@ object "A" { // Text: // (module // ;; custom section for sub-module -// ;; The Keccak-256 hash of the text representation of "B": 1eeffe5bc8d8819350ead60cc71ccd92c223cf52a908330db53461eb9ac89b62 -// ;; (@custom "B" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007b01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0901070002401a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0b01090002401a1a1a1a0b0b") +// ;; The Keccak-256 hash of the text representation of "B": ccfc48ce1c0d0542ffd25ae6858777b2f7b8a6d2b6608f679458182e719f5434 +// ;; (@custom "B" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007f01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0d010b00024042341a423a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a15011300024042341a42fd001a42b5011a423a1a0b0b") // ;; custom section for data // ;; (@custom "data1" "48656c6c6f2c20576f726c6421") // (memory $memory (export "memory") 1) @@ -76,4 +76,4 @@ object "A" { // ) // // Binary: -// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e000000fa0101420061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007b01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0901070002401a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0b01090002401a1a1a1a0b0b001305646174613148656c6c6f2c20576f726c64210a0901070002401a1a0b0b +// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e000000880201420061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007f01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0d010b00024042341a423a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a15011300024042341a42fd001a42b5011a423a1a0b0b001305646174613148656c6c6f2c20576f726c64210a0e010c00024042351a4286021a0b0b diff --git a/test/tools/ossfuzz/CMakeLists.txt b/test/tools/ossfuzz/CMakeLists.txt index beab9e79c..a6d4addc1 100644 --- a/test/tools/ossfuzz/CMakeLists.txt +++ b/test/tools/ossfuzz/CMakeLists.txt @@ -1,12 +1,14 @@ add_custom_target(ossfuzz) add_dependencies(ossfuzz solc_opt_ossfuzz + solc_opt_mutator_ossfuzz solc_noopt_ossfuzz + solc_noopt_mutator_ossfuzz const_opt_ossfuzz strictasm_diff_ossfuzz strictasm_opt_ossfuzz strictasm_assembly_ossfuzz - ) +) if (OSSFUZZ) @@ -31,6 +33,16 @@ if (OSSFUZZ) target_link_libraries(solc_opt_ossfuzz PRIVATE libsolc evmasm) set_target_properties(solc_opt_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(solc_opt_mutator_ossfuzz + solc_opt_ossfuzz.cpp + ../fuzzer_common.cpp + ../../TestCaseReader.cpp + SolidityGenerator.cpp + SolidityCustomMutatorInterface.cpp + ) + target_link_libraries(solc_opt_mutator_ossfuzz PRIVATE libsolc evmasm) + set_target_properties(solc_opt_mutator_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(solc_noopt_ossfuzz solc_noopt_ossfuzz.cpp ../fuzzer_common.cpp @@ -39,6 +51,16 @@ if (OSSFUZZ) target_link_libraries(solc_noopt_ossfuzz PRIVATE libsolc evmasm) set_target_properties(solc_noopt_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(solc_noopt_mutator_ossfuzz + solc_noopt_ossfuzz.cpp + ../fuzzer_common.cpp + ../../TestCaseReader.cpp + SolidityGenerator.cpp + SolidityCustomMutatorInterface.cpp + ) + target_link_libraries(solc_noopt_mutator_ossfuzz PRIVATE libsolc evmasm) + set_target_properties(solc_noopt_mutator_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) + add_executable(const_opt_ossfuzz const_opt_ossfuzz.cpp ../fuzzer_common.cpp) target_link_libraries(const_opt_ossfuzz PRIVATE libsolc evmasm) set_target_properties(const_opt_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) @@ -82,14 +104,14 @@ if (OSSFUZZ) protoToYul.cpp yulProto.pb.cc protomutators/YulProtoMutator.cpp -) + ) target_include_directories(yul_proto_diff_custom_mutate_ossfuzz PRIVATE /usr/include/libprotobuf-mutator) target_link_libraries(yul_proto_diff_custom_mutate_ossfuzz PRIVATE yul yulInterpreter protobuf-mutator-libfuzzer.a protobuf-mutator.a protobuf.a -) + ) set_target_properties(yul_proto_diff_custom_mutate_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE}) target_compile_options(yul_proto_diff_custom_mutate_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion) @@ -139,12 +161,24 @@ else() ) target_link_libraries(solc_opt_ossfuzz PRIVATE libsolc evmasm) + add_library(solc_opt_mutator_ossfuzz + solc_opt_ossfuzz.cpp + ../fuzzer_common.cpp + ) + target_link_libraries(solc_opt_mutator_ossfuzz PRIVATE libsolc evmasm) + add_library(solc_noopt_ossfuzz solc_noopt_ossfuzz.cpp ../fuzzer_common.cpp ) target_link_libraries(solc_noopt_ossfuzz PRIVATE libsolc evmasm) + add_library(solc_noopt_mutator_ossfuzz + solc_noopt_ossfuzz.cpp + ../fuzzer_common.cpp + ) + target_link_libraries(solc_noopt_mutator_ossfuzz PRIVATE libsolc evmasm) + add_library(const_opt_ossfuzz const_opt_ossfuzz.cpp ../fuzzer_common.cpp) diff --git a/test/tools/ossfuzz/SolidityCustomMutatorInterface.cpp b/test/tools/ossfuzz/SolidityCustomMutatorInterface.cpp new file mode 100644 index 000000000..ac56860b9 --- /dev/null +++ b/test/tools/ossfuzz/SolidityCustomMutatorInterface.cpp @@ -0,0 +1,69 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +// SPDX-License-Identifier: GPL-3.0 + +#include +#include + +#include + +using namespace std; +using namespace solidity::test::fuzzer; + +namespace +{ +/// Forward declare libFuzzer's default mutator definition +extern "C" size_t LLVMFuzzerMutate(uint8_t* _data, size_t _size, size_t _maxSize); + +/// Define Solidity's custom mutator by implementing libFuzzer's +/// custom mutator external interface. +extern "C" size_t LLVMFuzzerCustomMutator( + uint8_t* _data, + size_t _size, + size_t _maxSize, + unsigned int _seed +) +{ + if (_maxSize <= _size || _size == 0) + return LLVMFuzzerMutate(_data, _size, _maxSize); + return SolidityCustomMutatorInterface{_data, _size, _maxSize, _seed}.generate(); +} +} + +SolidityCustomMutatorInterface::SolidityCustomMutatorInterface( + uint8_t* _data, + size_t _size, + size_t _maxSize, + unsigned int _seed + ): + data(_data), + size(_size), + maxMutantSize(_maxSize), + generator(make_shared(_seed)) +{} + +size_t SolidityCustomMutatorInterface::generate() +{ + string testCase = generator->generateTestProgram(); + solAssert( + !testCase.empty() && data, + "Solc custom mutator: Invalid mutant or memory pointer" + ); + size_t mutantSize = min(testCase.size(), maxMutantSize - 1); + mempcpy(data, testCase.data(), mutantSize); + return mutantSize; +} diff --git a/test/tools/ossfuzz/SolidityCustomMutatorInterface.h b/test/tools/ossfuzz/SolidityCustomMutatorInterface.h new file mode 100644 index 000000000..2b7be6cc5 --- /dev/null +++ b/test/tools/ossfuzz/SolidityCustomMutatorInterface.h @@ -0,0 +1,46 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +// SPDX-License-Identifier: GPL-3.0 +/** + * Implements libFuzzer's custom mutator interface. + */ + +#pragma once + +#include + +#include + +namespace solidity::test::fuzzer +{ +struct SolidityCustomMutatorInterface +{ + SolidityCustomMutatorInterface(uint8_t* _data, size_t _size, size_t _maxSize, unsigned _seed); + /// Generates Solidity test program, copies it into buffer + /// provided by libFuzzer and @returns size of the test program. + size_t generate(); + + /// Raw pointer to libFuzzer provided input + uint8_t* data; + /// Size of libFuzzer provided input + size_t size; + /// Maximum length of mutant specified by libFuzzer + size_t maxMutantSize; + /// Solidity generator handle + std::shared_ptr generator; +}; +} diff --git a/test/tools/ossfuzz/SolidityGenerator.cpp b/test/tools/ossfuzz/SolidityGenerator.cpp new file mode 100644 index 000000000..f9c43ef66 --- /dev/null +++ b/test/tools/ossfuzz/SolidityGenerator.cpp @@ -0,0 +1,35 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +// SPDX-License-Identifier: GPL-3.0 + +#include + +#include + +using namespace solidity::test::fuzzer; +using namespace solidity::util; +using namespace std; + +string SolidityGenerator::generateTestProgram() +{ + // TODO: Add generators for grammar elements of + // Solidity antlr4 grammar. Currently, the generated + // test program consists of a version pragma only. + return Whiskers(R"(pragma ;)") + ("directive", "solidity >= 0.0.0") + .render(); +} \ No newline at end of file diff --git a/test/tools/ossfuzz/SolidityGenerator.h b/test/tools/ossfuzz/SolidityGenerator.h new file mode 100644 index 000000000..5b7abce04 --- /dev/null +++ b/test/tools/ossfuzz/SolidityGenerator.h @@ -0,0 +1,42 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see . +*/ +// SPDX-License-Identifier: GPL-3.0 +/** + * Implements generators for synthesizing mostly syntactically valid + * Solidity test programs. + */ + +#pragma once + +#include + +namespace solidity::test::fuzzer +{ +using RandomEngine = std::mt19937_64; + +class SolidityGenerator +{ +public: + SolidityGenerator(uint64_t _seed): m_rand(_seed) + {} + /// @returns a pseudo randomly generated test program + std::string generateTestProgram(); +private: + /// Random number generator + RandomEngine const m_rand; +}; +} \ No newline at end of file diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 75c59c180..5475818a3 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.h b/test/tools/yulInterpreter/EVMInstructionInterpreter.h index 3747a3fb1..25f9f2519 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.h +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp index 7d50e1527..66f03e02b 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h index 24e85cf2a..1837f7509 100644 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h +++ b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index c2fd9bff9..70cd9dc29 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/tools/yulInterpreter/Interpreter.h b/test/tools/yulInterpreter/Interpreter.h index 0f2fa5c7e..42c8c9138 100644 --- a/test/tools/yulInterpreter/Interpreter.h +++ b/test/tools/yulInterpreter/Interpreter.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index a0fa29269..f1f3e234c 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/yulPhaser/Program.cpp b/test/yulPhaser/Program.cpp index b7dd1f8ed..8aa2479a2 100644 --- a/test/yulPhaser/Program.cpp +++ b/test/yulPhaser/Program.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/tools/solidityUpgrade/Upgrade050.cpp b/tools/solidityUpgrade/Upgrade050.cpp index 8e1a2f027..9c0ecd656 100644 --- a/tools/solidityUpgrade/Upgrade050.cpp +++ b/tools/solidityUpgrade/Upgrade050.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include diff --git a/tools/solidityUpgrade/Upgrade060.cpp b/tools/solidityUpgrade/Upgrade060.cpp index a5d2f0af6..c614f89d0 100644 --- a/tools/solidityUpgrade/Upgrade060.cpp +++ b/tools/solidityUpgrade/Upgrade060.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include diff --git a/tools/yulPhaser/Program.cpp b/tools/yulPhaser/Program.cpp index ebd6827b3..c7b96bd21 100644 --- a/tools/yulPhaser/Program.cpp +++ b/tools/yulPhaser/Program.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/yulPhaser/Program.h b/tools/yulPhaser/Program.h index 12026805b..8eec71be2 100644 --- a/tools/yulPhaser/Program.h +++ b/tools/yulPhaser/Program.h @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include