Merge pull request #11106 from ethereum/respectMemoryModel

Respect memory model
This commit is contained in:
chriseth 2021-05-04 16:45:15 +02:00 committed by GitHub
commit 589c4a9a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 1153 additions and 361 deletions

View File

@ -205,12 +205,12 @@ string ABIFunctions::tupleDecoder(TypePointers const& _types, bool _fromMemory)
Whiskers templ(R"(
function <functionName>(headStart, dataEnd) <arrow> <valueReturnParams> {
if slt(sub(dataEnd, headStart), <minimumSize>) { <revertString> }
if slt(sub(dataEnd, headStart), <minimumSize>) { <revertString>() }
<decodeElements>
}
)");
templ("functionName", functionName);
templ("revertString", revertReasonIfDebug("ABI decoding: tuple data too short"));
templ("revertString", revertReasonIfDebugFunction("ABI decoding: tuple data too short"));
templ("minimumSize", to_string(headSize(decodingTypes)));
string decodeElements;
@ -235,7 +235,7 @@ string ABIFunctions::tupleDecoder(TypePointers const& _types, bool _fromMemory)
{
<?dynamic>
let offset := <load>(add(headStart, <pos>))
if gt(offset, 0xffffffffffffffff) { <revertString> }
if gt(offset, 0xffffffffffffffff) { <revertString>() }
<!dynamic>
let offset := <pos>
</dynamic>
@ -244,7 +244,7 @@ string ABIFunctions::tupleDecoder(TypePointers const& _types, bool _fromMemory)
)");
elementTempl("dynamic", decodingTypes[i]->isDynamicallyEncoded());
// TODO add test
elementTempl("revertString", revertReasonIfDebug("ABI decoding: invalid tuple offset"));
elementTempl("revertString", revertReasonIfDebugFunction("ABI decoding: invalid tuple offset"));
elementTempl("load", _fromMemory ? "mload" : "calldataload");
elementTempl("values", boost::algorithm::join(valueNamesLocal, ", "));
elementTempl("pos", to_string(headPos));
@ -487,12 +487,12 @@ string ABIFunctions::abiEncodingFunctionCalldataArrayWithoutCleanup(
else
templ("scaleLengthByStride",
Whiskers(R"(
if gt(length, <maxLength>) { <revertString> }
if gt(length, <maxLength>) { <revertString>() }
length := mul(length, <stride>)
)")
("stride", toCompactHexWithPrefix(fromArrayType.calldataStride()))
("maxLength", toCompactHexWithPrefix(u256(-1) / fromArrayType.calldataStride()))
("revertString", revertReasonIfDebug("ABI encoding: array data too long"))
("revertString", revertReasonIfDebugFunction("ABI encoding: array data too long"))
.render()
// TODO add revert test
);
@ -1148,14 +1148,14 @@ string ABIFunctions::abiDecodingFunctionArray(ArrayType const& _type, bool _from
R"(
// <readableTypeName>
function <functionName>(offset, end) -> array {
if iszero(slt(add(offset, 0x1f), end)) { <revertString> }
if iszero(slt(add(offset, 0x1f), end)) { <revertString>() }
let length := <retrieveLength>
array := <abiDecodeAvailableLen>(<offset>, length, end)
}
)"
);
// TODO add test
templ("revertString", revertReasonIfDebug("ABI decoding: invalid calldata array offset"));
templ("revertString", revertReasonIfDebugFunction("ABI decoding: invalid calldata array offset"));
templ("functionName", functionName);
templ("readableTypeName", _type.toString(true));
templ("retrieveLength", _type.isDynamicallySized() ? (load + "(offset)") : toCompactHexWithPrefix(_type.length()));
@ -1188,13 +1188,13 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t
</dynamic>
let src := offset
if gt(add(src, mul(length, <stride>)), end) {
<revertInvalidStride>
<revertInvalidStride>()
}
for { let i := 0 } lt(i, length) { i := add(i, 1) }
{
<?dynamicBase>
let innerOffset := <load>(src)
if gt(innerOffset, 0xffffffffffffffff) { <revertStringOffset> }
if gt(innerOffset, 0xffffffffffffffff) { <revertStringOffset>() }
let elementPos := add(offset, innerOffset)
<!dynamicBase>
let elementPos := src
@ -1215,9 +1215,9 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t
templ("dynamicBase", _type.baseType()->isDynamicallyEncoded());
templ(
"revertInvalidStride",
revertReasonIfDebug("ABI decoding: invalid calldata array stride")
revertReasonIfDebugFunction("ABI decoding: invalid calldata array stride")
);
templ("revertStringOffset", revertReasonIfDebug("ABI decoding: invalid calldata array offset"));
templ("revertStringOffset", revertReasonIfDebugFunction("ABI decoding: invalid calldata array offset"));
templ("decodingFun", abiDecodingFunction(*_type.baseType(), _fromMemory, false));
return templ.render();
});
@ -1241,15 +1241,15 @@ string ABIFunctions::abiDecodingFunctionCalldataArray(ArrayType const& _type)
w = Whiskers(R"(
// <readableTypeName>
function <functionName>(offset, end) -> arrayPos, length {
if iszero(slt(add(offset, 0x1f), end)) { <revertStringOffset> }
if iszero(slt(add(offset, 0x1f), end)) { <revertStringOffset>() }
length := calldataload(offset)
if gt(length, 0xffffffffffffffff) { <revertStringLength> }
if gt(length, 0xffffffffffffffff) { <revertStringLength>() }
arrayPos := add(offset, 0x20)
if gt(add(arrayPos, mul(length, <stride>)), end) { <revertStringPos> }
if gt(add(arrayPos, mul(length, <stride>)), end) { <revertStringPos>() }
}
)");
w("revertStringOffset", revertReasonIfDebug("ABI decoding: invalid calldata array offset"));
w("revertStringLength", revertReasonIfDebug("ABI decoding: invalid calldata array length"));
w("revertStringOffset", revertReasonIfDebugFunction("ABI decoding: invalid calldata array offset"));
w("revertStringLength", revertReasonIfDebugFunction("ABI decoding: invalid calldata array length"));
}
else
{
@ -1257,12 +1257,12 @@ string ABIFunctions::abiDecodingFunctionCalldataArray(ArrayType const& _type)
// <readableTypeName>
function <functionName>(offset, end) -> arrayPos {
arrayPos := offset
if gt(add(arrayPos, mul(<length>, <stride>)), end) { <revertStringPos> }
if gt(add(arrayPos, mul(<length>, <stride>)), end) { <revertStringPos>() }
}
)");
w("length", toCompactHexWithPrefix(_type.length()));
}
w("revertStringPos", revertReasonIfDebug("ABI decoding: invalid calldata array stride"));
w("revertStringPos", revertReasonIfDebugFunction("ABI decoding: invalid calldata array stride"));
w("functionName", functionName);
w("readableTypeName", _type.toString(true));
w("stride", toCompactHexWithPrefix(_type.calldataStride()));
@ -1288,11 +1288,11 @@ string ABIFunctions::abiDecodingFunctionByteArrayAvailableLength(ArrayType const
array := <allocate>(<allocationSize>(length))
mstore(array, length)
let dst := add(array, 0x20)
if gt(add(src, length), end) { <revertStringLength> }
if gt(add(src, length), end) { <revertStringLength>() }
<copyToMemFun>(src, dst, length)
}
)");
templ("revertStringLength", revertReasonIfDebug("ABI decoding: invalid byte array length"));
templ("revertStringLength", revertReasonIfDebugFunction("ABI decoding: invalid byte array length"));
templ("functionName", functionName);
templ("allocate", m_utils.allocationFunction());
templ("allocationSize", m_utils.arrayAllocationSizeFunction(_type));
@ -1312,12 +1312,12 @@ string ABIFunctions::abiDecodingFunctionCalldataStruct(StructType const& _type)
Whiskers w{R"(
// <readableTypeName>
function <functionName>(offset, end) -> value {
if slt(sub(end, offset), <minimumSize>) { <revertString> }
if slt(sub(end, offset), <minimumSize>) { <revertString>() }
value := offset
}
)"};
// TODO add test
w("revertString", revertReasonIfDebug("ABI decoding: struct calldata too short"));
w("revertString", revertReasonIfDebugFunction("ABI decoding: struct calldata too short"));
w("functionName", functionName);
w("readableTypeName", _type.toString(true));
w("minimumSize", to_string(_type.isDynamicallyEncoded() ? _type.calldataEncodedTailSize() : _type.calldataEncodedSize(true)));
@ -1337,7 +1337,7 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr
Whiskers templ(R"(
// <readableTypeName>
function <functionName>(headStart, end) -> value {
if slt(sub(end, headStart), <minimumSize>) { <revertString> }
if slt(sub(end, headStart), <minimumSize>) { <revertString>() }
value := <allocate>(<memorySize>)
<#members>
{
@ -1348,7 +1348,7 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr
}
)");
// TODO add test
templ("revertString", revertReasonIfDebug("ABI decoding: struct data too short"));
templ("revertString", revertReasonIfDebugFunction("ABI decoding: struct data too short"));
templ("functionName", functionName);
templ("readableTypeName", _type.toString(true));
templ("allocate", m_utils.allocationFunction());
@ -1365,7 +1365,7 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr
Whiskers memberTempl(R"(
<?dynamic>
let offset := <load>(add(headStart, <pos>))
if gt(offset, 0xffffffffffffffff) { <revertString> }
if gt(offset, 0xffffffffffffffff) { <revertString>() }
<!dynamic>
let offset := <pos>
</dynamic>
@ -1373,7 +1373,7 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr
)");
memberTempl("dynamic", decodingType->isDynamicallyEncoded());
// TODO add test
memberTempl("revertString", revertReasonIfDebug("ABI decoding: invalid struct offset"));
memberTempl("revertString", revertReasonIfDebugFunction("ABI decoding: invalid struct offset"));
memberTempl("load", _fromMemory ? "mload" : "calldataload");
memberTempl("pos", to_string(headPos));
memberTempl("memoryOffset", toCompactHexWithPrefix(_type.memoryOffsetOfMember(member.name)));
@ -1441,7 +1441,7 @@ string ABIFunctions::calldataAccessFunction(Type const& _type)
Whiskers w(R"(
function <functionName>(base_ref, ptr) -> <return> {
let rel_offset_of_tail := calldataload(ptr)
if iszero(slt(rel_offset_of_tail, sub(sub(calldatasize(), base_ref), sub(<neededLength>, 1)))) { <revertStringOffset> }
if iszero(slt(rel_offset_of_tail, sub(sub(calldatasize(), base_ref), sub(<neededLength>, 1)))) { <revertStringOffset>() }
value := add(rel_offset_of_tail, base_ref)
<handleLength>
}
@ -1453,14 +1453,14 @@ string ABIFunctions::calldataAccessFunction(Type const& _type)
w("handleLength", Whiskers(R"(
length := calldataload(value)
value := add(value, 0x20)
if gt(length, 0xffffffffffffffff) { <revertStringLength> }
if sgt(base_ref, sub(calldatasize(), mul(length, <calldataStride>))) { <revertStringStride> }
if gt(length, 0xffffffffffffffff) { <revertStringLength>() }
if sgt(base_ref, sub(calldatasize(), mul(length, <calldataStride>))) { <revertStringStride>() }
)")
("calldataStride", toCompactHexWithPrefix(arrayType->calldataStride()))
// TODO add test
("revertStringLength", revertReasonIfDebug("Invalid calldata access length"))
("revertStringLength", revertReasonIfDebugFunction("Invalid calldata access length"))
// TODO add test
("revertStringStride", revertReasonIfDebug("Invalid calldata access stride"))
("revertStringStride", revertReasonIfDebugFunction("Invalid calldata access stride"))
.render());
w("return", "value, length");
}
@ -1471,7 +1471,7 @@ string ABIFunctions::calldataAccessFunction(Type const& _type)
}
w("neededLength", toCompactHexWithPrefix(tailSize));
w("functionName", functionName);
w("revertStringOffset", revertReasonIfDebug("Invalid calldata access offset"));
w("revertStringOffset", revertReasonIfDebugFunction("Invalid calldata access offset"));
return w.render();
}
else if (_type.isValueType())
@ -1555,7 +1555,7 @@ size_t ABIFunctions::numVariablesForType(Type const& _type, EncodingOptions cons
return _type.sizeOnStack();
}
std::string ABIFunctions::revertReasonIfDebug(std::string const& _message)
std::string ABIFunctions::revertReasonIfDebugFunction(std::string const& _message)
{
return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message);
return m_utils.revertReasonIfDebugFunction(_message);
}

