From c63b768fff749bd4bbb7b01a9340f00abf32333f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Sep 2021 17:37:36 +0200 Subject: [PATCH 1/5] Sort yul functions by creation time. --- .../codegen/MultiUseYulFunctionCollector.cpp | 19 +++++++------------ .../codegen/MultiUseYulFunctionCollector.h | 10 +++++----- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/libsolidity/codegen/MultiUseYulFunctionCollector.cpp b/libsolidity/codegen/MultiUseYulFunctionCollector.cpp index 57d2a856c..69d30c6c8 100644 --- a/libsolidity/codegen/MultiUseYulFunctionCollector.cpp +++ b/libsolidity/codegen/MultiUseYulFunctionCollector.cpp @@ -33,13 +33,8 @@ using namespace solidity::util; string MultiUseYulFunctionCollector::requestedFunctions() { - string result; - for (auto const& [name, code]: m_requestedFunctions) - { - solAssert(code != "< arguments; vector returnParameters; string body = _creator(arguments, returnParameters); solAssert(!body.empty(), ""); - m_requestedFunctions[_name] = Whiskers(R"( + m_code += Whiskers(R"( function () -> { } @@ -80,7 +75,7 @@ string MultiUseYulFunctionCollector::createFunction( ("args", joinHumanReadable(arguments)) ("retParams", joinHumanReadable(returnParameters)) ("body", body) - .render();; + .render(); } return _name; } diff --git a/libsolidity/codegen/MultiUseYulFunctionCollector.h b/libsolidity/codegen/MultiUseYulFunctionCollector.h index 7883fa668..050b5858f 100644 --- a/libsolidity/codegen/MultiUseYulFunctionCollector.h +++ b/libsolidity/codegen/MultiUseYulFunctionCollector.h @@ -25,6 +25,7 @@ #include #include #include +#include namespace solidity::frontend { @@ -46,9 +47,8 @@ public: std::function&, std::vector&)> const& _creator ); - /// @returns concatenation of all generated functions. - /// Guarantees that the order of functions in the generated code is deterministic and - /// platform-independent. + /// @returns concatenation of all generated functions in the order in which they were + /// generated. /// Clears the internal list, i.e. calling it again will result in an /// empty return value. std::string requestedFunctions(); @@ -57,8 +57,8 @@ public: bool contains(std::string const& _name) const { return m_requestedFunctions.count(_name) > 0; } private: - /// Map from function name to code for a multi-use function. - std::map m_requestedFunctions; + std::set m_requestedFunctions; + std::string m_code; }; } From 1304080a77a4c7d15c5957f3484b5ba9b324e5e2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Sep 2021 18:00:20 +0200 Subject: [PATCH 2/5] Update commandline tests. --- .../combined_json_generated_sources/output | 764 +++++----- test/cmdlineTests/exp_base_literal/output | 224 +-- test/cmdlineTests/name_simplifier/output | 49 +- test/cmdlineTests/revert_strings/output | 464 +++--- .../standard_function_debug_info/output.json | 2 +- .../standard_generatedSources/output.json | 134 +- .../output.json | 25 +- .../standard_ir_requested/output.json | 48 +- .../output.json | 14 +- .../standard_viair_requested/output.json | 118 +- test/cmdlineTests/viair_abicoder_v1/output | 62 +- test/cmdlineTests/yul_optimizer_steps/output | 4 +- .../yul_source_locations/output.json | 1292 ++++++++--------- .../yul_source_locations_in_asm/output.json | 268 ++-- .../yul_string_format_ascii/output.json | 162 +-- .../output.json | 62 +- .../output.json | 76 +- .../yul_string_format_ascii_long/output.json | 170 +-- .../yul_string_format_hex/output.json | 76 +- 19 files changed, 2008 insertions(+), 2006 deletions(-) diff --git a/test/cmdlineTests/combined_json_generated_sources/output b/test/cmdlineTests/combined_json_generated_sources/output index 3cf5cfb68..0bd9395fe 100644 --- a/test/cmdlineTests/combined_json_generated_sources/output +++ b/test/cmdlineTests/combined_json_generated_sources/output @@ -17,14 +17,294 @@ "body": { "nodeType": "YulBlock", - "src": "114:478:1", + "src": "47:35:1", + "statements": + [ + { + "nodeType": "YulAssignment", + "src": "57:19:1", + "value": + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "73:2:1", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "67:5:1" + }, + "nodeType": "YulFunctionCall", + "src": "67:9:1" + }, + "variableNames": + [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "57:6:1" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "40:6:1", + "type": "" + } + ], + "src": "7:75:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "177:28:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "194:1:1", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "197:1:1", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "187:6:1" + }, + "nodeType": "YulFunctionCall", + "src": "187:12:1" + }, + "nodeType": "YulExpressionStatement", + "src": "187:12:1" + } + ] + }, + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulFunctionDefinition", + "src": "88:117:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "300:28:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "317:1:1", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "320:1:1", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "310:6:1" + }, + "nodeType": "YulFunctionCall", + "src": "310:12:1" + }, + "nodeType": "YulExpressionStatement", + "src": "310:12:1" + } + ] + }, + "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nodeType": "YulFunctionDefinition", + "src": "211:117:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "423:28:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "440:1:1", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "443:1:1", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "433:6:1" + }, + "nodeType": "YulFunctionCall", + "src": "433:12:1" + }, + "nodeType": "YulExpressionStatement", + "src": "433:12:1" + } + ] + }, + "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", + "nodeType": "YulFunctionDefinition", + "src": "334:117:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "546:28:1", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "563:1:1", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "566:1:1", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "556:6:1" + }, + "nodeType": "YulFunctionCall", + "src": "556:12:1" + }, + "nodeType": "YulExpressionStatement", + "src": "556:12:1" + } + ] + }, + "name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490", + "nodeType": "YulFunctionDefinition", + "src": "457:117:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "669:28: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" + } + ], + "functionName": + { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "679:6:1" + }, + "nodeType": "YulFunctionCall", + "src": "679:12:1" + }, + "nodeType": "YulExpressionStatement", + "src": "679:12:1" + } + ] + }, + "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", + "nodeType": "YulFunctionDefinition", + "src": "580:117:1" + }, + { + "body": + { + "nodeType": "YulBlock", + "src": "810:478:1", "statements": [ { "body": { "nodeType": "YulBlock", - "src": "163:83:1", + "src": "859:83:1", "statements": [ { @@ -35,13 +315,13 @@ { "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", "nodeType": "YulIdentifier", - "src": "165:77:1" + "src": "861:77:1" }, "nodeType": "YulFunctionCall", - "src": "165:79:1" + "src": "861:79:1" }, "nodeType": "YulExpressionStatement", - "src": "165:79:1" + "src": "861:79:1" } ] }, @@ -58,12 +338,12 @@ { "name": "offset", "nodeType": "YulIdentifier", - "src": "142:6:1" + "src": "838:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "150:4:1", + "src": "846:4:1", "type": "", "value": "0x1f" } @@ -72,42 +352,42 @@ { "name": "add", "nodeType": "YulIdentifier", - "src": "138:3:1" + "src": "834:3:1" }, "nodeType": "YulFunctionCall", - "src": "138:17:1" + "src": "834:17:1" }, { "name": "end", "nodeType": "YulIdentifier", - "src": "157:3:1" + "src": "853:3:1" } ], "functionName": { "name": "slt", "nodeType": "YulIdentifier", - "src": "134:3:1" + "src": "830:3:1" }, "nodeType": "YulFunctionCall", - "src": "134:27:1" + "src": "830:27:1" } ], "functionName": { "name": "iszero", "nodeType": "YulIdentifier", - "src": "127:6:1" + "src": "823:6:1" }, "nodeType": "YulFunctionCall", - "src": "127:35:1" + "src": "823:35:1" }, "nodeType": "YulIf", - "src": "124:122:1" + "src": "820:122:1" }, { "nodeType": "YulAssignment", - "src": "255:30:1", + "src": "951:30:1", "value": { "arguments": @@ -115,24 +395,24 @@ { "name": "offset", "nodeType": "YulIdentifier", - "src": "278:6:1" + "src": "974:6:1" } ], "functionName": { "name": "calldataload", "nodeType": "YulIdentifier", - "src": "265:12:1" + "src": "961:12:1" }, "nodeType": "YulFunctionCall", - "src": "265:20:1" + "src": "961:20:1" }, "variableNames": [ { "name": "length", "nodeType": "YulIdentifier", - "src": "255:6:1" + "src": "951:6:1" } ] }, @@ -140,7 +420,7 @@ "body": { "nodeType": "YulBlock", - "src": "328:83:1", + "src": "1024:83:1", "statements": [ { @@ -151,13 +431,13 @@ { "name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490", "nodeType": "YulIdentifier", - "src": "330:77:1" + "src": "1026:77:1" }, "nodeType": "YulFunctionCall", - "src": "330:79:1" + "src": "1026:79:1" }, "nodeType": "YulExpressionStatement", - "src": "330:79:1" + "src": "1026:79:1" } ] }, @@ -168,12 +448,12 @@ { "name": "length", "nodeType": "YulIdentifier", - "src": "300:6:1" + "src": "996:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "308:18:1", + "src": "1004:18:1", "type": "", "value": "0xffffffffffffffff" } @@ -182,17 +462,17 @@ { "name": "gt", "nodeType": "YulIdentifier", - "src": "297:2:1" + "src": "993:2:1" }, "nodeType": "YulFunctionCall", - "src": "297:30:1" + "src": "993:30:1" }, "nodeType": "YulIf", - "src": "294:117:1" + "src": "990:117:1" }, { "nodeType": "YulAssignment", - "src": "420:29:1", + "src": "1116:29:1", "value": { "arguments": @@ -200,12 +480,12 @@ { "name": "offset", "nodeType": "YulIdentifier", - "src": "436:6:1" + "src": "1132:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "444:4:1", + "src": "1140:4:1", "type": "", "value": "0x20" } @@ -214,17 +494,17 @@ { "name": "add", "nodeType": "YulIdentifier", - "src": "432:3:1" + "src": "1128:3:1" }, "nodeType": "YulFunctionCall", - "src": "432:17:1" + "src": "1128:17:1" }, "variableNames": [ { "name": "arrayPos", "nodeType": "YulIdentifier", - "src": "420:8:1" + "src": "1116:8:1" } ] }, @@ -232,7 +512,7 @@ "body": { "nodeType": "YulBlock", - "src": "503:83:1", + "src": "1199:83:1", "statements": [ { @@ -243,13 +523,13 @@ { "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", "nodeType": "YulIdentifier", - "src": "505:77:1" + "src": "1201:77:1" }, "nodeType": "YulFunctionCall", - "src": "505:79:1" + "src": "1201:79:1" }, "nodeType": "YulExpressionStatement", - "src": "505:79:1" + "src": "1201:79:1" } ] }, @@ -263,7 +543,7 @@ { "name": "arrayPos", "nodeType": "YulIdentifier", - "src": "468:8:1" + "src": "1164:8:1" }, { "arguments": @@ -271,12 +551,12 @@ { "name": "length", "nodeType": "YulIdentifier", - "src": "482:6:1" + "src": "1178:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "490:4:1", + "src": "1186:4:1", "type": "", "value": "0x20" } @@ -285,38 +565,38 @@ { "name": "mul", "nodeType": "YulIdentifier", - "src": "478:3:1" + "src": "1174:3:1" }, "nodeType": "YulFunctionCall", - "src": "478:17:1" + "src": "1174:17:1" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", - "src": "464:3:1" + "src": "1160:3:1" }, "nodeType": "YulFunctionCall", - "src": "464:32:1" + "src": "1160:32:1" }, { "name": "end", "nodeType": "YulIdentifier", - "src": "498:3:1" + "src": "1194:3:1" } ], "functionName": { "name": "gt", "nodeType": "YulIdentifier", - "src": "461:2:1" + "src": "1157:2:1" }, "nodeType": "YulFunctionCall", - "src": "461:41:1" + "src": "1157:41:1" }, "nodeType": "YulIf", - "src": "458:128:1" + "src": "1154:128:1" } ] }, @@ -327,13 +607,13 @@ { "name": "offset", "nodeType": "YulTypedName", - "src": "81:6:1", + "src": "777:6:1", "type": "" }, { "name": "end", "nodeType": "YulTypedName", - "src": "89:3:1", + "src": "785:3:1", "type": "" } ], @@ -342,30 +622,30 @@ { "name": "arrayPos", "nodeType": "YulTypedName", - "src": "97:8:1", + "src": "793:8:1", "type": "" }, { "name": "length", "nodeType": "YulTypedName", - "src": "107:6:1", + "src": "803:6:1", "type": "" } ], - "src": "24:568:1" + "src": "720:568:1" }, { "body": { "nodeType": "YulBlock", - "src": "699:458:1", + "src": "1395:458:1", "statements": [ { "body": { "nodeType": "YulBlock", - "src": "745:83:1", + "src": "1441:83:1", "statements": [ { @@ -376,13 +656,13 @@ { "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", "nodeType": "YulIdentifier", - "src": "747:77:1" + "src": "1443:77:1" }, "nodeType": "YulFunctionCall", - "src": "747:79:1" + "src": "1443:79:1" }, "nodeType": "YulExpressionStatement", - "src": "747:79:1" + "src": "1443:79:1" } ] }, @@ -396,27 +676,27 @@ { "name": "dataEnd", "nodeType": "YulIdentifier", - "src": "720:7:1" + "src": "1416:7:1" }, { "name": "headStart", "nodeType": "YulIdentifier", - "src": "729:9:1" + "src": "1425:9:1" } ], "functionName": { "name": "sub", "nodeType": "YulIdentifier", - "src": "716:3:1" + "src": "1412:3:1" }, "nodeType": "YulFunctionCall", - "src": "716:23:1" + "src": "1412:23:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "741:2:1", + "src": "1437:2:1", "type": "", "value": "32" } @@ -425,22 +705,22 @@ { "name": "slt", "nodeType": "YulIdentifier", - "src": "712:3:1" + "src": "1408:3:1" }, "nodeType": "YulFunctionCall", - "src": "712:32:1" + "src": "1408:32:1" }, "nodeType": "YulIf", - "src": "709:119:1" + "src": "1405:119:1" }, { "nodeType": "YulBlock", - "src": "838:312:1", + "src": "1534:312:1", "statements": [ { "nodeType": "YulVariableDeclaration", - "src": "853:45:1", + "src": "1549:45:1", "value": { "arguments": @@ -451,12 +731,12 @@ { "name": "headStart", "nodeType": "YulIdentifier", - "src": "884:9:1" + "src": "1580:9:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "895:1:1", + "src": "1591:1:1", "type": "", "value": "0" } @@ -465,27 +745,27 @@ { "name": "add", "nodeType": "YulIdentifier", - "src": "880:3:1" + "src": "1576:3:1" }, "nodeType": "YulFunctionCall", - "src": "880:17:1" + "src": "1576:17:1" } ], "functionName": { "name": "calldataload", "nodeType": "YulIdentifier", - "src": "867:12:1" + "src": "1563:12:1" }, "nodeType": "YulFunctionCall", - "src": "867:31:1" + "src": "1563:31:1" }, "variables": [ { "name": "offset", "nodeType": "YulTypedName", - "src": "857:6:1", + "src": "1553:6:1", "type": "" } ] @@ -494,7 +774,7 @@ "body": { "nodeType": "YulBlock", - "src": "945:83:1", + "src": "1641:83:1", "statements": [ { @@ -505,13 +785,13 @@ { "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", "nodeType": "YulIdentifier", - "src": "947:77:1" + "src": "1643:77:1" }, "nodeType": "YulFunctionCall", - "src": "947:79:1" + "src": "1643:79:1" }, "nodeType": "YulExpressionStatement", - "src": "947:79:1" + "src": "1643:79:1" } ] }, @@ -522,12 +802,12 @@ { "name": "offset", "nodeType": "YulIdentifier", - "src": "917:6:1" + "src": "1613:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "925:18:1", + "src": "1621:18:1", "type": "", "value": "0xffffffffffffffff" } @@ -536,17 +816,17 @@ { "name": "gt", "nodeType": "YulIdentifier", - "src": "914:2:1" + "src": "1610:2:1" }, "nodeType": "YulFunctionCall", - "src": "914:30:1" + "src": "1610:30:1" }, "nodeType": "YulIf", - "src": "911:117:1" + "src": "1607:117:1" }, { "nodeType": "YulAssignment", - "src": "1042:98:1", + "src": "1738:98:1", "value": { "arguments": @@ -557,49 +837,49 @@ { "name": "headStart", "nodeType": "YulIdentifier", - "src": "1112:9:1" + "src": "1808:9:1" }, { "name": "offset", "nodeType": "YulIdentifier", - "src": "1123:6:1" + "src": "1819:6:1" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", - "src": "1108:3:1" + "src": "1804:3:1" }, "nodeType": "YulFunctionCall", - "src": "1108:22:1" + "src": "1804:22:1" }, { "name": "dataEnd", "nodeType": "YulIdentifier", - "src": "1132:7:1" + "src": "1828:7:1" } ], "functionName": { "name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr", "nodeType": "YulIdentifier", - "src": "1060:47:1" + "src": "1756:47:1" }, "nodeType": "YulFunctionCall", - "src": "1060:80:1" + "src": "1756:80:1" }, "variableNames": [ { "name": "value0", "nodeType": "YulIdentifier", - "src": "1042:6:1" + "src": "1738:6:1" }, { "name": "value1", "nodeType": "YulIdentifier", - "src": "1050:6:1" + "src": "1746:6:1" } ] } @@ -614,13 +894,13 @@ { "name": "headStart", "nodeType": "YulTypedName", - "src": "661:9:1", + "src": "1357:9:1", "type": "" }, { "name": "dataEnd", "nodeType": "YulTypedName", - "src": "672:7:1", + "src": "1368:7:1", "type": "" } ], @@ -629,301 +909,21 @@ { "name": "value0", "nodeType": "YulTypedName", - "src": "684:6:1", + "src": "1380:6:1", "type": "" }, { "name": "value1", "nodeType": "YulTypedName", - "src": "692:6:1", + "src": "1388:6:1", "type": "" } ], - "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" + "src": "1294:559: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_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", + "contents": "{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {\n revert(0, 0)\n }\n\n function revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490() {\n revert(0, 0)\n }\n\n function revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() {\n revert(0, 0)\n }\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}\n", "id": 1, "language": "Yul", "name": "#utility.yul" diff --git a/test/cmdlineTests/exp_base_literal/output b/test/cmdlineTests/exp_base_literal/output index 36d7800a0..f4f8042c2 100644 --- a/test/cmdlineTests/exp_base_literal/output +++ b/test/cmdlineTests/exp_base_literal/output @@ -25,6 +25,10 @@ object "C_81" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:82:370 function constructor_C_81() { @@ -33,10 +37,6 @@ object "C_81" { } /// @src 0:82:370 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:"exp_base_literal/input.sol" object "C_81_deployed" { @@ -66,6 +66,37 @@ object "C_81" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function cleanup_t_uint256(value) -> cleaned { + cleaned := value + } + + function validator_revert_t_uint256(value) { + if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } + } + function abi_decode_t_uint256(offset, end) -> value { value := calldataload(offset) validator_revert_t_uint256(value) @@ -104,14 +135,18 @@ object "C_81" { } - function abi_encode_t_int256_to_t_int256_fromStack(value, pos) { - mstore(pos, cleanup_t_int256(value)) - } - function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) { mstore(pos, cleanup_t_uint256(value)) } + function cleanup_t_int256(value) -> cleaned { + cleaned := value + } + + function abi_encode_t_int256_to_t_int256_fromStack(value, pos) { + mstore(pos, cleanup_t_int256(value)) + } + function abi_encode_tuple_t_uint256_t_int256_t_uint256_t_uint256__to_t_uint256_t_int256_t_uint256_t_uint256__fromStack(headStart , value0, value1, value2, value3) -> tail { tail := add(headStart, 128) @@ -125,36 +160,34 @@ object "C_81" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) } - function checked_exp_t_rational_0_by_1_t_uint256(exponent) -> power { - exponent := cleanup_t_uint256(exponent) - - power := exp(0, exponent) + function zero_value_for_split_t_uint256() -> ret { + ret := 0 } - function checked_exp_t_rational_10_by_1_t_uint256(exponent) -> power { - exponent := cleanup_t_uint256(exponent) - - if gt(exponent, 77) { panic_error_0x11() } - - power := exp(10, exponent) + function zero_value_for_split_t_int256() -> ret { + ret := 0 } - function checked_exp_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_t_uint256(exponent) -> power { - exponent := cleanup_t_uint256(exponent) - - if gt(exponent, 1) { panic_error_0x11() } - - power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639935, exponent) + function cleanup_t_rational_2_by_1(value) -> cleaned { + cleaned := value } - function checked_exp_t_rational_1_by_1_t_uint256(exponent) -> power { - exponent := cleanup_t_uint256(exponent) + function identity(value) -> ret { + ret := value + } - power := exp(1, exponent) + function convert_t_rational_2_by_1_to_t_uint256(value) -> converted { + converted := cleanup_t_uint256(identity(cleanup_t_rational_2_by_1(value))) + } + + function panic_error_0x11() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x11) + revert(0, 0x24) } function checked_exp_t_rational_2_by_1_t_uint256(exponent) -> power { @@ -165,10 +198,12 @@ object "C_81" { power := exp(2, exponent) } - function checked_exp_t_rational_minus_1_by_1_t_uint256(exponent) -> power { - exponent := cleanup_t_uint256(exponent) + function cleanup_t_rational_minus_2_by_1(value) -> cleaned { + cleaned := value + } - power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639935, exponent) + function convert_t_rational_minus_2_by_1_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_rational_minus_2_by_1(value))) } function checked_exp_t_rational_minus_2_by_1_t_uint256(exponent) -> power { @@ -179,39 +214,39 @@ object "C_81" { power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639934, exponent) } - function cleanup_t_int256(value) -> cleaned { - cleaned := value - } - - function cleanup_t_rational_0_by_1(value) -> cleaned { - cleaned := value - } - function cleanup_t_rational_10_by_1(value) -> cleaned { cleaned := value } + function convert_t_rational_10_by_1_to_t_uint256(value) -> converted { + converted := cleanup_t_uint256(identity(cleanup_t_rational_10_by_1(value))) + } + + function checked_exp_t_rational_10_by_1_t_uint256(exponent) -> power { + exponent := cleanup_t_uint256(exponent) + + if gt(exponent, 77) { panic_error_0x11() } + + power := exp(10, exponent) + } + function cleanup_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1(value) -> cleaned { cleaned := value } - function cleanup_t_rational_1_by_1(value) -> cleaned { - cleaned := value + function convert_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_to_t_uint256(value) -> converted { + converted := cleanup_t_uint256(identity(cleanup_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1(value))) } - function cleanup_t_rational_2_by_1(value) -> cleaned { - cleaned := value + function checked_exp_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_t_uint256(exponent) -> power { + exponent := cleanup_t_uint256(exponent) + + if gt(exponent, 1) { panic_error_0x11() } + + power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639935, exponent) } - function cleanup_t_rational_minus_1_by_1(value) -> cleaned { - cleaned := value - } - - function cleanup_t_rational_minus_2_by_1(value) -> cleaned { - cleaned := value - } - - function cleanup_t_uint256(value) -> cleaned { + function cleanup_t_rational_0_by_1(value) -> cleaned { cleaned := value } @@ -219,28 +254,38 @@ object "C_81" { converted := cleanup_t_uint256(identity(cleanup_t_rational_0_by_1(value))) } - function convert_t_rational_10_by_1_to_t_uint256(value) -> converted { - converted := cleanup_t_uint256(identity(cleanup_t_rational_10_by_1(value))) + function checked_exp_t_rational_0_by_1_t_uint256(exponent) -> power { + exponent := cleanup_t_uint256(exponent) + + power := exp(0, exponent) } - function convert_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_to_t_uint256(value) -> converted { - converted := cleanup_t_uint256(identity(cleanup_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1(value))) - } - - function convert_t_rational_1_by_1_to_t_uint256(value) -> converted { - converted := cleanup_t_uint256(identity(cleanup_t_rational_1_by_1(value))) - } - - function convert_t_rational_2_by_1_to_t_uint256(value) -> converted { - converted := cleanup_t_uint256(identity(cleanup_t_rational_2_by_1(value))) + function cleanup_t_rational_minus_1_by_1(value) -> cleaned { + cleaned := value } function convert_t_rational_minus_1_by_1_to_t_int256(value) -> converted { converted := cleanup_t_int256(identity(cleanup_t_rational_minus_1_by_1(value))) } - function convert_t_rational_minus_2_by_1_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_rational_minus_2_by_1(value))) + function checked_exp_t_rational_minus_1_by_1_t_uint256(exponent) -> power { + exponent := cleanup_t_uint256(exponent) + + power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639935, exponent) + } + + function cleanup_t_rational_1_by_1(value) -> cleaned { + cleaned := value + } + + function convert_t_rational_1_by_1_to_t_uint256(value) -> converted { + converted := cleanup_t_uint256(identity(cleanup_t_rational_1_by_1(value))) + } + + function checked_exp_t_rational_1_by_1_t_uint256(exponent) -> power { + exponent := cleanup_t_uint256(exponent) + + power := exp(1, exponent) } /// @src 0:96:368 @@ -369,51 +414,6 @@ object "C_81" { } /// @src 0:82:370 - function identity(value) -> ret { - ret := value - } - - function panic_error_0x11() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x11) - 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 := - - shr(224, value) - - } - - function validator_revert_t_uint256(value) { - if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } - } - - function zero_value_for_split_t_int256() -> ret { - ret := 0 - } - - function zero_value_for_split_t_uint256() -> ret { - ret := 0 - } - } data ".metadata" hex"" diff --git a/test/cmdlineTests/name_simplifier/output b/test/cmdlineTests/name_simplifier/output index a774ead21..fcd70e0b0 100644 --- a/test/cmdlineTests/name_simplifier/output +++ b/test/cmdlineTests/name_simplifier/output @@ -62,6 +62,26 @@ object "C_59" { } revert(0, 0) } + function panic_error_0x41() + { + mstore(0, shl(224, 0x4e487b71)) + mstore(4, 0x41) + revert(0, 0x24) + } + function allocate_memory_1236() -> memPtr + { + memPtr := mload(64) + let newFreePtr := add(memPtr, 32) + if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() } + mstore(64, newFreePtr) + } + function allocate_memory(size) -> memPtr + { + memPtr := mload(64) + let newFreePtr := add(memPtr, and(add(size, 31), not(31))) + if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() } + mstore(64, newFreePtr) + } function abi_encode_uint256_string(headStart, value0, value1) -> tail { mstore(headStart, value0) @@ -80,19 +100,11 @@ object "C_59" { } tail := add(add(headStart, and(add(length, 31), not(31))), 96) } - function allocate_memory_1236() -> memPtr + function panic_error_0x32() { - memPtr := mload(64) - let newFreePtr := add(memPtr, 32) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() } - mstore(64, newFreePtr) - } - function allocate_memory(size) -> memPtr - { - memPtr := mload(64) - let newFreePtr := add(memPtr, and(add(size, 31), not(31))) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() } - mstore(64, newFreePtr) + mstore(0, shl(224, 0x4e487b71)) + mstore(4, 0x32) + revert(0, 0x24) } /// @src 0:381:623 function fun_sumArray(var_s_mpos) -> var, var_mpos @@ -118,19 +130,6 @@ object "C_59" { /// @src 0:500:619 var_mpos := memPtr } - /// @src 0:346:625 - function panic_error_0x32() - { - mstore(0, shl(224, 0x4e487b71)) - mstore(4, 0x32) - revert(0, 0x24) - } - function panic_error_0x41() - { - mstore(0, shl(224, 0x4e487b71)) - mstore(4, 0x41) - revert(0, 0x24) - } } data ".metadata" hex"" } diff --git a/test/cmdlineTests/revert_strings/output b/test/cmdlineTests/revert_strings/output index be43c5d0d..fde886ed5 100644 --- a/test/cmdlineTests/revert_strings/output +++ b/test/cmdlineTests/revert_strings/output @@ -25,14 +25,6 @@ object "C_15" { memPtr := mload(64) } - /// @src 0:59:147 - function constructor_C_15() { - - /// @src 0:59:147 - - } - /// @src 0:59:147 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { let start := allocate_unbounded() @@ -52,6 +44,14 @@ object "C_15" { } + /// @src 0:59:147 + function constructor_C_15() { + + /// @src 0:59:147 + + } + /// @src 0:59:147 + } /// @use-src 0:"revert_strings/input.sol" object "C_15_deployed" { @@ -81,233 +81,17 @@ object "C_15" { 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 + function shift_right_224_unsigned(value) -> newValue { + newValue := - mstore(array, length) - dst := add(array, 0x20) + shr(224, value) - 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) - } - - /// @src 0:93:145 - function fun_f_14(var__7_mpos, var_e_10) { - - } - /// @src 0:59:147 - - 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() @@ -346,25 +130,241 @@ object "C_15" { } + 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_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 round_up_to_mul_of_32(value) -> result { result := and(add(value, 31), not(31)) } - function shift_right_224_unsigned(value) -> newValue { - newValue := + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } - shr(224, 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 allocate_memory(size) -> memPtr { + memPtr := allocate_unbounded() + finalize_allocation(memPtr, size) + } + + 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 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 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 validator_revert_t_uint256(value) { + if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } + } + + function abi_decode_t_uint256(offset, end) -> value { + value := calldataload(offset) + validator_revert_t_uint256(value) + } + + // 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_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) + } + + // 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_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) } 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) } + function abi_decode_t_enum$_E_$3(offset, end) -> value { + value := calldataload(offset) + validator_revert_t_enum$_E_$3(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 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) + + } + + /// @src 0:93:145 + function fun_f_14(var__7_mpos, var_e_10) { + + } + /// @src 0:59:147 + } data ".metadata" hex"" diff --git a/test/cmdlineTests/standard_function_debug_info/output.json b/test/cmdlineTests/standard_function_debug_info/output.json index e0e6d7257..ed0de9572 100644 --- a/test/cmdlineTests/standard_function_debug_info/output.json +++ b/test/cmdlineTests/standard_function_debug_info/output.json @@ -1 +1 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"functionDebugData":{}},"deployedBytecode":{"functionDebugData":{"@f_19":{"entryPoint":96,"id":19,"parameterSlots":1,"returnSlots":1},"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":171,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":283,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":329,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":350,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint256_to_t_uint256_fromStack":{"entryPoint":423,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed":{"entryPoint":438,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_memory":{"entryPoint":465,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":492,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":502,"id":null,"parameterSlots":1,"returnSlots":1},"checked_add_t_uint256":{"entryPoint":546,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":632,"id":null,"parameterSlots":1,"returnSlots":1},"finalize_allocation":{"entryPoint":642,"id":null,"parameterSlots":2,"returnSlots":0},"panic_error_0x11":{"entryPoint":691,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x32":{"entryPoint":738,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":785,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":832,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef":{"entryPoint":837,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":842,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":847,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":852,"id":null,"parameterSlots":1,"returnSlots":1},"validator_revert_t_uint256":{"entryPoint":869,"id":null,"parameterSlots":1,"returnSlots":0}}}}}}},"sources":{"a.sol":{"id":0}}} +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"functionDebugData":{}},"deployedBytecode":{"functionDebugData":{"@f_19":{"entryPoint":96,"id":19,"parameterSlots":1,"returnSlots":1},"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":439,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":551,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":418,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":597,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint256_to_t_uint256_fromStack":{"entryPoint":670,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed":{"entryPoint":685,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_memory":{"entryPoint":309,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":171,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":336,"id":null,"parameterSlots":1,"returnSlots":1},"checked_add_t_uint256":{"entryPoint":806,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":385,"id":null,"parameterSlots":1,"returnSlots":1},"finalize_allocation":{"entryPoint":260,"id":null,"parameterSlots":2,"returnSlots":0},"panic_error_0x11":{"entryPoint":759,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x32":{"entryPoint":712,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":213,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":191,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef":{"entryPoint":380,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":186,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":181,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":196,"id":null,"parameterSlots":1,"returnSlots":1},"validator_revert_t_uint256":{"entryPoint":395,"id":null,"parameterSlots":1,"returnSlots":0}}}}}}},"sources":{"a.sol":{"id":0}}} diff --git a/test/cmdlineTests/standard_generatedSources/output.json b/test/cmdlineTests/standard_generatedSources/output.json index b09f6750f..6c7f72b6a 100644 --- a/test/cmdlineTests/standard_generatedSources/output.json +++ b/test/cmdlineTests/standard_generatedSources/output.json @@ -1,4 +1,70 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:4001:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:620:1","statements":[{"nodeType":"YulAssignment","src":"136:90:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"218:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"161:56:1"},"nodeType":"YulFunctionCall","src":"161:64:1"}],"functionName":{"name":"allocate_memory","nodeType":"YulIdentifier","src":"145:15:1"},"nodeType":"YulFunctionCall","src":"145:81:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"235:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"246:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"239:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"268:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"275:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"261:6:1"},"nodeType":"YulFunctionCall","src":"261:21:1"},"nodeType":"YulExpressionStatement","src":"261:21:1"},{"nodeType":"YulAssignment","src":"291:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"302:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"309:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"298:3:1"},"nodeType":"YulFunctionCall","src":"298:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"291:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"324:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"335:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"328:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"390:103:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef","nodeType":"YulIdentifier","src":"404:77:1"},"nodeType":"YulFunctionCall","src":"404:79:1"},"nodeType":"YulExpressionStatement","src":"404:79:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"360:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"369:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"377:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"365:3:1"},"nodeType":"YulFunctionCall","src":"365:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"356:3:1"},"nodeType":"YulFunctionCall","src":"356:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"385:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"353:2:1"},"nodeType":"YulFunctionCall","src":"353:36:1"},"nodeType":"YulIf","src":"350:143:1"},{"body":{"nodeType":"YulBlock","src":"562:178:1","statements":[{"nodeType":"YulVariableDeclaration","src":"577:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"595:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"581:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"619:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"645:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"657:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"624:20:1"},"nodeType":"YulFunctionCall","src":"624:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"612:6:1"},"nodeType":"YulFunctionCall","src":"612:50:1"},"nodeType":"YulExpressionStatement","src":"612:50:1"},{"nodeType":"YulAssignment","src":"675:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"686:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"691:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"682:3:1"},"nodeType":"YulFunctionCall","src":"682:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"675:3:1"}]},{"nodeType":"YulAssignment","src":"709:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"720:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"725:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"716:3:1"},"nodeType":"YulFunctionCall","src":"716:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"709:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"524:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"527:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"521:2:1"},"nodeType":"YulFunctionCall","src":"521:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"535:18:1","statements":[{"nodeType":"YulAssignment","src":"537:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"546:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"549:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"542:3:1"},"nodeType":"YulFunctionCall","src":"542:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"537:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"506:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"508:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"517:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"512:1:1","type":""}]}]},"src":"502:238:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"96:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"104:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"112:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"120:5:1","type":""}],"src":"24:722:1"},{"body":{"nodeType":"YulBlock","src":"846:293:1","statements":[{"body":{"nodeType":"YulBlock","src":"895:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nodeType":"YulIdentifier","src":"897:77:1"},"nodeType":"YulFunctionCall","src":"897:79:1"},"nodeType":"YulExpressionStatement","src":"897:79:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"874:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"882:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"870:3:1"},"nodeType":"YulFunctionCall","src":"870:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"889:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"866:3:1"},"nodeType":"YulFunctionCall","src":"866:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"859:6:1"},"nodeType":"YulFunctionCall","src":"859:35:1"},"nodeType":"YulIf","src":"856:122:1"},{"nodeType":"YulVariableDeclaration","src":"987:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1014:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1001:12:1"},"nodeType":"YulFunctionCall","src":"1001:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"991:6:1","type":""}]},{"nodeType":"YulAssignment","src":"1030:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1106:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1114:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1102:3:1"},"nodeType":"YulFunctionCall","src":"1102:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"1121:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"1129:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1039:62:1"},"nodeType":"YulFunctionCall","src":"1039:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"1030:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"824:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"832:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"840:5:1","type":""}],"src":"769:370:1"},{"body":{"nodeType":"YulBlock","src":"1197:87:1","statements":[{"nodeType":"YulAssignment","src":"1207:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1229:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1216:12:1"},"nodeType":"YulFunctionCall","src":"1216:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1207:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1272:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1245:26:1"},"nodeType":"YulFunctionCall","src":"1245:33:1"},"nodeType":"YulExpressionStatement","src":"1245:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1175:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1183:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1191:5:1","type":""}],"src":"1145:139:1"},{"body":{"nodeType":"YulBlock","src":"1381:448:1","statements":[{"body":{"nodeType":"YulBlock","src":"1427:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulIdentifier","src":"1429:77:1"},"nodeType":"YulFunctionCall","src":"1429:79:1"},"nodeType":"YulExpressionStatement","src":"1429:79:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1402:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1411:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1398:3:1"},"nodeType":"YulFunctionCall","src":"1398:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1423:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1394:3:1"},"nodeType":"YulFunctionCall","src":"1394:32:1"},"nodeType":"YulIf","src":"1391:119:1"},{"nodeType":"YulBlock","src":"1520:302:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1535:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1566:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1577:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1562:3:1"},"nodeType":"YulFunctionCall","src":"1562:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1549:12:1"},"nodeType":"YulFunctionCall","src":"1549:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1539:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1627:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nodeType":"YulIdentifier","src":"1629:77:1"},"nodeType":"YulFunctionCall","src":"1629:79:1"},"nodeType":"YulExpressionStatement","src":"1629:79:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1599:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1607:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1596:2:1"},"nodeType":"YulFunctionCall","src":"1596:30:1"},"nodeType":"YulIf","src":"1593:117:1"},{"nodeType":"YulAssignment","src":"1724:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1784:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1795:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1780:3:1"},"nodeType":"YulFunctionCall","src":"1780:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1804:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1734:45:1"},"nodeType":"YulFunctionCall","src":"1734:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1724:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1351:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1362:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1374:6:1","type":""}],"src":"1290:539:1"},{"body":{"nodeType":"YulBlock","src":"1900:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1917:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1940:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1922:17:1"},"nodeType":"YulFunctionCall","src":"1922:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1910:6:1"},"nodeType":"YulFunctionCall","src":"1910:37:1"},"nodeType":"YulExpressionStatement","src":"1910:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1888:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1895:3:1","type":""}],"src":"1835:118:1"},{"body":{"nodeType":"YulBlock","src":"2057:124:1","statements":[{"nodeType":"YulAssignment","src":"2067:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"2079:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"2090:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2075:3:1"},"nodeType":"YulFunctionCall","src":"2075:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"2067:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"2147:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"2160:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"2171:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2156:3:1"},"nodeType":"YulFunctionCall","src":"2156:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"2103:43:1"},"nodeType":"YulFunctionCall","src":"2103:71:1"},"nodeType":"YulExpressionStatement","src":"2103:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"2029:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"2041:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"2052:4:1","type":""}],"src":"1959:222:1"},{"body":{"nodeType":"YulBlock","src":"2228:88:1","statements":[{"nodeType":"YulAssignment","src":"2238:30:1","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nodeType":"YulIdentifier","src":"2248:18:1"},"nodeType":"YulFunctionCall","src":"2248:20:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2238:6:1"}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2297:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"2305:4:1"}],"functionName":{"name":"finalize_allocation","nodeType":"YulIdentifier","src":"2277:19:1"},"nodeType":"YulFunctionCall","src":"2277:33:1"},"nodeType":"YulExpressionStatement","src":"2277:33:1"}]},"name":"allocate_memory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"2212:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"2221:6:1","type":""}],"src":"2187:129:1"},{"body":{"nodeType":"YulBlock","src":"2362:35:1","statements":[{"nodeType":"YulAssignment","src":"2372:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2388:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"2382:5:1"},"nodeType":"YulFunctionCall","src":"2382:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2372:6:1"}]}]},"name":"allocate_unbounded","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"2355:6:1","type":""}],"src":"2322:75:1"},{"body":{"nodeType":"YulBlock","src":"2485:229:1","statements":[{"body":{"nodeType":"YulBlock","src":"2590:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"2592:16:1"},"nodeType":"YulFunctionCall","src":"2592:18:1"},"nodeType":"YulExpressionStatement","src":"2592:18:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2562:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2570:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2559:2:1"},"nodeType":"YulFunctionCall","src":"2559:30:1"},"nodeType":"YulIf","src":"2556:56:1"},{"nodeType":"YulAssignment","src":"2622:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2634:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2642:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2630:3:1"},"nodeType":"YulFunctionCall","src":"2630:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2622:4:1"}]},{"nodeType":"YulAssignment","src":"2684:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2696:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2702:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2692:3:1"},"nodeType":"YulFunctionCall","src":"2692:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2684:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2469:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2480:4:1","type":""}],"src":"2403:311:1"},{"body":{"nodeType":"YulBlock","src":"2765:32:1","statements":[{"nodeType":"YulAssignment","src":"2775:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2786:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2775:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2747:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2757:7:1","type":""}],"src":"2720:77:1"},{"body":{"nodeType":"YulBlock","src":"2846:238:1","statements":[{"nodeType":"YulVariableDeclaration","src":"2856:58:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2878:6:1"},{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2908:4:1"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"2886:21:1"},"nodeType":"YulFunctionCall","src":"2886:27:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2874:3:1"},"nodeType":"YulFunctionCall","src":"2874:40:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"2860:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"3025:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"3027:16:1"},"nodeType":"YulFunctionCall","src":"3027:18:1"},"nodeType":"YulExpressionStatement","src":"3027:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2968:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2980:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2965:2:1"},"nodeType":"YulFunctionCall","src":"2965:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"3004:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"3016:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"3001:2:1"},"nodeType":"YulFunctionCall","src":"3001:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2962:2:1"},"nodeType":"YulFunctionCall","src":"2962:62:1"},"nodeType":"YulIf","src":"2959:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3063:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"3067:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"3056:6:1"},"nodeType":"YulFunctionCall","src":"3056:22:1"},"nodeType":"YulExpressionStatement","src":"3056:22:1"}]},"name":"finalize_allocation","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nodeType":"YulTypedName","src":"2832:6:1","type":""},{"name":"size","nodeType":"YulTypedName","src":"2840:4:1","type":""}],"src":"2803:281:1"},{"body":{"nodeType":"YulBlock","src":"3118:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3135:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3138:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"3128:6:1"},"nodeType":"YulFunctionCall","src":"3128:88:1"},"nodeType":"YulExpressionStatement","src":"3128:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3232:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"3235:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"3225:6:1"},"nodeType":"YulFunctionCall","src":"3225:15:1"},"nodeType":"YulExpressionStatement","src":"3225:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3256:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3259:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3249:6:1"},"nodeType":"YulFunctionCall","src":"3249:15:1"},"nodeType":"YulExpressionStatement","src":"3249:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"3090:180:1"},{"body":{"nodeType":"YulBlock","src":"3365:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3382:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3385:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3375:6:1"},"nodeType":"YulFunctionCall","src":"3375:12:1"},"nodeType":"YulExpressionStatement","src":"3375:12:1"}]},"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nodeType":"YulFunctionDefinition","src":"3276:117:1"},{"body":{"nodeType":"YulBlock","src":"3488:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3505:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3508:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3498:6:1"},"nodeType":"YulFunctionCall","src":"3498:12:1"},"nodeType":"YulExpressionStatement","src":"3498:12:1"}]},"name":"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef","nodeType":"YulFunctionDefinition","src":"3399:117:1"},{"body":{"nodeType":"YulBlock","src":"3611:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3628:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3631:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3621:6:1"},"nodeType":"YulFunctionCall","src":"3621:12:1"},"nodeType":"YulExpressionStatement","src":"3621:12:1"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nodeType":"YulFunctionDefinition","src":"3522:117:1"},{"body":{"nodeType":"YulBlock","src":"3734:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3751:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3754:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3744:6:1"},"nodeType":"YulFunctionCall","src":"3744:12:1"},"nodeType":"YulExpressionStatement","src":"3744:12:1"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulFunctionDefinition","src":"3645:117:1"},{"body":{"nodeType":"YulBlock","src":"3816:54:1","statements":[{"nodeType":"YulAssignment","src":"3826:38:1","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3844:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"3851:2:1","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3840:3:1"},"nodeType":"YulFunctionCall","src":"3840:14:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3860:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"3856:3:1"},"nodeType":"YulFunctionCall","src":"3856:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"3836:3:1"},"nodeType":"YulFunctionCall","src":"3836:28:1"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"3826:6:1"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3799:5:1","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"3809:6:1","type":""}],"src":"3768:102:1"},{"body":{"nodeType":"YulBlock","src":"3919:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"3976:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3985:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3988:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3978:6:1"},"nodeType":"YulFunctionCall","src":"3978:12:1"},"nodeType":"YulExpressionStatement","src":"3978:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3942:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3967:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"3949:17:1"},"nodeType":"YulFunctionCall","src":"3949:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"3939:2:1"},"nodeType":"YulFunctionCall","src":"3939:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"3932:6:1"},"nodeType":"YulFunctionCall","src":"3932:43:1"},"nodeType":"YulIf","src":"3929:63:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3912:5:1","type":""}],"src":"3876:122:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:4001:1","statements":[{"body":{"nodeType":"YulBlock","src":"47:35:1","statements":[{"nodeType":"YulAssignment","src":"57:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"73:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"67:5:1"},"nodeType":"YulFunctionCall","src":"67:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"57:6:1"}]}]},"name":"allocate_unbounded","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"40:6:1","type":""}],"src":"7:75:1"},{"body":{"nodeType":"YulBlock","src":"177:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"194:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"197:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"187:6:1"},"nodeType":"YulFunctionCall","src":"187:12:1"},"nodeType":"YulExpressionStatement","src":"187:12:1"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulFunctionDefinition","src":"88:117:1"},{"body":{"nodeType":"YulBlock","src":"300:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"317:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"320:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"310:6:1"},"nodeType":"YulFunctionCall","src":"310:12:1"},"nodeType":"YulExpressionStatement","src":"310:12:1"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nodeType":"YulFunctionDefinition","src":"211:117:1"},{"body":{"nodeType":"YulBlock","src":"423:28:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"440:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"443:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"433:6:1"},"nodeType":"YulFunctionCall","src":"433:12:1"},"nodeType":"YulExpressionStatement","src":"433:12:1"}]},"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nodeType":"YulFunctionDefinition","src":"334:117:1"},{"body":{"nodeType":"YulBlock","src":"505:54:1","statements":[{"nodeType":"YulAssignment","src":"515:38:1","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"533:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"540:2:1","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"529:3:1"},"nodeType":"YulFunctionCall","src":"529:14:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"549:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"545:3:1"},"nodeType":"YulFunctionCall","src":"545:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"525:3:1"},"nodeType":"YulFunctionCall","src":"525:28:1"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"515:6:1"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"488:5:1","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"498:6:1","type":""}],"src":"457:102:1"},{"body":{"nodeType":"YulBlock","src":"593:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"610:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"613:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"603:6:1"},"nodeType":"YulFunctionCall","src":"603:88:1"},"nodeType":"YulExpressionStatement","src":"603:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"707:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"710:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"700:6:1"},"nodeType":"YulFunctionCall","src":"700:15:1"},"nodeType":"YulExpressionStatement","src":"700:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"731:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"734:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"724:6:1"},"nodeType":"YulFunctionCall","src":"724:15:1"},"nodeType":"YulExpressionStatement","src":"724:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"565:180:1"},{"body":{"nodeType":"YulBlock","src":"794:238:1","statements":[{"nodeType":"YulVariableDeclaration","src":"804:58:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"826:6:1"},{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"856:4:1"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"834:21:1"},"nodeType":"YulFunctionCall","src":"834:27:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"822:3:1"},"nodeType":"YulFunctionCall","src":"822:40:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"808:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"973:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"975:16:1"},"nodeType":"YulFunctionCall","src":"975:18:1"},"nodeType":"YulExpressionStatement","src":"975:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"916:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"928:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"913:2:1"},"nodeType":"YulFunctionCall","src":"913:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"952:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"964:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"949:2:1"},"nodeType":"YulFunctionCall","src":"949:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"910:2:1"},"nodeType":"YulFunctionCall","src":"910:62:1"},"nodeType":"YulIf","src":"907:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1011:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1015:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1004:6:1"},"nodeType":"YulFunctionCall","src":"1004:22:1"},"nodeType":"YulExpressionStatement","src":"1004:22:1"}]},"name":"finalize_allocation","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nodeType":"YulTypedName","src":"780:6:1","type":""},{"name":"size","nodeType":"YulTypedName","src":"788:4:1","type":""}],"src":"751:281:1"},{"body":{"nodeType":"YulBlock","src":"1079:88:1","statements":[{"nodeType":"YulAssignment","src":"1089:30:1","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nodeType":"YulIdentifier","src":"1099:18:1"},"nodeType":"YulFunctionCall","src":"1099:20:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1089:6:1"}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1148:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1156:4:1"}],"functionName":{"name":"finalize_allocation","nodeType":"YulIdentifier","src":"1128:19:1"},"nodeType":"YulFunctionCall","src":"1128:33:1"},"nodeType":"YulExpressionStatement","src":"1128:33:1"}]},"name":"allocate_memory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1063:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1072:6:1","type":""}],"src":"1038:129:1"},{"body":{"nodeType":"YulBlock","src":"1255:229:1","statements":[{"body":{"nodeType":"YulBlock","src":"1360:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"1362:16:1"},"nodeType":"YulFunctionCall","src":"1362:18:1"},"nodeType":"YulExpressionStatement","src":"1362:18:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"1332:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1340:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1329:2:1"},"nodeType":"YulFunctionCall","src":"1329:30:1"},"nodeType":"YulIf","src":"1326:56:1"},{"nodeType":"YulAssignment","src":"1392:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"1404:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1412:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"1400:3:1"},"nodeType":"YulFunctionCall","src":"1400:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"1392:4:1"}]},{"nodeType":"YulAssignment","src":"1454:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"1466:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"1472:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1462:3:1"},"nodeType":"YulFunctionCall","src":"1462:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"1454:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"1239:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"1250:4:1","type":""}],"src":"1173:311: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":"1658:32:1","statements":[{"nodeType":"YulAssignment","src":"1668:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"1679:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"1668:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1640:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"1650:7:1","type":""}],"src":"1613:77:1"},{"body":{"nodeType":"YulBlock","src":"1739:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"1796:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1805:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1808:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1798:6:1"},"nodeType":"YulFunctionCall","src":"1798:12:1"},"nodeType":"YulExpressionStatement","src":"1798:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1762:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1787:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1769:17:1"},"nodeType":"YulFunctionCall","src":"1769:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"1759:2:1"},"nodeType":"YulFunctionCall","src":"1759:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"1752:6:1"},"nodeType":"YulFunctionCall","src":"1752:43:1"},"nodeType":"YulIf","src":"1749:63:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1732:5:1","type":""}],"src":"1696:122:1"},{"body":{"nodeType":"YulBlock","src":"1876:87:1","statements":[{"nodeType":"YulAssignment","src":"1886:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1908:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1895:12:1"},"nodeType":"YulFunctionCall","src":"1895:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1886:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1951:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1924:26:1"},"nodeType":"YulFunctionCall","src":"1924:33:1"},"nodeType":"YulExpressionStatement","src":"1924:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1854:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1862:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1870:5:1","type":""}],"src":"1824:139:1"},{"body":{"nodeType":"YulBlock","src":"2088:620:1","statements":[{"nodeType":"YulAssignment","src":"2098:90:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2180:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"2123:56:1"},"nodeType":"YulFunctionCall","src":"2123:64:1"}],"functionName":{"name":"allocate_memory","nodeType":"YulIdentifier","src":"2107:15:1"},"nodeType":"YulFunctionCall","src":"2107:81:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"2098:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"2197:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"2208:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"2201:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"2230:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"2237:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2223:6:1"},"nodeType":"YulFunctionCall","src":"2223:21:1"},"nodeType":"YulExpressionStatement","src":"2223:21:1"},{"nodeType":"YulAssignment","src":"2253:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"2264:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"2271:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2260:3:1"},"nodeType":"YulFunctionCall","src":"2260:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"2253:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"2286:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"2297:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"2290:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2352:103:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef","nodeType":"YulIdentifier","src":"2366:77:1"},"nodeType":"YulFunctionCall","src":"2366:79:1"},"nodeType":"YulExpressionStatement","src":"2366:79:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"2322:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2331:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2339:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2327:3:1"},"nodeType":"YulFunctionCall","src":"2327:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2318:3:1"},"nodeType":"YulFunctionCall","src":"2318:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"2347:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2315:2:1"},"nodeType":"YulFunctionCall","src":"2315:36:1"},"nodeType":"YulIf","src":"2312:143:1"},{"body":{"nodeType":"YulBlock","src":"2524:178:1","statements":[{"nodeType":"YulVariableDeclaration","src":"2539:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"2557:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"2543:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"2581:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"2607:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"2619:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"2586:20:1"},"nodeType":"YulFunctionCall","src":"2586:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2574:6:1"},"nodeType":"YulFunctionCall","src":"2574:50:1"},"nodeType":"YulExpressionStatement","src":"2574:50:1"},{"nodeType":"YulAssignment","src":"2637:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"2648:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"2653:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2644:3:1"},"nodeType":"YulFunctionCall","src":"2644:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"2637:3:1"}]},{"nodeType":"YulAssignment","src":"2671:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"2682:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"2687:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2678:3:1"},"nodeType":"YulFunctionCall","src":"2678:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"2671:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"2486:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"2489:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2483:2:1"},"nodeType":"YulFunctionCall","src":"2483:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"2497:18:1","statements":[{"nodeType":"YulAssignment","src":"2499:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"2508:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"2511:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2504:3:1"},"nodeType":"YulFunctionCall","src":"2504:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"2499:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"2468:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"2470:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"2479:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"2474:1:1","type":""}]}]},"src":"2464:238:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"2058:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"2066:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"2074:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"2082:5:1","type":""}],"src":"1986:722:1"},{"body":{"nodeType":"YulBlock","src":"2808:293:1","statements":[{"body":{"nodeType":"YulBlock","src":"2857:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nodeType":"YulIdentifier","src":"2859:77:1"},"nodeType":"YulFunctionCall","src":"2859:79:1"},"nodeType":"YulExpressionStatement","src":"2859:79:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"2836:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2844:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2832:3:1"},"nodeType":"YulFunctionCall","src":"2832:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"2851:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"2828:3:1"},"nodeType":"YulFunctionCall","src":"2828:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"2821:6:1"},"nodeType":"YulFunctionCall","src":"2821:35:1"},"nodeType":"YulIf","src":"2818:122:1"},{"nodeType":"YulVariableDeclaration","src":"2949:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"2976:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"2963:12:1"},"nodeType":"YulFunctionCall","src":"2963:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"2953:6:1","type":""}]},{"nodeType":"YulAssignment","src":"2992:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"3068:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"3076:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3064:3:1"},"nodeType":"YulFunctionCall","src":"3064:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"3083:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"3091:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"3001:62:1"},"nodeType":"YulFunctionCall","src":"3001:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"2992:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"2786:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"2794:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"2802:5:1","type":""}],"src":"2731:370:1"},{"body":{"nodeType":"YulBlock","src":"3198:448:1","statements":[{"body":{"nodeType":"YulBlock","src":"3244:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulIdentifier","src":"3246:77:1"},"nodeType":"YulFunctionCall","src":"3246:79:1"},"nodeType":"YulExpressionStatement","src":"3246:79:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"3219:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"3228:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"3215:3:1"},"nodeType":"YulFunctionCall","src":"3215:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"3240:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"3211:3:1"},"nodeType":"YulFunctionCall","src":"3211:32:1"},"nodeType":"YulIf","src":"3208:119:1"},{"nodeType":"YulBlock","src":"3337:302:1","statements":[{"nodeType":"YulVariableDeclaration","src":"3352:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"3383:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"3394:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3379:3:1"},"nodeType":"YulFunctionCall","src":"3379:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"3366:12:1"},"nodeType":"YulFunctionCall","src":"3366:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"3356:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"3444:83:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nodeType":"YulIdentifier","src":"3446:77:1"},"nodeType":"YulFunctionCall","src":"3446:79:1"},"nodeType":"YulExpressionStatement","src":"3446:79:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"3416:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"3424:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"3413:2:1"},"nodeType":"YulFunctionCall","src":"3413:30:1"},"nodeType":"YulIf","src":"3410:117:1"},{"nodeType":"YulAssignment","src":"3541:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"3601:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"3612:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3597:3:1"},"nodeType":"YulFunctionCall","src":"3597:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"3621:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"3551:45:1"},"nodeType":"YulFunctionCall","src":"3551:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"3541:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"3168:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"3179:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"3191:6:1","type":""}],"src":"3107:539:1"},{"body":{"nodeType":"YulBlock","src":"3717:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"3734:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3757:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"3739:17:1"},"nodeType":"YulFunctionCall","src":"3739:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"3727:6:1"},"nodeType":"YulFunctionCall","src":"3727:37:1"},"nodeType":"YulExpressionStatement","src":"3727:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3705:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"3712:3:1","type":""}],"src":"3652:118:1"},{"body":{"nodeType":"YulBlock","src":"3874:124:1","statements":[{"nodeType":"YulAssignment","src":"3884:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"3896:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"3907:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3892:3:1"},"nodeType":"YulFunctionCall","src":"3892:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"3884:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"3964:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"3977:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"3988:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3973:3:1"},"nodeType":"YulFunctionCall","src":"3973:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"3920:43:1"},"nodeType":"YulFunctionCall","src":"3920:71:1"},"nodeType":"YulExpressionStatement","src":"3920:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"3846:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"3858:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"3869:4:1","type":""}],"src":"3776:222:1"}]},"contents":"{ + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() { + revert(0, 0) + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + 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 allocate_memory(size) -> memPtr { + memPtr := allocate_unbounded() + finalize_allocation(memPtr, size) + } + + 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 revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() { + revert(0, 0) + } + + function cleanup_t_uint256(value) -> cleaned { + cleaned := value + } + + function validator_revert_t_uint256(value) { + if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } + } + + function abi_decode_t_uint256(offset, end) -> value { + value := calldataload(offset) + validator_revert_t_uint256(value) + } // uint256[] function abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(offset, length, end) -> array { @@ -30,11 +96,6 @@ array := abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(add(offset, 0x20), length, end) } - function abi_decode_t_uint256(offset, end) -> value { - value := calldataload(offset) - validator_revert_t_uint256(value) - } - function abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr(headStart, dataEnd) -> value0 { if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } @@ -59,67 +120,6 @@ } - 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_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 panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - revert(0, 0x24) - } - - function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() { - revert(0, 0) - } - - function revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef() { - revert(0, 0) - } - - function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { - 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)) - } - - function validator_revert_t_uint256(value) { - if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } - } - } ","id":1,"language":"Yul","name":"#utility.yul"}]}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"Warning: Source file does not specify required compiler version! --> a.sol diff --git a/test/cmdlineTests/standard_irOptimized_requested/output.json b/test/cmdlineTests/standard_irOptimized_requested/output.json index e94582898..2651856c0 100644 --- a/test/cmdlineTests/standard_irOptimized_requested/output.json +++ b/test/cmdlineTests/standard_irOptimized_requested/output.json @@ -20,10 +20,10 @@ object \"C_7\" { return(_1, datasize(\"C_7_deployed\")) function allocate_unbounded() -> memPtr { memPtr := mload(64) } - function constructor_C_7() - { } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } + function constructor_C_7() + { } } /// @use-src 0:\"A\" object \"C_7_deployed\" { @@ -49,6 +49,14 @@ object \"C_7\" { } if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue + { newValue := shr(224, value) } + function allocate_unbounded() -> memPtr + { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + { revert(0, 0) } + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() + { revert(0, 0) } function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) @@ -58,20 +66,11 @@ object \"C_7\" { } function abi_encode_tuple__to__fromStack(headStart) -> tail { tail := add(headStart, 0) } - function allocate_unbounded() -> memPtr - { memPtr := mload(64) } + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + { revert(0, 0) } /// @src 0:92:119 function fun_f_6() { } - /// @src 0:79:121 - 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) } } data \".metadata\" hex\"\" } diff --git a/test/cmdlineTests/standard_ir_requested/output.json b/test/cmdlineTests/standard_ir_requested/output.json index 3cc5c0808..bc61d38bd 100644 --- a/test/cmdlineTests/standard_ir_requested/output.json +++ b/test/cmdlineTests/standard_ir_requested/output.json @@ -24,6 +24,10 @@ object \"C_7\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:79:121 function constructor_C_7() { @@ -32,10 +36,6 @@ object \"C_7\" { } /// @src 0:79:121 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_7_deployed\" { @@ -65,13 +65,10 @@ object \"C_7\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() - function abi_decode_tuple_(headStart, dataEnd) { - if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } + function shift_right_224_unsigned(value) -> newValue { + newValue := - } - - function abi_encode_tuple__to__fromStack(headStart ) -> tail { - tail := add(headStart, 0) + shr(224, value) } @@ -79,16 +76,6 @@ object \"C_7\" { memPtr := mload(64) } - /// @src 0:92:119 - function fun_f_6() { - - } - /// @src 0:79:121 - - function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { - revert(0, 0) - } - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } @@ -97,13 +84,26 @@ object \"C_7\" { revert(0, 0) } - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) + function abi_decode_tuple_(headStart, dataEnd) { + if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function abi_encode_tuple__to__fromStack(headStart ) -> tail { + tail := add(headStart, 0) + + } + + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + /// @src 0:92:119 + function fun_f_6() { + + } + /// @src 0:79:121 + } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/standard_optimizer_generatedSources/output.json b/test/cmdlineTests/standard_optimizer_generatedSources/output.json index 439101cc4..fba776458 100644 --- a/test/cmdlineTests/standard_optimizer_generatedSources/output.json +++ b/test/cmdlineTests/standard_optimizer_generatedSources/output.json @@ -1,5 +1,11 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1456:1","statements":[{"nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nodeType":"YulBlock","src":"109:1031:1","statements":[{"nodeType":"YulVariableDeclaration","src":"119:12:1","value":{"kind":"number","nodeType":"YulLiteral","src":"129:2:1","type":"","value":"32"},"variables":[{"name":"_1","nodeType":"YulTypedName","src":"123:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"176:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"185:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"188:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"178:6:1"},"nodeType":"YulFunctionCall","src":"178:12:1"},"nodeType":"YulExpressionStatement","src":"178:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"151:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"160:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"147:3:1"},"nodeType":"YulFunctionCall","src":"147:23:1"},{"name":"_1","nodeType":"YulIdentifier","src":"172:2:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"143:3:1"},"nodeType":"YulFunctionCall","src":"143:32:1"},"nodeType":"YulIf","src":"140:52:1"},{"nodeType":"YulVariableDeclaration","src":"201:37:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"228:9:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"215:12:1"},"nodeType":"YulFunctionCall","src":"215:23:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"205:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"247:28:1","value":{"kind":"number","nodeType":"YulLiteral","src":"257:18:1","type":"","value":"0xffffffffffffffff"},"variables":[{"name":"_2","nodeType":"YulTypedName","src":"251:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"302:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"311:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"314:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"304:6:1"},"nodeType":"YulFunctionCall","src":"304:12:1"},"nodeType":"YulExpressionStatement","src":"304:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"290:6:1"},{"name":"_2","nodeType":"YulIdentifier","src":"298:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"287:2:1"},"nodeType":"YulFunctionCall","src":"287:14:1"},"nodeType":"YulIf","src":"284:34:1"},{"nodeType":"YulVariableDeclaration","src":"327:32:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"341:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"352:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"337:3:1"},"nodeType":"YulFunctionCall","src":"337:22:1"},"variables":[{"name":"_3","nodeType":"YulTypedName","src":"331:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"407:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"416:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"419:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"409:6:1"},"nodeType":"YulFunctionCall","src":"409:12:1"},"nodeType":"YulExpressionStatement","src":"409:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"386:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"390:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"382:3:1"},"nodeType":"YulFunctionCall","src":"382:13:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"397:7:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"378:3:1"},"nodeType":"YulFunctionCall","src":"378:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"371:6:1"},"nodeType":"YulFunctionCall","src":"371:35:1"},"nodeType":"YulIf","src":"368:55:1"},{"nodeType":"YulVariableDeclaration","src":"432:26:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"455:2:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"442:12:1"},"nodeType":"YulFunctionCall","src":"442:16:1"},"variables":[{"name":"_4","nodeType":"YulTypedName","src":"436:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"481:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"483:16:1"},"nodeType":"YulFunctionCall","src":"483:18:1"},"nodeType":"YulExpressionStatement","src":"483:18:1"}]},"condition":{"arguments":[{"name":"_4","nodeType":"YulIdentifier","src":"473:2:1"},{"name":"_2","nodeType":"YulIdentifier","src":"477:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"470:2:1"},"nodeType":"YulFunctionCall","src":"470:10:1"},"nodeType":"YulIf","src":"467:36:1"},{"nodeType":"YulVariableDeclaration","src":"512:20:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"526:1:1","type":"","value":"5"},{"name":"_4","nodeType":"YulIdentifier","src":"529:2:1"}],"functionName":{"name":"shl","nodeType":"YulIdentifier","src":"522:3:1"},"nodeType":"YulFunctionCall","src":"522:10:1"},"variables":[{"name":"_5","nodeType":"YulTypedName","src":"516:2:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"541:23:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"561:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"555:5:1"},"nodeType":"YulFunctionCall","src":"555:9:1"},"variables":[{"name":"memPtr","nodeType":"YulTypedName","src":"545:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"573:56:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"595:6:1"},{"arguments":[{"arguments":[{"name":"_5","nodeType":"YulIdentifier","src":"611:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"615:2:1","type":"","value":"63"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"607:3:1"},"nodeType":"YulFunctionCall","src":"607:11:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"624:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"620:3:1"},"nodeType":"YulFunctionCall","src":"620:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"603:3:1"},"nodeType":"YulFunctionCall","src":"603:25:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"591:3:1"},"nodeType":"YulFunctionCall","src":"591:38:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"577:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"688:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"690:16:1"},"nodeType":"YulFunctionCall","src":"690:18:1"},"nodeType":"YulExpressionStatement","src":"690:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"647:10:1"},{"name":"_2","nodeType":"YulIdentifier","src":"659:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"644:2:1"},"nodeType":"YulFunctionCall","src":"644:18:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"667:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"679:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"664:2:1"},"nodeType":"YulFunctionCall","src":"664:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"641:2:1"},"nodeType":"YulFunctionCall","src":"641:46:1"},"nodeType":"YulIf","src":"638:72:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"726:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"730:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"719:6:1"},"nodeType":"YulFunctionCall","src":"719:22:1"},"nodeType":"YulExpressionStatement","src":"719:22:1"},{"nodeType":"YulVariableDeclaration","src":"750:17:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"761:6:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"754:3:1","type":""}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"783:6:1"},{"name":"_4","nodeType":"YulIdentifier","src":"791:2:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"776:6:1"},"nodeType":"YulFunctionCall","src":"776:18:1"},"nodeType":"YulExpressionStatement","src":"776:18:1"},{"nodeType":"YulAssignment","src":"803:22:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"814:6:1"},{"name":"_1","nodeType":"YulIdentifier","src":"822:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"810:3:1"},"nodeType":"YulFunctionCall","src":"810:15:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"803:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"834:22:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"849:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"853:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"845:3:1"},"nodeType":"YulFunctionCall","src":"845:11:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"838:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"902:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"911:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"914:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"904:6:1"},"nodeType":"YulFunctionCall","src":"904:12:1"},"nodeType":"YulExpressionStatement","src":"904:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"879:2:1"},{"name":"_5","nodeType":"YulIdentifier","src":"883:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"875:3:1"},"nodeType":"YulFunctionCall","src":"875:11:1"},{"name":"_1","nodeType":"YulIdentifier","src":"888:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"871:3:1"},"nodeType":"YulFunctionCall","src":"871:20:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"893:7:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"868:2:1"},"nodeType":"YulFunctionCall","src":"868:33:1"},"nodeType":"YulIf","src":"865:53:1"},{"nodeType":"YulVariableDeclaration","src":"927:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"936:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"931:1:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"991:118:1","statements":[{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1012:3:1"},{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1030:3:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1017:12:1"},"nodeType":"YulFunctionCall","src":"1017:17:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1005:6:1"},"nodeType":"YulFunctionCall","src":"1005:30:1"},"nodeType":"YulExpressionStatement","src":"1005:30:1"},{"nodeType":"YulAssignment","src":"1048:19:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1059:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1064:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1055:3:1"},"nodeType":"YulFunctionCall","src":"1055:12:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"1048:3:1"}]},{"nodeType":"YulAssignment","src":"1080:19:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1091:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1096:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1087:3:1"},"nodeType":"YulFunctionCall","src":"1087:12:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"1080:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"957:1:1"},{"name":"_4","nodeType":"YulIdentifier","src":"960:2:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"954:2:1"},"nodeType":"YulFunctionCall","src":"954:9:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"964:18:1","statements":[{"nodeType":"YulAssignment","src":"966:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"975:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"978:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"971:3:1"},"nodeType":"YulFunctionCall","src":"971:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"966:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"950:3:1","statements":[]},"src":"946:163:1"},{"nodeType":"YulAssignment","src":"1118:16:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"1128:6:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1118:6:1"}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"75:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"86:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"98:6:1","type":""}],"src":"14:1126:1"},{"body":{"nodeType":"YulBlock","src":"1246:76:1","statements":[{"nodeType":"YulAssignment","src":"1256:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1268:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1279:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1264:3:1"},"nodeType":"YulFunctionCall","src":"1264:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1256:4:1"}]},{"expression":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1298:9:1"},{"name":"value0","nodeType":"YulIdentifier","src":"1309:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1291:6:1"},"nodeType":"YulFunctionCall","src":"1291:25:1"},"nodeType":"YulExpressionStatement","src":"1291:25:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1215:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1226:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1237:4:1","type":""}],"src":"1145:177:1"},{"body":{"nodeType":"YulBlock","src":"1359:95:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1376:1:1","type":"","value":"0"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1383:3:1","type":"","value":"224"},{"kind":"number","nodeType":"YulLiteral","src":"1388:10:1","type":"","value":"0x4e487b71"}],"functionName":{"name":"shl","nodeType":"YulIdentifier","src":"1379:3:1"},"nodeType":"YulFunctionCall","src":"1379:20:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1369:6:1"},"nodeType":"YulFunctionCall","src":"1369:31:1"},"nodeType":"YulExpressionStatement","src":"1369:31:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1416:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"1419:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1409:6:1"},"nodeType":"YulFunctionCall","src":"1409:15:1"},"nodeType":"YulExpressionStatement","src":"1409:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1440:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1443:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1433:6:1"},"nodeType":"YulFunctionCall","src":"1433:15:1"},"nodeType":"YulExpressionStatement","src":"1433:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"1327:127:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1456:1","statements":[{"nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nodeType":"YulBlock","src":"46:95:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"63:1:1","type":"","value":"0"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"70:3:1","type":"","value":"224"},{"kind":"number","nodeType":"YulLiteral","src":"75:10:1","type":"","value":"0x4e487b71"}],"functionName":{"name":"shl","nodeType":"YulIdentifier","src":"66:3:1"},"nodeType":"YulFunctionCall","src":"66:20:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"56:6:1"},"nodeType":"YulFunctionCall","src":"56:31:1"},"nodeType":"YulExpressionStatement","src":"56:31:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"103:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"106:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"96:6:1"},"nodeType":"YulFunctionCall","src":"96:15:1"},"nodeType":"YulExpressionStatement","src":"96:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"127:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"130:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"120:6:1"},"nodeType":"YulFunctionCall","src":"120:15:1"},"nodeType":"YulExpressionStatement","src":"120:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"14:127:1"},{"body":{"nodeType":"YulBlock","src":"241:1031:1","statements":[{"nodeType":"YulVariableDeclaration","src":"251:12:1","value":{"kind":"number","nodeType":"YulLiteral","src":"261:2:1","type":"","value":"32"},"variables":[{"name":"_1","nodeType":"YulTypedName","src":"255:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"308:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"317:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"320:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"310:6:1"},"nodeType":"YulFunctionCall","src":"310:12:1"},"nodeType":"YulExpressionStatement","src":"310:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"283:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"292:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"279:3:1"},"nodeType":"YulFunctionCall","src":"279:23:1"},{"name":"_1","nodeType":"YulIdentifier","src":"304:2:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"275:3:1"},"nodeType":"YulFunctionCall","src":"275:32:1"},"nodeType":"YulIf","src":"272:52:1"},{"nodeType":"YulVariableDeclaration","src":"333:37:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"360:9:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"347:12:1"},"nodeType":"YulFunctionCall","src":"347:23:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"337:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"379:28:1","value":{"kind":"number","nodeType":"YulLiteral","src":"389:18:1","type":"","value":"0xffffffffffffffff"},"variables":[{"name":"_2","nodeType":"YulTypedName","src":"383:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"434:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"443:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"446:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"436:6:1"},"nodeType":"YulFunctionCall","src":"436:12:1"},"nodeType":"YulExpressionStatement","src":"436:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"422:6:1"},{"name":"_2","nodeType":"YulIdentifier","src":"430:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"419:2:1"},"nodeType":"YulFunctionCall","src":"419:14:1"},"nodeType":"YulIf","src":"416:34:1"},{"nodeType":"YulVariableDeclaration","src":"459:32:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"473:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"484:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"469:3:1"},"nodeType":"YulFunctionCall","src":"469:22:1"},"variables":[{"name":"_3","nodeType":"YulTypedName","src":"463:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"539:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"548:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"551:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"541:6:1"},"nodeType":"YulFunctionCall","src":"541:12:1"},"nodeType":"YulExpressionStatement","src":"541:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"518:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"522:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"514:3:1"},"nodeType":"YulFunctionCall","src":"514:13:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"529:7:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"510:3:1"},"nodeType":"YulFunctionCall","src":"510:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"503:6:1"},"nodeType":"YulFunctionCall","src":"503:35:1"},"nodeType":"YulIf","src":"500:55:1"},{"nodeType":"YulVariableDeclaration","src":"564:26:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"587:2:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"574:12:1"},"nodeType":"YulFunctionCall","src":"574:16:1"},"variables":[{"name":"_4","nodeType":"YulTypedName","src":"568:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"613:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"615:16:1"},"nodeType":"YulFunctionCall","src":"615:18:1"},"nodeType":"YulExpressionStatement","src":"615:18:1"}]},"condition":{"arguments":[{"name":"_4","nodeType":"YulIdentifier","src":"605:2:1"},{"name":"_2","nodeType":"YulIdentifier","src":"609:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"602:2:1"},"nodeType":"YulFunctionCall","src":"602:10:1"},"nodeType":"YulIf","src":"599:36:1"},{"nodeType":"YulVariableDeclaration","src":"644:20:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"658:1:1","type":"","value":"5"},{"name":"_4","nodeType":"YulIdentifier","src":"661:2:1"}],"functionName":{"name":"shl","nodeType":"YulIdentifier","src":"654:3:1"},"nodeType":"YulFunctionCall","src":"654:10:1"},"variables":[{"name":"_5","nodeType":"YulTypedName","src":"648:2:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"673:23:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"693:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"687:5:1"},"nodeType":"YulFunctionCall","src":"687:9:1"},"variables":[{"name":"memPtr","nodeType":"YulTypedName","src":"677:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"705:56:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"727:6:1"},{"arguments":[{"arguments":[{"name":"_5","nodeType":"YulIdentifier","src":"743:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"747:2:1","type":"","value":"63"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"739:3:1"},"nodeType":"YulFunctionCall","src":"739:11:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"756:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"752:3:1"},"nodeType":"YulFunctionCall","src":"752:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"735:3:1"},"nodeType":"YulFunctionCall","src":"735:25:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"723:3:1"},"nodeType":"YulFunctionCall","src":"723:38:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"709:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"820:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"822:16:1"},"nodeType":"YulFunctionCall","src":"822:18:1"},"nodeType":"YulExpressionStatement","src":"822:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"779:10:1"},{"name":"_2","nodeType":"YulIdentifier","src":"791:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"776:2:1"},"nodeType":"YulFunctionCall","src":"776:18:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"799:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"811:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"796:2:1"},"nodeType":"YulFunctionCall","src":"796:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"773:2:1"},"nodeType":"YulFunctionCall","src":"773:46:1"},"nodeType":"YulIf","src":"770:72:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"858:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"862:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"851:6:1"},"nodeType":"YulFunctionCall","src":"851:22:1"},"nodeType":"YulExpressionStatement","src":"851:22:1"},{"nodeType":"YulVariableDeclaration","src":"882:17:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"893:6:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"886:3:1","type":""}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"915:6:1"},{"name":"_4","nodeType":"YulIdentifier","src":"923:2:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"908:6:1"},"nodeType":"YulFunctionCall","src":"908:18:1"},"nodeType":"YulExpressionStatement","src":"908:18:1"},{"nodeType":"YulAssignment","src":"935:22:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"946:6:1"},{"name":"_1","nodeType":"YulIdentifier","src":"954:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"942:3:1"},"nodeType":"YulFunctionCall","src":"942:15:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"935:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"966:22:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"981:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"985:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"977:3:1"},"nodeType":"YulFunctionCall","src":"977:11:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"970:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1034:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1043:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1046:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1036:6:1"},"nodeType":"YulFunctionCall","src":"1036:12:1"},"nodeType":"YulExpressionStatement","src":"1036:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"1011:2:1"},{"name":"_5","nodeType":"YulIdentifier","src":"1015:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1007:3:1"},"nodeType":"YulFunctionCall","src":"1007:11:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1020:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1003:3:1"},"nodeType":"YulFunctionCall","src":"1003:20:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1025:7:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1000:2:1"},"nodeType":"YulFunctionCall","src":"1000:33:1"},"nodeType":"YulIf","src":"997:53:1"},{"nodeType":"YulVariableDeclaration","src":"1059:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"1068:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"1063:1:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1123:118:1","statements":[{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1144:3:1"},{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1162:3:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1149:12:1"},"nodeType":"YulFunctionCall","src":"1149:17:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1137:6:1"},"nodeType":"YulFunctionCall","src":"1137:30:1"},"nodeType":"YulExpressionStatement","src":"1137:30:1"},{"nodeType":"YulAssignment","src":"1180:19:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1191:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1196:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1187:3:1"},"nodeType":"YulFunctionCall","src":"1187:12:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"1180:3:1"}]},{"nodeType":"YulAssignment","src":"1212:19:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1223:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1228:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1219:3:1"},"nodeType":"YulFunctionCall","src":"1219:12:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"1212:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1089:1:1"},{"name":"_4","nodeType":"YulIdentifier","src":"1092:2:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"1086:2:1"},"nodeType":"YulFunctionCall","src":"1086:9:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"1096:18:1","statements":[{"nodeType":"YulAssignment","src":"1098:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1107:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"1110:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1103:3:1"},"nodeType":"YulFunctionCall","src":"1103:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"1098:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"1082:3:1","statements":[]},"src":"1078:163:1"},{"nodeType":"YulAssignment","src":"1250:16:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"1260:6:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1250:6:1"}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"207:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"218:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"230:6:1","type":""}],"src":"146:1126:1"},{"body":{"nodeType":"YulBlock","src":"1378:76:1","statements":[{"nodeType":"YulAssignment","src":"1388:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1400:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1411:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1396:3:1"},"nodeType":"YulFunctionCall","src":"1396:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1388:4:1"}]},{"expression":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1430:9:1"},{"name":"value0","nodeType":"YulIdentifier","src":"1441:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1423:6:1"},"nodeType":"YulFunctionCall","src":"1423:25:1"},"nodeType":"YulExpressionStatement","src":"1423:25:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1347:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1358:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1369:4:1","type":""}],"src":"1277:177:1"}]},"contents":"{ { } + function panic_error_0x41() + { + mstore(0, shl(224, 0x4e487b71)) + mstore(4, 0x41) + revert(0, 0x24) + } function abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr(headStart, dataEnd) -> value0 { let _1 := 32 @@ -35,10 +41,4 @@ tail := add(headStart, 32) mstore(headStart, value0) } - function panic_error_0x41() - { - mstore(0, shl(224, 0x4e487b71)) - mstore(4, 0x41) - revert(0, 0x24) - } }","id":1,"language":"Yul","name":"#utility.yul"}]}}}}},"sources":{"a.sol":{"id":0}}} diff --git a/test/cmdlineTests/standard_viair_requested/output.json b/test/cmdlineTests/standard_viair_requested/output.json index 9fa0b02a9..3ba066ab4 100644 --- a/test/cmdlineTests/standard_viair_requested/output.json +++ b/test/cmdlineTests/standard_viair_requested/output.json @@ -24,6 +24,10 @@ object \"C_3\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:79:92 function constructor_C_3() { @@ -32,10 +36,6 @@ object \"C_3\" { } /// @src 0:79:92 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_3_deployed\" { @@ -53,6 +53,13 @@ object \"C_3\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + function allocate_unbounded() -> memPtr { memPtr := mload(64) } @@ -61,13 +68,6 @@ object \"C_3\" { revert(0, 0) } - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - } data \".metadata\" hex\"\" @@ -101,6 +101,10 @@ object \"D_16\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:93:146 function constructor_D_16() { @@ -109,10 +113,6 @@ object \"D_16\" { } /// @src 0:93:146 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"D_16_deployed\" { @@ -142,6 +142,25 @@ object \"D_16\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } @@ -152,8 +171,20 @@ object \"D_16\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + function revert_forward_1() { + let pos := allocate_unbounded() + returndatacopy(pos, 0, returndatasize()) + revert(pos, returndatasize()) } /// @src 0:106:144 @@ -176,37 +207,6 @@ object \"D_16\" { } /// @src 0:93:146 - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - 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()) - revert(pos, returndatasize()) - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - } /*=====================================================* * WARNING * @@ -233,6 +233,10 @@ object \"D_16\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:79:92 function constructor_C_3() { @@ -241,10 +245,6 @@ object \"D_16\" { } /// @src 0:79:92 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_3_deployed\" { @@ -262,6 +262,13 @@ object \"D_16\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + function allocate_unbounded() -> memPtr { memPtr := mload(64) } @@ -270,13 +277,6 @@ object \"D_16\" { revert(0, 0) } - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/viair_abicoder_v1/output b/test/cmdlineTests/viair_abicoder_v1/output index 6a164cc43..c3715f007 100644 --- a/test/cmdlineTests/viair_abicoder_v1/output +++ b/test/cmdlineTests/viair_abicoder_v1/output @@ -25,6 +25,10 @@ object "test_11" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:79:169 function constructor_test_11() { @@ -33,10 +37,6 @@ object "test_11" { } /// @src 0:79:169 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:"viair_abicoder_v1/input.sol" object "test_11_deployed" { @@ -66,11 +66,34 @@ object "test_11" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function cleanup_t_bool(value) -> cleaned { + cleaned := iszero(iszero(value)) + } + function abi_encode_t_bool_to_t_bool_fromStack(value, pos) { mstore(pos, cleanup_t_bool(value)) } @@ -82,12 +105,12 @@ object "test_11" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) } - function cleanup_t_bool(value) -> cleaned { - cleaned := iszero(iszero(value)) + function zero_value_for_split_t_bool() -> ret { + ret := 0 } /// @src 0:99:167 @@ -105,29 +128,6 @@ object "test_11" { } /// @src 0:79:169 - 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) - - } - - function zero_value_for_split_t_bool() -> ret { - ret := 0 - } - } data ".metadata" hex"" diff --git a/test/cmdlineTests/yul_optimizer_steps/output b/test/cmdlineTests/yul_optimizer_steps/output index 5db709e53..3e4ba5809 100644 --- a/test/cmdlineTests/yul_optimizer_steps/output +++ b/test/cmdlineTests/yul_optimizer_steps/output @@ -39,10 +39,10 @@ object "C_7" { pop(iszero(calldatasize())) revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() } - function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() - { revert(0, 0) } function shift_right_unsigned(value) -> newValue { newValue := shr(224, value) } + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + { revert(0, 0) } } data ".metadata" hex"" } diff --git a/test/cmdlineTests/yul_source_locations/output.json b/test/cmdlineTests/yul_source_locations/output.json index 4ce705261..f6f431177 100644 --- a/test/cmdlineTests/yul_source_locations/output.json +++ b/test/cmdlineTests/yul_source_locations/output.json @@ -23,6 +23,52 @@ object \"C_54\" { return(_2, datasize(\"C_54_deployed\")) + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + 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 allocate_memory(size) -> memPtr { + memPtr := allocate_unbounded() + finalize_allocation(memPtr, size) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function cleanup_t_int256(value) -> cleaned { + cleaned := value + } + + function validator_revert_t_int256(value) { + if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } + } + function abi_decode_t_int256_fromMemory(offset, end) -> value { value := mload(offset) validator_revert_t_int256(value) @@ -40,23 +86,55 @@ object \"C_54\" { } - function allocate_memory(size) -> memPtr { - memPtr := allocate_unbounded() - finalize_allocation(memPtr, size) - } + function copy_arguments_for_constructor_20_object_C_54() -> ret_param_0 { + let programSize := datasize(\"C_54\") + let argSize := sub(codesize(), programSize) - function allocate_unbounded() -> memPtr { - memPtr := mload(64) - } + let memoryDataOffset := allocate_memory(argSize) + codecopy(memoryDataOffset, programSize, argSize) - function cleanup_t_int256(value) -> cleaned { - cleaned := value + ret_param_0 := abi_decode_tuple_t_int256_fromMemory(memoryDataOffset, add(memoryDataOffset, argSize)) } function cleanup_t_rational_42_by_1(value) -> cleaned { cleaned := value } + function identity(value) -> ret { + ret := value + } + + function convert_t_rational_42_by_1_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_rational_42_by_1(value))) + } + + function shift_left_0(value) -> newValue { + newValue := + + shl(0, value) + + } + + function update_byte_slice_32_shift_0(value, toInsert) -> result { + let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + toInsert := shift_left_0(toInsert) + value := and(value, not(mask)) + result := or(value, and(toInsert, mask)) + } + + function convert_t_int256_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_int256(value))) + } + + function prepare_store_t_int256(value) -> ret { + ret := value + } + + function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { + let convertedValue_0 := convert_t_int256_to_t_int256(value_0) + sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) + } + /// @src 0:175:223 function constructor_C_54(var__init_12) { @@ -77,84 +155,6 @@ object \"C_54\" { } /// @src 0:79:428 - function convert_t_int256_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_int256(value))) - } - - function convert_t_rational_42_by_1_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_rational_42_by_1(value))) - } - - function copy_arguments_for_constructor_20_object_C_54() -> ret_param_0 { - let programSize := datasize(\"C_54\") - let argSize := sub(codesize(), programSize) - - let memoryDataOffset := allocate_memory(argSize) - codecopy(memoryDataOffset, programSize, argSize) - - ret_param_0 := abi_decode_tuple_t_int256_fromMemory(memoryDataOffset, add(memoryDataOffset, argSize)) - } - - 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 identity(value) -> ret { - ret := value - } - - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - revert(0, 0x24) - } - - function prepare_store_t_int256(value) -> ret { - ret := value - } - - function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { - 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)) - } - - function shift_left_0(value) -> newValue { - newValue := - - shl(0, value) - - } - - function update_byte_slice_32_shift_0(value, toInsert) -> result { - let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - toInsert := shift_left_0(toInsert) - value := and(value, not(mask)) - result := or(value, and(toInsert, mask)) - } - - function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { - let convertedValue_0 := convert_t_int256_to_t_int256(value_0) - sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) - } - - function validator_revert_t_int256(value) { - if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } - } - } /// @use-src 0:\"C\" object \"C_54_deployed\" { @@ -208,9 +208,23 @@ object \"C_54\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() - function abi_decode_t_int256_fromMemory(offset, end) -> value { - value := mload(offset) - validator_revert_t_int256(value) + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) } function abi_decode_tuple_(headStart, dataEnd) { @@ -218,27 +232,14 @@ object \"C_54\" { } - function abi_decode_tuple_t_int256_fromMemory(headStart, dataEnd) -> value0 { - if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } - - { - - let offset := 0 - - value0 := abi_decode_t_int256_fromMemory(add(headStart, offset), dataEnd) - } - + function cleanup_t_int256(value) -> cleaned { + cleaned := value } function abi_encode_t_int256_to_t_int256_fromStack(value, pos) { mstore(pos, cleanup_t_int256(value)) } - function abi_encode_tuple__to__fromStack(headStart ) -> tail { - tail := add(headStart, 0) - - } - function abi_encode_tuple_t_int256__to_t_int256__fromStack(headStart , value0) -> tail { tail := add(headStart, 32) @@ -246,8 +247,70 @@ object \"C_54\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function shift_right_unsigned_dynamic(bits, value) -> newValue { + newValue := + + shr(bits, value) + + } + + function cleanup_from_storage_t_int256(value) -> cleaned { + cleaned := value + } + + function extract_from_storage_value_dynamict_int256(slot_value, offset) -> value { + value := cleanup_from_storage_t_int256(shift_right_unsigned_dynamic(mul(offset, 8), slot_value)) + } + + function read_from_storage_split_dynamic_t_int256(slot, offset) -> value { + value := extract_from_storage_value_dynamict_int256(sload(slot), offset) + + } + + /// @src 0:152:171 + function getter_fun_stateVar_10() -> ret { + + let slot := 0 + let offset := 0 + + ret := read_from_storage_split_dynamic_t_int256(slot, offset) + + } + /// @src 0:79:428 + + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + function zero_value_for_split_t_int256() -> ret { + ret := 0 + } + + function cleanup_t_rational_41_by_1(value) -> cleaned { + cleaned := value + } + + function identity(value) -> ret { + ret := value + } + + function convert_t_rational_41_by_1_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_rational_41_by_1(value))) + } + + /// @src 0:93:119 + function constant_constVar_5() -> ret { + /// @src 0:117:119 + let expr_4 := 0x29 + let _2 := convert_t_rational_41_by_1_to_t_int256(expr_4) + + ret := _2 + } + + function panic_error_0x11() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x11) + revert(0, 0x24) } function checked_add_t_int256(x, y) -> sum { @@ -262,57 +325,119 @@ object \"C_54\" { sum := add(x, y) } - function cleanup_from_storage_t_int256(value) -> cleaned { - cleaned := value + /// @src 0:226:302 + function fun_f_30() -> var__23 { + /// @src 0:262:265 + let zero_t_int256_1 := zero_value_for_split_t_int256() + var__23 := zero_t_int256_1 + + /// @src 0:279:287 + let expr_25 := constant_constVar_5() + /// @src 0:290:298 + let _3 := loadimmutable(\"8\") + let expr_26 := _3 + /// @src 0:279:298 + let expr_27 := checked_add_t_int256(expr_25, expr_26) + + /// @src 0:272:298 + var__23 := expr_27 + leave + + } + /// @src 0:79:428 + + function shift_right_0_unsigned(value) -> newValue { + newValue := + + shr(0, value) + } - function cleanup_t_int256(value) -> cleaned { - cleaned := value + function extract_from_storage_value_offset_0t_int256(slot_value) -> value { + value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_value)) } - function cleanup_t_rational_41_by_1(value) -> cleaned { - cleaned := value + function read_from_storage_split_offset_0_t_int256(slot) -> value { + value := extract_from_storage_value_offset_0t_int256(sload(slot)) + } - function cleanup_t_uint160(value) -> cleaned { - cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) + function increment_t_int256(value) -> ret { + value := cleanup_t_int256(value) + if eq(value, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) { panic_error_0x11() } + ret := add(value, 1) } - /// @src 0:93:119 - function constant_constVar_5() -> ret { - /// @src 0:117:119 - let expr_4 := 0x29 - let _2 := convert_t_rational_41_by_1_to_t_int256(expr_4) + function shift_left_0(value) -> newValue { + newValue := + + shl(0, value) - ret := _2 } - function convert_t_contract$_C_$54_to_t_address(value) -> converted { - converted := convert_t_uint160_to_t_address(value) + function update_byte_slice_32_shift_0(value, toInsert) -> result { + let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + toInsert := shift_left_0(toInsert) + value := and(value, not(mask)) + result := or(value, and(toInsert, mask)) } function convert_t_int256_to_t_int256(value) -> converted { converted := cleanup_t_int256(identity(cleanup_t_int256(value))) } - function convert_t_rational_41_by_1_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_rational_41_by_1(value))) + function prepare_store_t_int256(value) -> ret { + ret := value } - function convert_t_uint160_to_t_address(value) -> converted { - converted := convert_t_uint160_to_t_uint160(value) + function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { + let convertedValue_0 := convert_t_int256_to_t_int256(value_0) + sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) + } + + /// @src 0:304:341 + function modifier_m_40(var__42) -> _5 { + _5 := var__42 + + /// @src 0:322:332 + let _7 := read_from_storage_split_offset_0_t_int256(0x00) + let _6 := increment_t_int256(_7) + update_storage_value_offset_0t_int256_to_t_int256(0x00, _6) + let expr_33 := _7 + /// @src 0:336:337 + _5 := fun_f2_53_inner(var__42) + + } + /// @src 0:79:428 + + function cleanup_t_uint160(value) -> cleaned { + cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) } function convert_t_uint160_to_t_uint160(value) -> converted { converted := cleanup_t_uint160(identity(cleanup_t_uint160(value))) } - function extract_from_storage_value_dynamict_int256(slot_value, offset) -> value { - value := cleanup_from_storage_t_int256(shift_right_unsigned_dynamic(mul(offset, 8), slot_value)) + function convert_t_uint160_to_t_address(value) -> converted { + converted := convert_t_uint160_to_t_uint160(value) } - function extract_from_storage_value_offset_0t_int256(slot_value) -> value { - value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_value)) + function convert_t_contract$_C_$54_to_t_address(value) -> converted { + converted := convert_t_uint160_to_t_address(value) + } + + function revert_error_0cc013b6b3b6beabea4e3a74a6d380f0df81852ca99887912475e1f66b2a2c20() { + revert(0, 0) + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) } function finalize_allocation(memPtr, size) { @@ -322,15 +447,48 @@ object \"C_54\" { mstore(64, newFreePtr) } - /// @src 0:343:426 - function fun_f2_53() -> var__42 { - /// @src 0:375:378 - let zero_t_int256_4 := zero_value_for_split_t_int256() - var__42 := zero_t_int256_4 + function shift_left_224(value) -> newValue { + newValue := + + shl(224, value) - var__42 := modifier_m_40(var__42) } - /// @src 0:79:428 + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function validator_revert_t_int256(value) { + if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } + } + + function abi_decode_t_int256_fromMemory(offset, end) -> value { + value := mload(offset) + validator_revert_t_int256(value) + } + + function abi_decode_tuple_t_int256_fromMemory(headStart, dataEnd) -> value0 { + if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } + + { + + let offset := 0 + + value0 := abi_decode_t_int256_fromMemory(add(headStart, offset), dataEnd) + } + + } + + function abi_encode_tuple__to__fromStack(headStart ) -> tail { + tail := add(headStart, 0) + + } + + function revert_forward_1() { + let pos := allocate_unbounded() + returndatacopy(pos, 0, returndatasize()) + revert(pos, returndatasize()) + } /// @src 0:343:426 function fun_f2_53_inner(_8) -> var__42 { @@ -381,174 +539,16 @@ object \"C_54\" { } /// @src 0:79:428 - /// @src 0:226:302 - function fun_f_30() -> var__23 { - /// @src 0:262:265 - let zero_t_int256_1 := zero_value_for_split_t_int256() - var__23 := zero_t_int256_1 - - /// @src 0:279:287 - let expr_25 := constant_constVar_5() - /// @src 0:290:298 - let _3 := loadimmutable(\"8\") - let expr_26 := _3 - /// @src 0:279:298 - let expr_27 := checked_add_t_int256(expr_25, expr_26) - - /// @src 0:272:298 - var__23 := expr_27 - leave + /// @src 0:343:426 + function fun_f2_53() -> var__42 { + /// @src 0:375:378 + let zero_t_int256_4 := zero_value_for_split_t_int256() + var__42 := zero_t_int256_4 + var__42 := modifier_m_40(var__42) } /// @src 0:79:428 - /// @src 0:152:171 - function getter_fun_stateVar_10() -> ret { - - let slot := 0 - let offset := 0 - - ret := read_from_storage_split_dynamic_t_int256(slot, offset) - - } - /// @src 0:79:428 - - function identity(value) -> ret { - ret := value - } - - function increment_t_int256(value) -> ret { - value := cleanup_t_int256(value) - if eq(value, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) { panic_error_0x11() } - ret := add(value, 1) - } - - /// @src 0:304:341 - function modifier_m_40(var__42) -> _5 { - _5 := var__42 - - /// @src 0:322:332 - let _7 := read_from_storage_split_offset_0_t_int256(0x00) - let _6 := increment_t_int256(_7) - update_storage_value_offset_0t_int256_to_t_int256(0x00, _6) - let expr_33 := _7 - /// @src 0:336:337 - _5 := fun_f2_53_inner(var__42) - - } - /// @src 0:79:428 - - function panic_error_0x11() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x11) - revert(0, 0x24) - } - - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - revert(0, 0x24) - } - - function prepare_store_t_int256(value) -> ret { - ret := value - } - - function read_from_storage_split_dynamic_t_int256(slot, offset) -> value { - value := extract_from_storage_value_dynamict_int256(sload(slot), offset) - - } - - function read_from_storage_split_offset_0_t_int256(slot) -> value { - value := extract_from_storage_value_offset_0t_int256(sload(slot)) - - } - - function revert_error_0cc013b6b3b6beabea4e3a74a6d380f0df81852ca99887912475e1f66b2a2c20() { - revert(0, 0) - } - - 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 revert_forward_1() { - let pos := allocate_unbounded() - returndatacopy(pos, 0, returndatasize()) - revert(pos, returndatasize()) - } - - function round_up_to_mul_of_32(value) -> result { - result := and(add(value, 31), not(31)) - } - - function shift_left_0(value) -> newValue { - newValue := - - shl(0, value) - - } - - function shift_left_224(value) -> newValue { - newValue := - - shl(224, value) - - } - - function shift_right_0_unsigned(value) -> newValue { - newValue := - - shr(0, value) - - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function shift_right_unsigned_dynamic(bits, value) -> newValue { - newValue := - - shr(bits, value) - - } - - function update_byte_slice_32_shift_0(value, toInsert) -> result { - let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - toInsert := shift_left_0(toInsert) - value := and(value, not(mask)) - result := or(value, and(toInsert, mask)) - } - - function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { - let convertedValue_0 := convert_t_int256_to_t_int256(value_0) - sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) - } - - function validator_revert_t_int256(value) { - if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } - } - - function zero_value_for_split_t_int256() -> ret { - ret := 0 - } - } data \".metadata\" hex\"\" @@ -581,6 +581,52 @@ object \"D_72\" { return(_2, datasize(\"D_72_deployed\")) + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + 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 allocate_memory(size) -> memPtr { + memPtr := allocate_unbounded() + finalize_allocation(memPtr, size) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function cleanup_t_int256(value) -> cleaned { + cleaned := value + } + + function validator_revert_t_int256(value) { + if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } + } + function abi_decode_t_int256_fromMemory(offset, end) -> value { value := mload(offset) validator_revert_t_int256(value) @@ -598,13 +644,52 @@ object \"D_72\" { } - function allocate_memory(size) -> memPtr { - memPtr := allocate_unbounded() - finalize_allocation(memPtr, size) + function copy_arguments_for_constructor_71_object_D_72() -> ret_param_0 { + let programSize := datasize(\"D_72\") + let argSize := sub(codesize(), programSize) + + let memoryDataOffset := allocate_memory(argSize) + codecopy(memoryDataOffset, programSize, argSize) + + ret_param_0 := abi_decode_tuple_t_int256_fromMemory(memoryDataOffset, add(memoryDataOffset, argSize)) } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function cleanup_t_rational_3_by_1(value) -> cleaned { + cleaned := value + } + + function identity(value) -> ret { + ret := value + } + + function convert_t_rational_3_by_1_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_rational_3_by_1(value))) + } + + function shift_right_0_unsigned(value) -> newValue { + newValue := + + shr(0, value) + + } + + function cleanup_from_storage_t_int256(value) -> cleaned { + cleaned := value + } + + function extract_from_storage_value_offset_0t_int256(slot_value) -> value { + value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_value)) + } + + function read_from_storage_split_offset_0_t_int256(slot) -> value { + value := extract_from_storage_value_offset_0t_int256(sload(slot)) + + } + + function panic_error_0x11() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x11) + revert(0, 0x24) } function checked_add_t_int256(x, y) -> sum { @@ -619,41 +704,32 @@ object \"D_72\" { sum := add(x, y) } - function cleanup_from_storage_t_int256(value) -> cleaned { - cleaned := value - } + function shift_left_0(value) -> newValue { + newValue := - function cleanup_t_int256(value) -> cleaned { - cleaned := value - } - - function cleanup_t_rational_3_by_1(value) -> cleaned { - cleaned := value - } - - function cleanup_t_rational_42_by_1(value) -> cleaned { - cleaned := value - } - - /// @src 0:175:223 - function constructor_C_54(var__init_12) { - - /// @src 0:175:223 - - /// @src 0:147:149 - let expr_7 := 0x2a - let _6 := convert_t_rational_42_by_1_to_t_int256(expr_7) - mstore(128, _6) - - /// @src 0:214:219 - let _7 := var__init_12 - let expr_16 := _7 - /// @src 0:203:219 - update_storage_value_offset_0t_int256_to_t_int256(0x00, expr_16) - let expr_17 := expr_16 + shl(0, value) } - /// @src 1:91:166 + + function update_byte_slice_32_shift_0(value, toInsert) -> result { + let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + toInsert := shift_left_0(toInsert) + value := and(value, not(mask)) + result := or(value, and(toInsert, mask)) + } + + function convert_t_int256_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_int256(value))) + } + + function prepare_store_t_int256(value) -> ret { + ret := value + } + + function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { + let convertedValue_0 := convert_t_int256_to_t_int256(value_0) + sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) + } /// @src 1:113:164 function constructor_D_72(var__init2_63) { @@ -676,109 +752,33 @@ object \"D_72\" { } /// @src 1:91:166 - function convert_t_int256_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_int256(value))) - } - - function convert_t_rational_3_by_1_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_rational_3_by_1(value))) + function cleanup_t_rational_42_by_1(value) -> cleaned { + cleaned := value } function convert_t_rational_42_by_1_to_t_int256(value) -> converted { converted := cleanup_t_int256(identity(cleanup_t_rational_42_by_1(value))) } - function copy_arguments_for_constructor_71_object_D_72() -> ret_param_0 { - let programSize := datasize(\"D_72\") - let argSize := sub(codesize(), programSize) + /// @src 0:175:223 + function constructor_C_54(var__init_12) { - let memoryDataOffset := allocate_memory(argSize) - codecopy(memoryDataOffset, programSize, argSize) + /// @src 0:175:223 - ret_param_0 := abi_decode_tuple_t_int256_fromMemory(memoryDataOffset, add(memoryDataOffset, argSize)) - } + /// @src 0:147:149 + let expr_7 := 0x2a + let _6 := convert_t_rational_42_by_1_to_t_int256(expr_7) + mstore(128, _6) - function extract_from_storage_value_offset_0t_int256(slot_value) -> value { - value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_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 identity(value) -> ret { - ret := value - } - - function panic_error_0x11() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x11) - revert(0, 0x24) - } - - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - revert(0, 0x24) - } - - function prepare_store_t_int256(value) -> ret { - ret := value - } - - function read_from_storage_split_offset_0_t_int256(slot) -> value { - value := extract_from_storage_value_offset_0t_int256(sload(slot)) + /// @src 0:214:219 + let _7 := var__init_12 + let expr_16 := _7 + /// @src 0:203:219 + update_storage_value_offset_0t_int256_to_t_int256(0x00, expr_16) + let expr_17 := expr_16 } - - function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { - 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)) - } - - function shift_left_0(value) -> newValue { - newValue := - - shl(0, value) - - } - - function shift_right_0_unsigned(value) -> newValue { - newValue := - - shr(0, value) - - } - - function update_byte_slice_32_shift_0(value, toInsert) -> result { - let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - toInsert := shift_left_0(toInsert) - value := and(value, not(mask)) - result := or(value, and(toInsert, mask)) - } - - function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { - let convertedValue_0 := convert_t_int256_to_t_int256(value_0) - sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) - } - - function validator_revert_t_int256(value) { - if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } - } + /// @src 1:91:166 } /// @use-src 0:\"C\", 1:\"D\" @@ -833,9 +833,23 @@ object \"D_72\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() - function abi_decode_t_int256_fromMemory(offset, end) -> value { - value := mload(offset) - validator_revert_t_int256(value) + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) } function abi_decode_tuple_(headStart, dataEnd) { @@ -843,27 +857,14 @@ object \"D_72\" { } - function abi_decode_tuple_t_int256_fromMemory(headStart, dataEnd) -> value0 { - if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } - - { - - let offset := 0 - - value0 := abi_decode_t_int256_fromMemory(add(headStart, offset), dataEnd) - } - + function cleanup_t_int256(value) -> cleaned { + cleaned := value } function abi_encode_t_int256_to_t_int256_fromStack(value, pos) { mstore(pos, cleanup_t_int256(value)) } - function abi_encode_tuple__to__fromStack(headStart ) -> tail { - tail := add(headStart, 0) - - } - function abi_encode_tuple_t_int256__to_t_int256__fromStack(headStart , value0) -> tail { tail := add(headStart, 32) @@ -871,8 +872,70 @@ object \"D_72\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function shift_right_unsigned_dynamic(bits, value) -> newValue { + newValue := + + shr(bits, value) + + } + + function cleanup_from_storage_t_int256(value) -> cleaned { + cleaned := value + } + + function extract_from_storage_value_dynamict_int256(slot_value, offset) -> value { + value := cleanup_from_storage_t_int256(shift_right_unsigned_dynamic(mul(offset, 8), slot_value)) + } + + function read_from_storage_split_dynamic_t_int256(slot, offset) -> value { + value := extract_from_storage_value_dynamict_int256(sload(slot), offset) + + } + + /// @src 0:152:171 + function getter_fun_stateVar_10() -> ret { + + let slot := 0 + let offset := 0 + + ret := read_from_storage_split_dynamic_t_int256(slot, offset) + + } + /// @src 1:91:166 + + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + function zero_value_for_split_t_int256() -> ret { + ret := 0 + } + + function cleanup_t_rational_41_by_1(value) -> cleaned { + cleaned := value + } + + function identity(value) -> ret { + ret := value + } + + function convert_t_rational_41_by_1_to_t_int256(value) -> converted { + converted := cleanup_t_int256(identity(cleanup_t_rational_41_by_1(value))) + } + + /// @src 0:93:119 + function constant_constVar_5() -> ret { + /// @src 0:117:119 + let expr_4 := 0x29 + let _2 := convert_t_rational_41_by_1_to_t_int256(expr_4) + + ret := _2 + } + + function panic_error_0x11() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x11) + revert(0, 0x24) } function checked_add_t_int256(x, y) -> sum { @@ -887,57 +950,119 @@ object \"D_72\" { sum := add(x, y) } - function cleanup_from_storage_t_int256(value) -> cleaned { - cleaned := value + /// @src 0:226:302 + function fun_f_30() -> var__23 { + /// @src 0:262:265 + let zero_t_int256_1 := zero_value_for_split_t_int256() + var__23 := zero_t_int256_1 + + /// @src 0:279:287 + let expr_25 := constant_constVar_5() + /// @src 0:290:298 + let _3 := loadimmutable(\"8\") + let expr_26 := _3 + /// @src 0:279:298 + let expr_27 := checked_add_t_int256(expr_25, expr_26) + + /// @src 0:272:298 + var__23 := expr_27 + leave + + } + /// @src 1:91:166 + + function shift_right_0_unsigned(value) -> newValue { + newValue := + + shr(0, value) + } - function cleanup_t_int256(value) -> cleaned { - cleaned := value + function extract_from_storage_value_offset_0t_int256(slot_value) -> value { + value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_value)) } - function cleanup_t_rational_41_by_1(value) -> cleaned { - cleaned := value + function read_from_storage_split_offset_0_t_int256(slot) -> value { + value := extract_from_storage_value_offset_0t_int256(sload(slot)) + } - function cleanup_t_uint160(value) -> cleaned { - cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) + function increment_t_int256(value) -> ret { + value := cleanup_t_int256(value) + if eq(value, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) { panic_error_0x11() } + ret := add(value, 1) } - /// @src 0:93:119 - function constant_constVar_5() -> ret { - /// @src 0:117:119 - let expr_4 := 0x29 - let _2 := convert_t_rational_41_by_1_to_t_int256(expr_4) + function shift_left_0(value) -> newValue { + newValue := + + shl(0, value) - ret := _2 } - function convert_t_contract$_C_$54_to_t_address(value) -> converted { - converted := convert_t_uint160_to_t_address(value) + function update_byte_slice_32_shift_0(value, toInsert) -> result { + let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + toInsert := shift_left_0(toInsert) + value := and(value, not(mask)) + result := or(value, and(toInsert, mask)) } function convert_t_int256_to_t_int256(value) -> converted { converted := cleanup_t_int256(identity(cleanup_t_int256(value))) } - function convert_t_rational_41_by_1_to_t_int256(value) -> converted { - converted := cleanup_t_int256(identity(cleanup_t_rational_41_by_1(value))) + function prepare_store_t_int256(value) -> ret { + ret := value } - function convert_t_uint160_to_t_address(value) -> converted { - converted := convert_t_uint160_to_t_uint160(value) + function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { + let convertedValue_0 := convert_t_int256_to_t_int256(value_0) + sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) + } + + /// @src 0:304:341 + function modifier_m_40(var__42) -> _5 { + _5 := var__42 + + /// @src 0:322:332 + let _7 := read_from_storage_split_offset_0_t_int256(0x00) + let _6 := increment_t_int256(_7) + update_storage_value_offset_0t_int256_to_t_int256(0x00, _6) + let expr_33 := _7 + /// @src 0:336:337 + _5 := fun_f2_53_inner(var__42) + + } + /// @src 1:91:166 + + function cleanup_t_uint160(value) -> cleaned { + cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) } function convert_t_uint160_to_t_uint160(value) -> converted { converted := cleanup_t_uint160(identity(cleanup_t_uint160(value))) } - function extract_from_storage_value_dynamict_int256(slot_value, offset) -> value { - value := cleanup_from_storage_t_int256(shift_right_unsigned_dynamic(mul(offset, 8), slot_value)) + function convert_t_uint160_to_t_address(value) -> converted { + converted := convert_t_uint160_to_t_uint160(value) } - function extract_from_storage_value_offset_0t_int256(slot_value) -> value { - value := cleanup_from_storage_t_int256(shift_right_0_unsigned(slot_value)) + function convert_t_contract$_C_$54_to_t_address(value) -> converted { + converted := convert_t_uint160_to_t_address(value) + } + + function revert_error_0cc013b6b3b6beabea4e3a74a6d380f0df81852ca99887912475e1f66b2a2c20() { + revert(0, 0) + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) } function finalize_allocation(memPtr, size) { @@ -947,15 +1072,48 @@ object \"D_72\" { mstore(64, newFreePtr) } - /// @src 0:343:426 - function fun_f2_53() -> var__42 { - /// @src 0:375:378 - let zero_t_int256_4 := zero_value_for_split_t_int256() - var__42 := zero_t_int256_4 + function shift_left_224(value) -> newValue { + newValue := + + shl(224, value) - var__42 := modifier_m_40(var__42) } - /// @src 1:91:166 + + function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() { + revert(0, 0) + } + + function validator_revert_t_int256(value) { + if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } + } + + function abi_decode_t_int256_fromMemory(offset, end) -> value { + value := mload(offset) + validator_revert_t_int256(value) + } + + function abi_decode_tuple_t_int256_fromMemory(headStart, dataEnd) -> value0 { + if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } + + { + + let offset := 0 + + value0 := abi_decode_t_int256_fromMemory(add(headStart, offset), dataEnd) + } + + } + + function abi_encode_tuple__to__fromStack(headStart ) -> tail { + tail := add(headStart, 0) + + } + + function revert_forward_1() { + let pos := allocate_unbounded() + returndatacopy(pos, 0, returndatasize()) + revert(pos, returndatasize()) + } /// @src 0:343:426 function fun_f2_53_inner(_8) -> var__42 { @@ -1006,174 +1164,16 @@ object \"D_72\" { } /// @src 1:91:166 - /// @src 0:226:302 - function fun_f_30() -> var__23 { - /// @src 0:262:265 - let zero_t_int256_1 := zero_value_for_split_t_int256() - var__23 := zero_t_int256_1 - - /// @src 0:279:287 - let expr_25 := constant_constVar_5() - /// @src 0:290:298 - let _3 := loadimmutable(\"8\") - let expr_26 := _3 - /// @src 0:279:298 - let expr_27 := checked_add_t_int256(expr_25, expr_26) - - /// @src 0:272:298 - var__23 := expr_27 - leave + /// @src 0:343:426 + function fun_f2_53() -> var__42 { + /// @src 0:375:378 + let zero_t_int256_4 := zero_value_for_split_t_int256() + var__42 := zero_t_int256_4 + var__42 := modifier_m_40(var__42) } /// @src 1:91:166 - /// @src 0:152:171 - function getter_fun_stateVar_10() -> ret { - - let slot := 0 - let offset := 0 - - ret := read_from_storage_split_dynamic_t_int256(slot, offset) - - } - /// @src 1:91:166 - - function identity(value) -> ret { - ret := value - } - - function increment_t_int256(value) -> ret { - value := cleanup_t_int256(value) - if eq(value, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) { panic_error_0x11() } - ret := add(value, 1) - } - - /// @src 0:304:341 - function modifier_m_40(var__42) -> _5 { - _5 := var__42 - - /// @src 0:322:332 - let _7 := read_from_storage_split_offset_0_t_int256(0x00) - let _6 := increment_t_int256(_7) - update_storage_value_offset_0t_int256_to_t_int256(0x00, _6) - let expr_33 := _7 - /// @src 0:336:337 - _5 := fun_f2_53_inner(var__42) - - } - /// @src 1:91:166 - - function panic_error_0x11() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x11) - revert(0, 0x24) - } - - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - revert(0, 0x24) - } - - function prepare_store_t_int256(value) -> ret { - ret := value - } - - function read_from_storage_split_dynamic_t_int256(slot, offset) -> value { - value := extract_from_storage_value_dynamict_int256(sload(slot), offset) - - } - - function read_from_storage_split_offset_0_t_int256(slot) -> value { - value := extract_from_storage_value_offset_0t_int256(sload(slot)) - - } - - function revert_error_0cc013b6b3b6beabea4e3a74a6d380f0df81852ca99887912475e1f66b2a2c20() { - revert(0, 0) - } - - 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 revert_forward_1() { - let pos := allocate_unbounded() - returndatacopy(pos, 0, returndatasize()) - revert(pos, returndatasize()) - } - - function round_up_to_mul_of_32(value) -> result { - result := and(add(value, 31), not(31)) - } - - function shift_left_0(value) -> newValue { - newValue := - - shl(0, value) - - } - - function shift_left_224(value) -> newValue { - newValue := - - shl(224, value) - - } - - function shift_right_0_unsigned(value) -> newValue { - newValue := - - shr(0, value) - - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function shift_right_unsigned_dynamic(bits, value) -> newValue { - newValue := - - shr(bits, value) - - } - - function update_byte_slice_32_shift_0(value, toInsert) -> result { - let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - toInsert := shift_left_0(toInsert) - value := and(value, not(mask)) - result := or(value, and(toInsert, mask)) - } - - function update_storage_value_offset_0t_int256_to_t_int256(slot, value_0) { - let convertedValue_0 := convert_t_int256_to_t_int256(value_0) - sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_int256(convertedValue_0))) - } - - function validator_revert_t_int256(value) { - if iszero(eq(value, cleanup_t_int256(value))) { revert(0, 0) } - } - - function zero_value_for_split_t_int256() -> ret { - ret := 0 - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/yul_source_locations_in_asm/output.json b/test/cmdlineTests/yul_source_locations_in_asm/output.json index 7c96a12db..56e0a6f31 100644 --- a/test/cmdlineTests/yul_source_locations_in_asm/output.json +++ b/test/cmdlineTests/yul_source_locations_in_asm/output.json @@ -55,6 +55,7 @@ tag_3: mload(0xa0) /* \"C\":147:149 42 */ mstore(0x80, 0x2a) + /* \"C\":203:219 stateVar = _init */ 0x00 /* \"C\":79:428 contract C... */ sstore @@ -186,26 +187,11 @@ sub_0: assembly { tag_23: pop jump\t// out - tag_24: - 0x00 - 0x20 - dup3 - dup5 - sub - slt - iszero - tag_26 - jumpi - 0x00 - dup1 - revert - tag_26: - pop - mload - swap2 - swap1 - pop - jump\t// out + /* \"C\":117:119 41 */ + tag_25: + mstore(0x00, shl(0xe0, 0x4e487b71)) + mstore(0x04, 0x11) + revert(0x00, 0x24) tag_10: 0x00 sub(shl(0xff, 0x01), 0x2a) @@ -214,20 +200,18 @@ sub_0: assembly { 0x01 and iszero - tag_30 + tag_29 jumpi - tag_30 - tag_31 + tag_29 + tag_25 jump\t// in - tag_30: + tag_29: pop - /* \"C\":117:119 41 */ 0x29 - /* \"C\":79:428 contract C... */ add swap1 jump\t// out - tag_32: + tag_30: 0x00 dup1 dup3 @@ -242,12 +226,12 @@ sub_0: assembly { sgt and iszero - tag_35 + tag_33 jumpi - tag_35 - tag_31 + tag_33 + tag_25 jump\t// in - tag_35: + tag_33: shl(0xff, 0x01) dup4 swap1 @@ -257,12 +241,12 @@ sub_0: assembly { dup2 and iszero - tag_37 + tag_35 jumpi - tag_37 - tag_31 + tag_35 + tag_25 jump\t// in - tag_37: + tag_35: pop pop add @@ -282,13 +266,15 @@ sub_0: assembly { dup2 eq iszero - tag_40 + tag_38 jumpi - tag_40 - tag_31 + tag_38 + tag_25 jump\t// in - tag_40: + tag_38: + /* \"C\":117:119 41 */ 0x01 + /* \"C\":79:428 contract C... */ add dup1 dup3 @@ -297,14 +283,14 @@ sub_0: assembly { address /* \"C\":403:411 this.f() */ extcodesize - tag_41 + tag_39 jumpi /* \"C\":79:428 contract C... */ dup2 dup3 revert /* \"C\":403:411 this.f() */ - tag_41: + tag_39: /* \"C\":79:428 contract C... */ mload(0x40) shl(0xe4, 0x026121ff) @@ -324,7 +310,7 @@ sub_0: assembly { gas staticcall dup1 - tag_42 + tag_40 jumpi /* \"C\":79:428 contract C... */ mload(0x40) @@ -336,13 +322,13 @@ sub_0: assembly { dup2 revert /* \"C\":403:411 this.f() */ - tag_42: + tag_40: /* \"C\":79:428 contract C... */ dup4 /* \"C\":403:411 this.f() */ dup2 iszero - tag_43 + tag_41 jumpi returndatasize /* \"C\":79:428 contract C... */ @@ -350,7 +336,6 @@ sub_0: assembly { add not(0x1f) and - /* \"C\":117:119 41 */ dup4 add 0xffffffffffffffff @@ -361,10 +346,9 @@ sub_0: assembly { lt or iszero - tag_44 + tag_42 jumpi shl(0xe0, 0x4e487b71) - /* \"C\":79:428 contract C... */ dup7 mstore 0x41 @@ -375,31 +359,28 @@ sub_0: assembly { 0x24 dup7 revert - /* \"C\":117:119 41 */ - tag_44: - /* \"C\":79:428 contract C... */ + tag_42: 0x40 - /* \"C\":117:119 41 */ mstore /* \"C\":403:411 this.f() */ - tag_45 + tag_43 returndatasize dup5 add dup5 - tag_24 + tag_44 jump\t// in - tag_45: + tag_43: swap1 pop - tag_43: + tag_41: /* \"C\":392:411 stateVar + this.f() */ - tag_46 + tag_45 dup2 dup6 - tag_32 + tag_30 jump\t// in - tag_46: + tag_45: swap5 pop pop @@ -407,14 +388,14 @@ sub_0: assembly { pop pop /* \"C\":392:422 stateVar + this.f() + immutVar */ - tag_47 + tag_46 /* \"C\":414:422 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":392:422 stateVar + this.f() + immutVar */ dup3 - tag_32 + tag_30 jump\t// in - tag_47: + tag_46: /* \"C\":336:337 _ */ swap2 pop @@ -423,10 +404,26 @@ sub_0: assembly { swap1 jump\t// out /* \"C\":79:428 contract C... */ - tag_31: - mstore(0x00, shl(0xe0, 0x4e487b71)) - mstore(0x04, 0x11) - revert(0x00, 0x24) + tag_44: + 0x00 + 0x20 + dup3 + dup5 + sub + slt + iszero + tag_48 + jumpi + 0x00 + dup1 + revert + tag_48: + pop + mload + swap2 + swap1 + pop + jump\t// out auxdata: } @@ -506,6 +503,7 @@ tag_5: mstore(0x80, 0x2a) /* \"D\":107:108 3 */ 0x03 + /* \"C\":203:219 stateVar = _init */ 0x00 /* \"D\":91:166 contract D is C(3)... */ sstore @@ -517,15 +515,25 @@ tag_5: iszero tag_8 jumpi - mstore(0x00, shl(0xe0, 0x4e487b71)) + shl(0xe0, 0x4e487b71) + /* \"C\":203:219 stateVar = _init */ + 0x00 + /* \"D\":91:166 contract D is C(3)... */ + mstore mstore(0x04, 0x11) - revert(0x00, 0x24) + 0x24 + /* \"C\":203:219 stateVar = _init */ + 0x00 + /* \"D\":91:166 contract D is C(3)... */ + revert tag_8: /* \"D\":107:108 3 */ 0x03 /* \"D\":91:166 contract D is C(3)... */ add + /* \"C\":203:219 stateVar = _init */ 0x00 + /* \"D\":91:166 contract D is C(3)... */ sstore /* \"D\":113:164 constructor(int _init2)... */ jump\t// out @@ -641,26 +649,11 @@ sub_0: assembly { tag_23: pop jump\t// out - tag_24: - 0x00 - 0x20 - dup3 - dup5 - sub - slt - iszero - tag_26 - jumpi - 0x00 - dup1 - revert - tag_26: - pop - mload - swap2 - swap1 - pop - jump\t// out + /* \"C\":117:119 41 */ + tag_25: + mstore(0x00, shl(0xe0, 0x4e487b71)) + mstore(0x04, 0x11) + revert(0x00, 0x24) tag_10: 0x00 sub(shl(0xff, 0x01), 0x2a) @@ -669,20 +662,18 @@ sub_0: assembly { 0x01 and iszero - tag_30 + tag_29 jumpi - tag_30 - tag_31 + tag_29 + tag_25 jump\t// in - tag_30: + tag_29: pop - /* \"C\":117:119 41 */ 0x29 - /* \"D\":91:166 contract D is C(3)... */ add swap1 jump\t// out - tag_32: + tag_30: 0x00 dup1 dup3 @@ -697,12 +688,12 @@ sub_0: assembly { sgt and iszero - tag_35 + tag_33 jumpi - tag_35 - tag_31 + tag_33 + tag_25 jump\t// in - tag_35: + tag_33: shl(0xff, 0x01) dup4 swap1 @@ -712,12 +703,12 @@ sub_0: assembly { dup2 and iszero - tag_37 + tag_35 jumpi - tag_37 - tag_31 + tag_35 + tag_25 jump\t// in - tag_37: + tag_35: pop pop add @@ -737,13 +728,15 @@ sub_0: assembly { dup2 eq iszero - tag_40 + tag_38 jumpi - tag_40 - tag_31 + tag_38 + tag_25 jump\t// in - tag_40: + tag_38: + /* \"C\":117:119 41 */ 0x01 + /* \"D\":91:166 contract D is C(3)... */ add dup1 dup3 @@ -752,14 +745,14 @@ sub_0: assembly { address /* \"C\":403:411 this.f() */ extcodesize - tag_41 + tag_39 jumpi /* \"D\":91:166 contract D is C(3)... */ dup2 dup3 revert /* \"C\":403:411 this.f() */ - tag_41: + tag_39: /* \"D\":91:166 contract D is C(3)... */ mload(0x40) shl(0xe4, 0x026121ff) @@ -779,7 +772,7 @@ sub_0: assembly { gas staticcall dup1 - tag_42 + tag_40 jumpi /* \"D\":91:166 contract D is C(3)... */ mload(0x40) @@ -791,13 +784,13 @@ sub_0: assembly { dup2 revert /* \"C\":403:411 this.f() */ - tag_42: + tag_40: /* \"D\":91:166 contract D is C(3)... */ dup4 /* \"C\":403:411 this.f() */ dup2 iszero - tag_43 + tag_41 jumpi returndatasize /* \"D\":91:166 contract D is C(3)... */ @@ -805,7 +798,6 @@ sub_0: assembly { add not(0x1f) and - /* \"C\":117:119 41 */ dup4 add 0xffffffffffffffff @@ -816,10 +808,9 @@ sub_0: assembly { lt or iszero - tag_44 + tag_42 jumpi shl(0xe0, 0x4e487b71) - /* \"D\":91:166 contract D is C(3)... */ dup7 mstore 0x41 @@ -830,31 +821,28 @@ sub_0: assembly { 0x24 dup7 revert - /* \"C\":117:119 41 */ - tag_44: - /* \"D\":91:166 contract D is C(3)... */ + tag_42: 0x40 - /* \"C\":117:119 41 */ mstore /* \"C\":403:411 this.f() */ - tag_45 + tag_43 returndatasize dup5 add dup5 - tag_24 + tag_44 jump\t// in - tag_45: + tag_43: swap1 pop - tag_43: + tag_41: /* \"C\":392:411 stateVar + this.f() */ - tag_46 + tag_45 dup2 dup6 - tag_32 + tag_30 jump\t// in - tag_46: + tag_45: swap5 pop pop @@ -862,14 +850,14 @@ sub_0: assembly { pop pop /* \"C\":392:422 stateVar + this.f() + immutVar */ - tag_47 + tag_46 /* \"C\":414:422 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":392:422 stateVar + this.f() + immutVar */ dup3 - tag_32 + tag_30 jump\t// in - tag_47: + tag_46: /* \"C\":336:337 _ */ swap2 pop @@ -878,10 +866,26 @@ sub_0: assembly { swap1 jump\t// out /* \"D\":91:166 contract D is C(3)... */ - tag_31: - mstore(0x00, shl(0xe0, 0x4e487b71)) - mstore(0x04, 0x11) - revert(0x00, 0x24) + tag_44: + 0x00 + 0x20 + dup3 + dup5 + sub + slt + iszero + tag_48 + jumpi + 0x00 + dup1 + revert + tag_48: + pop + mload + swap2 + swap1 + pop + jump\t// out auxdata: } diff --git a/test/cmdlineTests/yul_string_format_ascii/output.json b/test/cmdlineTests/yul_string_format_ascii/output.json index 76a14d5cb..4c42c4f78 100644 --- a/test/cmdlineTests/yul_string_format_ascii/output.json +++ b/test/cmdlineTests/yul_string_format_ascii/output.json @@ -24,6 +24,10 @@ object \"C_11\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:78:164 function constructor_C_11() { @@ -32,10 +36,6 @@ object \"C_11\" { } /// @src 0:78:164 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_11_deployed\" { @@ -65,11 +65,58 @@ object \"C_11\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function array_length_t_string_memory_ptr(value) -> length { + + length := mload(value) + + } + + function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos { + mstore(pos, length) + updated_pos := add(pos, 0x20) + } + + function copy_memory_to_memory(src, dst, length) { + let i := 0 + for { } lt(i, length) { i := add(i, 32) } + { + mstore(add(dst, i), mload(add(src, i))) + } + if gt(i, length) + { + // clear end + mstore(add(dst, length), 0) + } + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end { let length := array_length_t_string_memory_ptr(value) pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) @@ -85,23 +132,32 @@ object \"C_11\" { } + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + function zero_value_for_split_t_string_memory_ptr() -> ret { + ret := 96 + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + 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 allocate_memory(size) -> memPtr { memPtr := allocate_unbounded() finalize_allocation(memPtr, size) } - function allocate_memory_array_t_string_memory_ptr(length) -> memPtr { - let allocSize := array_allocation_size_t_string_memory_ptr(length) - memPtr := allocate_memory(allocSize) - - mstore(memPtr, length) - - } - - function allocate_unbounded() -> memPtr { - memPtr := mload(64) - } - function array_allocation_size_t_string_memory_ptr(length) -> size { // Make sure we can allocate memory without overflow if gt(length, 0xffffffffffffffff) { panic_error_0x41() } @@ -113,19 +169,18 @@ object \"C_11\" { } - function array_length_t_string_memory_ptr(value) -> length { + function allocate_memory_array_t_string_memory_ptr(length) -> memPtr { + let allocSize := array_allocation_size_t_string_memory_ptr(length) + memPtr := allocate_memory(allocSize) - length := mload(value) + mstore(memPtr, length) } - function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos { - mstore(pos, length) - updated_pos := add(pos, 0x20) - } + function store_literal_in_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21(memPtr) { + + mstore(add(memPtr, 0), \"abcabc\") - function convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() -> converted { - converted := copy_literal_to_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21() } function copy_literal_to_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21() -> memPtr { @@ -133,24 +188,8 @@ object \"C_11\" { store_literal_in_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21(add(memPtr, 32)) } - function copy_memory_to_memory(src, dst, length) { - let i := 0 - for { } lt(i, length) { i := add(i, 32) } - { - mstore(add(dst, i), mload(add(src, i))) - } - if gt(i, length) - { - // clear end - mstore(add(dst, length), 0) - } - } - - 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 convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() -> converted { + converted := copy_literal_to_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21() } /// @src 0:91:162 @@ -166,45 +205,6 @@ object \"C_11\" { } /// @src 0:78:164 - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - 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)) - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function store_literal_in_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21(memPtr) { - - mstore(add(memPtr, 0), \"abcabc\") - - } - - function zero_value_for_split_t_string_memory_ptr() -> ret { - ret := 96 - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json b/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json index 39046124f..0832d0e4e 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json @@ -24,6 +24,10 @@ object \"C_11\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:78:158 function constructor_C_11() { @@ -32,10 +36,6 @@ object \"C_11\" { } /// @src 0:78:158 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_11_deployed\" { @@ -65,11 +65,34 @@ object \"C_11\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function cleanup_t_bytes32(value) -> cleaned { + cleaned := value + } + function abi_encode_t_bytes32_to_t_bytes32_fromStack(value, pos) { mstore(pos, cleanup_t_bytes32(value)) } @@ -81,12 +104,12 @@ object \"C_11\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) } - function cleanup_t_bytes32(value) -> cleaned { - cleaned := value + function zero_value_for_split_t_bytes32() -> ret { + ret := 0 } function convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_bytes32() -> converted { @@ -106,29 +129,6 @@ object \"C_11\" { } /// @src 0:78:158 - 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) - - } - - function zero_value_for_split_t_bytes32() -> ret { - ret := 0 - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json index 8ff41db27..f6c63057c 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json @@ -24,6 +24,10 @@ object \"C_11\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:78:159 function constructor_C_11() { @@ -32,10 +36,6 @@ object \"C_11\" { } /// @src 0:78:159 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_11_deployed\" { @@ -65,11 +65,34 @@ object \"C_11\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function cleanup_t_bytes4(value) -> cleaned { + cleaned := and(value, 0xffffffff00000000000000000000000000000000000000000000000000000000) + } + function abi_encode_t_bytes4_to_t_bytes4_fromStack(value, pos) { mstore(pos, cleanup_t_bytes4(value)) } @@ -81,18 +104,25 @@ object \"C_11\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) } - function cleanup_t_bytes4(value) -> cleaned { - cleaned := and(value, 0xffffffff00000000000000000000000000000000000000000000000000000000) + function zero_value_for_split_t_bytes4() -> ret { + ret := 0 } function cleanup_t_rational_1633837924_by_1(value) -> cleaned { cleaned := value } + function shift_left_224(value) -> newValue { + newValue := + + shl(224, value) + + } + function convert_t_rational_1633837924_by_1_to_t_bytes4(value) -> converted { converted := cleanup_t_bytes4(shift_left_224(cleanup_t_rational_1633837924_by_1(value))) } @@ -112,36 +142,6 @@ object \"C_11\" { } /// @src 0:78:159 - 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 := - - shl(224, value) - - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function zero_value_for_split_t_bytes4() -> ret { - ret := 0 - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/yul_string_format_ascii_long/output.json b/test/cmdlineTests/yul_string_format_ascii_long/output.json index 8c7c8b38a..c1f4cd6e2 100644 --- a/test/cmdlineTests/yul_string_format_ascii_long/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_long/output.json @@ -24,6 +24,10 @@ object \"C_11\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:78:243 function constructor_C_11() { @@ -32,10 +36,6 @@ object \"C_11\" { } /// @src 0:78:243 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_11_deployed\" { @@ -65,11 +65,58 @@ object \"C_11\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function array_length_t_string_memory_ptr(value) -> length { + + length := mload(value) + + } + + function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos { + mstore(pos, length) + updated_pos := add(pos, 0x20) + } + + function copy_memory_to_memory(src, dst, length) { + let i := 0 + for { } lt(i, length) { i := add(i, 32) } + { + mstore(add(dst, i), mload(add(src, i))) + } + if gt(i, length) + { + // clear end + mstore(add(dst, length), 0) + } + } + + function round_up_to_mul_of_32(value) -> result { + result := and(add(value, 31), not(31)) + } + function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end { let length := array_length_t_string_memory_ptr(value) pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) @@ -85,23 +132,32 @@ object \"C_11\" { } + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) + } + + function zero_value_for_split_t_string_memory_ptr() -> ret { + ret := 96 + } + + function panic_error_0x41() { + mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) + mstore(4, 0x41) + revert(0, 0x24) + } + + 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 allocate_memory(size) -> memPtr { memPtr := allocate_unbounded() finalize_allocation(memPtr, size) } - function allocate_memory_array_t_string_memory_ptr(length) -> memPtr { - let allocSize := array_allocation_size_t_string_memory_ptr(length) - memPtr := allocate_memory(allocSize) - - mstore(memPtr, length) - - } - - function allocate_unbounded() -> memPtr { - memPtr := mload(64) - } - function array_allocation_size_t_string_memory_ptr(length) -> size { // Make sure we can allocate memory without overflow if gt(length, 0xffffffffffffffff) { panic_error_0x41() } @@ -113,19 +169,22 @@ object \"C_11\" { } - function array_length_t_string_memory_ptr(value) -> length { + function allocate_memory_array_t_string_memory_ptr(length) -> memPtr { + let allocSize := array_allocation_size_t_string_memory_ptr(length) + memPtr := allocate_memory(allocSize) - length := mload(value) + mstore(memPtr, length) } - function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos { - mstore(pos, length) - updated_pos := add(pos, 0x20) - } + function store_literal_in_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571(memPtr) { + + mstore(add(memPtr, 0), \"abcdabcdcafecafeabcdabcdcafecafe\") + + mstore(add(memPtr, 32), \"ffffzzzzoooo0123456789,.<,>.?:;'\") + + mstore(add(memPtr, 64), \"[{]}|`~!@#$%^&*()-_=+\") - function convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() -> converted { - converted := copy_literal_to_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571() } function copy_literal_to_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571() -> memPtr { @@ -133,24 +192,8 @@ object \"C_11\" { store_literal_in_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571(add(memPtr, 32)) } - function copy_memory_to_memory(src, dst, length) { - let i := 0 - for { } lt(i, length) { i := add(i, 32) } - { - mstore(add(dst, i), mload(add(src, i))) - } - if gt(i, length) - { - // clear end - mstore(add(dst, length), 0) - } - } - - 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 convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() -> converted { + converted := copy_literal_to_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571() } /// @src 0:91:241 @@ -166,49 +209,6 @@ object \"C_11\" { } /// @src 0:78:243 - function panic_error_0x41() { - mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) - mstore(4, 0x41) - 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)) - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function store_literal_in_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571(memPtr) { - - mstore(add(memPtr, 0), \"abcdabcdcafecafeabcdabcdcafecafe\") - - mstore(add(memPtr, 32), \"ffffzzzzoooo0123456789,.<,>.?:;'\") - - mstore(add(memPtr, 64), \"[{]}|`~!@#$%^&*()-_=+\") - - } - - function zero_value_for_split_t_string_memory_ptr() -> ret { - ret := 96 - } - } data \".metadata\" hex\"\" diff --git a/test/cmdlineTests/yul_string_format_hex/output.json b/test/cmdlineTests/yul_string_format_hex/output.json index 58f2d628a..a5a46751a 100644 --- a/test/cmdlineTests/yul_string_format_hex/output.json +++ b/test/cmdlineTests/yul_string_format_hex/output.json @@ -24,6 +24,10 @@ object \"C_11\" { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + /// @src 0:78:159 function constructor_C_11() { @@ -32,10 +36,6 @@ object \"C_11\" { } /// @src 0:78:159 - function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { - revert(0, 0) - } - } /// @use-src 0:\"A\" object \"C_11_deployed\" { @@ -65,11 +65,34 @@ object \"C_11\" { if iszero(calldatasize()) { } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function allocate_unbounded() -> memPtr { + memPtr := mload(64) + } + + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { + revert(0, 0) + } + + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { + revert(0, 0) + } + function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } + function cleanup_t_bytes4(value) -> cleaned { + cleaned := and(value, 0xffffffff00000000000000000000000000000000000000000000000000000000) + } + function abi_encode_t_bytes4_to_t_bytes4_fromStack(value, pos) { mstore(pos, cleanup_t_bytes4(value)) } @@ -81,18 +104,25 @@ object \"C_11\" { } - function allocate_unbounded() -> memPtr { - memPtr := mload(64) + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { + revert(0, 0) } - function cleanup_t_bytes4(value) -> cleaned { - cleaned := and(value, 0xffffffff00000000000000000000000000000000000000000000000000000000) + function zero_value_for_split_t_bytes4() -> ret { + ret := 0 } function cleanup_t_rational_2864434397_by_1(value) -> cleaned { cleaned := value } + function shift_left_224(value) -> newValue { + newValue := + + shl(224, value) + + } + function convert_t_rational_2864434397_by_1_to_t_bytes4(value) -> converted { converted := cleanup_t_bytes4(shift_left_224(cleanup_t_rational_2864434397_by_1(value))) } @@ -112,36 +142,6 @@ object \"C_11\" { } /// @src 0:78:159 - 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 := - - shl(224, value) - - } - - function shift_right_224_unsigned(value) -> newValue { - newValue := - - shr(224, value) - - } - - function zero_value_for_split_t_bytes4() -> ret { - ret := 0 - } - } data \".metadata\" hex\"\" From 4b0cd6cc8cdfa6337421c0a9610c3a2c0343c08f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Sep 2021 18:01:45 +0200 Subject: [PATCH 3/5] Update gas costs. --- test/libsolidity/GasCosts.cpp | 6 +++--- test/libsolidity/gasTests/abiv2_optimised.sol | 4 ++-- ...abi_encode_v2_in_function_inherited_in_v1_contract.sol | 2 +- .../array/copying/array_copy_storage_storage_dyn_dyn.sol | 2 +- .../array/copying/array_nested_memory_to_storage.sol | 2 +- ...y_of_structs_containing_arrays_calldata_to_storage.sol | 2 +- .../semanticTests/externalContracts/prbmath_unsigned.sol | 4 ++-- .../semanticTests/externalContracts/ramanujan_pi.sol | 6 +++--- .../semanticTests/externalContracts/strings.sol | 8 ++++---- .../semanticTests/functionTypes/store_function.sol | 2 +- .../structs/struct_delete_storage_nested_small.sol | 2 +- test/libsolidity/semanticTests/various/erc20.sol | 8 ++++---- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index a03ccbb1e..b3fb9d8b7 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(string_storage) if (CommonOptions::get().useABIEncoderV1) CHECK_DEPLOY_GAS(133045, 129731, evmVersion); else - CHECK_DEPLOY_GAS(144679, 121229, evmVersion); + CHECK_DEPLOY_GAS(144999, 121229, evmVersion); } // This is only correct on >=Constantinople. else if (!CommonOptions::get().useABIEncoderV1) @@ -117,9 +117,9 @@ BOOST_AUTO_TEST_CASE(string_storage) else { if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(138693, 123969, evmVersion); + CHECK_DEPLOY_GAS(139013, 123969, evmVersion); else - CHECK_DEPLOY_GAS(123301, 110969, evmVersion); + CHECK_DEPLOY_GAS(123361, 110969, evmVersion); } } else if (evmVersion < EVMVersion::istanbul()) diff --git a/test/libsolidity/gasTests/abiv2_optimised.sol b/test/libsolidity/gasTests/abiv2_optimised.sol index 093acf49a..074e75f1b 100644 --- a/test/libsolidity/gasTests/abiv2_optimised.sol +++ b/test/libsolidity/gasTests/abiv2_optimised.sol @@ -17,9 +17,9 @@ contract C { // optimize-yul: true // ---- // creation: -// codeDepositCost: 680600 +// codeDepositCost: 681000 // executionCost: 715 -// totalCost: 681315 +// totalCost: 681715 // external: // a(): 2285 // b(uint256): 4652 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol index f278d314a..a216efec1 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol @@ -32,6 +32,6 @@ contract C is B { // compileViaYul: also // ---- // test() -> 77 -// gas irOptimized: 120952 +// gas irOptimized: 121752 // gas legacy: 155249 // gas legacyOptimized: 111743 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol index b28049ce7..05e038378 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol @@ -17,7 +17,7 @@ contract c { // ---- // setData1(uint256,uint256,uint256): 10, 5, 4 -> // copyStorageStorage() -> -// gas irOptimized: 111487 +// gas irOptimized: 111488 // gas legacy: 109278 // gas legacyOptimized: 109268 // getData2(uint256): 5 -> 10, 4 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol index f807b8e2c..707e25056 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol @@ -46,6 +46,6 @@ contract Test { // test1() -> 3 // test2() -> 6 // test3() -> 24 -// gas irOptimized: 133742 +// gas irOptimized: 133753 // gas legacy: 134295 // gas legacyOptimized: 133383 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol index db32fc1d3..970a5dced 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol @@ -23,4 +23,4 @@ contract C { // compileViaYul: true // ---- // f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1 -// gas irOptimized: 330384 +// gas irOptimized: 330385 diff --git a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol index b15cf5deb..8a096f524 100644 --- a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol +++ b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol @@ -50,7 +50,7 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 1770739 +// gas irOptimized: 1769431 // gas legacy: 2356230 // gas legacyOptimized: 1746528 // div(uint256,uint256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 @@ -58,7 +58,7 @@ contract test { // gas legacy: 22497 // gas legacyOptimized: 22010 // exp(uint256): 3141592653589793238 -> 23140692632779268978 -// gas irOptimized: 24245 +// gas irOptimized: 24234 // gas legacy: 25104 // gas legacyOptimized: 24258 // exp2(uint256): 3141592653589793238 -> 8824977827076287620 diff --git a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol index 98eb25470..2c9376b22 100644 --- a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol +++ b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol @@ -35,10 +35,10 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 526745 +// gas irOptimized: 528041 // gas legacy: 733634 -// gas legacyOptimized: 478742 +// gas legacyOptimized: 479606 // prb_pi() -> 3141592656369545286 -// gas irOptimized: 62867 +// gas irOptimized: 63027 // gas legacy: 98903 // gas legacyOptimized: 75735 diff --git a/test/libsolidity/semanticTests/externalContracts/strings.sol b/test/libsolidity/semanticTests/externalContracts/strings.sol index b20d53f29..1fa79f382 100644 --- a/test/libsolidity/semanticTests/externalContracts/strings.sol +++ b/test/libsolidity/semanticTests/externalContracts/strings.sol @@ -51,11 +51,11 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 776466 +// gas irOptimized: 778254 // gas legacy: 1188228 -// gas legacyOptimized: 749336 +// gas legacyOptimized: 750416 // toSlice(string): 0x20, 11, "hello world" -> 11, 0xa0 -// gas irOptimized: 22723 +// gas irOptimized: 22734 // gas legacy: 23190 // gas legacyOptimized: 22508 // roundtrip(string): 0x20, 11, "hello world" -> 0x20, 11, "hello world" @@ -67,7 +67,7 @@ contract test { // gas legacy: 25716 // gas legacyOptimized: 24115 // multiconcat(string,uint256): 0x40, 3, 11, "hello world" -> 0x20, 0x58, 0x68656c6c6f20776f726c6468656c6c6f20776f726c6468656c6c6f20776f726c, 0x6468656c6c6f20776f726c6468656c6c6f20776f726c6468656c6c6f20776f72, 49027192869463622675296414541903001712009715982962058146354235762728281047040 # concatenating 3 times # -// gas irOptimized: 28962 +// gas irOptimized: 28958 // gas legacy: 31621 // gas legacyOptimized: 27914 // benchmark(string,bytes32): 0x40, 0x0842021, 8, "solidity" -> 0x2020 diff --git a/test/libsolidity/semanticTests/functionTypes/store_function.sol b/test/libsolidity/semanticTests/functionTypes/store_function.sol index 9537fda7f..ddebc11b7 100644 --- a/test/libsolidity/semanticTests/functionTypes/store_function.sol +++ b/test/libsolidity/semanticTests/functionTypes/store_function.sol @@ -28,6 +28,6 @@ contract C { // compileViaYul: also // ---- // t() -> 9 -// gas irOptimized: 99004 +// gas irOptimized: 99010 // gas legacy: 159083 // gas legacyOptimized: 108916 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol index b0e6b7b10..838539628 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol @@ -33,4 +33,4 @@ contract C { // compileViaYul: true // ---- // f() -> 0, 0, 0 -// gas irOptimized: 117648 +// gas irOptimized: 117388 diff --git a/test/libsolidity/semanticTests/various/erc20.sol b/test/libsolidity/semanticTests/various/erc20.sol index 61c1f0bab..6e7487ee5 100644 --- a/test/libsolidity/semanticTests/various/erc20.sol +++ b/test/libsolidity/semanticTests/various/erc20.sol @@ -98,7 +98,7 @@ contract ERC20 { // ---- // constructor() // ~ emit Transfer(address,address,uint256): #0x00, #0x1212121212121212121212121212120000000012, 0x14 -// gas irOptimized: 460447 +// gas irOptimized: 459547 // gas legacy: 833310 // gas legacyOptimized: 416135 // totalSupply() -> 20 @@ -107,12 +107,12 @@ contract ERC20 { // gas legacyOptimized: 23368 // transfer(address,uint256): 2, 5 -> true // ~ emit Transfer(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x05 -// gas irOptimized: 48514 +// gas irOptimized: 48503 // gas legacy: 49317 // gas legacyOptimized: 48491 // decreaseAllowance(address,uint256): 2, 0 -> true // ~ emit Approval(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x00 -// gas irOptimized: 26316 +// gas irOptimized: 26327 // gas legacy: 27012 // gas legacyOptimized: 26275 // decreaseAllowance(address,uint256): 2, 1 -> FAILURE, hex"4e487b71", 0x11 @@ -121,7 +121,7 @@ contract ERC20 { // gas legacyOptimized: 24056 // transfer(address,uint256): 2, 14 -> true // ~ emit Transfer(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x0e -// gas irOptimized: 28614 +// gas irOptimized: 28603 // gas legacy: 29417 // gas legacyOptimized: 28591 // transfer(address,uint256): 2, 2 -> FAILURE, hex"4e487b71", 0x11 From 0b5671c885331e2ab33c1386ba16e0118f2e65b3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Sep 2021 12:18:00 +0200 Subject: [PATCH 4/5] Clarify C++ evaluation order. --- .../codegen/ir/IRGeneratorForStatements.cpp | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 8f281a10e..48e381e31 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -798,10 +798,8 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp) if (auto type = dynamic_cast(commonType)) isSigned = type->isSigned(); - string args = - expressionAsType(_binOp.leftExpression(), *commonType, true) + - ", " + - expressionAsType(_binOp.rightExpression(), *commonType, true); + string args = expressionAsType(_binOp.leftExpression(), *commonType, true); + args += ", " + expressionAsType(_binOp.rightExpression(), *commonType, true); string expr; if (op == Token::Equal) @@ -1115,16 +1113,14 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) IRVariable array = convert(*arguments[0], *TypeProvider::bytesMemory()); IRVariable hashVariable(m_context.newYulVariable(), *TypeProvider::fixedBytes(32)); + string dataAreaFunction = m_utils.arrayDataAreaFunction(*TypeProvider::bytesMemory()); + string arrayLengthFunction = m_utils.arrayLengthFunction(*TypeProvider::bytesMemory()); define(hashVariable) << "keccak256(" << - m_utils.arrayDataAreaFunction(*TypeProvider::bytesMemory()) << - "(" << - array.commaSeparatedList() << - "), " << - m_utils.arrayLengthFunction(*TypeProvider::bytesMemory()) << - "(" << - array.commaSeparatedList() << - "))\n"; + (dataAreaFunction + "(" + array.commaSeparatedList() + ")") << + ", " << + (arrayLengthFunction + "(" + array.commaSeparatedList() +")") << + ")\n"; IRVariable selectorVariable(m_context.newYulVariable(), *TypeProvider::fixedBytes(4)); define(selectorVariable, hashVariable); selector = selectorVariable.name(); @@ -1249,16 +1245,14 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) { auto array = convert(*arguments[0], *arrayType); + string dataAreaFunction = m_utils.arrayDataAreaFunction(*arrayType); + string arrayLengthFunction = m_utils.arrayLengthFunction(*arrayType); define(_functionCall) << "keccak256(" << - m_utils.arrayDataAreaFunction(*arrayType) << - "(" << - array.commaSeparatedList() << - "), " << - m_utils.arrayLengthFunction(*arrayType) << - "(" << - array.commaSeparatedList() << - "))\n"; + (dataAreaFunction + "(" + array.commaSeparatedList() + ")") << + ", " << + (arrayLengthFunction + "(" + array.commaSeparatedList() +")") << + ")\n"; } break; } @@ -1646,11 +1640,14 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) expressionAsType(_memberAccess.expression(), *TypeProvider::address()) << ")\n"; else if (member == "code") + { + string externalCodeFunction = m_utils.externalCodeFunction(); define(_memberAccess) << - m_utils.externalCodeFunction() << + externalCodeFunction << "(" << expressionAsType(_memberAccess.expression(), *TypeProvider::address()) << ")\n"; + } else if (member == "codehash") define(_memberAccess) << "extcodehash(" << @@ -1946,7 +1943,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) assignInternalFunctionIDIfNotCalledDirectly(_memberAccess, resolvedFunctionDef); } else if (auto const* variable = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) - handleVariableReference(*variable, _memberAccess); + handleVariableReference(*variable, _memberAccess); else if (memberFunctionType) { switch (memberFunctionType->kind()) @@ -2149,8 +2146,9 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) } case DataLocation::CallData: { + string indexAccessFunction = m_utils.calldataArrayIndexAccessFunction(arrayType); string const indexAccessFunctionCall = - m_utils.calldataArrayIndexAccessFunction(arrayType) + + indexAccessFunction + "(" + IRVariable(_indexAccess.baseExpression()).commaSeparatedList() + ", " + @@ -2867,13 +2865,16 @@ void IRGeneratorForStatements::writeToLValue(IRLValue const& _lvalue, IRVariable ")\n"; } else if (auto const* literalType = dynamic_cast(&_value.type())) + { + string writeUInt = m_utils.writeToMemoryFunction(*TypeProvider::uint256()); appendCode() << - m_utils.writeToMemoryFunction(*TypeProvider::uint256()) << + writeUInt << "(" << _memory.address << ", " << m_utils.copyLiteralToMemoryFunction(literalType->value()) + "()" << ")\n"; + } else { solAssert(_lvalue.type.sizeOnStack() == 1, ""); @@ -2949,11 +2950,14 @@ IRVariable IRGeneratorForStatements::readFromLValue(IRLValue const& _lvalue) solUnimplementedAssert(_lvalue.type.sizeOnStack() == 1, ""); solAssert(_lvalue.type == *_immutable.variable->type(), ""); if (m_context.executionContext() == IRGenerationContext::ExecutionContext::Creation) + { + string readFunction = m_utils.readFromMemory(*_immutable.variable->type()); define(result) << - m_utils.readFromMemory(*_immutable.variable->type()) << + readFunction << "(" << to_string(m_context.immutableMemoryOffset(*_immutable.variable)) << ")\n"; + } else define(result) << "loadimmutable(\"" << to_string(_immutable.variable->id()) << "\")\n"; }, From 59faffcd5f3436342622b18f2b3cff177bd068fe Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Sep 2021 12:18:42 +0200 Subject: [PATCH 5/5] Changelog entry. --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index fc61a1b19..bdd90663f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ Compiler Features: Bugfixes: + * Code Generator: Use stable source order for ABI functions. * Opcode Optimizer: Prevent the optimizer from running multiple times to avoid potential bytecode differences for referenced code. * Name Resolver: Fix that when importing an aliased symbol using ``import {AliasedName} from "a.sol"`` it would use the original name of the symbol and not the aliased one. * SMTChecker: Fix false negative caused by ``push`` on storage array references returned by internal functions.