Skip to content

Commit 9501ad8

Browse files
committed
Remove EOF: libyul
1 parent c06a4e2 commit 9501ad8

122 files changed

Lines changed: 171 additions & 14327 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libevmasm/Assembly.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,11 +1730,7 @@ LinkerObject const& Assembly::assembleEOF() const
17301730
if (ret.bytecode.size() - sectionStart > std::numeric_limits<uint16_t>::max())
17311731
// TODO: Include source location. Note that origin locations we have in debug data are
17321732
// not usable for error reporting when compiling pure Yul because they point at the optimized source.
1733-
throw Error(
1734-
2202_error,
1735-
Error::Type::CodeGenerationError,
1736-
"Code section too large for EOF."
1737-
);
1733+
solAssert(false, "Code section too large for EOF.");
17381734
setBigEndianUint16(ret.bytecode, codeSectionSizePositions[codeSectionIndex], ret.bytecode.size() - sectionStart);
17391735

17401736
ret.codeSectionLocations.push_back(LinkerObject::CodeSectionLocation{
@@ -1789,9 +1785,8 @@ LinkerObject const& Assembly::assembleEOF() const
17891785
auto const preDeployAndStaticAuxDataSize = preDeployDataSectionSize + staticAuxDataSize;
17901786

17911787
if (preDeployAndStaticAuxDataSize > std::numeric_limits<uint16_t>::max())
1792-
throw Error(
1793-
3965_error,
1794-
Error::Type::CodeGenerationError,
1788+
solAssert(
1789+
false,
17951790
"The highest accessed data offset exceeds the maximum possible size of the static auxdata section."
17961791
);
17971792

liblangutil/EVMVersion.cpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,25 @@ using namespace solidity;
2626
using namespace solidity::evmasm;
2727
using namespace solidity::langutil;
2828

29-
bool EVMVersion::hasOpcode(Instruction _opcode, std::optional<uint8_t> _eofVersion) const
29+
bool EVMVersion::hasOpcode(Instruction _opcode) const
3030
{
31-
// EOF version can be only defined since osaka
32-
assert(!_eofVersion.has_value() || *this >= EVMVersion::firstWithEOF());
33-
3431
switch (_opcode)
3532
{
3633
case Instruction::RETURNDATACOPY:
3734
case Instruction::RETURNDATASIZE:
3835
return supportsReturndata();
3936
case Instruction::STATICCALL:
40-
return !_eofVersion.has_value() && hasStaticCall();
37+
return hasStaticCall();
4138
case Instruction::SHL:
4239
case Instruction::SHR:
4340
case Instruction::SAR:
4441
return hasBitwiseShifting();
4542
case Instruction::CLZ:
4643
return hasCLZ();
4744
case Instruction::CREATE2:
48-
return !_eofVersion.has_value() && hasCreate2();
45+
return hasCreate2();
4946
case Instruction::EXTCODEHASH:
50-
return !_eofVersion.has_value() && hasExtCodeHash();
47+
return hasExtCodeHash();
5148
case Instruction::CHAINID:
5249
return hasChainID();
5350
case Instruction::SELFBALANCE:
@@ -63,21 +60,6 @@ bool EVMVersion::hasOpcode(Instruction _opcode, std::optional<uint8_t> _eofVersi
6360
case Instruction::TSTORE:
6461
case Instruction::TLOAD:
6562
return supportsTransientStorage();
66-
// Instructions below are deprecated in EOF
67-
case Instruction::CALL:
68-
case Instruction::CALLCODE:
69-
case Instruction::DELEGATECALL:
70-
case Instruction::SELFDESTRUCT:
71-
case Instruction::JUMP:
72-
case Instruction::JUMPI:
73-
case Instruction::PC:
74-
case Instruction::CREATE:
75-
case Instruction::CODESIZE:
76-
case Instruction::CODECOPY:
77-
case Instruction::EXTCODESIZE:
78-
case Instruction::EXTCODECOPY:
79-
case Instruction::GAS:
80-
return !_eofVersion.has_value();
8163
// Instructions below available only in EOF
8264
case Instruction::EOFCREATE:
8365
case Instruction::RETURNCONTRACT:
@@ -92,7 +74,7 @@ bool EVMVersion::hasOpcode(Instruction _opcode, std::optional<uint8_t> _eofVersi
9274
case Instruction::EXTCALL:
9375
case Instruction::EXTSTATICCALL:
9476
case Instruction::EXTDELEGATECALL:
95-
return _eofVersion.has_value();
77+
return false;
9678
default:
9779
return true;
9880
}

liblangutil/EVMVersion.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ class EVMVersion
8686
};
8787
}
8888

89-
static auto constexpr allEOFVersions()
90-
{
91-
return std::array{
92-
std::optional<uint8_t>(),
93-
std::make_optional<uint8_t>(1)
94-
};
95-
}
96-
9789
static std::optional<EVMVersion> fromString(std::string const& _version)
9890
{
9991
for (auto const& v: allVersions())
@@ -102,8 +94,6 @@ class EVMVersion
10294
return std::nullopt;
10395
}
10496

105-
static EVMVersion firstWithEOF() { return {Version::Osaka}; }
106-
10797
bool isExperimental() const {
10898
solAssert(Version::Future > currentVersion);
10999
return m_version > currentVersion;
@@ -150,10 +140,9 @@ class EVMVersion
150140
bool hasBlobHash() const { return *this >= cancun(); }
151141
bool hasMcopy() const { return *this >= cancun(); }
152142
bool supportsTransientStorage() const { return *this >= cancun(); }
153-
bool supportsEOF() const { return *this >= firstWithEOF(); }
154143
constexpr size_t reachableStackDepth() const { return 16; }
155144

156-
bool hasOpcode(evmasm::Instruction _opcode, std::optional<uint8_t> _eofVersion) const;
145+
bool hasOpcode(evmasm::Instruction _opcode) const;
157146

158147
/// Whether we have to retain the costs for the call opcode itself (false),
159148
/// or whether we can just forward easily all remaining gas (true).

libsolidity/ast/ASTJsonImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ ASTPointer<InlineAssembly> ASTJsonImporter::createInlineAssembly(Json const& _no
735735
astAssert(evmVersion.has_value(), "Invalid EVM version!");
736736
astAssert(m_evmVersion == evmVersion, "Imported tree evm version differs from configured evm version!");
737737

738-
yul::Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(evmVersion.value(), std::nullopt);
738+
yul::Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(evmVersion.value());
739739
ASTPointer<std::vector<ASTPointer<ASTString>>> flags;
740740
if (_node.contains("flags"))
741741
{

libsolidity/codegen/CompilerContext.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ void CompilerContext::appendInlineAssembly(
436436
ErrorList errors;
437437
ErrorReporter errorReporter(errors);
438438
langutil::CharStream charStream(_assembly, _sourceName);
439-
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion, std::nullopt);
439+
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
440440
std::optional<langutil::SourceLocation> locationOverride;
441441
if (!_system)
442442
locationOverride = m_asm->currentSourceLocation();
@@ -521,7 +521,6 @@ void CompilerContext::appendInlineAssembly(
521521
analysisInfo,
522522
*m_asm,
523523
m_evmVersion,
524-
std::nullopt,
525524
identifierAccess.generateCode,
526525
_system,
527526
_optimiserSettings.optimizeStackAllocation

libsolidity/codegen/ContractCompiler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
958958
*analysisInfo,
959959
*m_context.assemblyPtr(),
960960
m_context.evmVersion(),
961-
std::nullopt,
962961
identifierAccessCodeGen,
963962
false,
964963
m_optimiserSettings.optimizeStackAllocation

libsolidity/interface/CompilerStack.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,6 @@ YulStack CompilerStack::loadGeneratedIR(std::string const& _ir) const
848848
{
849849
YulStack stack(
850850
m_evmVersion,
851-
std::nullopt,
852851
m_optimiserSettings,
853852
m_debugInfoSelection,
854853
this, // _soliditySourceProvider
@@ -937,7 +936,7 @@ Json CompilerStack::generatedSources(std::string const& _contractName, bool _run
937936
ErrorList errors;
938937
ErrorReporter errorReporter(errors);
939938
CharStream charStream(source, sourceName);
940-
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion, std::nullopt);
939+
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
941940
std::shared_ptr<yul::AST> parserResult = yul::Parser{errorReporter, dialect}.parse(charStream);
942941
solAssert(parserResult);
943942
sources[0]["ast"] = yul::AsmJsonConverter{dialect, sourceIndex}(parserResult->root());

libsolidity/interface/StandardCompiler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,6 @@ Json StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
17801780

17811781
YulStack stack(
17821782
_inputsAndSettings.evmVersion,
1783-
std::nullopt,
17841783
_inputsAndSettings.optimiserSettings,
17851784
_inputsAndSettings.debugInfoSelection.has_value() ?
17861785
_inputsAndSettings.debugInfoSelection.value() :

libsolidity/parsing/Parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
15181518
SourceLocation location = currentLocation();
15191519

15201520
expectToken(Token::Assembly);
1521-
yul::Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion, std::nullopt);
1521+
yul::Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
15221522
if (m_scanner->currentToken() == Token::StringLiteral)
15231523
{
15241524
if (m_scanner->currentLiteral() != "evmasm")

0 commit comments

Comments
 (0)