View File

@ -273,9 +273,9 @@ private:
/// is true), for which it is two.
static size_t numVariablesForType(Type const& _type, EncodingOptions const& _options);
/// @returns code that stores @param _message for revert reason
/// @returns the name of a function that uses @param _message for revert reason
/// if m_revertStrings is debug.
std::string revertReasonIfDebug(std::string const& _message = "");
std::string revertReasonIfDebugFunction(std::string const& _message = "");
langutil::EVMVersion m_evmVersion;
RevertStrings const m_revertStrings;

View File

@ -560,7 +560,11 @@ void CompilerContext::optimizeYul(yul::Object& _object, yul::EVMDialect const& _
string CompilerContext::revertReasonIfDebug(string const& _message)
{
return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message);
return YulUtilFunctions::revertReasonIfDebugBody(
m_revertStrings,
"mload(" + to_string(CompilerUtils::freeMemoryPointer) + ")",
_message
);
}
void CompilerContext::updateSourceLocation()

View File

@ -268,7 +268,7 @@ public:
);
/// If m_revertStrings is debug, @returns inline assembly code that
/// stores @param _message in memory position 0 and reverts.
/// stores @param _message at the free memory pointer and reverts.
/// Otherwise returns "revert(0, 0)".
std::string revertReasonIfDebug(std::string const& _message = "");

