Merge pull request #10418 from ethereum/function-specializer

Function specializer
This commit is contained in:
chriseth 2021-03-29 15:48:01 +02:00 committed by GitHub
commit bb49bc5892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
149 changed files with 1217 additions and 584 deletions

View File

@ -5,6 +5,7 @@ Language Features:
Compiler Features:
* Low-Level Inliner: Inline ordinary jumps to small blocks and jumps to small blocks that terminate.
* Yul Optimizer: Added a new step FunctionSpecializer, that specializes a function with its literal arguments.
Bugfixes:

View File

@ -1125,6 +1125,7 @@ Abbreviation Full name
``i`` ``FullInliner``
``g`` ``FunctionGrouper``
``h`` ``FunctionHoister``
``F`` ``FunctionSpecializer``
``T`` ``LiteralRematerialiser``
``L`` ``LoadResolver``
``M`` ``LoopInvariantCodeMotion``

View File

@ -45,7 +45,7 @@ struct OptimiserSettings
"xarulrul" // Prune a bit more in SSA
"xarrcL" // Turn into SSA again and simplify
"gvif" // Run full inliner
"CTUcarrLsTOtfDncarrIulc" // SSA plus simplify
"CTUcarrLsTFOtfDncarrIulc" // SSA plus simplify
"]"
"jmuljuljul VcTOcul jmul"; // Make source short and pretty

View File

@ -93,9 +93,7 @@ template <class T>
inline std::vector<T> operator+(std::vector<T>&& _a, std::vector<T>&& _b)
{
std::vector<T> ret(std::move(_a));
if (&_a == &_b)
ret += ret;
else
assert(&_a != &_b);
ret += std::move(_b);
return ret;
}

View File

@ -131,6 +131,8 @@ add_library(yul
optimiser/FunctionGrouper.h
optimiser/FunctionHoister.cpp
optimiser/FunctionHoister.h
optimiser/FunctionSpecializer.cpp
optimiser/FunctionSpecializer.h
optimiser/InlinableExpressionFunctionFinder.cpp
optimiser/InlinableExpressionFunctionFinder.h
optimiser/KnowledgeBase.cpp

View File

@ -171,3 +171,9 @@ TypedName ASTCopier::translate(TypedName const& _typedName)
return TypedName{_typedName.location, translateIdentifier(_typedName.name), _typedName.type};
}
YulString FunctionCopier::translateIdentifier(YulString _name)
{
if (m_translations.count(_name))
return m_translations.at(_name);
return _name;
}

View File

@ -29,6 +29,7 @@
#include <optional>
#include <set>
#include <vector>
#include <map>
namespace solidity::yul
{
@ -117,5 +118,22 @@ std::vector<T> ASTCopier::translateVector(std::vector<T> const& _values)
return translated;
}
/// Helper class that creates a copy of the function definition, replacing the names of the variable
/// declarations with new names.
class FunctionCopier: public ASTCopier
{
public:
FunctionCopier(
std::map<YulString, YulString> const& _translations
):
m_translations(_translations)
{}
using ASTCopier::operator();
YulString translateIdentifier(YulString _name) override;
private:
/// A mapping between old and new names. We replace the names of variable declarations contained
/// in the mapping with their new names.
std::map<YulString, YulString> const& m_translations;
};
}

View File

@ -0,0 +1,158 @@
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <libyul/optimiser/FunctionSpecializer.h>
#include <libyul/optimiser/ASTCopier.h>
#include <libyul/optimiser/CallGraphGenerator.h>
#include <libyul/optimiser/NameCollector.h>
#include <libyul/optimiser/NameDispenser.h>
#include <libyul/AST.h>
#include <libyul/YulString.h>
#include <libsolutil/CommonData.h>
#include <range/v3/algorithm/any_of.hpp>
#include <range/v3/view/enumerate.hpp>
#include <variant>
using namespace std;
using namespace solidity::util;
using namespace solidity::yul;
FunctionSpecializer::LiteralArguments FunctionSpecializer::specializableArguments(
FunctionCall const& _f
)
{
auto heuristic = [&](Expression const& _e) -> optional<Expression>
{
if (holds_alternative<Literal>(_e))
return ASTCopier{}.translate(_e);
return nullopt;
};
return applyMap(_f.arguments, heuristic);
}
void FunctionSpecializer::operator()(FunctionCall& _f)
{
ASTModifier::operator()(_f);
// TODO When backtracking is implemented, the restriction of recursive functions can be lifted.
if (
m_dialect.builtin(_f.functionName.name) ||
m_recursiveFunctions.count(_f.functionName.name)
)
return;
LiteralArguments arguments = specializableArguments(_f);
if (ranges::any_of(arguments, [](auto& _a) { return _a.has_value(); }))
{
YulString oldName = move(_f.functionName.name);
auto newName = m_nameDispenser.newName(oldName);
m_oldToNewMap[oldName].emplace_back(make_pair(newName, arguments));
_f.functionName.name = newName;
_f.arguments = util::filter(
_f.arguments,
applyMap(arguments, [](auto& _a) { return !_a; })
);
}
}
FunctionDefinition FunctionSpecializer::specialize(
FunctionDefinition const& _f,
YulString _newName,
FunctionSpecializer::LiteralArguments _arguments
)
{
yulAssert(_arguments.size() == _f.parameters.size(), "");
map<YulString, YulString> translatedNames = applyMap(
NameCollector{_f, NameCollector::OnlyVariables}.names(),
[&](auto& _name) -> pair<YulString, YulString>
{
return make_pair(_name, m_nameDispenser.newName(_name));
},
map<YulString, YulString>{}
);
FunctionDefinition newFunction = get<FunctionDefinition>(FunctionCopier{translatedNames}(_f));
// Function parameters that will be specialized inside the body are converted into variable
// declarations.
vector<Statement> missingVariableDeclarations;
for (auto&& [index, argument]: _arguments | ranges::views::enumerate)
if (argument)
missingVariableDeclarations.emplace_back(
VariableDeclaration{
_f.location,
vector<TypedName>{newFunction.parameters[index]},
make_unique<Expression>(move(*argument))
}
);
newFunction.body.statements =
move(missingVariableDeclarations) + move(newFunction.body.statements);
// Only take those indices that cannot be specialized, i.e., whose value is `nullopt`.
newFunction.parameters =
util::filter(
newFunction.parameters,
applyMap(_arguments, [&](auto const& _v) { return !_v; })
);
newFunction.name = move(_newName);
return newFunction;
}
void FunctionSpecializer::run(OptimiserStepContext& _context, Block& _ast)
{
FunctionSpecializer f{
CallGraphGenerator::callGraph(_ast).recursiveFunctions(),
_context.dispenser,
_context.dialect
};
f(_ast);
iterateReplacing(_ast.statements, [&](Statement& _s) -> optional<vector<Statement>>
{
if (holds_alternative<FunctionDefinition>(_s))
{
auto& functionDefinition = get<FunctionDefinition>(_s);
if (f.m_oldToNewMap.count(functionDefinition.name))
{
vector<Statement> out = applyMap(
f.m_oldToNewMap.at(functionDefinition.name),
[&](auto& _p) -> Statement
{
return f.specialize(functionDefinition, move(_p.first), move(_p.second));
}
);
return move(out) + make_vector<Statement>(move(functionDefinition));
}
}
return nullopt;
});
}

View File

@ -0,0 +1,113 @@
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/optimiser/NameDispenser.h>
#include <libyul/optimiser/OptimiserStep.h>
#include <libyul/ASTForward.h>
#include <libyul/Dialect.h>
#include <map>
#include <optional>
#include <vector>
namespace solidity::yul
{
/**
* FunctionSpecializer: Optimiser step that specializes the function with its literal arguments.
*
* If a function, say, `function f(a, b) { sstore (a, b)}`, is called with literal arguments, for
* example, `f(x, 5)`, where `x` is an identifier, it could be specialized by creating a new
* function `f_1` that takes only one argument, i.e.,
*
* function f_1(a_1) {
* let b_1 := 5
* sstore(a_1, b_1)
* }
*
* Other optimization steps will be able to make more simplifications to the function. The
* optimization step is mainly useful for functions that would not be inlined.
*
* Prerequisites: Disambiguator, FunctionHoister
*
* LiteralRematerialiser is recommended as a prerequisite, even though it's not required for
* correctness.
*/
class FunctionSpecializer: public ASTModifier
{
public:
/// A vector of function-call arguments. An element 'has value' if it's a literal, and the
/// corresponding Expression would be the literal.
using LiteralArguments = std::vector<std::optional<Expression>>;
static constexpr char const* name{"FunctionSpecializer"};
static void run(OptimiserStepContext& _context, Block& _ast);
using ASTModifier::operator();
void operator()(FunctionCall& _f) override;
private:
explicit FunctionSpecializer(
std::set<YulString> _recursiveFunctions,
NameDispenser& _nameDispenser,
Dialect const& _dialect
):
m_recursiveFunctions(std::move(_recursiveFunctions)),
m_nameDispenser(_nameDispenser),
m_dialect(_dialect)
{}
/// Returns a vector of Expressions, where the index `i` is an expression if the function's
/// `i`-th argument can be specialized, nullopt otherwise.
LiteralArguments specializableArguments(FunctionCall const& _f);
/// Given a function definition `_f` and its arguments `_arguments`, of which, at least one is a
/// literal, this function returns a new function with the literal arguments specialized.
///
/// Note that the returned function definition will have new (and unique) names, for both the
/// function and variable declarations to retain the properties enforced by the Disambiguator.
///
/// For example, if `_f` is the function `function f(a, b, c) -> d { sstore(a, b) }`,
/// `_arguments` is the vector of literals `{1, 2, nullopt}` and the @param, `_newName` has
/// value `f_1`, the returned function could be:
///
/// function f_1(c_2) -> d_3 {
/// let a_4 := 1
/// let b_5 := 2
/// sstore(a_4, b_5)
/// }
///
FunctionDefinition specialize(
FunctionDefinition const& _f,
YulString _newName,
FunctionSpecializer::LiteralArguments _arguments
);
/// A mapping between the old function name and a pair of new function name and its arguments.
/// Note that at least one of the argument will have a literal value.
std::map<YulString, std::vector<std::pair<YulString, LiteralArguments>>> m_oldToNewMap;
/// We skip specializing recursive functions. Need backtracking to properly deal with them.
std::set<YulString> const m_recursiveFunctions;
NameDispenser& m_nameDispenser;
Dialect const& m_dialect;
};
}

View File