View File

@ -2220,16 +2220,16 @@ string YulUtilFunctions::calldataArrayIndexRangeAccess(ArrayType const& _type)
return m_functionCollector.createFunction(functionName, [&]() {
return Whiskers(R"(
function <functionName>(offset, length, startIndex, endIndex) -> offsetOut, lengthOut {
if gt(startIndex, endIndex) { <revertSliceStartAfterEnd> }
if gt(endIndex, length) { <revertSliceGreaterThanLength> }
if gt(startIndex, endIndex) { <revertSliceStartAfterEnd>() }
if gt(endIndex, length) { <revertSliceGreaterThanLength>() }
offsetOut := add(offset, mul(startIndex, <stride>))
lengthOut := sub(endIndex, startIndex)
}
)")
("functionName", functionName)
("stride", to_string(_type.calldataStride()))
("revertSliceStartAfterEnd", revertReasonIfDebug("Slice starts after end"))
("revertSliceGreaterThanLength", revertReasonIfDebug("Slice is greater than length"))
("revertSliceStartAfterEnd", revertReasonIfDebugFunction("Slice starts after end"))
("revertSliceGreaterThanLength", revertReasonIfDebugFunction("Slice is greater than length"))
.render();
});
}
@ -2243,13 +2243,13 @@ string YulUtilFunctions::accessCalldataTailFunction(Type const& _type)
return Whiskers(R"(
function <functionName>(base_ref, ptr_to_tail) -> addr<?dynamicallySized>, length</dynamicallySized> {
let rel_offset_of_tail := calldataload(ptr_to_tail)
if iszero(slt(rel_offset_of_tail, sub(sub(calldatasize(), base_ref), sub(<neededLength>, 1)))) { <invalidCalldataTailOffset> }
if iszero(slt(rel_offset_of_tail, sub(sub(calldatasize(), base_ref), sub(<neededLength>, 1)))) { <invalidCalldataTailOffset>() }
addr := add(base_ref, rel_offset_of_tail)
<?dynamicallySized>
length := calldataload(addr)
if gt(length, 0xffffffffffffffff) { <invalidCalldataTailLength> }
if gt(length, 0xffffffffffffffff) { <invalidCalldataTailLength>() }
addr := add(addr, 32)
if sgt(addr, sub(calldatasize(), mul(length, <calldataStride>))) { <shortCalldataTail> }
if sgt(addr, sub(calldatasize(), mul(length, <calldataStride>))) { <shortCalldataTail>() }
</dynamicallySized>
}
)")
@ -2257,9 +2257,9 @@ string YulUtilFunctions::accessCalldataTailFunction(Type const& _type)
("dynamicallySized", _type.isDynamicallySized())
("neededLength", toCompactHexWithPrefix(_type.calldataEncodedTailSize()))
("calldataStride", toCompactHexWithPrefix(_type.isDynamicallySized() ? dynamic_cast<ArrayType const&>(_type).calldataStride() : 0))
("invalidCalldataTailOffset", revertReasonIfDebug("Invalid calldata tail offset"))
("invalidCalldataTailLength", revertReasonIfDebug("Invalid calldata tail length"))
("shortCalldataTail", revertReasonIfDebug("Calldata tail too short"))
("invalidCalldataTailOffset", revertReasonIfDebugFunction("Invalid calldata tail offset"))
("invalidCalldataTailLength", revertReasonIfDebugFunction("Invalid calldata tail length"))
("shortCalldataTail", revertReasonIfDebugFunction("Calldata tail too short"))
.render();
});
}
@ -4212,42 +4212,52 @@ string YulUtilFunctions::readFromMemoryOrCalldata(Type const& _type, bool _fromC
});
}
string YulUtilFunctions::revertReasonIfDebug(RevertStrings revertStrings, string const& _message)
string YulUtilFunctions::revertReasonIfDebugFunction(string const& _message)
{
if (revertStrings >= RevertStrings::Debug && !_message.empty())
{
Whiskers templ(R"({
mstore(0, <sig>)
mstore(4, 0x20)
mstore(add(4, 0x20), <length>)
let reasonPos := add(4, 0x40)
<#word>
mstore(add(reasonPos, <offset>), <wordValue>)
</word>
revert(0, add(reasonPos, <end>))
})");
templ("sig", util::selectorFromSignature("Error(string)").str());
templ("length", to_string(_message.length()));
size_t words = (_message.length() + 31) / 32;
vector<map<string, string>> wordParams(words);
for (size_t i = 0; i < words; ++i)
{
wordParams[i]["offset"] = to_string(i * 32);
wordParams[i]["wordValue"] = formatAsStringOrNumber(_message.substr(32 * i, 32));
}
templ("word", wordParams);
templ("end", to_string(words * 32));
return templ.render();
}
else
return "revert(0, 0)";
string functionName = "revert_error_" + util::toHex(util::keccak256(_message).asBytes());
return m_functionCollector.createFunction(functionName, [&](auto&, auto&) -> string {
return revertReasonIfDebugBody(m_revertStrings, allocateUnboundedFunction() + "()", _message);
});
}
string YulUtilFunctions::revertReasonIfDebug(string const& _message)
string YulUtilFunctions::revertReasonIfDebugBody(
RevertStrings _revertStrings,
string const& _allocation,
string const& _message
)
{
return revertReasonIfDebug(m_revertStrings, _message);
if (_revertStrings < RevertStrings::Debug || _message.empty())
return "revert(0, 0)";
Whiskers templ(R"(
let start := <allocate>
let pos := start
mstore(pos, <sig>)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, <length>)
pos := add(pos, 0x20)
<#word>
mstore(add(pos, <offset>), <wordValue>)
</word>
revert(start, <overallLength>)
)");
templ("allocate", _allocation);
templ("sig", util::selectorFromSignature("Error(string)").str());
templ("length", to_string(_message.length()));
size_t words = (_message.length() + 31) / 32;
vector<map<string, string>> wordParams(words);
for (size_t i = 0; i < words; ++i)
{
wordParams[i]["offset"] = to_string(i * 32);
wordParams[i]["wordValue"] = formatAsStringOrNumber(_message.substr(32 * i, 32));
}
templ("word", wordParams);
templ("overallLength", to_string(4 + 0x20 + 0x20 + words * 32));
return templ.render();
}
string YulUtilFunctions::panicFunction(util::PanicCode _code)

View File

@ -453,12 +453,18 @@ public:
/// signature: (slot, offset) ->
std::string storageSetToZeroFunction(Type const& _type);
/// If revertStrings is debug, @returns inline assembly code that
/// If revertStrings is debug, @returns the name of a function that
/// stores @param _message in memory position 0 and reverts.
/// Otherwise returns "revert(0, 0)".
static std::string revertReasonIfDebug(RevertStrings revertStrings, std::string const& _message = "");
/// Otherwise returns the name of a function that uses "revert(0, 0)".
std::string revertReasonIfDebugFunction(std::string const& _message = "");
std::string revertReasonIfDebug(std::string const& _message = "");
/// @returns the function body of ``revertReasonIfDebug``.
/// Should only be used internally and by the old code generator.
static std::string revertReasonIfDebugBody(
RevertStrings _revertStrings,
std::string const& _allocation,
std::string const& _message
);
/// Reverts with ``Panic(uint256)`` and the given code.
std::string panicFunction(util::PanicCode _code);

View File

@ -177,8 +177,3 @@ ABIFunctions IRGenerationContext::abiFunctions()
{
return ABIFunctions(m_evmVersion, m_revertStrings, m_functions);
}
std::string IRGenerationContext::revertReasonIfDebug(std::string const& _message)
{
return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message);
}

View File

@ -143,10 +143,6 @@ public:
ABIFunctions abiFunctions();
/// @returns code that stores @param _message for revert reason
/// if m_revertStrings is debug.
std::string revertReasonIfDebug(std::string const& _message = "");
RevertStrings revertStrings() const { return m_revertStrings; }
std::set<ContractDefinition const*, ASTNode::CompareByID>& subObjectsCreated() { return m_subObjects; }

View File

@ -839,7 +839,7 @@ string IRGenerator::deployCode(ContractDefinition const& _contract)
string IRGenerator::callValueCheck()
{
return "if callvalue() { " + m_context.revertReasonIfDebug("Ether sent to non-payable function") + " }";
return "if callvalue() { " + m_utils.revertReasonIfDebugFunction("Ether sent to non-payable function") + "() }";
}
string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
@ -885,8 +885,8 @@ string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
// we revert.
delegatecallCheck =
"if iszero(called_via_delegatecall) { " +
m_context.revertReasonIfDebug("Non-view function of library called without DELEGATECALL") +
" }";
m_utils.revertReasonIfDebugFunction("Non-view function of library called without DELEGATECALL") +
"() }";
}
templ["delegatecallCheck"] = delegatecallCheck;
templ["callValueCheck"] = (type->isPayable() || _contract.isLibrary()) ? "" : callValueCheck();
@ -937,12 +937,11 @@ string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
t("fallback", fallbackCode);
}
else
t(
"fallback",
t("fallback", (
etherReceiver ?
m_context.revertReasonIfDebug("Unknown signature and no fallback defined") :
m_context.revertReasonIfDebug("Contract does not have fallback nor receive functions")
);
m_utils.revertReasonIfDebugFunction("Unknown signature and no fallback defined") :
m_utils.revertReasonIfDebugFunction("Contract does not have fallback nor receive functions")
) + "()");
return t.render();
}

View File

@ -2433,7 +2433,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall(
}
Whiskers templ(R"(
if iszero(extcodesize(<address>)) { <revertNoCode> }
if iszero(extcodesize(<address>)) { <revertNoCode>() }
// storage for arguments and returned data
let <pos> := <allocateUnbounded>()
@ -2458,7 +2458,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall(
<?+retVars> <retVars> := </+retVars> <abiDecode>(<pos>, add(<pos>, <returnSize>))
}
)");
templ("revertNoCode", m_context.revertReasonIfDebug("Target contract does not contain code"));
templ("revertNoCode", m_utils.revertReasonIfDebugFunction("Target contract does not contain code"));
templ("pos", m_context.newYulVariable());
templ("end", m_context.newYulVariable());
if (_functionCall.annotation().tryCall)

View File