@ -36,6 +36,7 @@ void NameCollector::operator()(VariableDeclaration const& _varDecl)
void NameCollector::operator ()(FunctionDefinition const& _funDef)
{
if (m_collectWhat == VariablesAndFunctions)
m_names.emplace(_funDef.name);
for (auto const& arg: _funDef.parameters)
m_names.emplace(arg.name);

View File

@ -35,11 +35,26 @@ namespace solidity::yul
class NameCollector: public ASTWalker
{
public:
explicit NameCollector(Block const& _block)
enum CollectWhat { VariablesAndFunctions, OnlyVariables };
explicit NameCollector(
Block const& _block,
CollectWhat _collectWhat = VariablesAndFunctions
):
m_collectWhat(_collectWhat)
{
(*this)(_block);
}
explicit NameCollector(
FunctionDefinition const& _functionDefinition,
CollectWhat _collectWhat = VariablesAndFunctions
):
m_collectWhat(_collectWhat)
{
(*this)(_functionDefinition);
}
using ASTWalker::operator ();
void operator()(VariableDeclaration const& _varDecl) override;
void operator()(FunctionDefinition const& _funDef) override;
@ -47,6 +62,7 @@ public:
std::set<YulString> names() const { return m_names; }
private:
std::set<YulString> m_names;
CollectWhat m_collectWhat = VariablesAndFunctions;
};
/**

View File

@ -41,6 +41,7 @@
#include <libyul/optimiser/ForLoopConditionOutOfBody.h>
#include <libyul/optimiser/ForLoopInitRewriter.h>
#include <libyul/optimiser/ForLoopConditionIntoBody.h>
#include <libyul/optimiser/FunctionSpecializer.h>
#include <libyul/optimiser/ReasoningBasedSimplifier.h>
#include <libyul/optimiser/Rematerialiser.h>
#include <libyul/optimiser/UnusedFunctionParameterPruner.h>
@ -192,6 +193,7 @@ map<string, unique_ptr<OptimiserStep>> const& OptimiserSuite::allSteps()
FullInliner,
FunctionGrouper,
FunctionHoister,
FunctionSpecializer,
LiteralRematerialiser,
LoadResolver,
LoopInvariantCodeMotion,
@ -231,6 +233,7 @@ map<string, char> const& OptimiserSuite::stepNameToAbbreviationMap()
{FullInliner::name, 'i'},
{FunctionGrouper::name, 'g'},
{FunctionHoister::name, 'h'},
{FunctionSpecializer::name, 'F'},
{LiteralRematerialiser::name, 'T'},
{LoadResolver::name, 'L'},
{LoopInvariantCodeMotion::name, 'M'},

View File

@ -14,9 +14,17 @@ object "object" {
code {
function main()
{
let _1 := 0
mstore_internal(0:i32, _1, _1, _1, _1)
mstore_internal(32:i32, _1, _1, _1, 1)
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
i64.store(0:i32, y)
i64.store(i32.add(0:i32, 8:i32), y)
i64.store(i32.add(0:i32, 16:i32), y)
i64.store(i32.add(0:i32, 24:i32), y)
i64.store(32:i32, y)
i64.store(i32.add(32:i32, 8:i32), y)
i64.store(i32.add(32:i32, 16:i32), y)
let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(1))), 32)
i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(1, 32))))))
eth.storageStore(0:i32, 32:i32)
}
function bswap16(x:i32) -> y:i32
@ -28,24 +36,12 @@ object "object" {
let hi:i32 := i32.shl(bswap16(x), 16:i32)
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
}
function bswap64(x) -> y
{
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32)
y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32)))))
}
function mstore_internal(pos:i32, y1, y2, y3, y4)
{
i64.store(pos, bswap64(y1))
i64.store(i32.add(pos, 8:i32), bswap64(y2))
i64.store(i32.add(pos, 16:i32), bswap64(y3))
i64.store(i32.add(pos, 24:i32), bswap64(y4))
}
}
}
Binary representation:
0061736d01000000011b0560000060017e017e60017f017f60057f7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000403060500020201030503010001060100071102066d656d6f72790200046d61696e00010ac001052901017e0240420021004100200020002000200010054120200020002000420110054100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b2201027e02402000a71003ad422086210220022000422088a71003ad8421010b20010b32000240200020011004370000200041086a20021004370000200041106a20031004370000200041186a200410043700000b0b
0061736d01000000010e0360000060017f017f60027f7f0002190108657468657265756d0c73746f7261676553746f726500020304030001010503010001060100071102066d656d6f72790200046d61696e00010ac70103850101037e02404200a71003ad422086210020004200422088a71003ad84210141002001370000410041086a2001370000410041106a2001370000410041186a200137000041202001370000412041086a2001370000412041106a20013700004201a71003ad4220862102412041186a20024201422088a71003ad843700004100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b
Text representation:
(module
@ -54,11 +50,21 @@ Text representation:
(export "main" (func $main))
(func $main
(local $_1 i64)
(local $hi i64)
(local $y i64)
(local $hi_1 i64)
(block $label_
(local.set $_1 (i64.const 0))
(call $mstore_internal (i32.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))
(call $mstore_internal (i32.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1))
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
(i64.store (i32.const 0) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y))
(i64.store (i32.const 32) (local.get $y))
(i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y))
(i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y))
(local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 1)))) (i64.const 32)))
(i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 1) (i64.const 32)))))))
(call $eth.storageStore (i32.const 0) (i32.const 32))
)
)
@ -87,31 +93,4 @@ Text representation:
(local.get $y)
)
(func $bswap64
(param $x i64)
(result i64)
(local $y i64)
(local $hi i64)
(block $label__3
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32)))))))
)
(local.get $y)
)
(func $mstore_internal
(param $pos i32)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__4
(i64.store (local.get $pos) (call $bswap64 (local.get $y1)))
(i64.store (i32.add (local.get $pos) (i32.const 8)) (call $bswap64 (local.get $y2)))
(i64.store (i32.add (local.get $pos) (i32.const 16)) (call $bswap64 (local.get $y3)))
(i64.store (i32.add (local.get $pos) (i32.const 24)) (call $bswap64 (local.get $y4)))
)
)
)

View File

@ -24,68 +24,64 @@ object "object" {
code {
function main()
{
let _1 := 0
let x, x_1, x_2, x_3 := calldataload(_1, _1, _1, _1)
let x, x_1, x_2, x_3 := calldataload()
let x_4 := x
let x_5 := x_1
let x_6 := x_2
let x_7 := x_3
let _2 := 1
let _3:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(_1, _1), i64.or(_1, _2)))))
let _1:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, 1)))))
for { }
i32.eqz(_3)
i32.eqz(_1)
{
let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7, _1, _1, _1, _2)
let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7)
x_4 := x_8
x_5 := x_9
x_6 := x_10
x_7 := x_11
}
{
let _4, _5, _6, _7 := iszero_887(_1, _1, _1, lt(x_4, x_5, x_6, x_7, _1, _1, _1, 10))
if i32.eqz(i64.eqz(i64.or(i64.or(_4, _5), i64.or(_6, _7)))) { break }
let _8, _9, _10, _11 := eq_888(x_4, x_5, x_6, x_7, _1, _1, _1, 2)
if i32.eqz(i64.eqz(i64.or(i64.or(_8, _9), i64.or(_10, _11)))) { break }
let _12, _13, _14, _15 := eq_888(x_4, x_5, x_6, x_7, _1, _1, _1, 4)
if i32.eqz(i64.eqz(i64.or(i64.or(_12, _13), i64.or(_14, _15)))) { continue }
let _2, _3, _4, _5 := iszero_1300_2121(lt(x_4, x_5, x_6, x_7))
if i32.eqz(i64.eqz(i64.or(i64.or(_2, _3), i64.or(_4, _5)))) { break }
let _6, _7, _8, _9 := eq_740_2122(x_4, x_5, x_6, x_7)
if i32.eqz(i64.eqz(i64.or(i64.or(_6, _7), i64.or(_8, _9)))) { break }
let _10, _11, _12, _13 := eq_741_2123(x_4, x_5, x_6, x_7)
if i32.eqz(i64.eqz(i64.or(i64.or(_10, _11), i64.or(_12, _13)))) { continue }
}
sstore(_1, _1, _1, _1, x_4, x_5, x_6, x_7)
sstore(x_4, x_5, x_6, x_7)
}
function add_carry(x, y, c) -> r, r_c
function add(x1, x2, x3, x4) -> r1, r2, r3, r4
{
let t := i64.add(x, y)
r := i64.add(t, c)
r_c := i64.extend_i32_u(i32.or(i64.lt_u(t, x), i64.lt_u(r, t)))
}
function add(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4
{
let t := i64.add(x4, y4)
let t := i64.add(x4, 1)
r4 := i64.add(t, 0)
let r3_1, carry := add_carry(x3, y3, i64.extend_i32_u(i32.or(i64.lt_u(t, x4), i64.lt_u(r4, t))))
r3 := r3_1
let r2_1, carry_1 := add_carry(x2, y2, carry)
r2 := r2_1
let r1_1, carry_2 := add_carry(x1, y1, carry_1)
r1 := r1_1
let t_1 := i64.add(x3, 0)
r3 := i64.add(t_1, i64.extend_i32_u(i32.or(i64.lt_u(t, x4), i64.lt_u(r4, t))))
let t_2 := i64.add(x2, 0)
r2 := i64.add(t_2, i64.extend_i32_u(i32.or(i64.lt_u(t_1, x3), i64.lt_u(r3, t_1))))
r1 := i64.add(i64.add(x1, 0), i64.extend_i32_u(i32.or(i64.lt_u(t_2, x2), i64.lt_u(r2, t_2))))
}
function iszero_887(x1, x2, x3, x4) -> r1, r2, r3, r4
function iszero_1300_2121(x4) -> r1, r2, r3, r4
{
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(x1, x2), i64.or(x3, x4))))
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, x4))))
}
function eq_888(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4
function eq_740_2122(x1, x2, x3, x4) -> r1, r2, r3, r4
{
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, y1), i32.and(i64.eq(x2, y2), i32.and(i64.eq(x3, y3), i64.eq(x4, y4)))))
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 2)))))
}
function lt(x1, x2, x3, x4, y1, y2, y3, y4) -> z4
function eq_741_2123(x1, x2, x3, x4) -> r1, r2, r3, r4
{
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 4)))))
}
function lt(x1, x2, x3, x4) -> z4
{
let z:i32 := false
let _1:i32 := 0xffffffff:i32
switch i32.select(_1, i64.ne(x1, y1), i64.lt_u(x1, y1))
let _1 := 0
let _2:i32 := 0xffffffff:i32
switch i32.select(_2, i64.ne(x1, _1), i64.lt_u(x1, _1))
case 0:i32 {
switch i32.select(_1, i64.ne(x2, y2), i64.lt_u(x2, y2))
switch i32.select(_2, i64.ne(x2, _1), i64.lt_u(x2, _1))
case 0:i32 {
switch i32.select(_1, i64.ne(x3, y3), i64.lt_u(x3, y3))
case 0:i32 { z := i64.lt_u(x4, y4) }
switch i32.select(_2, i64.ne(x3, _1), i64.lt_u(x3, _1))
case 0:i32 { z := i64.lt_u(x4, 10) }
case 1:i32 { z := 0:i32 }
default { z := 1:i32 }
}
@ -96,11 +92,18 @@ object "object" {
default { z := 1:i32 }
z4 := i64.extend_i32_u(z)
}
function u256_to_i32(x1, x2, x3, x4) -> v:i32
function u256_to_i32_744() -> v:i32
{
if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { unreachable() }
if i64.ne(0, i64.shr_u(x4, 32)) { unreachable() }
v := i32.wrap_i64(x4)
if i64.ne(0, i64.or(i64.or(0, 0), 0)) { unreachable() }
if i64.ne(0, i64.shr_u(32, 32)) { unreachable() }
v := i32.wrap_i64(32)
}
function u256_to_i32() -> v:i32
{
let _1 := 0
if i64.ne(_1, i64.or(i64.or(_1, _1), _1)) { unreachable() }
if i64.ne(_1, i64.shr_u(_1, 32)) { unreachable() }
v := i32.wrap_i64(_1)
}
function bswap16(x:i32) -> y:i32
{
@ -116,59 +119,66 @@ object "object" {
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32)
y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32)))))
}
function calldataload(x1, x2, x3, x4) -> z1, z2, z3, z4
function calldataload() -> z1, z2, z3, z4
{
let cds:i32 := eth.getCallDataSize()
let _1 := 0
let destination:i32 := u256_to_i32(_1, _1, _1, _1)
let offset:i32 := u256_to_i32(x1, x2, x3, x4)
let requested_size:i32 := u256_to_i32(_1, _1, _1, 32)
if i64.ne(_1, i64.or(i64.or(_1, _1), _1)) { unreachable() }
if i64.ne(_1, i64.shr_u(_1, 32)) { unreachable() }
let v:i32 := i32.wrap_i64(_1)
let offset:i32 := u256_to_i32()
let requested_size:i32 := u256_to_i32_744()
if i32.gt_u(offset, i32.sub(0xffffffff:i32, requested_size)) { eth.revert(0:i32, 0:i32) }
let available_size:i32 := i32.sub(cds, offset)
if i32.gt_u(offset, cds) { available_size := 0:i32 }
let _2:i32 := 0:i32
if i32.gt_u(available_size, _2)
{
eth.callDataCopy(destination, offset, available_size)
eth.callDataCopy(v, offset, available_size)
}
if i32.gt_u(requested_size, available_size)
{
let _3:i32 := i32.sub(requested_size, available_size)
let _4:i32 := i32.add(destination, available_size)
let _4:i32 := i32.add(v, available_size)
let i:i32 := _2
for { } i32.lt_u(i, _3) { i := i32.add(i, 1:i32) }
{
i32.store8(i32.add(_4, i), _2)
}
}
let z1_1 := bswap64(i64.load(_2))
let z2_1 := bswap64(i64.load(i32.add(_2, 8:i32)))
let z3_1 := bswap64(i64.load(i32.add(_2, 16:i32)))
let z4_1 := bswap64(i64.load(i32.add(_2, 24:i32)))
let z1_1, z2_1, z3_1, z4_1 := mload_internal()
z1 := z1_1
z2 := z2_1
z3 := z3_1
z4 := z4_1
}
function sstore(x1, x2, x3, x4, y1, y2, y3, y4)
function sstore(y1, y2, y3, y4)
{
mstore_internal(0:i32, x1, x2, x3, x4)
mstore_internal(32:i32, y1, y2, y3, y4)
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
i64.store(0:i32, y)
i64.store(i32.add(0:i32, 8:i32), y)
i64.store(i32.add(0:i32, 16:i32), y)
i64.store(i32.add(0:i32, 24:i32), y)
i64.store(32:i32, bswap64(y1))
i64.store(i32.add(32:i32, 8:i32), bswap64(y2))
i64.store(i32.add(32:i32, 16:i32), bswap64(y3))
i64.store(i32.add(32:i32, 24:i32), bswap64(y4))
eth.storageStore(0:i32, 32:i32)
}
function mstore_internal(pos:i32, y1, y2, y3, y4)
function mload_internal() -> z1, z2, z3, z4
{
i64.store(pos, bswap64(y1))
i64.store(i32.add(pos, 8:i32), bswap64(y2))
i64.store(i32.add(pos, 16:i32), bswap64(y3))
i64.store(i32.add(pos, 24:i32), bswap64(y4))
z1 := bswap64(i64.load(0:i32))
z2 := bswap64(i64.load(i32.add(0:i32, 8:i32)))
z3 := bswap64(i64.load(i32.add(0:i32, 16:i32)))
z4 := bswap64(i64.load(i32.add(0:i32, 24:i32)))
}
}
}
Binary representation:
0061736d0100000001530c6000006000017f60017e017e60037e7e7e017e60047e7e7e7e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60017f017f60057f7e7e7e7e0060027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000a08657468657265756d06726576657274000a08657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000b030e0d0003070407070508080204060905030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00040ac0090dcb02030a7e017f107e02404200210002402000200020002000100e21012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402000200020002005200620072008200020002000420a10091007210b2300210c2301210d2302210e0b200b200c84200d200e8484504504400c030b0240200520062007200820002000200042021008210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004204100821132300211423012115230221160b2013201484201520168484504504400c010b0b0240200520062007200820002000200020091006211723002118230121192302211a0b201721052018210620192107201a21080c000b0b20002000200020002005200620072008100f0b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1005210d2300210e0b200d210a024020012005200e1005210f230021100b200f2109024020002004201010052111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b2f01047e02402000200451200120055120022006512003200751717171ad210b0b20092400200a2401200b240220080ba30102017e057f024041002109417f210a0240200a200020045220002004541b210b200b41004604400240200a200120055220012005541b210c200c41004604400240200a200220065220022006541b210d200d41004604402003200754210905200d41014604404100210905410121090b0b0b05200c41014604404100210905410121090b0b0b05200b41014604404100210905410121090b0b0b2009ad21080b20080b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100b411074210220022000411076100b7221010b20010b2201027e02402000a7100cad422086210220022000422088a7100cad8421010b20010bfc0105047e017f017e087f047e024010022108420021092009200920092009100a210a2000200120022003100a210b2009200920094220100a210c200b417f200c6b4b04404100410010010b2008200b6b210d200b20084b04404100210d0b4100210e200d200e4b0440200a200b200d10030b200c200d4b0440200c200d6b210f200a200d6a2110200e2111024003402011200f49450d010240201020116a200e3a00000b201141016a21110c000b0b0b200e290000100d2112200e41086a290000100d2113200e41106a290000100d2114200e41186a290000100d2115201221042013210520142106201521070b20052400200624012007240220040b230002404100200020012002200310104120200420052006200710104100412010000b0b3200024020002001100d370000200041086a2002100d370000200041106a2003100d370000200041186a2004100d3700000b0b
0061736d010000000130096000006000017e6000017f60017e017e60047e7e7e7e0060047e7e7e7e017e60017f017f60027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000708657468657265756d06726576657274000708657468657265756d0f67657443616c6c4461746153697a65000208657468657265756d0c63616c6c44617461436f70790008030f0e00050305050502020606030104010503010001061a057e0142000b7e0142000b7e0142000b7f0141000b7f0141000b071102066d656d6f72790200046d61696e00040a8a0a0e8d0203087e017f107e02400240100f21002300210123012102230221030b200021042001210520022106200321074200420084420042018484504545210802400340200845450d010240024020042005200620071009100621092303210a2304210b2300210c0b2009200a84200b200c8484504504400c030b024020042005200620071007210d2300210e2301210f230221100b200d200e84200f20108484504504400c030b02402004200520062007100821112300211223012113230221140b2011201284201320148484504504400c010b0b02402004200520062007100521152300211623012117230221180b201521042016210520172106201821070c000b0b200420052006200710100b0b6701077e0240200342017c2108200842007c2107200242007c210920092008200354200720085472ad7c2106200142007c210a200a2009200254200620095472ad7c2105200042007c200a2001542005200a5472ad7c21040b20052400200624012007240220040b2401047e0240420042008442002000848450ad21040b20022400200324012004240220010b2f01047e02402000420051200142005120024200512003420251717171ad21070b20052400200624012007240220040b2f01047e02402000420051200142005120024200512003420451717171ad21070b20052400200624012007240220040bab0104017e017f017e047f02404100210542002106417f210702402007200020065220002006541b21082008410046044002402007200120065220012006541b21092009410046044002402007200220065220022006541b210a200a41004604402003420a54210505200a41014604404100210505410121050b0b0b05200941014604404100210505410121050b0b0b05200841014604404100210505410121050b0b0b2005ad21040b20040b2901017f024042004200420084420084520440000b42004220422088520440000b4220a721000b20000b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100c411074210220022000411076100c7221010b20010b2201027e02402000a7100dad422086210220022000422088a7100dad8421010b20010be60105047e017f017e087f047e0240100221044200210520052005200584200584520440000b20052005422088520440000b2005a72106100b2107100a21082007417f20086b4b04404100410010010b200420076b2109200720044b0440410021090b4100210a2009200a4b044020062007200910030b200820094b0440200820096b210b200620096a210c200a210d02400340200d200b49450d010240200c200d6a200a3a00000b200d41016a210d0c000b0b0b02401011210e2300210f23012110230221110b200e2100200f210120102102201121030b20012400200224012003240220000b7801027e02404200a7100dad422086210420044200422088a7100dad84210541002005370000410041086a2005370000410041106a2005370000410041186a200537000041202000100e370000412041086a2001100e370000412041106a2002100e370000412041186a2003100e3700004100412010000b0b4201047e02404100290000100e2100410041086a290000100e2101410041106a290000100e2102410041186a290000100e21030b20012400200224012003240220000b
Text representation:
(module
@ -181,9 +191,10 @@ Text representation:
(global $global_ (mut i64) (i64.const 0))
(global $global__1 (mut i64) (i64.const 0))
(global $global__2 (mut i64) (i64.const 0))
(global $global__6 (mut i32) (i32.const 0))
(global $global__7 (mut i32) (i32.const 0))
(func $main
(local $_1 i64)
(local $x i64)
(local $x_1 i64)
(local $x_2 i64)
@ -192,8 +203,9 @@ Text representation:
(local $x_5 i64)
(local $x_6 i64)
(local $x_7 i64)
(local $_1 i32)
(local $_2 i64)
(local $_3 i32)
(local $_3 i64)
(local $_4 i64)
(local $_5 i64)
(local $_6 i64)
@ -204,16 +216,13 @@ Text representation:
(local $_11 i64)
(local $_12 i64)
(local $_13 i64)
(local $_14 i64)
(local $_15 i64)
(local $x_8 i64)
(local $x_9 i64)
(local $x_10 i64)
(local $x_11 i64)
(block $label_
(local.set $_1 (i64.const 0))
(block
(local.set $x (call $calldataload (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))
(local.set $x (call $calldataload))
(local.set $x_1 (global.get $global_))
(local.set $x_2 (global.get $global__1))
(local.set $x_3 (global.get $global__2))
@ -223,46 +232,45 @@ Text representation:
(local.set $x_5 (local.get $x_1))
(local.set $x_6 (local.get $x_2))
(local.set $x_7 (local.get $x_3))
(local.set $_2 (i64.const 1))
(local.set $_3 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))
(local.set $_1 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (i64.const 1)))))))
(block $label__3
(loop $label__5
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_3))))
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_1))))
(block $label__4
(block
(local.set $_4 (call $iszero_887 (local.get $_1) (local.get $_1) (local.get $_1) (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))))
(local.set $_2 (call $iszero_1300_2121 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))))
(local.set $_3 (global.get $global__6))
(local.set $_4 (global.get $global__7))
(local.set $_5 (global.get $global_))
(local.set $_6 (global.get $global__1))
(local.set $_7 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_4) (local.get $_5)) (i64.or (local.get $_6) (local.get $_7))))) (then
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_2) (local.get $_3)) (i64.or (local.get $_4) (local.get $_5))))) (then
(br $label__3)
))
(block
(local.set $_8 (call $eq_888 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2)))
(local.set $_9 (global.get $global_))
(local.set $_10 (global.get $global__1))
(local.set $_11 (global.get $global__2))
(local.set $_6 (call $eq_740_2122 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
(local.set $_7 (global.get $global_))
(local.set $_8 (global.get $global__1))
(local.set $_9 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11))))) (then
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_6) (local.get $_7)) (i64.or (local.get $_8) (local.get $_9))))) (then
(br $label__3)
))
(block
(local.set $_12 (call $eq_888 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4)))
(local.set $_13 (global.get $global_))
(local.set $_14 (global.get $global__1))
(local.set $_15 (global.get $global__2))
(local.set $_10 (call $eq_741_2123 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
(local.set $_11 (global.get $global_))
(local.set $_12 (global.get $global__1))
(local.set $_13 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15))))) (then
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_10) (local.get $_11)) (i64.or (local.get $_12) (local.get $_13))))) (then
(br $label__4)
))
)
(block
(local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2)))
(local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
(local.set $x_9 (global.get $global_))
(local.set $x_10 (global.get $global__1))
(local.set $x_11 (global.get $global__2))
@ -276,90 +284,31 @@ Text representation:
)
)
(call $sstore (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))
(call $sstore (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))
)
)
(func $add_carry
(param $x i64)
(param $y i64)
(param $c i64)
(result i64)
(local $r i64)
(local $r_c i64)
(local $t i64)
(block $label__6
(local.set $t (i64.add (local.get $x) (local.get $y)))
(local.set $r (i64.add (local.get $t) (local.get $c)))
(local.set $r_c (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x)) (i64.lt_u (local.get $r) (local.get $t)))))
)
(global.set $global_ (local.get $r_c))
(local.get $r)
)
(func $add
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(local $t i64)
(local $r3_1 i64)
(local $carry i64)
(local $r2_1 i64)
(local $carry_1 i64)
(local $r1_1 i64)
(local $carry_2 i64)
(block $label__7
(local.set $t (i64.add (local.get $x4) (local.get $y4)))
(local.set $r4 (i64.add (local.get $t) (i64.const 0)))
(block
(local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t))))))
(local.set $carry (global.get $global_))
)
(local.set $r3 (local.get $r3_1))
(block
(local.set $r2_1 (call $add_carry (local.get $x2) (local.get $y2) (local.get $carry)))
(local.set $carry_1 (global.get $global_))
)
(local.set $r2 (local.get $r2_1))
(block
(local.set $r1_1 (call $add_carry (local.get $x1) (local.get $y1) (local.get $carry_1)))
(local.set $carry_2 (global.get $global_))
)
(local.set $r1 (local.get $r1_1))
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
)
(func $iszero_887
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(local $t_1 i64)
(local $t_2 i64)
(block $label__8
(local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4))))))
(local.set $t (i64.add (local.get $x4) (i64.const 1)))
(local.set $r4 (i64.add (local.get $t) (i64.const 0)))
(local.set $t_1 (i64.add (local.get $x3) (i64.const 0)))
(local.set $r3 (i64.add (local.get $t_1) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t))))))
(local.set $t_2 (i64.add (local.get $x2) (i64.const 0)))
(local.set $r2 (i64.add (local.get $t_2) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_1) (local.get $x3)) (i64.lt_u (local.get $r3) (local.get $t_1))))))
(local.set $r1 (i64.add (i64.add (local.get $x1) (i64.const 0)) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_2) (local.get $x2)) (i64.lt_u (local.get $r2) (local.get $t_2))))))
)
(global.set $global_ (local.get $r2))
@ -368,22 +317,55 @@ Text representation:
(local.get $r1)
)
(func $eq_888
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(func $iszero_1300_2121
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(block $label__9
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (local.get $y1)) (i32.and (i64.eq (local.get $x2) (local.get $y2)) (i32.and (i64.eq (local.get $x3) (local.get $y3)) (i64.eq (local.get $x4) (local.get $y4)))))))
(local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (local.get $x4))))))
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
)
(func $eq_740_2122
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(block $label__10
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 2)))))))
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
)
(func $eq_741_2123
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(block $label__11
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 4)))))))
)
(global.set $global_ (local.get $r2))
@ -397,32 +379,30 @@ Text representation:
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $z4 i64)
(local $z i32)
(local $_1 i32)
(local $_1 i64)
(local $_2 i32)
(local $condition i32)
(local $condition_11 i32)
(local $condition_12 i32)
(block $label__10
(local $condition_13 i32)
(local $condition_14 i32)
(block $label__12
(local.set $z (i32.const 0))
(local.set $_1 (i32.const 4294967295))
(local.set $_1 (i64.const 0))
(local.set $_2 (i32.const 4294967295))
(block
(local.set $condition (select (local.get $_1) (i64.ne (local.get $x1) (local.get $y1)) (i64.lt_u (local.get $x1) (local.get $y1))))
(local.set $condition (select (local.get $_2) (i64.ne (local.get $x1) (local.get $_1)) (i64.lt_u (local.get $x1) (local.get $_1))))
(if (i32.eq (local.get $condition) (i32.const 0)) (then
(block
(local.set $condition_11 (select (local.get $_1) (i64.ne (local.get $x2) (local.get $y2)) (i64.lt_u (local.get $x2) (local.get $y2))))
(if (i32.eq (local.get $condition_11) (i32.const 0)) (then
(local.set $condition_13 (select (local.get $_2) (i64.ne (local.get $x2) (local.get $_1)) (i64.lt_u (local.get $x2) (local.get $_1))))
(if (i32.eq (local.get $condition_13) (i32.const 0)) (then
(block
(local.set $condition_12 (select (local.get $_1) (i64.ne (local.get $x3) (local.get $y3)) (i64.lt_u (local.get $x3) (local.get $y3))))
(if (i32.eq (local.get $condition_12) (i32.const 0)) (then
(local.set $z (i64.lt_u (local.get $x4) (local.get $y4)))
(local.set $condition_14 (select (local.get $_2) (i64.ne (local.get $x3) (local.get $_1)) (i64.lt_u (local.get $x3) (local.get $_1))))
(if (i32.eq (local.get $condition_14) (i32.const 0)) (then
(local.set $z (i64.lt_u (local.get $x4) (i64.const 10)))
)(else
(if (i32.eq (local.get $condition_12) (i32.const 1)) (then
(if (i32.eq (local.get $condition_14) (i32.const 1)) (then
(local.set $z (i32.const 0))
)(else
(local.set $z (i32.const 1))
@ -431,7 +411,7 @@ Text representation:
)
)(else
(if (i32.eq (local.get $condition_11) (i32.const 1)) (then
(if (i32.eq (local.get $condition_13) (i32.const 1)) (then
(local.set $z (i32.const 0))
)(else
(local.set $z (i32.const 1))
@ -454,19 +434,31 @@ Text representation:
(local.get $z4)
)
(func $u256_to_i32
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(func $u256_to_i32_744
(result i32)
(local $v i32)
(block $label__13
(if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then
(block $label__15
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
(unreachable)))
(if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then
(if (i64.ne (i64.const 0) (i64.shr_u (i64.const 32) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (local.get $x4)))
(local.set $v (i32.wrap_i64 (i64.const 32)))
)
(local.get $v)
)
(func $u256_to_i32
(result i32)
(local $v i32)
(local $_1 i64)
(block $label__16
(local.set $_1 (i64.const 0))
(if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then
(unreachable)))
(if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (local.get $_1)))
)
(local.get $v)
@ -476,7 +468,7 @@ Text representation:
(param $x i32)
(result i32)
(local $y i32)
(block $label__14
(block $label__17
(local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255))))
)
@ -488,7 +480,7 @@ Text representation:
(result i32)
(local $y i32)
(local $hi i32)
(block $label__15
(block $label__18
(local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16)))
(local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16)))))
@ -501,7 +493,7 @@ Text representation:
(result i64)
(local $y i64)
(local $hi i64)
(block $label__16
(block $label__19
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32)))))))
@ -510,10 +502,6 @@ Text representation:
)
(func $calldataload
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $z1 i64)
(local $z2 i64)
@ -521,7 +509,7 @@ Text representation:
(local $z4 i64)
(local $cds i32)
(local $_1 i64)
(local $destination i32)
(local $v i32)
(local $offset i32)
(local $requested_size i32)
(local $available_size i32)
@ -533,12 +521,16 @@ Text representation:
(local $z2_1 i64)
(local $z3_1 i64)
(local $z4_1 i64)
(block $label__17
(block $label__20
(local.set $cds (call $eth.getCallDataSize))
(local.set $_1 (i64.const 0))
(local.set $destination (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))
(local.set $offset (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
(local.set $requested_size (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 32)))
(if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then
(unreachable)))
(if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (local.get $_1)))
(local.set $offset (call $u256_to_i32))
(local.set $requested_size (call $u256_to_i32_744))
(if (i32.gt_u (local.get $offset) (i32.sub (i32.const 4294967295) (local.get $requested_size))) (then
(call $eth.revert (i32.const 0) (i32.const 0))))
(local.set $available_size (i32.sub (local.get $cds) (local.get $offset)))
@ -547,27 +539,30 @@ Text representation:
))
(local.set $_2 (i32.const 0))
(if (i32.gt_u (local.get $available_size) (local.get $_2)) (then
(call $eth.callDataCopy (local.get $destination) (local.get $offset) (local.get $available_size))))
(call $eth.callDataCopy (local.get $v) (local.get $offset) (local.get $available_size))))
(if (i32.gt_u (local.get $requested_size) (local.get $available_size)) (then
(local.set $_3 (i32.sub (local.get $requested_size) (local.get $available_size)))
(local.set $_4 (i32.add (local.get $destination) (local.get $available_size)))
(local.set $_4 (i32.add (local.get $v) (local.get $available_size)))
(local.set $i (local.get $_2))
(block $label__18
(loop $label__20
(br_if $label__18 (i32.eqz (i32.lt_u (local.get $i) (local.get $_3))))
(block $label__19
(block $label__21
(loop $label__23
(br_if $label__21 (i32.eqz (i32.lt_u (local.get $i) (local.get $_3))))
(block $label__22
(i32.store8 (i32.add (local.get $_4) (local.get $i)) (local.get $_2))
)
(local.set $i (i32.add (local.get $i) (i32.const 1)))
(br $label__20)
(br $label__23)
)
)
))
(local.set $z1_1 (call $bswap64 (i64.load (local.get $_2))))
(local.set $z2_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 8)))))
(local.set $z3_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 16)))))
(local.set $z4_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 24)))))
(block
(local.set $z1_1 (call $mload_internal))
(local.set $z2_1 (global.get $global_))
(local.set $z3_1 (global.get $global__1))
(local.set $z4_1 (global.get $global__2))
)
(local.set $z1 (local.get $z1_1))
(local.set $z2 (local.get $z2_1))
(local.set $z3 (local.get $z3_1))
@ -581,33 +576,44 @@ Text representation:
)
(func $sstore
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__21
(call $mstore_internal (i32.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))
(call $mstore_internal (i32.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))
(local $hi i64)
(local $y i64)
(block $label__24
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
(i64.store (i32.const 0) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y))
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y))
(i64.store (i32.const 32) (call $bswap64 (local.get $y1)))
(i64.store (i32.add (i32.const 32) (i32.const 8)) (call $bswap64 (local.get $y2)))
(i64.store (i32.add (i32.const 32) (i32.const 16)) (call $bswap64 (local.get $y3)))
(i64.store (i32.add (i32.const 32) (i32.const 24)) (call $bswap64 (local.get $y4)))
(call $eth.storageStore (i32.const 0) (i32.const 32))
)
)
(func $mstore_internal
(param $pos i32)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__22
(i64.store (local.get $pos) (call $bswap64 (local.get $y1)))
(i64.store (i32.add (local.get $pos) (i32.const 8)) (call $bswap64 (local.get $y2)))
(i64.store (i32.add (local.get $pos) (i32.const 16)) (call $bswap64 (local.get $y3)))
(i64.store (i32.add (local.get $pos) (i32.const 24)) (call $bswap64 (local.get $y4)))
(func $mload_internal
(result i64)
(local $z1 i64)
(local $z2 i64)
(local $z3 i64)
(local $z4 i64)
(block $label__25
(local.set $z1 (call $bswap64 (i64.load (i32.const 0))))
(local.set $z2 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 8)))))
(local.set $z3 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 16)))))
(local.set $z4 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 24)))))
)
(global.set $global_ (local.get $z2))
(global.set $global__1 (local.get $z3))
(global.set $global__2 (local.get $z4))
(local.get $z1)
)
)

View File

@ -64,17 +64,16 @@ object "D_16" {
returndatacopy(_1, _1, returndatasize())
revert(_1, returndatasize())
}
return(allocate_memory(_1), _1)
return(allocate_memory(), _1)
}
}
revert(0, 0)
}
function allocate_memory(size) -> memPtr
function allocate_memory() -> 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)
if gt(memPtr, 0xffffffffffffffff) { panic_error_0x41() }
mstore(64, memPtr)
}
function panic_error_0x41()
{

View File

@ -45,14 +45,14 @@ object "C_59" {
for { } lt(i, _4) { i := add(i, 1) }
{
if slt(sub(calldatasize(), src), _2) { revert(_1, _1) }
let value := allocate_memory(_2)
let value := allocate_memory_1246()
mstore(value, calldataload(src))
mstore(dst, value)
dst := add(dst, _2)
src := add(src, _2)
}
let ret, ret_1 := fun_sumArray(dst_1)
let memPos := allocate_memory(_1)
let memPos := allocate_memory_1247()
return(memPos, sub(abi_encode_uint256_string(memPos, ret, ret_1), memPos))
}
}
@ -76,6 +76,19 @@ object "C_59" {
}
tail := add(add(headStart, and(add(length, 31), not(31))), 96)
}
function allocate_memory_1246() -> 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_1247() -> memPtr
{
memPtr := mload(64)
if gt(memPtr, 0xffffffffffffffff) { panic_error_0x41() }
mstore(64, memPtr)
}
function allocate_memory(size) -> memPtr
{
memPtr := mload(64)
@ -85,7 +98,10 @@ object "C_59" {
}
function copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927() -> memPtr
{
let memPtr_1 := allocate_memory(160)
let memPtr_1 := mload(64)
let newFreePtr := add(memPtr_1, 160)
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr_1)) { panic_error_0x41() }
mstore(64, newFreePtr)
mstore(memPtr_1, 100)
memPtr := memPtr_1
mstore(add(memPtr_1, 0x20), "longstringlongstringlongstringlo")
@ -101,7 +117,7 @@ object "C_59" {
{
if iszero(lt(var_mpos, mload(var_s_mpos))) { panic_error_0x32() }
let _1 := mload(mload(add(add(var_s_mpos, shl(5, var_mpos)), 32)))
let _2, _3 := storage_array_index_access_struct_S(var_mpos, var_mpos)
let _2, _3 := storage_array_index_access_struct_S_1254()
sstore(_2, _1)
if iszero(lt(0x01, mload(var_s_mpos))) { panic_error_0x32() }
let _4 := mload(mload(add(var_s_mpos, 64)))
@ -111,7 +127,7 @@ object "C_59" {
let shiftBits := shl(3, var_mpos)
let mask := shl(shiftBits, not(0))
sstore(slot, or(and(_5, not(mask)), and(shl(shiftBits, _4), mask)))
let _6, _7 := storage_array_index_access_struct_S(0x02, var_mpos)
let _6, _7 := storage_array_index_access_struct_S()
var := extract_from_storage_value_dynamict_uint256(sload(_6), _7)
var_mpos := copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927()
}
@ -127,10 +143,16 @@ object "C_59" {
mstore(4, 0x41)
revert(0, 0x24)
}
function storage_array_index_access_struct_S(array, index) -> slot, offset
function storage_array_index_access_struct_S_1254() -> slot, offset
{
if iszero(lt(index, 0x02)) { panic_error_0x32() }
slot := add(array, index)
if iszero(lt(slot, 0x02)) { panic_error_0x32() }
slot := add(slot, slot)
offset := offset
}
function storage_array_index_access_struct_S() -> slot, offset
{
if iszero(lt(slot, 0x02)) { panic_error_0x32() }
slot := add(0x02, slot)
offset := offset
}
}

View File

@ -40,7 +40,7 @@ object "Arraysum_34" {
mstore(_1, _1)
var_sum := checked_add_uint256(var_sum, sload(add(keccak256(_1, 0x20), var_i)))
}
let memPos := allocate_memory(_1)
let memPos := allocate_memory()
return(memPos, sub(abi_encode_uint256(memPos, var_sum), memPos))
}
}
@ -51,17 +51,16 @@ object "Arraysum_34" {
tail := add(headStart, 32)
mstore(headStart, value0)
}
function allocate_memory(size) -> memPtr
function allocate_memory() -> memPtr
{
memPtr := mload(64)
let newFreePtr := add(memPtr, and(add(size, 31), not(31)))
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr))
if gt(memPtr, 0xffffffffffffffff)
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 0x41)
revert(0, 0x24)
}
mstore(64, newFreePtr)
mstore(64, memPtr)
}
function checked_add_uint256(x, y) -> sum
{

View File

@ -1,7 +1,7 @@
{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d01000000013f0960000060017e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e00600c7e7e7e7e7e7e7e7e7e7e7e7e0060017f0060017f017f60027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000808657468657265756d06726576657274000708657468657265756d0c67657443616c6c56616c7565000508657468657265756d0666696e6973680007030a090002020606010403030503010001060100071102066d656d6f72790200046d61696e00040086030c435f335f6465706c6f7965640061736d0100000001160460000060047e7e7e7e017f60017f017f60027f7f0002130108657468657265756d067265766572740003030504000102020503010001060100071102066d656d6f72790200046d61696e00010a9f0204b30104017e027f037e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b2000a71004ad422086210320032000422088a71004ad84210420022004370000200241086a2004370000200241106a2004370000428001a71004ad4220862105200241186a2005428001422088a71004ad84370000200020002000200010022106200020002000200010022107200741c0006a210820082007490440000b2008200610000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100341107421022002200041107610037221010b20010b0af00309dc0103017e027f057e02404200210020002000200042c00010052101200141c0006a210220022001490440000b20001009210320022003370000200241086a2003370000200241106a2003370000200241186a428001100937000041001002410029000010092104410041086a29000010092105410041106a2900001009210620042005842006410041186a290000100984845045044020002000200020002000200020002000100c0b42f9022107200020002000200020002000200042d3012000200020002007100a20002000200020002000200020002007100b0b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b2601027f0240200020012002200310052105200541c0006a210420042005490440000b0b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100741107421022002200041107610077221010b20010b2201027e02402000a71008ad422086210220022000422088a71008ad8421010b20010b25000240200020012002200310062004200520062007100520082009200a200b100510000b0b1b000240200020012002200310062004200520062007100510030b0b1b000240200020012002200310062004200520062007100510010b0b","wast":"(module
{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d0100000001330b6000006000017e6000017f60017e0060017e017e60017e017f60027e7e0060017f0060017f017f60027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000a08657468657265756d06726576657274000908657468657265756d0c67657443616c6c56616c7565000708657468657265756d0666696e6973680009030d0c0002050208080101040603000503010001060100071102066d656d6f72790200046d61696e00040092030c435f335f6465706c6f7965640061736d010000000112046000006000017f60017f017f60027f7f0002130108657468657265756d06726576657274000303060500010102020503010001060100071102066d656d6f72790200046d61696e00010aae02059d0103017e027f037e02404200210020002000200084200084520440000b200042c000422088520440000b42c000a72101200141c0006a210220022001490440000b2000a71005ad422086210320032000422088a71005ad84210420022004370000200241086a2004370000200241106a2004370000428001a71005ad4220862105200241186a2005428001422088a71005ad843700001003100210000b0b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b1e01027f024010022101200141c0006a210020002001490440000b0b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100441107421022002200041107610047221010b20010b0aca040c960102027f057e024010052100200041c0006a210120012000490440000b100a210220012002370000200141086a2002370000200141106a2002370000200141186a100b370000410010024100290000100c2103410041086a290000100c2104410041106a290000100c210520032004842005410041186a290000100c848450450440100f0b428503210642ca012006100d2006100e0b0b2b01017f024042004200420084420084520440000b420042c000422088520440000b42c000a721000b20000b2901017f024042004200420084420084520440000b42002000422088520440000b2000a721010b20010b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100841107421022002200041107610087221010b20010b2201027e02404200a71009ad422086210120014200422088a71009ad8421000b20000b2401027e0240428001a71009ad42208621012001428001422088a71009ad8421000b20000b2201027e02402000a71009ad422086210220022000422088a71009ad8421010b20010b3001047f024020011006210220001006210310072104200441c0006a210520052004490440000b20052003200210000b0b2801037f024020001006210110072102200241c0006a210320032002490440000b2003200110030b0b2601037f02401007210010072101200141c0006a210220022001490440000b2002200010010b0b","wast":"(module
;; custom section for sub-module
;; The Keccak-256 hash of the text representation of \"C_3_deployed\": 380167268971b84f9fd4e61f1659da4fd304bd6e30ec2dd33d412f3c8203ced7
;; (@custom \"C_3_deployed\" \"0061736d0100000001160460000060047e7e7e7e017f60017f017f60027f7f0002130108657468657265756d067265766572740003030504000102020503010001060100071102066d656d6f72790200046d61696e00010a9f0204b30104017e027f037e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b2000a71004ad422086210320032000422088a71004ad84210420022004370000200241086a2004370000200241106a2004370000428001a71004ad4220862105200241186a2005428001422088a71004ad84370000200020002000200010022106200020002000200010022107200741c0006a210820082007490440000b2008200610000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100341107421022002200041107610037221010b20010b\")
;; The Keccak-256 hash of the text representation of \"C_3_deployed\": 1c21519afc0397d3ba45d99eb2354c3d74191cd82bffab348d52efabddb63f6a
;; (@custom \"C_3_deployed\" \"0061736d010000000112046000006000017f60017f017f60027f7f0002130108657468657265756d06726576657274000303060500010102020503010001060100071102066d656d6f72790200046d61696e00010aae02059d0103017e027f037e02404200210020002000200084200084520440000b200042c000422088520440000b42c000a72101200141c0006a210220022001490440000b2000a71005ad422086210320032000422088a71005ad84210420022004370000200241086a2004370000200241106a2004370000428001a71005ad4220862105200241186a2005428001422088a71005ad843700001003100210000b0b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b1e01027f024010022101200141c0006a210020002001490440000b0b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100441107421022002200041107610047221010b20010b\")
(import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32)))
(import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32)))
(import \"ethereum\" \"getCallValue\" (func $eth.getCallValue (param i32)))
@ -10,46 +10,55 @@
(export \"main\" (func $main))
(func $main
(local $_1 i64)
(local $p i32)
(local $r i32)
(local $_2 i64)
(local $_1 i64)
(local $z1 i64)
(local $z2 i64)
(local $z3 i64)
(local $_3 i64)
(local $_2 i64)
(block $label_
(local.set $_1 (i64.const 0))
(local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64)))
(local.set $p (call $u256_to_i32_685))
(local.set $r (i32.add (local.get $p) (i32.const 64)))
(if (i32.lt_u (local.get $r) (local.get $p)) (then
(unreachable)))
(local.set $_2 (call $bswap64 (local.get $_1)))
(i64.store (local.get $r) (local.get $_2))
(i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $_2))
(i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $_2))
(i64.store (i32.add (local.get $r) (i32.const 24)) (call $bswap64 (i64.const 128)))
(local.set $_1 (call $bswap64_388))
(i64.store (local.get $r) (local.get $_1))
(i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $_1))
(i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $_1))
(i64.store (i32.add (local.get $r) (i32.const 24)) (call $bswap64_389))
(call $eth.getCallValue (i32.const 0))
(local.set $z1 (call $bswap64 (i64.load (i32.const 0))))
(local.set $z2 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 8)))))
(local.set $z3 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 16)))))
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 24)))))))) (then
(call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))))
(local.set $_3 (datasize \"C_3_deployed\"))
(call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_3_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))
(call $return (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))
(call $revert)))
(local.set $_2 (datasize \"C_3_deployed\"))
(call $codecopy (dataoffset \"C_3_deployed\") (local.get $_2))
(call $return (local.get $_2))
)
)
(func $u256_to_i32
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(func $u256_to_i32_685
(result i32)
(local $v i32)
(block $label__1
(if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
(unreachable)))
(if (i64.ne (i64.const 0) (i64.shr_u (i64.const 64) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (i64.const 64)))
)
(local.get $v)
)
(func $u256_to_i32_687
(param $x4 i64)
(result i32)
(local $v i32)
(block $label__2
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
(unreachable)))
(if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then
(unreachable)))
@ -59,29 +68,27 @@
(local.get $v)
)
(func $to_internal_i32ptr
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(func $u256_to_i32
(result i32)
(local $r i32)
(local $p i32)
(block $label__2
(local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
(local.set $r (i32.add (local.get $p) (i32.const 64)))
(if (i32.lt_u (local.get $r) (local.get $p)) (then
(local $v i32)
(local $_1 i64)
(block $label__3
(local.set $_1 (i64.const 0))
(if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then
(unreachable)))
(if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (local.get $_1)))
)
(local.get $r)
(local.get $v)
)
(func $bswap16
(param $x i32)
(result i32)
(local $y i32)
(block $label__3
(block $label__4
(local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255))))
)
@ -93,7 +100,7 @@
(result i32)
(local $y i32)
(local $hi i32)
(block $label__4
(block $label__5
(local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16)))
(local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16)))))
@ -101,12 +108,36 @@
(local.get $y)
)
(func $bswap64_388
(result i64)
(local $y i64)
(local $hi i64)
(block $label__6
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
)
(local.get $y)
)
(func $bswap64_389
(result i64)
(local $y i64)
(local $hi i64)
(block $label__7
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 128)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 128) (i64.const 32)))))))
)
(local.get $y)
)
(func $bswap64
(param $x i64)
(result i64)
(local $y i64)
(local $hi i64)
(block $label__5
(block $label__8
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32)))))))
@ -115,48 +146,49 @@
)
(func $codecopy
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(param $z1 i64)
(param $z2 i64)
(param $z3 i64)
(param $z4 i64)
(block $label__6
(call $eth.codeCopy (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4)))
(local $_1 i32)
(local $_2 i32)
(local $p i32)
(local $r i32)
(block $label__9
(local.set $_1 (call $u256_to_i32_687 (local.get $z4)))
(local.set $_2 (call $u256_to_i32_687 (local.get $y4)))
(local.set $p (call $u256_to_i32))
(local.set $r (i32.add (local.get $p) (i32.const 64)))
(if (i32.lt_u (local.get $r) (local.get $p)) (then
(unreachable)))
(call $eth.codeCopy (local.get $r) (local.get $_2) (local.get $_1))
)
)
(func $return
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__7
(call $eth.finish (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))
(local $_1 i32)
(local $p i32)
(local $r i32)
(block $label__10
(local.set $_1 (call $u256_to_i32_687 (local.get $y4)))
(local.set $p (call $u256_to_i32))
(local.set $r (i32.add (local.get $p) (i32.const 64)))
(if (i32.lt_u (local.get $r) (local.get $p)) (then
(unreachable)))
(call $eth.finish (local.get $r) (local.get $_1))
)
)
(func $revert
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__8
(call $eth.revert (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))
(local $_1 i32)
(local $p i32)
(local $r i32)
(block $label__11
(local.set $_1 (call $u256_to_i32))
(local.set $p (call $u256_to_i32))
(local.set $r (i32.add (local.get $p) (i32.const 64)))
(if (i32.lt_u (local.get $r) (local.get $p)) (then
(unreachable)))
(call $eth.revert (local.get $r) (local.get $_1))
)
)

View File

@ -35,9 +35,9 @@ object "C_3" {
======= viair_subobjects/input.sol:D =======
Binary:
608060405234156100105760006000fd5b61010d80610021600039806000f350fe6080604052600436101515610088576000803560e01c6326121ff0141561008657341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100cb565b5b50806100e560803980608083f01515610079573d82833e3d82fd5b508061008482610092565bf35b505b60006000fd6100e3565b60006040519050601f19601f830116810181811067ffffffffffffffff821117156100c0576100bf6100cb565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
608060405234156100105760006000fd5b60fb80610020600039806000f350fe6080604052600436101515610087576000803560e01c6326121ff0141561008557341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100b9565b5b50806100d360803980608083f01515610079573d82833e3d82fd5b5080610083610091565bf35b505b60006000fd6100d1565b6000604051905067ffffffffffffffff8111156100b1576100b06100b9565b5b806040525b90565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
Binary of the runtime part:
6080604052600436101515610088576000803560e01c6326121ff0141561008657341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100cb565b5b50806100e560803980608083f01515610079573d82833e3d82fd5b508061008482610092565bf35b505b60006000fd6100e3565b60006040519050601f19601f830116810181811067ffffffffffffffff821117156100c0576100bf6100cb565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
6080604052600436101515610087576000803560e01c6326121ff0141561008557341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100b9565b5b50806100d360803980608083f01515610079573d82833e3d82fd5b5080610083610091565bf35b505b60006000fd6100d1565b6000604051905067ffffffffffffffff8111156100b1576100b06100b9565b5b806040525b90565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
Optimized IR:
/*******************************************************
* WARNING *
@ -76,17 +76,16 @@ object "D_16" {
returndatacopy(_1, _1, returndatasize())
revert(_1, returndatasize())
}
return(allocate_memory(_1), _1)
return(allocate_memory(), _1)
}
}
revert(0, 0)
}
function allocate_memory(size) -> memPtr
function allocate_memory() -> 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)
if gt(memPtr, 0xffffffffffffffff) { panic_error_0x41() }
mstore(64, memPtr)
}
function panic_error_0x41()
{

View File

@ -17,9 +17,9 @@ contract C {
// optimize-yul: true
// ----
// creation:
// codeDepositCost: 571400
// executionCost: 606
// totalCost: 572006
// codeDepositCost: 626600
// executionCost: 657
// totalCost: 627257
// external:
// a(): 985
// b(uint256): 2052

View File

@ -24,6 +24,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb
// gas irOptimized: 194174
// gas irOptimized: 193697
// gas legacy: 196426
// gas legacyOptimized: 193425
// gas legacyOptimized: 193405

View File

@ -60,10 +60,10 @@ contract C {
// compileViaYul: also
// ----
// test_bytes() ->
// gas irOptimized: 516922
// gas irOptimized: 511133
// gas legacy: 466763
// gas legacyOptimized: 374537
// test_uint256() ->
// gas irOptimized: 712564
// gas irOptimized: 706775
// gas legacy: 634592
// gas legacyOptimized: 499373

View File

@ -26,6 +26,6 @@ contract C {
// ----
// library: L
// f() -> 8, 7, 1, 2, 7, 12
// gas irOptimized: 172123
// gas irOptimized: 165254
// gas legacy: 164775
// gas legacyOptimized: 162697

View File

@ -61,10 +61,10 @@ contract C {
// compileViaYul: also
// ----
// test_bytes() ->
// gas irOptimized: 516922
// gas irOptimized: 511133
// gas legacy: 466763
// gas legacyOptimized: 374537
// test_uint256() ->
// gas irOptimized: 712564
// gas irOptimized: 706775
// gas legacy: 634592
// gas legacyOptimized: 499373

View File

@ -53,6 +53,6 @@ contract C {
// f2() -> 0x20, 0xa0, 0x1, 0x60, 0x2, 0x3, "abc"
// f3() -> 0x20, 0xa0, 0x1, 0x60, 0x2, 0x3, "abc"
// f4() -> 0x20, 0x160, 0x1, 0x80, 0xc0, 0x2, 0x3, "abc", 0x7, 0x40, 0x2, 0x2, 0x3
// gas irOptimized: 110858
// gas irOptimized: 110468
// gas legacy: 111328
// gas legacyOptimized: 109206

View File

@ -30,6 +30,6 @@ contract C is B {
// compileViaYul: also
// ----
// test() -> 77
// gas irOptimized: 139828
// gas irOptimized: 142789
// gas legacy: 156573
// gas legacyOptimized: 112983
// gas legacyOptimized: 112940

View File

@ -38,4 +38,5 @@ contract C is B {
// compileViaYul: also
// ----
// test() -> 5, 10
// gas irOptimized: 101019
// gas legacy: 100441

View File

@ -21,6 +21,6 @@ contract C {
// f(uint256[][1]): 32, 32, 0 -> true
// f(uint256[][1]): 32, 32, 1, 42 -> true
// f(uint256[][1]): 32, 32, 8, 421, 422, 423, 424, 425, 426, 427, 428 -> true
// gas irOptimized: 227647
// gas irOptimized: 227280
// gas legacy: 144300
// gas legacyOptimized: 124189

View File

@ -19,10 +19,10 @@ contract C {
// compileViaYul: also
// ----
// h(uint256[2][]): 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324
// gas irOptimized: 172712
// gas irOptimized: 172551
// gas legacy: 175929
// gas legacyOptimized: 172504
// i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224
// gas irOptimized: 107681
// gas irOptimized: 107492
// gas legacy: 109868
// gas legacyOptimized: 107388

View File

@ -11,6 +11,6 @@ contract C {
// compileViaYul: also
// ----
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
// gas irOptimized: 130299
// gas irOptimized: 130202
// gas legacy: 131690
// gas legacyOptimized: 130577

View File

@ -14,9 +14,9 @@ contract Test {
// compileViaYul: also
// ----
// set(uint24[3][]): 0x20, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 -> 0x06
// gas irOptimized: 200167
// gas irOptimized: 199798
// gas legacy: 278685
// gas legacyOptimized: 273732
// gas legacyOptimized: 273594
// data(uint256,uint256): 0x02, 0x02 -> 0x09
// data(uint256,uint256): 0x05, 0x01 -> 0x11
// data(uint256,uint256): 0x06, 0x00 -> FAILURE

View File

@ -47,7 +47,7 @@ contract c {
// gas legacyOptimized: 109706
// storage: nonempty
// test_long() -> 67
// gas irOptimized: 134698
// gas irOptimized: 134469
// gas legacy: 213590
// gas legacyOptimized: 211044
// storage: nonempty

View File

@ -19,6 +19,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0
// gas irOptimized: 312322
// gas irOptimized: 311507
// gas legacy: 483915
// gas legacyOptimized: 478672

View File

@ -15,7 +15,7 @@ contract c {
// ----
// getLength() -> 0
// set(): 1, 2 -> true
// gas irOptimized: 103207
// gas irOptimized: 103153
// gas legacy: 103126
// gas legacyOptimized: 102967
// getLength() -> 68

View File

@ -22,7 +22,7 @@ contract c {
// compileViaYul: also
// ----
// store(uint256[9],uint8[3][]): 21, 22, 23, 24, 25, 26, 27, 28, 29, 0x140, 4, 1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33 -> 32
// gas irOptimized: 628978
// gas irOptimized: 612370
// gas legacy: 817315
// gas legacyOptimized: 816813
// retrieve() -> 9, 28, 9, 28, 4, 3, 32

View File

@ -23,6 +23,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> true
// gas irOptimized: 111965
// gas irOptimized: 107807
// gas legacy: 107335
// gas legacyOptimized: 105857

View File

@ -48,6 +48,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> true
// gas irOptimized: 253493
// gas irOptimized: 233902
// gas legacy: 239061
// gas legacyOptimized: 235988

View File

@ -15,6 +15,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0
// gas irOptimized: 150525
// gas irOptimized: 139626
// gas legacy: 138913
// gas legacyOptimized: 137448

View File

@ -42,11 +42,11 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0
// gas irOptimized: 111968
// gas irOptimized: 107769
// gas legacy: 107306
// gas legacyOptimized: 105861
// g() -> 0
// h() -> 0
// gas irOptimized: 112011
// gas irOptimized: 107820
// gas legacy: 107328
// gas legacyOptimized: 105903

View File

@ -21,6 +21,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000
// gas irOptimized: 247460
// gas irOptimized: 246856
// gas legacy: 276683
// gas legacyOptimized: 275534

View File

@ -37,12 +37,12 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x02000202
// gas irOptimized: 2481119
// gas irOptimized: 2477836
// gas legacy: 2288641
// gas legacyOptimized: 2258654
// storage: empty
// clear() -> 0, 0
// gas irOptimized: 1856784
// gas irOptimized: 1854274
// gas legacy: 1727169
// gas legacyOptimized: 1698931
// storage: empty

View File

@ -15,6 +15,6 @@ contract c {
// compileViaYul: also
// ----
// test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10
// gas irOptimized: 611490
// gas irOptimized: 610623
// gas legacy: 604268
// gas legacyOptimized: 603688

View File

@ -19,6 +19,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 5, 4
// gas irOptimized: 235594
// gas irOptimized: 235198
// gas legacy: 237001
// gas legacyOptimized: 235316

View File

@ -23,6 +23,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 3, 4
// gas irOptimized: 195483
// gas irOptimized: 191241
// gas legacy: 208853
// gas legacyOptimized: 200341

View File

@ -20,6 +20,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 5, 4
// gas irOptimized: 276018
// gas irOptimized: 265237
// gas legacy: 264734
// gas legacyOptimized: 263160

View File

@ -14,4 +14,4 @@ contract c {
// compileViaYul: also
// ----
// test() -> 9, 4
// gas irOptimized: 100283
// gas irOptimized: 99282

View File

@ -18,6 +18,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 8, 0
// gas irOptimized: 158923
// gas irOptimized: 154937
// gas legacy: 153995
// gas legacyOptimized: 153403

View File

@ -19,7 +19,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> 4, 5
// gas irOptimized: 282808
// gas irOptimized: 259287
// gas legacy: 255936
// gas legacyOptimized: 254359
// storage: empty

View File

@ -17,6 +17,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0x20, 2, 0x40, 0xa0, 2, 0, 1, 2, 2, 3
// gas irOptimized: 170692
// gas irOptimized: 168769
// gas legacy: 163978
// gas legacyOptimized: 158150

View File

@ -19,6 +19,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 222905
// gas irOptimized: 218689
// gas legacy: 328106
// gas legacyOptimized: 308072
// gas legacyOptimized: 307826

View File

@ -21,6 +21,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x04000000000000000000000000000000000000000000000000, 0x0, 0x0
// gas irOptimized: 109180
// gas irOptimized: 107799
// gas legacy: 116651
// gas legacyOptimized: 107000

View File

@ -21,6 +21,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0
// gas irOptimized: 290176
// gas irOptimized: 288963
// gas legacy: 309353
// gas legacyOptimized: 307699

View File

@ -21,6 +21,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00
// gas irOptimized: 269679
// gas irOptimized: 264046
// gas legacy: 269681
// gas legacyOptimized: 268753

View File

@ -38,10 +38,10 @@ contract c {
// compileViaYul: true
// ----
// test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65
// gas irOptimized: 179750
// gas irOptimized: 179347
// test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65
// gas irOptimized: 155229
// gas irOptimized: 154097
// test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65
// gas irOptimized: 133495
// gas irOptimized: 132762
// test4(uint256[2][2]): 23, 42, 23, 42 -> 65
// gas irOptimized: 107858
// gas irOptimized: 105500

View File

@ -40,12 +40,12 @@ contract Test {
// compileViaYul: also
// ----
// test() -> 24
// gas irOptimized: 217724
// gas irOptimized: 216554
// gas legacy: 215533
// gas legacyOptimized: 214947
// test1() -> 3
// test2() -> 6
// test3() -> 24
// gas irOptimized: 124650
// gas irOptimized: 123067
// gas legacy: 122795
// gas legacyOptimized: 121883

View File

@ -17,4 +17,4 @@ contract C {
// compileViaYul: true
// ----
// f((uint128,uint64,uint128)[]): 0x20, 3, 0, 0, 12, 0, 11, 0, 10, 0, 0 -> 10, 11, 12
// gas irOptimized: 123321
// gas irOptimized: 123100

View File

@ -19,4 +19,4 @@ contract C {
// compileViaYul: true
// ----
// f() -> 10, 11, 12
// gas irOptimized: 122679
// gas irOptimized: 122096

View File

@ -23,4 +23,4 @@ contract C {
// compileViaYul: true
// ----
// f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1
// gas irOptimized: 354491
// gas irOptimized: 354017

View File

@ -26,4 +26,4 @@ contract C {
// compileViaYul: true
// ----
// f() -> 3, 3, 3, 1
// gas irOptimized: 189735
// gas irOptimized: 187687

View File

@ -15,6 +15,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 1, 2, 3
// gas irOptimized: 135042
// gas irOptimized: 133583
// gas legacy: 134419
// gas legacyOptimized: 125440

View File

@ -12,7 +12,7 @@ contract Test {
// compileViaYul: also
// ----
// set(uint24[]): 0x20, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 -> 18
// gas irOptimized: 121109
// gas irOptimized: 121010
// gas legacy: 125815
// gas legacyOptimized: 123614
// data(uint256): 7 -> 8

View File

@ -7,11 +7,11 @@ contract c {
// compileViaYul: also
// ----
// set(uint256): 1, 2 -> true
// gas irOptimized: 103359
// gas irOptimized: 103311
// gas legacy: 103491
// gas legacyOptimized: 103136
// set(uint256): 2, 2, 3, 4, 5 -> true
// gas irOptimized: 164046
// gas irOptimized: 163998
// gas legacy: 164121
// gas legacyOptimized: 163766
// storage: nonempty

View File

@ -19,25 +19,25 @@ contract c {
// ----
// f(uint256): 0 -> 0x20, 0x00
// f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00
// gas irOptimized: 222425
// gas irOptimized: 221795
// gas legacy: 255464
// gas legacyOptimized: 250998
// f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671
// gas irOptimized: 233052
// gas irOptimized: 232383
// gas legacy: 267931
// gas legacyOptimized: 263329
// f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 241863
// gas irOptimized: 241178
// gas legacy: 277538
// gas legacyOptimized: 272818
// f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992
// gas irOptimized: 355653
// gas irOptimized: 354488
// gas legacy: 423428
// gas legacyOptimized: 414868
// f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000
// gas legacy: 106445
// gas legacyOptimized: 104379
// f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968
// gas irOptimized: 816179
// gas irOptimized: 813943
// gas legacy: 954517
// gas legacyOptimized: 937521

View File

@ -11,6 +11,6 @@ contract C {
// compileViaYul: also
// ----
// f(uint256[]): 0x20, 0x03, 0x1, 0x2, 0x3 -> 0x1
// gas irOptimized: 108090
// gas irOptimized: 105320
// gas legacy: 105365
// gas legacyOptimized: 105147

View File

@ -37,7 +37,7 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0x40, 0x80, 6, 0x6162636465660000000000000000000000000000000000000000000000000000, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000
// gas irOptimized: 172876
// gas irOptimized: 172472
// gas legacy: 174794
// gas legacyOptimized: 174188
// g() -> 0x40, 0xc0, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000, 0x11, 0x3132333435363738393233343536373839000000000000000000000000000000

View File

@ -48,6 +48,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0xff
// gas irOptimized: 137415
// gas irOptimized: 136355
// gas legacy: 137645
// gas legacyOptimized: 134376

View File

@ -18,6 +18,6 @@ contract C {
// compileViaYul: also
// ----
// test() -> 7
// gas irOptimized: 134680
// gas irOptimized: 134260
// gas legacy: 211296
// gas legacyOptimized: 211087

View File

@ -9,7 +9,7 @@ contract c {
// compileViaYul: also
// ----
// set(): 1, 2, 3, 4, 5 -> true
// gas irOptimized: 163855
// gas irOptimized: 163790
// gas legacy: 163756
// gas legacyOptimized: 163596
// storage: nonempty

View File

@ -20,6 +20,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 3
// gas irOptimized: 175175
// gas irOptimized: 174259
// gas legacy: 179707
// gas legacyOptimized: 178763

View File

@ -19,6 +19,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 1, 2, 3, 4, 5, 6, 7
// gas irOptimized: 218088
// gas irOptimized: 212697
// gas legacy: 223725
// gas legacyOptimized: 222886

View File

@ -13,6 +13,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000
// gas irOptimized: 198770
// gas irOptimized: 198455
// gas legacy: 199159
// gas legacyOptimized: 198132

View File

@ -20,6 +20,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 1, 2, 3, 4, 5, 6, 7
// gas irOptimized: 218088
// gas irOptimized: 212697
// gas legacy: 223730
// gas legacyOptimized: 222891

View File

@ -26,6 +26,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 11, 0x0c, 1, 0x15, 22, 4
// gas irOptimized: 292610
// gas irOptimized: 289378
// gas legacy: 296916
// gas legacyOptimized: 283163

View File

@ -15,6 +15,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> 2, 3, 4
// gas irOptimized: 240291
// gas irOptimized: 209867
// gas legacy: 241549
// gas legacyOptimized: 236002

View File

@ -20,6 +20,6 @@ contract C {
// compileViaYul: also
// ----
// f() -> "A", 8, 4, "B"
// gas irOptimized: 170553
// gas irOptimized: 151068
// gas legacy: 121398
// gas legacyOptimized: 115494

View File

@ -18,6 +18,6 @@ contract c {
// compileViaYul: also
// ----
// test1() -> true
// gas irOptimized: 533377
// gas irOptimized: 531791
// gas legacy: 613377
// gas legacyOptimized: 606411

View File

@ -16,4 +16,4 @@ contract C {
// compileViaYul: also
// ----
// f() -> 0, 0, 0
// gas irOptimized: 101909
// gas irOptimized: 101644

View File

@ -16,7 +16,7 @@ contract c {
// ----
// storage: empty
// fill() ->
// gas irOptimized: 536196
// gas irOptimized: 535980
// gas legacy: 504373
// gas legacyOptimized: 499648
// storage: nonempty

View File

@ -44,7 +44,7 @@ contract c {
// ----
// getLengths() -> 0, 0
// setLengths(uint256,uint256): 48, 49 ->
// gas irOptimized: 276350
// gas irOptimized: 275906
// gas legacy: 308271
// gas legacyOptimized: 300117
// getLengths() -> 48, 49

View File

@ -18,7 +18,7 @@ contract c {
// ----
// storage: empty
// fill() -> 8
// gas irOptimized: 181160
// gas irOptimized: 170158
// gas legacy: 165456
// gas legacyOptimized: 164387
// storage: nonempty

View File

@ -13,7 +13,7 @@ contract c {
// ----
// storage: empty
// fill() ->
// gas irOptimized: 423997
// gas irOptimized: 423949
// gas legacy: 429460
// gas legacyOptimized: 425520
// storage: nonempty

View File

@ -21,6 +21,6 @@ contract B {
// compileViaYul: also
// ----
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
// gas irOptimized: 179451
// gas irOptimized: 152350
// gas legacy: 264410
// gas legacyOptimized: 134899

View File

@ -45,6 +45,6 @@ contract C {
// compileViaYul: also
// ----
// test() -> 5, 6, 7
// gas irOptimized: 360198
// gas irOptimized: 354715
// gas legacy: 500424
// gas legacyOptimized: 307813

View File

@ -25,7 +25,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> 1, 2, 3
// gas irOptimized: 2556747
// gas irOptimized: 2462156
// gas legacy: 2416722
// gas legacyOptimized: 2405396
// storage: empty

View File

@ -20,7 +20,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> 38, 28, 18
// gas irOptimized: 538686
// gas irOptimized: 531794
// gas legacy: 454080
// gas legacyOptimized: 443170
// storage: empty

View File

@ -20,7 +20,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> 20, 10
// gas irOptimized: 374254
// gas irOptimized: 369920
// gas legacy: 320859
// gas legacyOptimized: 314681
// storage: empty

View File

@ -12,6 +12,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000
// gas irOptimized: 163879
// gas irOptimized: 163643
// gas legacy: 245809
// gas legacyOptimized: 242636

View File

@ -18,7 +18,7 @@ contract c {
// compileViaYul: also
// ----
// test() -> true
// gas irOptimized: 460283
// gas irOptimized: 455964
// gas legacy: 552064
// gas legacyOptimized: 533164
// storage: empty

View File

@ -17,7 +17,7 @@ contract c {
// compileViaYul: also
// ----
// test() ->
// gas irOptimized: 302142
// gas irOptimized: 300920
// gas legacy: 372763
// gas legacyOptimized: 366846
// storage: empty

View File

@ -12,6 +12,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 161236
// gas irOptimized: 160975
// gas legacy: 243287
// gas legacyOptimized: 240361

View File

@ -18,6 +18,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 5, 4, 3, 3
// gas irOptimized: 116387
// gas irOptimized: 111041
// gas legacy: 111938
// gas legacyOptimized: 110528

View File

@ -14,6 +14,6 @@ contract C {
// compileViaYul: also
// ----
// f(uint120[]): 0x20, 3, 1, 2, 3 -> 1
// gas irOptimized: 116591
// gas irOptimized: 116414
// gas legacy: 116886
// gas legacyOptimized: 116699

View File

@ -16,6 +16,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 1, 2, 3, 4
// gas irOptimized: 112751
// gas irOptimized: 112131
// gas legacy: 107098
// gas legacyOptimized: 106362

View File

@ -22,6 +22,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 2, 3, 4, 5
// gas irOptimized: 147373
// gas irOptimized: 146426
// gas legacy: 190684
// gas legacyOptimized: 188256

View File

@ -18,6 +18,6 @@ contract c {
// compileViaYul: also
// ----
// test((uint16,uint16,uint16[3],uint16[])): 0x20, 2, 3, 0, 0, 4, 0xC0, 4, 0, 0, 5, 0, 0 -> 2, 3, 4, 5
// gas irOptimized: 148644
// gas irOptimized: 148261
// gas legacy: 152444
// gas legacyOptimized: 146671

View File

@ -17,6 +17,6 @@ contract c {
// compileViaYul: also
// ----
// test() -> 0
// gas irOptimized: 397892
// gas irOptimized: 396112
// gas legacy: 565428
// gas legacyOptimized: 552524

View File

@ -29,14 +29,14 @@ contract C {
// ----
// l() -> 0
// f(uint256,uint256): 42, 64 ->
// gas irOptimized: 202796
// gas irOptimized: 202728
// gas legacy: 163034
// gas legacyOptimized: 157045
// l() -> 1
// ll(uint256): 0 -> 43
// a(uint256,uint256): 0, 42 -> 64
// f(uint256,uint256): 84, 128 ->
// gas irOptimized: 299012
// gas irOptimized: 298944
// gas legacy: 222080
// gas legacyOptimized: 210631
// l() -> 2

View File

@ -23,7 +23,7 @@ contract C {
// ----
// l() -> 0
// g(uint256): 70 ->
// gas irOptimized: 433438
// gas irOptimized: 428840
// gas legacy: 419791
// gas legacyOptimized: 415408
// l() -> 70

View File

@ -26,6 +26,6 @@ contract Main {
// compileViaYul: also
// ----
// f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1
// gas irOptimized: 117287
// gas irOptimized: 117113
// gas legacy: 127152
// gas legacyOptimized: 113679

View File

@ -26,6 +26,6 @@ contract Creator {
// compileViaYul: also
// ----
// f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8
// gas irOptimized: 472714
// gas irOptimized: 479282
// gas legacy: 570900
// gas legacyOptimized: 435524

Some files were not shown because too many files have changed in this diff Show More