@ -10,54 +10,38 @@
"ast":
{
"nodeType": "YulBlock",
"src": "0:825:1",
"src": "0:1856:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "114:277:1",
"src": "114:478:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "163:16:1",
"src": "163:83:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "172:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "175:1:1",
"type": "",
"value": "0"
}
],
"arguments": [],
"functionName":
{
"name": "revert",
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulIdentifier",
"src": "165:6:1"
"src": "165:77:1"
},
"nodeType": "YulFunctionCall",
"src": "165:12:1"
"src": "165:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "165:12:1"
"src": "165:79:1"
}
]
},
@ -123,7 +107,7 @@
},
{
"nodeType": "YulAssignment",
"src": "188:30:1",
"src": "255:30:1",
"value":
{
"arguments":
@ -131,24 +115,24 @@
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "211:6:1"
"src": "278:6:1"
}
],
"functionName":
{
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "198:12:1"
"src": "265:12:1"
},
"nodeType": "YulFunctionCall",
"src": "198:20:1"
"src": "265:20:1"
},
"variableNames":
[
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "188:6:1"
"src": "255:6:1"
}
]
},
@ -156,40 +140,24 @@
"body":
{
"nodeType": "YulBlock",
"src": "261:16:1",
"src": "328:83:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "270:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "273:1:1",
"type": "",
"value": "0"
}
],
"arguments": [],
"functionName":
{
"name": "revert",
"name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490",
"nodeType": "YulIdentifier",
"src": "263:6:1"
"src": "330:77:1"
},
"nodeType": "YulFunctionCall",
"src": "263:12:1"
"src": "330:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "263:12:1"
"src": "330:79:1"
}
]
},
@ -200,12 +168,12 @@
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "233:6:1"
"src": "300:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "241:18:1",
"src": "308:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
@ -214,17 +182,17 @@
{
"name": "gt",
"nodeType": "YulIdentifier",
"src": "230:2:1"
"src": "297:2:1"
},
"nodeType": "YulFunctionCall",
"src": "230:30:1"
"src": "297:30:1"
},
"nodeType": "YulIf",
"src": "227:2:1"
"src": "294:2:1"
},
{
"nodeType": "YulAssignment",
"src": "286:29:1",
"src": "420:29:1",
"value":
{
"arguments":
@ -232,12 +200,12 @@
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "302:6:1"
"src": "436:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "310:4:1",
"src": "444:4:1",
"type": "",
"value": "0x20"
}
@ -246,17 +214,17 @@
{
"name": "add",
"nodeType": "YulIdentifier",
"src": "298:3:1"
"src": "432:3:1"
},
"nodeType": "YulFunctionCall",
"src": "298:17:1"
"src": "432:17:1"
},
"variableNames":
[
{
"name": "arrayPos",
"nodeType": "YulIdentifier",
"src": "286:8:1"
"src": "420:8:1"
}
]
},
@ -264,40 +232,24 @@
"body":
{
"nodeType": "YulBlock",
"src": "369:16:1",
"src": "503:83:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "378:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "381:1:1",
"type": "",
"value": "0"
}
],
"arguments": [],
"functionName":
{
"name": "revert",
"name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef",
"nodeType": "YulIdentifier",
"src": "371:6:1"
"src": "505:77:1"
},
"nodeType": "YulFunctionCall",
"src": "371:12:1"
"src": "505:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "371:12:1"
"src": "505:79:1"
}
]
},
@ -311,7 +263,7 @@
{
"name": "arrayPos",
"nodeType": "YulIdentifier",
"src": "334:8:1"
"src": "468:8:1"
},
{
"arguments":
@ -319,12 +271,12 @@
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "348:6:1"
"src": "482:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "356:4:1",
"src": "490:4:1",
"type": "",
"value": "0x20"
}
@ -333,38 +285,38 @@
{
"name": "mul",
"nodeType": "YulIdentifier",
"src": "344:3:1"
"src": "478:3:1"
},
"nodeType": "YulFunctionCall",
"src": "344:17:1"
"src": "478:17:1"
}
],
"functionName":
{
"name": "add",
"nodeType": "YulIdentifier",
"src": "330:3:1"
"src": "464:3:1"
},
"nodeType": "YulFunctionCall",
"src": "330:32:1"
"src": "464:32:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "364:3:1"
"src": "498:3:1"
}
],
"functionName":
{
"name": "gt",
"nodeType": "YulIdentifier",
"src": "327:2:1"
"src": "461:2:1"
},
"nodeType": "YulFunctionCall",
"src": "327:41:1"
"src": "461:41:1"
},
"nodeType": "YulIf",
"src": "324:2:1"
"src": "458:2:1"
}
]
},
@ -400,53 +352,37 @@
"type": ""
}
],
"src": "24:367:1"
"src": "24:568:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "498:324:1",
"src": "699:458:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "544:16:1",
"src": "745:83:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "553:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "556:1:1",
"type": "",
"value": "0"
}
],
"arguments": [],
"functionName":
{
"name": "revert",
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "546:6:1"
"src": "747:77:1"
},
"nodeType": "YulFunctionCall",
"src": "546:12:1"
"src": "747:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "546:12:1"
"src": "747:79:1"
}
]
},
@ -460,27 +396,27 @@
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "519:7:1"
"src": "720:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "528:9:1"
"src": "729:9:1"
}
],
"functionName":
{
"name": "sub",
"nodeType": "YulIdentifier",
"src": "515:3:1"
"src": "716:3:1"
},
"nodeType": "YulFunctionCall",
"src": "515:23:1"
"src": "716:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "540:2:1",
"src": "741:2:1",
"type": "",
"value": "32"
}
@ -489,22 +425,22 @@
{
"name": "slt",
"nodeType": "YulIdentifier",
"src": "511:3:1"
"src": "712:3:1"
},
"nodeType": "YulFunctionCall",
"src": "511:32:1"
"src": "712:32:1"
},
"nodeType": "YulIf",
"src": "508:2:1"
"src": "709:2:1"
},
{
"nodeType": "YulBlock",
"src": "570:245:1",
"src": "838:312:1",
"statements":
[
{
"nodeType": "YulVariableDeclaration",
"src": "585:45:1",
"src": "853:45:1",
"value":
{
"arguments":
@ -515,12 +451,12 @@
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "616:9:1"
"src": "884:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "627:1:1",
"src": "895:1:1",
"type": "",
"value": "0"
}
@ -529,27 +465,27 @@
{
"name": "add",
"nodeType": "YulIdentifier",
"src": "612:3:1"
"src": "880:3:1"
},
"nodeType": "YulFunctionCall",
"src": "612:17:1"
"src": "880:17:1"
}
],
"functionName":
{
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "599:12:1"
"src": "867:12:1"
},
"nodeType": "YulFunctionCall",
"src": "599:31:1"
"src": "867:31:1"
},
"variables":
[
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "589:6:1",
"src": "857:6:1",
"type": ""
}
]
@ -558,40 +494,24 @@
"body":
{
"nodeType": "YulBlock",
"src": "677:16:1",
"src": "945:83:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "686:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "689:1:1",
"type": "",
"value": "0"
}
],
"arguments": [],
"functionName":
{
"name": "revert",
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulIdentifier",
"src": "679:6:1"
"src": "947:77:1"
},
"nodeType": "YulFunctionCall",
"src": "679:12:1"
"src": "947:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "679:12:1"
"src": "947:79:1"
}
]
},
@ -602,12 +522,12 @@
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "649:6:1"
"src": "917:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "657:18:1",
"src": "925:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
@ -616,17 +536,17 @@
{
"name": "gt",
"nodeType": "YulIdentifier",
"src": "646:2:1"
"src": "914:2:1"
},
"nodeType": "YulFunctionCall",
"src": "646:30:1"
"src": "914:30:1"
},
"nodeType": "YulIf",
"src": "643:2:1"
"src": "911:2:1"
},
{
"nodeType": "YulAssignment",
"src": "707:98:1",
"src": "1042:98:1",
"value":
{
"arguments":
@ -637,49 +557,49 @@
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "777:9:1"
"src": "1112:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "788:6:1"
"src": "1123:6:1"
}
],
"functionName":
{
"name": "add",
"nodeType": "YulIdentifier",
"src": "773:3:1"
"src": "1108:3:1"
},
"nodeType": "YulFunctionCall",
"src": "773:22:1"
"src": "1108:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "797:7:1"
"src": "1132:7:1"
}
],
"functionName":
{
"name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr",
"nodeType": "YulIdentifier",
"src": "725:47:1"
"src": "1060:47:1"
},
"nodeType": "YulFunctionCall",
"src": "725:80:1"
"src": "1060:80:1"
},
"variableNames":
[
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "707:6:1"
"src": "1042:6:1"
},
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "715:6:1"
"src": "1050:6:1"
}
]
}
@ -694,13 +614,13 @@
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "460:9:1",
"src": "661:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "471:7:1",
"src": "672:7:1",
"type": ""
}
],
@ -709,21 +629,301 @@
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "483:6:1",
"src": "684:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "491:6:1",
"src": "692:6:1",
"type": ""
}
],
"src": "397:425:1"
"src": "598:559:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1203:35:1",
"statements":
[
{
"nodeType": "YulAssignment",
"src": "1213:19:1",
"value":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1229:2:1",
"type": "",
"value": "64"
}
],
"functionName":
{
"name": "mload",
"nodeType": "YulIdentifier",
"src": "1223:5:1"
},
"nodeType": "YulFunctionCall",
"src": "1223:9:1"
},
"variableNames":
[
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "1213:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nodeType": "YulFunctionDefinition",
"returnVariables":
[
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "1196:6:1",
"type": ""
}
],
"src": "1163:75:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1333:28:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1350:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1353:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1343:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1343:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1343:12:1"
}
]
},
"name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490",
"nodeType": "YulFunctionDefinition",
"src": "1244:117:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1456:28:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1473:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1476:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1466:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1466:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1466:12:1"
}
]
},
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulFunctionDefinition",
"src": "1367:117:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1579:28:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1596:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1599:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1589:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1589:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1589:12:1"
}
]
},
"name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef",
"nodeType": "YulFunctionDefinition",
"src": "1490:117:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1702:28:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1719:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1722:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1712:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1712:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1712:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulFunctionDefinition",
"src": "1613:117:1"
},
{
"body":
{
"nodeType": "YulBlock",
"src": "1825:28:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1842:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1845:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1835:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1835:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1835:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulFunctionDefinition",
"src": "1736:117:1"
}
]
},
"contents": "{\n\n // uint256[]\n function abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(offset, end) -> arrayPos, length {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n length := calldataload(offset)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n arrayPos := add(offset, 0x20)\n if gt(add(arrayPos, mul(length, 0x20)), end) { revert(0, 0) }\n }\n\n function abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n\n value0, value1 := abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n}\n",
"contents": "{\n\n // uint256[]\n function abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(offset, end) -> arrayPos, length {\n if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }\n length := calldataload(offset)\n if gt(length, 0xffffffffffffffff) { revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490() }\n arrayPos := add(offset, 0x20)\n if gt(add(arrayPos, mul(length, 0x20)), end) { revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() }\n }\n\n function abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value0, value1 := abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490() {\n revert(0, 0)\n }\n\n function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {\n revert(0, 0)\n }\n\n function revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"

View File

@ -10,7 +10,7 @@ IR:
object "C_81" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_81()
@ -27,6 +27,10 @@ object "C_81" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object "C_81_deployed" {
code {
@ -41,7 +45,7 @@ object "C_81" {
{
// f(uint256,uint256,uint256,uint256)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
let param_0, param_1, param_2, param_3 := abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256(4, calldatasize())
let ret_0, ret_1, ret_2, ret_3 := fun_f_80(param_0, param_1, param_2, param_3)
let memPos := allocate_unbounded()
@ -52,7 +56,7 @@ object "C_81" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_t_uint256(offset, end) -> value {
value := calldataload(offset)
@ -60,7 +64,7 @@ object "C_81" {
}
function abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256(headStart, dataEnd) -> value0, value1, value2, value3 {
if slt(sub(dataEnd, headStart), 128) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 128) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
{
@ -290,6 +294,22 @@ object "C_81" {
revert(0, 0x24)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=

View File

@ -45,7 +45,7 @@ object "C_59" {
for { } lt(i, _4) { i := add(i, 1) }
{
if slt(sub(calldatasize(), src), _2) { revert(_1, _1) }
let value := allocate_memory_1238()
let value := allocate_memory_1228()
mstore(value, calldataload(src))
mstore(dst, value)
dst := add(dst, _2)
@ -76,7 +76,7 @@ object "C_59" {
}
tail := add(add(headStart, and(add(length, 31), not(31))), 96)
}
function allocate_memory_1238() -> memPtr
function allocate_memory_1228() -> memPtr
{
memPtr := mload(64)
let newFreePtr := add(memPtr, 32)

View File

@ -0,0 +1 @@
--revert-strings debug --ir

View File

@ -0,0 +1,7 @@
pragma solidity >=0.0;
// SPDX-License-Identifier: GPL-3.0
contract C {
enum E { X }
function f(uint[][] memory, E e) public pure {
}
}

View File

@ -0,0 +1,362 @@
IR:
/*******************************************************
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "C_15" {
code {
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_15()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_15_deployed"), datasize("C_15_deployed"))
return(_1, datasize("C_15_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function constructor_C_15() {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 34)
pos := add(pos, 0x20)
mstore(add(pos, 0), "Ether sent to non-payable functi")
mstore(add(pos, 32), "on")
revert(start, 132)
}
}
object "C_15_deployed" {
code {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x02e8cd18
{
// f(uint256[][],uint8)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
let param_0, param_1 := abi_decode_tuple_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptrt_enum$_E_$3(4, calldatasize())
fun_f_14(param_0, param_1)
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
// uint256[][]
function abi_decode_available_length_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(offset, length, end) -> array {
array := allocate_memory(array_allocation_size_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(length))
let dst := array
mstore(array, length)
dst := add(array, 0x20)
let src := offset
if gt(add(src, mul(length, 0x20)), end) {
revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef()
}
for { let i := 0 } lt(i, length) { i := add(i, 1) }
{
let innerOffset := calldataload(src)
if gt(innerOffset, 0xffffffffffffffff) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }
let elementPos := add(offset, innerOffset)
mstore(dst, abi_decode_t_array$_t_uint256_$dyn_memory_ptr(elementPos, end))
dst := add(dst, 0x20)
src := add(src, 0x20)
}
}
// uint256[]
function abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(offset, length, end) -> array {
array := allocate_memory(array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr(length))
let dst := array
mstore(array, length)
dst := add(array, 0x20)
let src := offset
if gt(add(src, mul(length, 0x20)), end) {
revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef()
}
for { let i := 0 } lt(i, length) { i := add(i, 1) }
{
let elementPos := src
mstore(dst, abi_decode_t_uint256(elementPos, end))
dst := add(dst, 0x20)
src := add(src, 0x20)
}
}
// uint256[][]
function abi_decode_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(offset, end) -> array {
if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }
let length := calldataload(offset)
array := abi_decode_available_length_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(add(offset, 0x20), length, end)
}
// uint256[]
function abi_decode_t_array$_t_uint256_$dyn_memory_ptr(offset, end) -> array {
if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }
let length := calldataload(offset)
array := abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(add(offset, 0x20), length, end)
}
function abi_decode_t_enum$_E_$3(offset, end) -> value {
value := calldataload(offset)
validator_revert_t_enum$_E_$3(value)
}
function abi_decode_t_uint256(offset, end) -> value {
value := calldataload(offset)
validator_revert_t_uint256(value)
}
function abi_decode_tuple_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptrt_enum$_E_$3(headStart, dataEnd) -> value0, value1 {
if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
{
let offset := calldataload(add(headStart, 0))
if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }
value0 := abi_decode_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(add(headStart, offset), dataEnd)
}
{
let offset := 32
value1 := abi_decode_t_enum$_E_$3(add(headStart, offset), dataEnd)
}
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function allocate_memory(size) -> memPtr {
memPtr := allocate_unbounded()
finalize_allocation(memPtr, size)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function array_allocation_size_t_array$_t_array$_t_uint256_$dyn_memory_ptr_$dyn_memory_ptr(length) -> size {
// Make sure we can allocate memory without overflow
if gt(length, 0xffffffffffffffff) { panic_error_0x41() }
size := mul(length, 0x20)
// add length slot
size := add(size, 0x20)
}
function array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr(length) -> size {
// Make sure we can allocate memory without overflow
if gt(length, 0xffffffffffffffff) { panic_error_0x41() }
size := mul(length, 0x20)
// add length slot
size := add(size, 0x20)
}
function cleanup_t_uint256(value) -> cleaned {
cleaned := value
}
function finalize_allocation(memPtr, size) {
let newFreePtr := add(memPtr, round_up_to_mul_of_32(size))
// protect against overflow
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
mstore(64, newFreePtr)
}
function fun_f_14(var__7_mpos, var_e_10) {
}
function panic_error_0x41() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 0x41)
revert(0, 0x24)
}
function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 43)
pos := add(pos, 0x20)
mstore(add(pos, 0), "ABI decoding: invalid calldata a")
mstore(add(pos, 32), "rray offset")
revert(start, 132)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 53)
pos := add(pos, 0x20)
mstore(add(pos, 0), "Contract does not have fallback ")
mstore(add(pos, 32), "nor receive functions")
revert(start, 132)
}
function revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 43)
pos := add(pos, 0x20)
mstore(add(pos, 0), "ABI decoding: invalid calldata a")
mstore(add(pos, 32), "rray stride")
revert(start, 132)
}
function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 34)
pos := add(pos, 0x20)
mstore(add(pos, 0), "ABI decoding: invalid tuple offs")
mstore(add(pos, 32), "et")
revert(start, 132)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 34)
pos := add(pos, 0x20)
mstore(add(pos, 0), "Ether sent to non-payable functi")
mstore(add(pos, 32), "on")
revert(start, 132)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
let start := allocate_unbounded()
let pos := start
mstore(pos, 3963877391197344453575983046348115674221700746820753546331534351508065746944)
pos := add(pos, 4)
mstore(pos, 0x20)
pos := add(pos, 0x20)
mstore(pos, 34)
pos := add(pos, 0x20)
mstore(add(pos, 0), "ABI decoding: tuple data too sho")
mstore(add(pos, 32), "rt")
revert(start, 132)
}
function round_up_to_mul_of_32(value) -> result {
result := and(add(value, 31), not(31))
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function validator_revert_t_enum$_E_$3(value) {
if iszero(lt(value, 1)) { revert(0, 0) }
}
function validator_revert_t_uint256(value) {
if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,10 @@
object \"C_7\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
}
constructor_C_7()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_7_deployed\"), datasize(\"C_7_deployed\"))
@ -17,6 +20,8 @@ object \"C_7\" {
{ memPtr := mload(64) }
function constructor_C_7()
{ }
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
{ revert(0, 0) }
}
object \"C_7_deployed\" {
code {
@ -26,7 +31,10 @@ object \"C_7\" {
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0 {
if callvalue() { revert(0, 0) }
if callvalue()
{
revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
}
abi_decode_tuple_(4, calldatasize())
fun_f_6()
let memPos := allocate_unbounded()
@ -36,10 +44,13 @@ object \"C_7\" {
default { }
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd)
{
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0)
{
revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b()
}
}
function abi_encode_tuple__to__fromStack(headStart) -> tail
{ tail := add(headStart, 0) }
@ -47,6 +58,12 @@ object \"C_7\" {
{ memPtr := mload(64) }
function fun_f_6()
{ }
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
{ revert(0, 0) }
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
{ revert(0, 0) }
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b()
{ revert(0, 0) }
function shift_right_224_unsigned(value) -> newValue
{ newValue := shr(224, value) }
}

View File

@ -9,7 +9,7 @@
object \"C_7\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_7()
@ -26,6 +26,10 @@ object \"C_7\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_7_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_7\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_6()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_7\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -71,6 +75,18 @@ object \"C_7\" {
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=

View File

@ -9,7 +9,7 @@
object \"C_3\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_3()
@ -26,6 +26,10 @@ object \"C_3\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_3_deployed\" {
code {
@ -39,7 +43,15 @@ object \"C_3\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=
@ -65,7 +77,7 @@ object \"C_3\" {
object \"D_16\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_D_16()
@ -82,6 +94,10 @@ object \"D_16\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"D_16_deployed\" {
code {
@ -96,7 +112,7 @@ object \"D_16\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_15()
let memPos := allocate_unbounded()
@ -107,10 +123,10 @@ object \"D_16\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -145,6 +161,18 @@ object \"D_16\" {
revert(0, 0x24)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function revert_forward_1() {
let pos := allocate_unbounded()
returndatacopy(pos, 0, returndatasize())
@ -169,7 +197,7 @@ object \"D_16\" {
object \"C_3\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_3()
@ -186,6 +214,10 @@ object \"D_16\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_3_deployed\" {
code {
@ -199,7 +231,15 @@ object \"D_16\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=

View File

@ -10,7 +10,7 @@ IR:
object "test_11" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_test_11()
@ -27,6 +27,10 @@ object "test_11" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object "test_11_deployed" {
code {
@ -41,7 +45,7 @@ object "test_11" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -52,10 +56,10 @@ object "test_11" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -88,6 +92,18 @@ object "test_11" {
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=

View File

@ -10,13 +10,18 @@ object "C_7" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
}
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_7_deployed"), datasize("C_7_deployed"))
return(_1, datasize("C_7_deployed"))
}
function allocate_unbounded() -> memPtr
{ memPtr := mload(64) }
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb()
{ revert(0, 0) }
}
object "C_7_deployed" {
code {
@ -28,8 +33,10 @@ object "C_7" {
pop(selector)
}
pop(iszero(calldatasize()))
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
{ revert(0, 0) }
function shift_right_unsigned(value) -> newValue
{ newValue := shr(224, value) }
}

View File

@ -9,7 +9,7 @@
object \"C_11\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_11()
@ -26,6 +26,10 @@ object \"C_11\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_11_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_11\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_11\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -156,6 +160,18 @@ object \"C_11\" {
revert(0, 0x24)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function round_up_to_mul_of_32(value) -> result {
result := and(add(value, 31), not(31))
}

View File

@ -9,7 +9,7 @@
object \"C_11\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_11()
@ -26,6 +26,10 @@ object \"C_11\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_11_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_11\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_11\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -90,6 +94,18 @@ object \"C_11\" {
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=

View File

@ -9,7 +9,7 @@
object \"C_11\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_11()
@ -26,6 +26,10 @@ object \"C_11\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_11_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_11\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_11\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -95,6 +99,18 @@ object \"C_11\" {
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_left_224(value) -> newValue {
newValue :=

View File

@ -9,7 +9,7 @@
object \"C_11\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_11()
@ -26,6 +26,10 @@ object \"C_11\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_11_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_11\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_11\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -156,6 +160,18 @@ object \"C_11\" {
revert(0, 0x24)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function round_up_to_mul_of_32(value) -> result {
result := and(add(value, 31), not(31))
}

View File

@ -9,7 +9,7 @@
object \"C_11\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_11()
@ -26,6 +26,10 @@ object \"C_11\" {
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
}
object \"C_11_deployed\" {
code {
@ -40,7 +44,7 @@ object \"C_11\" {
{
// f()
if callvalue() { revert(0, 0) }
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
let ret_0 := fun_f_10()
let memPos := allocate_unbounded()
@ -51,10 +55,10 @@ object \"C_11\" {
default {}
}
if iszero(calldatasize()) { }
revert(0, 0)
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
@ -95,6 +99,18 @@ object \"C_11\" {
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function shift_left_224(value) -> newValue {
newValue :=

View File

@ -14,9 +14,9 @@ contract C {
}
// ----
// creation:
// codeDepositCost: 1211600
// executionCost: 1261
// totalCost: 1212861
// codeDepositCost: 1259800
// executionCost: 1308
// totalCost: 1261108
// external:
// a(): 1130
// b(uint256): infinite

View File

@ -17,9 +17,9 @@ contract C {
// optimize-yul: true
// ----
// creation:
// codeDepositCost: 681000
// codeDepositCost: 680600
// executionCost: 715
// totalCost: 681715
// totalCost: 681315
// external:
// a(): 985
// b(uint256): 2052

View File

@ -24,9 +24,9 @@ contract Large {
}
// ----
// creation:
// codeDepositCost: 902600
// codeDepositCost: 904400
// executionCost: 942
// totalCost: 903542
// totalCost: 905342
// external:
// a(): 1175
// b(uint256): infinite

View File

@ -11,9 +11,9 @@ contract Medium {
}
// ----
// creation:
// codeDepositCost: 349600
// codeDepositCost: 351400
// executionCost: 386
// totalCost: 349986
// totalCost: 351786
// external:
// a(): 1152
// b(uint256): infinite

View File

@ -6,9 +6,9 @@ contract Small {
}
// ----
// creation:
// codeDepositCost: 112800
// codeDepositCost: 114600
// executionCost: 159
// totalCost: 112959
// totalCost: 114759
// external:
// fallback: 129
// a(): 1107

View File

@ -19,9 +19,9 @@ contract C {
// optimize-yul: false
// ----
// creation:
// codeDepositCost: 109000
// codeDepositCost: 110800
// executionCost: 159
// totalCost: 109159
// totalCost: 110959
// external:
// exp_neg_one(uint256): 2259
// exp_one(uint256): infinite

View File

@ -37,7 +37,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x02000202
// gas irOptimized: 2470372
// gas irOptimized: 2476392
// gas legacy: 2288641
// gas legacyOptimized: 2258654
// storageEmpty -> 1

View File

@ -22,5 +22,5 @@ contract B {
// ----
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
// gas irOptimized: 135883
// gas legacy: 264410
// gas legacy: 266210
// gas legacyOptimized: 135699

View File

@ -46,5 +46,5 @@ contract C {
// ----
// test() -> 5, 6, 7
// gas irOptimized: 345955
// gas legacy: 500424
// gas legacy: 508437
// gas legacyOptimized: 309013

View File

@ -27,5 +27,5 @@ contract Creator {
// ----
// f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8
// gas irOptimized: 474718
// gas legacy: 570900
// gas legacy: 578926
// gas legacyOptimized: 436724

View File

@ -27,5 +27,5 @@ contract Creator {
// ----
// f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h"
// gas irOptimized: 330976
// gas legacy: 414850
// gas legacy: 422873
// gas legacyOptimized: 292281

View File

@ -29,5 +29,5 @@ contract C {
// ----
// t() -> 9
// gas irOptimized: 103953
// gas legacy: 161097
// gas legacy: 162897
// gas legacyOptimized: 112116

View File

@ -24,7 +24,7 @@ contract D {
// ----
// f() -> 1
// gas irOptimized: 86504
// gas legacy: 114412
// gas legacy: 116212
// g() -> 5
// gas irOptimized: 86600
// gas legacy: 114872
// gas legacy: 116672

View File

@ -26,4 +26,4 @@ contract B {
// ----
// g() -> 42
// gas irOptimized: 90635
// gas legacy: 117797
// gas legacy: 126809

View File

@ -26,5 +26,5 @@ contract B {
// ----
// g() -> 42
// gas irOptimized: 119658
// gas legacy: 180597
// gas legacy: 187809
// gas legacyOptimized: 117351

View File

@ -65,11 +65,11 @@ contract Test {
}
}
// ====
// compileViaYul: also
// compileToEwasm: also
// compileViaYul: also
// ----
// load() -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
// gas irOptimized: 111580
// gas irOptimized: 111532
// gas legacy: 113999
// gas legacyOptimized: 106281
// store() -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06