mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove EWASM backend.
This commit is contained in:
@@ -135,8 +135,6 @@ set(libyul_sources
|
||||
libyul/ControlFlowSideEffectsTest.h
|
||||
libyul/EVMCodeTransformTest.cpp
|
||||
libyul/EVMCodeTransformTest.h
|
||||
libyul/EwasmTranslationTest.cpp
|
||||
libyul/EwasmTranslationTest.h
|
||||
libyul/FunctionSideEffects.cpp
|
||||
libyul/FunctionSideEffects.h
|
||||
libyul/Inliner.cpp
|
||||
|
||||
+2
-22
@@ -108,13 +108,11 @@ void CommonOptions::addOptions()
|
||||
("eof-version", po::value<uint64_t>()->implicit_value(1u), "which EOF version to use")
|
||||
("testpath", po::value<fs::path>(&this->testPath)->default_value(solidity::test::testPath()), "path to test files")
|
||||
("vm", po::value<std::vector<fs::path>>(&vmPaths), "path to evmc library, can be supplied multiple times.")
|
||||
("ewasm", po::bool_switch(&ewasm)->default_value(ewasm), "tries to automatically find an ewasm vm and enable ewasm test-execution.")
|
||||
("batches", po::value<size_t>(&this->batches)->default_value(1), "set number of batches to split the tests into")
|
||||
("selected-batch", po::value<size_t>(&this->selectedBatch)->default_value(0), "zero-based number of batch to execute")
|
||||
("no-semantic-tests", po::bool_switch(&disableSemanticTests)->default_value(disableSemanticTests), "disable semantic tests")
|
||||
("no-smt", po::bool_switch(&disableSMT)->default_value(disableSMT), "disable SMT checker")
|
||||
("optimize", po::bool_switch(&optimize)->default_value(optimize), "enables optimization")
|
||||
("enforce-compile-to-ewasm", po::bool_switch(&enforceCompileToEwasm)->default_value(enforceCompileToEwasm), "Enforce compiling all tests to Ewasm to see if additional tests can be activated.")
|
||||
("enforce-gas-cost", po::value<bool>(&enforceGasTest)->default_value(enforceGasTest)->implicit_value(true), "Enforce checking gas cost in semantic tests.")
|
||||
("enforce-gas-cost-min-value", po::value(&enforceGasTestMinValue)->default_value(enforceGasTestMinValue), "Threshold value to enforce adding gas checks to a test.")
|
||||
("abiencoderv1", po::bool_switch(&useABIEncoderV1)->default_value(useABIEncoderV1), "enables abi encoder v1")
|
||||
@@ -209,14 +207,6 @@ bool CommonOptions::parse(int argc, char const* const* argv)
|
||||
vmPaths.emplace_back(*repoPath);
|
||||
else
|
||||
vmPaths.emplace_back(evmoneFilename);
|
||||
if (ewasm) {
|
||||
if (auto envPath = getenv("ETH_HERA"))
|
||||
vmPaths.emplace_back(envPath);
|
||||
else if (auto repoPath = findInDefaultPath(heraFilename))
|
||||
vmPaths.emplace_back(*repoPath);
|
||||
else
|
||||
vmPaths.emplace_back(heraFilename);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -234,8 +224,6 @@ string CommonOptions::toString(vector<string> const& _selectedOptions) const
|
||||
{"optimize", boolToString(optimize)},
|
||||
{"useABIEncoderV1", boolToString(useABIEncoderV1)},
|
||||
{"batch", to_string(selectedBatch + 1) + "/" + to_string(batches)},
|
||||
{"ewasm", boolToString(ewasm)},
|
||||
{"enforceCompileToEwasm", boolToString(enforceCompileToEwasm)},
|
||||
{"enforceGasTest", boolToString(enforceGasTest)},
|
||||
{"enforceGasTestMinValue", enforceGasTestMinValue.str()},
|
||||
{"disableSemanticTests", boolToString(disableSemanticTests)},
|
||||
@@ -303,10 +291,10 @@ bool isValidSemanticTestPath(boost::filesystem::path const& _testPath)
|
||||
|
||||
bool loadVMs(CommonOptions const& _options)
|
||||
{
|
||||
if (_options.disableSemanticTests && !_options.ewasm)
|
||||
if (_options.disableSemanticTests)
|
||||
return true;
|
||||
|
||||
auto [evmSupported, ewasmSupported] = solidity::test::EVMHost::checkVmPaths(_options.vmPaths);
|
||||
bool evmSupported = solidity::test::EVMHost::checkVmPaths(_options.vmPaths);
|
||||
if (!_options.disableSemanticTests && !evmSupported)
|
||||
{
|
||||
std::cerr << "Unable to find " << solidity::test::evmoneFilename;
|
||||
@@ -315,14 +303,6 @@ bool loadVMs(CommonOptions const& _options)
|
||||
std::cerr << solidity::test::evmoneDownloadLink << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (_options.ewasm && !ewasmSupported)
|
||||
{
|
||||
std::cerr << "Unable to find " << solidity::test::heraFilename;
|
||||
std::cerr << ". To be able to enable ewasm tests, please provide the path using --vm <path>." << std::endl;
|
||||
std::cerr << "You can download it at" << std::endl;
|
||||
std::cerr << solidity::test::heraDownloadLink << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,18 +34,12 @@ namespace solidity::test
|
||||
#ifdef _WIN32
|
||||
static constexpr auto evmoneFilename = "evmone.dll";
|
||||
static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-windows-amd64.zip";
|
||||
static constexpr auto heraFilename = "hera.dll";
|
||||
static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/archive/v0.6.0.tar.gz";
|
||||
#elif defined(__APPLE__)
|
||||
static constexpr auto evmoneFilename = "libevmone.dylib";
|
||||
static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-darwin-x86_64.tar.gz";
|
||||
static constexpr auto heraFilename = "libhera.dylib";
|
||||
static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases/download/v0.6.0/hera-0.6.0-darwin-x86_64.tar.gz";
|
||||
#else
|
||||
static constexpr auto evmoneFilename = "libevmone.so";
|
||||
static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-linux-x86_64.tar.gz";
|
||||
static constexpr auto heraFilename = "libhera.so";
|
||||
static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases/download/v0.6.0/hera-0.6.0-linux-x86_64.tar.gz";
|
||||
#endif
|
||||
|
||||
struct ConfigException: public util::Exception {};
|
||||
@@ -58,9 +52,7 @@ struct CommonOptions
|
||||
|
||||
std::vector<boost::filesystem::path> vmPaths;
|
||||
boost::filesystem::path testPath;
|
||||
bool ewasm = false;
|
||||
bool optimize = false;
|
||||
bool enforceCompileToEwasm = false;
|
||||
bool enforceGasTest = false;
|
||||
u256 enforceGasTestMinValue = 100000;
|
||||
bool disableSemanticTests = false;
|
||||
|
||||
+4
-12
@@ -47,10 +47,10 @@ evmc::VM& EVMHost::getVM(string const& _path)
|
||||
auto vm = evmc::VM{evmc_load_and_configure(_path.c_str(), &errorCode)};
|
||||
if (vm && errorCode == EVMC_LOADER_SUCCESS)
|
||||
{
|
||||
if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1 | EVMC_CAPABILITY_EWASM))
|
||||
if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1))
|
||||
vms[_path] = make_unique<evmc::VM>(evmc::VM(std::move(vm)));
|
||||
else
|
||||
cerr << "VM loaded neither supports EVM1 nor EWASM" << endl;
|
||||
cerr << "VM loaded does not support EVM1" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -67,10 +67,9 @@ evmc::VM& EVMHost::getVM(string const& _path)
|
||||
return NullVM;
|
||||
}
|
||||
|
||||
std::tuple<bool, bool> EVMHost::checkVmPaths(vector<boost::filesystem::path> const& _vmPaths)
|
||||
bool EVMHost::checkVmPaths(vector<boost::filesystem::path> const& _vmPaths)
|
||||
{
|
||||
bool evmVmFound = false;
|
||||
bool ewasmVmFound = false;
|
||||
for (auto const& path: _vmPaths)
|
||||
{
|
||||
evmc::VM& vm = EVMHost::getVM(path.string());
|
||||
@@ -83,15 +82,8 @@ std::tuple<bool, bool> EVMHost::checkVmPaths(vector<boost::filesystem::path> con
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Multiple evm1 evmc vms defined. Please only define one evm1 evmc vm."));
|
||||
evmVmFound = true;
|
||||
}
|
||||
|
||||
if (vm.has_capability(EVMC_CAPABILITY_EWASM))
|
||||
{
|
||||
if (ewasmVmFound)
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Multiple ewasm evmc vms where defined. Please only define one ewasm evmc vm."));
|
||||
ewasmVmFound = true;
|
||||
}
|
||||
}
|
||||
return {evmVmFound, ewasmVmFound};
|
||||
return evmVmFound;
|
||||
}
|
||||
|
||||
EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
|
||||
|
||||
+4
-5
@@ -65,16 +65,15 @@ public:
|
||||
|
||||
// Solidity testing specific features.
|
||||
|
||||
/// Tries to dynamically load an evmc vm supporting evm1 or ewasm and caches the loaded VM.
|
||||
/// Tries to dynamically load an evmc vm supporting evm1 and caches the loaded VM.
|
||||
/// @returns vmc::VM(nullptr) on failure.
|
||||
static evmc::VM& getVM(std::string const& _path = {});
|
||||
|
||||
/// Tries to load all defined evmc vm shared libraries.
|
||||
/// @param _vmPaths paths to multiple evmc shared libraries.
|
||||
/// @throw Exception if multiple evm1 or multiple ewasm evmc vms where loaded.
|
||||
/// @returns A pair of booleans, the first element being true, if an evmc vm supporting evm1 was loaded properly,
|
||||
/// the second being true, if an evmc vm supporting ewasm was loaded properly.
|
||||
static std::tuple<bool, bool> checkVmPaths(std::vector<boost::filesystem::path> const& _vmPaths);
|
||||
/// @throw Exception if multiple evm1 vms where loaded.
|
||||
/// @returns true, if an evmc vm supporting evm1 was loaded properly,
|
||||
static bool checkVmPaths(std::vector<boost::filesystem::path> const& _vmPaths);
|
||||
|
||||
explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm);
|
||||
|
||||
|
||||
@@ -60,11 +60,6 @@ ExecutionFramework::ExecutionFramework(langutil::EVMVersion _evmVersion, vector<
|
||||
{
|
||||
if (solidity::test::CommonOptions::get().optimize)
|
||||
m_optimiserSettings = solidity::frontend::OptimiserSettings::standard();
|
||||
|
||||
for (auto const& path: m_vmPaths)
|
||||
if (EVMHost::getVM(path.string()).has_capability(EVMC_CAPABILITY_EWASM))
|
||||
m_supportsEwasm = true;
|
||||
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,6 @@ protected:
|
||||
solidity::frontend::RevertStrings m_revertStrings = solidity::frontend::RevertStrings::Default;
|
||||
solidity::frontend::OptimiserSettings m_optimiserSettings = solidity::frontend::OptimiserSettings::minimal();
|
||||
bool m_showMessages = false;
|
||||
bool m_supportsEwasm = false;
|
||||
std::unique_ptr<EVMHost> m_evmcHost;
|
||||
|
||||
std::vector<boost::filesystem::path> m_vmPaths;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <test/libsolidity/SMTCheckerTest.h>
|
||||
#include <test/libyul/ControlFlowGraphTest.h>
|
||||
#include <test/libyul/EVMCodeTransformTest.h>
|
||||
#include <test/libyul/EwasmTranslationTest.h>
|
||||
#include <test/libyul/YulOptimizerTest.h>
|
||||
#include <test/libyul/YulInterpreterTest.h>
|
||||
#include <test/libyul/ObjectCompilerTest.h>
|
||||
@@ -78,7 +77,6 @@ Testsuite const g_interactiveTestsuites[] = {
|
||||
{"SMT Checker", "libsolidity", "smtCheckerTests", true, false, &SMTCheckerTest::create},
|
||||
{"Gas Estimates", "libsolidity", "gasTests", false, false, &GasTest::create},
|
||||
{"Memory Guard Tests", "libsolidity", "memoryGuardTests", false, false, &MemoryGuardTest::create},
|
||||
{"Ewasm Translation", "libyul", "ewasmTranslationTests", false, false, &yul::test::EwasmTranslationTest::create}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
langutil::EVMVersion evmVersion;
|
||||
std::optional<uint8_t> eofVersion;
|
||||
std::vector<boost::filesystem::path> vmPaths;
|
||||
bool enforceCompileToEwasm = false;
|
||||
bool enforceGasCost = false;
|
||||
u256 enforceGasCostMinValue;
|
||||
};
|
||||
|
||||
@@ -209,8 +209,6 @@ EOF
|
||||
sed -i.bak -E -e 's/([0-9a-f]{34}\$__)[0-9a-f]+(__\$[0-9a-f]{17})/\1<BYTECODE REMOVED>\2/g' "$stdout_path"
|
||||
# Remove metadata in assembly output (see below about the magic numbers)
|
||||
sed -i.bak -E -e 's/"[0-9a-f]+64697066735822[0-9a-f]+64736f6c63[0-9a-f]+/"<BYTECODE REMOVED>/g' "$stdout_path"
|
||||
# Remove hash of text representation in ewasm
|
||||
sed -i.bak -E -e 's/The Keccak-256 hash of the text representation of .*: [0-9a-f]+/The Keccak-256 hash of the text representation of <REMOVED>/g' "$stdout_path"
|
||||
|
||||
# Replace escaped newlines by actual newlines for readability
|
||||
# shellcheck disable=SC1003
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
sstore(0, 1)
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
|
||||
======= evm_to_wasm/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code { { sstore(0, 1) } }
|
||||
}
|
||||
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
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
|
||||
{
|
||||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32))
|
||||
}
|
||||
function bswap32(x:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010e0360000060017f017f60027f7f0002190108657468657265756d0c73746f7261676553746f726500020304030001010503010001060100071102066d656d6f72790200046d61696e00010ac70103850101037e02404200a71003ad422086210020004200422088a71003ad84210141002001370000410041086a2001370000410041106a2001370000410041186a200137000041202001370000412041086a2001370000412041106a20013700004201a71003ad4220862102412041186a20024201422088a71003ad843700004100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $hi_1 i64)
|
||||
(block $label_
|
||||
(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))
|
||||
)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__1
|
||||
(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))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap32
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__2
|
||||
(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)))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
for { } lt(x, 10) { x := add(x, 1) } {
|
||||
if eq(x, 2) { break }
|
||||
if eq(x, 4) { continue }
|
||||
}
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,583 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_break/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
{
|
||||
let x := calldataload(0)
|
||||
for { } lt(x, 10) { x := add(x, 1) }
|
||||
{
|
||||
if eq(x, 2) { break }
|
||||
if eq(x, 4) { continue }
|
||||
}
|
||||
sstore(0, x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
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 _1:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, 1)))))
|
||||
for { }
|
||||
i32.eqz(_1)
|
||||
{
|
||||
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 _2, _3, _4, _5 := iszero_1324_2108(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_771_2109(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_772_2110(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(x_4, x_5, x_6, x_7)
|
||||
}
|
||||
function add(x1, x2, x3, x4) -> r1, r2, r3, r4
|
||||
{
|
||||
let t := i64.add(x4, 1)
|
||||
r4 := i64.add(t, 0)
|
||||
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_1324_2108(x4) -> r1, r2, r3, r4
|
||||
{
|
||||
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, x4))))
|
||||
}
|
||||
function eq_771_2109(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, 2)))))
|
||||
}
|
||||
function eq_772_2110(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 := 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(_2, i64.ne(x2, _1), i64.lt_u(x2, _1))
|
||||
case 0:i32 {
|
||||
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 }
|
||||
}
|
||||
case 1:i32 { z := 0:i32 }
|
||||
default { z := 1:i32 }
|
||||
}
|
||||
case 1:i32 { z := 0:i32 }
|
||||
default { z := 1:i32 }
|
||||
z4 := i64.extend_i32_u(z)
|
||||
}
|
||||
function u256_to_i32_774() -> 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 u256_to_i32() -> v:i32
|
||||
{
|
||||
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 bswap16(x:i32) -> y:i32
|
||||
{
|
||||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32))
|
||||
}
|
||||
function bswap32(x:i32) -> y:i32
|
||||
{
|
||||
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 calldataload() -> z1, z2, z3, z4
|
||||
{
|
||||
let cds:i32 := eth.getCallDataSize()
|
||||
let destination:i32 := u256_to_i32_774()
|
||||
let offset:i32 := u256_to_i32_774()
|
||||
let requested_size:i32 := u256_to_i32()
|
||||
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 _1:i32 := 0:i32
|
||||
if i32.gt_u(available_size, _1)
|
||||
{
|
||||
eth.callDataCopy(destination, offset, available_size)
|
||||
}
|
||||
if i32.gt_u(requested_size, available_size)
|
||||
{
|
||||
let _2:i32 := i32.sub(requested_size, available_size)
|
||||
let _3:i32 := i32.add(destination, available_size)
|
||||
let i:i32 := _1
|
||||
for { } i32.lt_u(i, _2) { i := i32.add(i, 1:i32) }
|
||||
{
|
||||
i32.store8(i32.add(_3, i), _1)
|
||||
}
|
||||
}
|
||||
let z1_1 := bswap64(i64.load(_1))
|
||||
let z2_1 := bswap64(i64.load(i32.add(_1, 8:i32)))
|
||||
let z3_1 := bswap64(i64.load(i32.add(_1, 16:i32)))
|
||||
let z4_1 := bswap64(i64.load(i32.add(_1, 24:i32)))
|
||||
z1 := z1_1
|
||||
z2 := z2_1
|
||||
z3 := z3_1
|
||||
z4 := z4_1
|
||||
}
|
||||
function sstore(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d010000000130096000006000017e6000017f60017e017e60047e7e7e7e0060047e7e7e7e017e60017f017f60027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000708657468657265756d06726576657274000708657468657265756d0f67657443616c6c4461746153697a65000208657468657265756d0c63616c6c44617461436f70790008030e0d0005030505050202060603010405030100010615047e0142000b7e0142000b7e0142000b7f0141000b071102066d656d6f72790200046d61696e00040abd090d8d0203087e017f107e02400240100f21002300210123012102230221030b200021042001210520022106200321074200420084420042018484504545210802400340200845450d010240024020042005200620071009100621092303210a2300210b2301210c0b2009200a84200b200c8484504504400c030b024020042005200620071007210d2300210e2301210f230221100b200d200e84200f20108484504504400c030b02402004200520062007100821112300211223012113230221140b2011201284201320148484504504400c010b0b02402004200520062007100521152300211623012117230221180b201521042016210520172106201821070c000b0b200420052006200710100b0b6701077e0240200342017c2108200842007c2107200242007c210920092008200354200720085472ad7c2106200142007c210a200a2009200254200620095472ad7c2105200042007c200a2001542005200a5472ad7c21040b20052400200624012007240220040b2401047e0240420042008442002000848450ad21040b20022400200324012004240220010b2f01047e02402000420051200142005120024200512003420251717171ad21070b20052400200624012007240220040b2f01047e02402000420051200142005120024200512003420451717171ad21070b20052400200624012007240220040bab0104017e017f017e047f02404100210542002106417f210702402007200020065220002006541b21082008410046044002402007200120065220012006541b21092009410046044002402007200220065220022006541b210a200a41004604402003420a54210505200a41014604404100210505410121050b0b0b05200941014604404100210505410121050b0b0b05200841014604404100210505410121050b0b0b2005ad21040b20040b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b2901017f024042004200420084420084520440000b42004220422088520440000b4220a721000b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100c411074210220022000411076100c7221010b20010b2201027e02402000a7100dad422086210220022000422088a7100dad8421010b20010bdc0103047e097f047e024010022104100a2105100a2106100b21072006417f20076b4b04404100410010010b200420066b2108200620044b0440410021080b41002109200820094b044020052006200810030b200720084b0440200720086b210a200520086a210b2009210c02400340200c200a49450d010240200b200c6a20093a00000b200c41016a210c0c000b0b0b2009290000100e210d200941086a290000100e210e200941106a290000100e210f200941186a290000100e2110200d2100200e2101200f2102201021030b20012400200224012003240220000b7801027e02404200a7100dad422086210420044200422088a7100dad84210541002005370000410041086a2005370000410041106a2005370000410041186a200537000041202000100e370000412041086a2001100e370000412041106a2002100e370000412041186a2003100e3700004100412010000b0b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(import "ethereum" "revert" (func $eth.revert (param i32 i32)))
|
||||
(import "ethereum" "getCallDataSize" (func $eth.getCallDataSize (result i32)))
|
||||
(import "ethereum" "callDataCopy" (func $eth.callDataCopy (param i32 i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
(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))
|
||||
|
||||
(func $main
|
||||
(local $x i64)
|
||||
(local $x_1 i64)
|
||||
(local $x_2 i64)
|
||||
(local $x_3 i64)
|
||||
(local $x_4 i64)
|
||||
(local $x_5 i64)
|
||||
(local $x_6 i64)
|
||||
(local $x_7 i64)
|
||||
(local $_1 i32)
|
||||
(local $_2 i64)
|
||||
(local $_3 i64)
|
||||
(local $_4 i64)
|
||||
(local $_5 i64)
|
||||
(local $_6 i64)
|
||||
(local $_7 i64)
|
||||
(local $_8 i64)
|
||||
(local $_9 i64)
|
||||
(local $_10 i64)
|
||||
(local $_11 i64)
|
||||
(local $_12 i64)
|
||||
(local $_13 i64)
|
||||
(local $x_8 i64)
|
||||
(local $x_9 i64)
|
||||
(local $x_10 i64)
|
||||
(local $x_11 i64)
|
||||
(block $label_
|
||||
(block
|
||||
(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))
|
||||
|
||||
)
|
||||
(local.set $x_4 (local.get $x))
|
||||
(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 $_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 $_1))))
|
||||
(block $label__4
|
||||
(block
|
||||
(local.set $_2 (call $iszero_1324_2108 (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_))
|
||||
(local.set $_5 (global.get $global__1))
|
||||
|
||||
)
|
||||
(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 $_6 (call $eq_771_2109 (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 $_6) (local.get $_7)) (i64.or (local.get $_8) (local.get $_9))))) (then
|
||||
(br $label__3)
|
||||
))
|
||||
(block
|
||||
(local.set $_10 (call $eq_772_2110 (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 $_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.set $x_9 (global.get $global_))
|
||||
(local.set $x_10 (global.get $global__1))
|
||||
(local.set $x_11 (global.get $global__2))
|
||||
|
||||
)
|
||||
(local.set $x_4 (local.get $x_8))
|
||||
(local.set $x_5 (local.get $x_9))
|
||||
(local.set $x_6 (local.get $x_10))
|
||||
(local.set $x_7 (local.get $x_11))
|
||||
(br $label__5)
|
||||
)
|
||||
|
||||
)
|
||||
(call $sstore (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))
|
||||
)
|
||||
)
|
||||
|
||||
(func $add
|
||||
(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 i64)
|
||||
(local $t_1 i64)
|
||||
(local $t_2 i64)
|
||||
(block $label__7
|
||||
(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))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $iszero_1324_2108
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r1 i64)
|
||||
(local $r2 i64)
|
||||
(local $r3 i64)
|
||||
(local $r4 i64)
|
||||
(block $label__8
|
||||
(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_771_2109
|
||||
(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__9
|
||||
(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_772_2110
|
||||
(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 4)))))))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $r2))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $lt
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $z4 i64)
|
||||
(local $z i32)
|
||||
(local $_1 i64)
|
||||
(local $_2 i32)
|
||||
(local $condition i32)
|
||||
(local $condition_12 i32)
|
||||
(local $condition_13 i32)
|
||||
(block $label__11
|
||||
(local.set $z (i32.const 0))
|
||||
(local.set $_1 (i64.const 0))
|
||||
(local.set $_2 (i32.const 4294967295))
|
||||
(block
|
||||
(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_12 (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_12) (i32.const 0)) (then
|
||||
(block
|
||||
(local.set $condition_13 (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_13) (i32.const 0)) (then
|
||||
(local.set $z (i64.lt_u (local.get $x4) (i64.const 10)))
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition_13) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition_12) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
(local.set $z4 (i64.extend_i32_u (local.get $z)))
|
||||
|
||||
)
|
||||
(local.get $z4)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_774
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(local $_1 i64)
|
||||
(block $label__14
|
||||
(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)
|
||||
)
|
||||
|
||||
(func $u256_to_i32
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(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 (i64.const 32) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (i64.const 32)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__16
|
||||
(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))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap32
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__17
|
||||
(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)))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap64
|
||||
(param $x i64)
|
||||
(result i64)
|
||||
(local $y i64)
|
||||
(local $hi i64)
|
||||
(block $label__18
|
||||
(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 $calldataload
|
||||
(result i64)
|
||||
(local $z1 i64)
|
||||
(local $z2 i64)
|
||||
(local $z3 i64)
|
||||
(local $z4 i64)
|
||||
(local $cds i32)
|
||||
(local $destination i32)
|
||||
(local $offset i32)
|
||||
(local $requested_size i32)
|
||||
(local $available_size i32)
|
||||
(local $_1 i32)
|
||||
(local $_2 i32)
|
||||
(local $_3 i32)
|
||||
(local $i i32)
|
||||
(local $z1_1 i64)
|
||||
(local $z2_1 i64)
|
||||
(local $z3_1 i64)
|
||||
(local $z4_1 i64)
|
||||
(block $label__19
|
||||
(local.set $cds (call $eth.getCallDataSize))
|
||||
(local.set $destination (call $u256_to_i32_774))
|
||||
(local.set $offset (call $u256_to_i32_774))
|
||||
(local.set $requested_size (call $u256_to_i32))
|
||||
(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)))
|
||||
(if (i32.gt_u (local.get $offset) (local.get $cds)) (then
|
||||
(local.set $available_size (i32.const 0))
|
||||
))
|
||||
(local.set $_1 (i32.const 0))
|
||||
(if (i32.gt_u (local.get $available_size) (local.get $_1)) (then
|
||||
(call $eth.callDataCopy (local.get $destination) (local.get $offset) (local.get $available_size))))
|
||||
(if (i32.gt_u (local.get $requested_size) (local.get $available_size)) (then
|
||||
(local.set $_2 (i32.sub (local.get $requested_size) (local.get $available_size)))
|
||||
(local.set $_3 (i32.add (local.get $destination) (local.get $available_size)))
|
||||
(local.set $i (local.get $_1))
|
||||
(block $label__20
|
||||
(loop $label__22
|
||||
(br_if $label__20 (i32.eqz (i32.lt_u (local.get $i) (local.get $_2))))
|
||||
(block $label__21
|
||||
(i32.store8 (i32.add (local.get $_3) (local.get $i)) (local.get $_1))
|
||||
)
|
||||
(local.set $i (i32.add (local.get $i) (i32.const 1)))
|
||||
(br $label__22)
|
||||
)
|
||||
|
||||
)
|
||||
))
|
||||
(local.set $z1_1 (call $bswap64 (i64.load (local.get $_1))))
|
||||
(local.set $z2_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 8)))))
|
||||
(local.set $z3_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 16)))))
|
||||
(local.set $z4_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 24)))))
|
||||
(local.set $z1 (local.get $z1_1))
|
||||
(local.set $z2 (local.get $z2_1))
|
||||
(local.set $z3 (local.get $z3_1))
|
||||
(local.set $z4 (local.get $z4_1))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $z2))
|
||||
(global.set $global__1 (local.get $z3))
|
||||
(global.set $global__2 (local.get $z4))
|
||||
(local.get $z1)
|
||||
)
|
||||
|
||||
(func $sstore
|
||||
(param $y1 i64)
|
||||
(param $y2 i64)
|
||||
(param $y3 i64)
|
||||
(param $y4 i64)
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(block $label__23
|
||||
(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))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --asm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_asm_only/input.yul (Ewasm) =======
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_ewasm_ir_only/input.yul (Ewasm) =======
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
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(42))), 32)
|
||||
i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(42, 32))))))
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32))
|
||||
}
|
||||
function bswap32(x:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_ewasm_only/input.yul (Ewasm) =======
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $hi_1 i64)
|
||||
(block $label_
|
||||
(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 42)))) (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 42) (i64.const 32)))))))
|
||||
(call $eth.storageStore (i32.const 0) (i32.const 32))
|
||||
)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__1
|
||||
(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))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap32
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__2
|
||||
(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)))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --machine ewasm
|
||||
@@ -1 +0,0 @@
|
||||
The selected input language is not directly supported when targeting the Ewasm machine and automatic translation is not available.
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
sstore(0, 1)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +1 @@
|
||||
--link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +1 @@
|
||||
The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --ewasm, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--optimize --ewasm-ir
|
||||
@@ -1 +0,0 @@
|
||||
The following outputs are not supported in compiler mode: --ewasm-ir.
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,4 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
pragma solidity *;
|
||||
|
||||
contract C {}
|
||||
@@ -1 +1 @@
|
||||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --ewasm-ir --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +1 @@
|
||||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --ewasm, --ewasm-ir, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer":
|
||||
{
|
||||
"enabled": true,
|
||||
"details": {"yul": true}
|
||||
},
|
||||
"outputSelection":
|
||||
{
|
||||
"*": { "*": ["ewasm.wast", "ewasm.wasm"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
{
|
||||
"contracts":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"C":
|
||||
{
|
||||
"ewasm":
|
||||
{
|
||||
"wasm": "<BYTECODE REMOVED>",
|
||||
"wast": "(module
|
||||
;; custom section for sub-module
|
||||
;; The Keccak-256 hash of the text representation of <REMOVED>
|
||||
;; (@custom \"C_3_deployed\" \"<BYTECODE REMOVED>\")
|
||||
(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)))
|
||||
(import \"ethereum\" \"finish\" (func $eth.finish (param i32 i32)))
|
||||
(memory $memory (export \"memory\") 1)
|
||||
(export \"main\" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $p i32)
|
||||
(local $r i32)
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $z3 i64)
|
||||
(local $_1 i64)
|
||||
(block $label_
|
||||
(local.set $p (call $u256_to_i32_716))
|
||||
(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 $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 (local.get $r) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 24)) (call $bswap64))
|
||||
(call $eth.getCallValue (i32.const 0))
|
||||
(local.set $z3 (i64.load (i32.const 8)))
|
||||
(if (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (local.get $z3) (i64.load (i32.const 0)))))) (then
|
||||
(call $eth.revert (call $to_internal_i32ptr_334) (call $u256_to_i32_333))))
|
||||
(local.set $_1 (datasize \"C_3_deployed\"))
|
||||
(call $eth.codeCopy (call $to_internal_i32ptr) (call $u256_to_i32 (dataoffset \"C_3_deployed\")) (call $u256_to_i32 (local.get $_1)))
|
||||
(call $eth.finish (call $to_internal_i32ptr) (call $u256_to_i32 (local.get $_1)))
|
||||
)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_333
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(local $_1 i64)
|
||||
(block $label__1
|
||||
(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)
|
||||
)
|
||||
|
||||
(func $u256_to_i32
|
||||
(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)))
|
||||
(local.set $v (i32.wrap_i64 (local.get $x4)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_716
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(block $label__3
|
||||
(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 $to_internal_i32ptr_334
|
||||
(result i32)
|
||||
(local $r i32)
|
||||
(local $p i32)
|
||||
(block $label__4
|
||||
(local.set $p (call $u256_to_i32_333))
|
||||
(local.set $r (i32.add (local.get $p) (i32.const 64)))
|
||||
(if (i32.lt_u (local.get $r) (local.get $p)) (then
|
||||
(unreachable)))
|
||||
|
||||
)
|
||||
(local.get $r)
|
||||
)
|
||||
|
||||
(func $to_internal_i32ptr
|
||||
(result i32)
|
||||
(local $r i32)
|
||||
(local $v i32)
|
||||
(block $label__5
|
||||
(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 128) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (i64.const 128)))
|
||||
(local.set $r (i32.add (local.get $v) (i32.const 64)))
|
||||
(if (i32.lt_u (local.get $r) (local.get $v)) (then
|
||||
(unreachable)))
|
||||
|
||||
)
|
||||
(local.get $r)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__6
|
||||
(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))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap32
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__7
|
||||
(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)))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
(func $bswap64
|
||||
(result i64)
|
||||
(local $y i64)
|
||||
(local $hi i64)
|
||||
(block $label__8
|
||||
(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)
|
||||
)
|
||||
|
||||
)
|
||||
"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; abstract contract C { }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer":
|
||||
{
|
||||
"enabled": true,
|
||||
"details": {"yul": true}
|
||||
},
|
||||
"outputSelection":
|
||||
{
|
||||
"*": { "*": ["ewasm.wast", "ewasm.wasm"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"contracts":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"C":
|
||||
{
|
||||
"ewasm":
|
||||
{
|
||||
"wasm": "",
|
||||
"wast": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
--yul-dialect evm --machine ewasm
|
||||
--yul-dialect evm --machine evm
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --optimize --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= strict_asm_output_selection_ewasm_ir_only/input.yul (EVM) =======
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --optimize --ewasm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= strict_asm_output_selection_ewasm_only/input.yul (EVM) =======
|
||||
@@ -1 +1 @@
|
||||
--strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--yul --yul-dialect ewasm --machine ewasm
|
||||
@@ -1,17 +0,0 @@
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let m:i64, n:i32, p:i32, q:i64 := multireturn(1:i32, 2:i64, 3:i64, 4:i32)
|
||||
}
|
||||
|
||||
function multireturn(a:i32, b:i64, c:i64, d:i32) -> x:i64, y:i32, z:i32, w:i64
|
||||
{
|
||||
x := b
|
||||
w := c
|
||||
|
||||
y := a
|
||||
z := d
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
======= wasm_to_wasm_function_returning_multiple_values/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let m, n:i32, p:i32, q := multireturn(1:i32, 2, 3, 4:i32)
|
||||
}
|
||||
function multireturn(a:i32, b, c, d:i32) -> x, y:i32, z:i32, w
|
||||
{
|
||||
x := b
|
||||
w := c
|
||||
y := a
|
||||
z := d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010c0260000060047f7e7e7f017e020100030302000105030100010610037f0141000b7f0141000b7e0142000b071102066d656d6f72790200046d61696e00000a52022603017e027f017e024002404101420242034104100121002300210123012102230221030b0b0b2903017e027f017e0240200121042002210720002105200321060b20052400200624012007240220040b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
(global $global_ (mut i32) (i32.const 0))
|
||||
(global $global__1 (mut i32) (i32.const 0))
|
||||
(global $global__2 (mut i64) (i64.const 0))
|
||||
|
||||
(func $main
|
||||
(local $m i64)
|
||||
(local $n i32)
|
||||
(local $p i32)
|
||||
(local $q i64)
|
||||
(block $label_
|
||||
(block
|
||||
(local.set $m (call $multireturn (i32.const 1) (i64.const 2) (i64.const 3) (i32.const 4)))
|
||||
(local.set $n (global.get $global_))
|
||||
(local.set $p (global.get $global__1))
|
||||
(local.set $q (global.get $global__2))
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(func $multireturn
|
||||
(param $a i32)
|
||||
(param $b i64)
|
||||
(param $c i64)
|
||||
(param $d i32)
|
||||
(result i64)
|
||||
(local $x i64)
|
||||
(local $y i32)
|
||||
(local $z i32)
|
||||
(local $w i64)
|
||||
(block $label__3
|
||||
(local.set $x (local.get $b))
|
||||
(local.set $w (local.get $c))
|
||||
(local.set $y (local.get $a))
|
||||
(local.set $z (local.get $d))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $y))
|
||||
(global.set $global__1 (local.get $z))
|
||||
(global.set $global__2 (local.get $w))
|
||||
(local.get $x)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--yul --yul-dialect ewasm --machine ewasm
|
||||
@@ -1,8 +0,0 @@
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
i64.store8(0x01:i32, 42:i64)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
======= wasm_to_wasm_memory_instructions_alignment/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{ i64.store8(0x01:i32, 42) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0e010c0002404101422a3c00000b0b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(block $label_
|
||||
(i64.store8 (i32.const 1) (i64.const 42))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --yul-dialect evm --machine ewasm --optimize --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
/// @use-src 0:"test.sol"
|
||||
object "C" {
|
||||
code { sstore(0,0) }
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
======= yul_to_wasm_source_location_crash/input.yul (Ewasm) =======
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
/// @use-src 0:"test.sol"
|
||||
object "C" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
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)
|
||||
i64.store(i32.add(32:i32, 24:i32), y)
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32))
|
||||
}
|
||||
function bswap32(x:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@ abstract contract C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract C {
|
||||
m[c] = payable(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { {} }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { function g() { pop(blockhash(20)) } g() }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { function f() { leave } }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { for {} 1 { pop(sload(0)) } { break continue } }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -8,5 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -5,5 +5,4 @@ contract C {
|
||||
assembly { let x := s.offset let y := mul(s.slot, 2) }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { let x := "abc" }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -8,5 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -3,5 +3,4 @@ contract C {
|
||||
assembly { switch 0 case 0 {} default {} }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
assembly { x := 7 }
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -16,5 +16,4 @@ contract C {
|
||||
/** Some comment on mod.*/ modifier mod() { _; }
|
||||
/** Some comment on fn.*/ function fn() public {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -21,5 +21,4 @@ contract C {
|
||||
uint param3
|
||||
) public {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -12,5 +12,4 @@ contract C {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -12,5 +12,4 @@ contract C {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
contract C {
|
||||
event E(function() internal);
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -11,6 +11,5 @@ interface I {
|
||||
uint calldata c = 123.4;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// failAfter: Parsed
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
fallback() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
fallback() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
contract C {
|
||||
fallback() external {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -5,5 +5,4 @@ contract C {
|
||||
mapping(E => bool) c;
|
||||
mapping(address keyAddress => uint256 value) d;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C
|
||||
uint public constant b = 2;
|
||||
uint public c = 3;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,6 +4,5 @@ contract C is NotExisting.X
|
||||
NotExisting.SomeStruct public myStruct;
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
// ----
|
||||
// failAfter: Parsed
|
||||
|
||||
@@ -9,5 +9,4 @@ contract C is B {
|
||||
function foo() public override { }
|
||||
function faa() public override { }
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -2,5 +2,4 @@ contract C {
|
||||
receive() external payable {
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract B {
|
||||
contract C is A, B {
|
||||
function f() public override(A, B) {}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -4,5 +4,4 @@ contract C {
|
||||
error T();
|
||||
function h() public { f(); }
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -9,5 +9,4 @@ contract C {
|
||||
type MyUInt is uint;
|
||||
mapping(MyAddress => MyUInt) public m;
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract C {
|
||||
return -a - b;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -7,5 +7,4 @@ contract Sample {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
@@ -50,7 +50,6 @@ SemanticTest::SemanticTest(
|
||||
langutil::EVMVersion _evmVersion,
|
||||
optional<uint8_t> _eofVersion,
|
||||
vector<boost::filesystem::path> const& _vmPaths,
|
||||
bool _enforceCompileToEwasm,
|
||||
bool _enforceGasCost,
|
||||
u256 _enforceGasCostMinValue
|
||||
):
|
||||
@@ -60,7 +59,6 @@ SemanticTest::SemanticTest(
|
||||
m_lineOffset(m_reader.lineNumber()),
|
||||
m_builtins(makeBuiltins()),
|
||||
m_sideEffectHooks(makeSideEffectHooks()),
|
||||
m_enforceCompileToEwasm(_enforceCompileToEwasm),
|
||||
m_enforceGasCost(_enforceGasCost),
|
||||
m_enforceGasCostMinValue(std::move(_enforceGasCostMinValue))
|
||||
{
|
||||
@@ -83,25 +81,6 @@ SemanticTest::SemanticTest(
|
||||
m_testCaseWantsYulRun = util::contains(yulRunTriggers, compileViaYul);
|
||||
m_testCaseWantsLegacyRun = util::contains(legacyRunTriggers, compileViaYul);
|
||||
|
||||
// Do not enforce ewasm, if via yul was explicitly denied.
|
||||
if (compileViaYul == "false")
|
||||
m_enforceCompileToEwasm = false;
|
||||
|
||||
string compileToEwasm = m_reader.stringSetting("compileToEwasm", "false");
|
||||
if (compileToEwasm == "also")
|
||||
m_testCaseWantsEwasmRun = true;
|
||||
else if (compileToEwasm == "false")
|
||||
m_testCaseWantsEwasmRun = false;
|
||||
else
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + "."));
|
||||
|
||||
if (m_testCaseWantsEwasmRun && !m_testCaseWantsYulRun)
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + ", compileViaYul need to be enabled."));
|
||||
|
||||
// run ewasm tests only if an ewasm evmc vm was defined
|
||||
if (m_testCaseWantsEwasmRun && !m_supportsEwasm)
|
||||
m_testCaseWantsEwasmRun = false;
|
||||
|
||||
auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default"));
|
||||
soltestAssert(revertStrings, "Invalid revertStrings setting.");
|
||||
m_revertStrings = revertStrings.value();
|
||||
@@ -298,24 +277,10 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
|
||||
TestResult result = TestResult::Success;
|
||||
|
||||
if (m_testCaseWantsLegacyRun && !m_eofVersion.has_value())
|
||||
result = runTest(_stream, _linePrefix, _formatted, false, false);
|
||||
result = runTest(_stream, _linePrefix, _formatted, false);
|
||||
|
||||
if (m_testCaseWantsYulRun && result == TestResult::Success)
|
||||
result = runTest(_stream, _linePrefix, _formatted, true, false);
|
||||
|
||||
if (!m_eofVersion.has_value() && (m_testCaseWantsEwasmRun || m_enforceCompileToEwasm) && result == TestResult::Success)
|
||||
{
|
||||
// TODO: Once we have full Ewasm support, we could remove try/catch here.
|
||||
try
|
||||
{
|
||||
result = runTest(_stream, _linePrefix, _formatted, true, true);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (!m_enforceCompileToEwasm)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
result = runTest(_stream, _linePrefix, _formatted, true);
|
||||
|
||||
if (result != TestResult::Success)
|
||||
solidity::test::CommonOptions::get().printSelectedOptions(
|
||||
@@ -331,33 +296,19 @@ TestCase::TestResult SemanticTest::runTest(
|
||||
ostream& _stream,
|
||||
string const& _linePrefix,
|
||||
bool _formatted,
|
||||
bool _isYulRun,
|
||||
bool _isEwasmRun)
|
||||
bool _isYulRun)
|
||||
{
|
||||
bool success = true;
|
||||
m_gasCostFailure = false;
|
||||
|
||||
if (_isEwasmRun)
|
||||
{
|
||||
soltestAssert(_isYulRun, "");
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EWASM);
|
||||
}
|
||||
else
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
|
||||
selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
|
||||
|
||||
reset();
|
||||
|
||||
m_compileViaYul = _isYulRun;
|
||||
if (_isEwasmRun)
|
||||
{
|
||||
soltestAssert(m_compileViaYul, "");
|
||||
m_compileToEwasm = _isEwasmRun;
|
||||
}
|
||||
|
||||
m_canEnableEwasmRun = false;
|
||||
|
||||
if (_isYulRun)
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul" << (_isEwasmRun ? " (ewasm):" : ":") << endl;
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul: " << endl;
|
||||
|
||||
for (TestFunctionCall& test: m_tests)
|
||||
test.reset();
|
||||
@@ -470,31 +421,8 @@ TestCase::TestResult SemanticTest::runTest(
|
||||
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
|
||||
}
|
||||
|
||||
// Right now we have sometimes different test results in Yul vs. Ewasm.
|
||||
// The main reason is that Ewasm just returns a failure in some cases.
|
||||
// TODO: If Ewasm support got fully implemented, we could implement this in the same way as above.
|
||||
if (success && !m_testCaseWantsEwasmRun && _isEwasmRun)
|
||||
{
|
||||
// TODO: There is something missing in Ewasm to support other types of revert strings:
|
||||
// for now, we just ignore test-cases that do not use RevertStrings::Default.
|
||||
if (m_revertStrings != RevertStrings::Default)
|
||||
return TestResult::Success;
|
||||
|
||||
m_canEnableEwasmRun = true;
|
||||
AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) <<
|
||||
_linePrefix << endl <<
|
||||
_linePrefix << "Test can pass via Yul (Ewasm), but marked with \"compileToEwasm: false.\"" << endl;
|
||||
return TestResult::Failure;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
// Ignore failing tests that can't yet get compiled to Ewasm:
|
||||
// if the test run was not successful and enforce compiling to ewasm was set,
|
||||
// but the test case did not want to get run with Ewasm, we just ignore this failure.
|
||||
if (m_enforceCompileToEwasm && !m_testCaseWantsEwasmRun)
|
||||
return TestResult::Success;
|
||||
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl;
|
||||
for (TestFunctionCall const& test: m_tests)
|
||||
{
|
||||
@@ -647,21 +575,12 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
|
||||
void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix)
|
||||
{
|
||||
auto& settings = m_reader.settings();
|
||||
if (settings.empty() && !m_canEnableEwasmRun)
|
||||
if (settings.empty())
|
||||
return;
|
||||
|
||||
_stream << _linePrefix << "// ====" << endl;
|
||||
if (m_canEnableEwasmRun)
|
||||
{
|
||||
soltestAssert(m_testCaseWantsYulRun, "");
|
||||
_stream << _linePrefix << "// compileToEwasm: also\n";
|
||||
}
|
||||
|
||||
for (auto const& [settingName, settingValue]: settings)
|
||||
if (
|
||||
!(settingName == "compileToEwasm" && m_canEnableEwasmRun)
|
||||
)
|
||||
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
|
||||
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
|
||||
}
|
||||
|
||||
void SemanticTest::parseExpectations(istream& _stream)
|
||||
|
||||
@@ -53,7 +53,6 @@ public:
|
||||
_options.evmVersion,
|
||||
_options.eofVersion,
|
||||
_options.vmPaths,
|
||||
_options.enforceCompileToEwasm,
|
||||
_options.enforceGasCost,
|
||||
_options.enforceGasCostMinValue
|
||||
);
|
||||
@@ -64,7 +63,6 @@ public:
|
||||
langutil::EVMVersion _evmVersion,
|
||||
std::optional<uint8_t> _eofVersion,
|
||||
std::vector<boost::filesystem::path> const& _vmPaths,
|
||||
bool _enforceCompileToEwasm = false,
|
||||
bool _enforceGasCost = false,
|
||||
u256 _enforceGasCostMinValue = 100000
|
||||
);
|
||||
@@ -85,7 +83,7 @@ public:
|
||||
bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map<std::string, solidity::test::Address> const& _libraries = {});
|
||||
|
||||
private:
|
||||
TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun, bool _isEwasmRun);
|
||||
TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun);
|
||||
bool checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const;
|
||||
std::map<std::string, Builtin> makeBuiltins();
|
||||
std::vector<SideEffectHook> makeSideEffectHooks() const;
|
||||
@@ -98,12 +96,9 @@ private:
|
||||
std::map<std::string, Builtin> const m_builtins;
|
||||
std::vector<SideEffectHook> const m_sideEffectHooks;
|
||||
bool m_testCaseWantsYulRun = true;
|
||||
bool m_testCaseWantsEwasmRun = false;
|
||||
bool m_testCaseWantsLegacyRun = true;
|
||||
bool m_enforceCompileToEwasm = false;
|
||||
bool m_runWithABIEncoderV1Only = false;
|
||||
bool m_allowNonExistingFunctions = false;
|
||||
bool m_canEnableEwasmRun = false;
|
||||
bool m_gasCostFailure = false;
|
||||
bool m_enforceGasCost = false;
|
||||
u256 m_enforceGasCostMinValue;
|
||||
|
||||
@@ -53,33 +53,19 @@ using namespace solidity::langutil;
|
||||
|
||||
#define ALSO_VIA_YUL(CODE) \
|
||||
{ \
|
||||
m_doEwasmTestrun = true; \
|
||||
\
|
||||
m_compileViaYul = false; \
|
||||
m_compileToEwasm = false; \
|
||||
{ CODE } \
|
||||
\
|
||||
m_compileViaYul = true; \
|
||||
reset(); \
|
||||
{ CODE } \
|
||||
\
|
||||
if (m_doEwasmTestrun) \
|
||||
{ \
|
||||
m_compileToEwasm = true; \
|
||||
reset(); \
|
||||
{ CODE } \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DISABLE_EWASM_TESTRUN() \
|
||||
{ m_doEwasmTestrun = false; }
|
||||
|
||||
namespace solidity::frontend::test
|
||||
{
|
||||
|
||||
struct SolidityEndToEndTestExecutionFramework: public SolidityExecutionFramework
|
||||
{
|
||||
bool m_doEwasmTestrun = false;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(SolidityEndToEndTest, SolidityEndToEndTestExecutionFramework)
|
||||
@@ -108,7 +94,6 @@ BOOST_AUTO_TEST_CASE(creation_code_optimizer)
|
||||
reset();
|
||||
compileAndRun(codeC + codeD);
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0x20, bytecodeC.size()) + encode(bytecodeC, false));
|
||||
m_doEwasmTestrun = false;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -166,8 +151,6 @@ BOOST_AUTO_TEST_CASE(recursive_calls)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
function<u256(u256)> recursive_calls_cpp = [&recursive_calls_cpp](u256 const& n) -> u256
|
||||
{
|
||||
@@ -193,8 +176,6 @@ BOOST_AUTO_TEST_CASE(while_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto while_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -223,8 +204,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto do_while_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -270,8 +249,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto do_while = [](u256 n) -> u256
|
||||
@@ -322,8 +299,6 @@ BOOST_AUTO_TEST_CASE(nested_loops)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto nested_loops_cpp = [](u256 n) -> u256
|
||||
@@ -390,8 +365,6 @@ BOOST_AUTO_TEST_CASE(nested_loops_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto nested_loops_cpp = [](u256 n) -> u256
|
||||
@@ -446,8 +419,6 @@ BOOST_AUTO_TEST_CASE(for_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop = [](u256 n) -> u256
|
||||
@@ -509,8 +480,6 @@ BOOST_AUTO_TEST_CASE(nested_for_loop_multiple_local_vars)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop = [](u256 n) -> u256
|
||||
@@ -551,8 +520,6 @@ BOOST_AUTO_TEST_CASE(for_loop)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop_cpp = [](u256 const& n) -> u256
|
||||
@@ -580,8 +547,6 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto for_loop_simple_init_expr_cpp = [](u256 const& n) -> u256
|
||||
@@ -621,7 +586,6 @@ BOOST_AUTO_TEST_CASE(for_loop_break_continue)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto breakContinue = [](u256 const& n) -> u256
|
||||
@@ -657,8 +621,6 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
auto short_circuiting_cpp = [](u256 n) -> u256
|
||||
@@ -776,8 +738,6 @@ BOOST_AUTO_TEST_CASE(mapping_state_inc_dec)
|
||||
return --table[value++];
|
||||
};
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
value = 0;
|
||||
table.clear();
|
||||
@@ -804,8 +764,6 @@ BOOST_AUTO_TEST_CASE(multi_level_mapping)
|
||||
else return table[_x][_y] = _z;
|
||||
};
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
table.clear();
|
||||
|
||||
@@ -842,8 +800,6 @@ BOOST_AUTO_TEST_CASE(constructor)
|
||||
};
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
testContractAgainstCpp("get(uint256)", get, u256(6));
|
||||
testContractAgainstCpp("get(uint256)", get, u256(7));
|
||||
@@ -862,8 +818,6 @@ BOOST_AUTO_TEST_CASE(send_ether)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
u256 amount(250);
|
||||
compileAndRun(sourceCode, amount + 1);
|
||||
h160 address(23);
|
||||
@@ -896,8 +850,6 @@ BOOST_AUTO_TEST_CASE(transfer_ether)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "B");
|
||||
h160 const nonPayableRecipient = m_contractAddress;
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
@@ -1237,8 +1189,6 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("f(uint256,uint256)", 5, 9) != encodeArgs(5, 8));
|
||||
ABI_CHECK(callContractFunction("f(uint256,uint256)", 5, 9), encodeArgs(9, 8));
|
||||
@@ -1382,7 +1332,6 @@ BOOST_AUTO_TEST_CASE(library_call_protection)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
ABI_CHECK(callContractFunction("np(Lib.S storage)", 0), encodeArgs());
|
||||
ABI_CHECK(callContractFunction("v(Lib.S storage)", 0), encodeArgs(m_sender));
|
||||
@@ -1406,7 +1355,6 @@ BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN();
|
||||
compileAndRun(sourceCode);
|
||||
bytes calldata1 = util::selectorFromSignatureH32("f()").asBytes() + bytes(61, 0x22) + bytes(12, 0x12);
|
||||
sendMessage(calldata1, false);
|
||||
@@ -1446,7 +1394,6 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN();
|
||||
compileAndRun(sourceCode, 0, "sender");
|
||||
|
||||
// No additional data, just function selector
|
||||
@@ -1485,7 +1432,6 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "sender");
|
||||
ABI_CHECK(callContractFunction("recv(uint256)", 7), bytes());
|
||||
ABI_CHECK(callContractFunction("val()"), encodeArgs(0));
|
||||
@@ -1508,7 +1454,6 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode);
|
||||
ABI_CHECK(callContractFunction("set()", 1, 2, 3, 4, 5), encodeArgs(true));
|
||||
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
||||
@@ -1569,7 +1514,6 @@ BOOST_AUTO_TEST_CASE(struct_referencing)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "L");
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0, 3));
|
||||
ABI_CHECK(callContractFunction("g()"), encodeArgs(4));
|
||||
@@ -1618,7 +1562,6 @@ BOOST_AUTO_TEST_CASE(enum_referencing)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "L");
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(1));
|
||||
ABI_CHECK(callContractFunction("g()"), encodeArgs(3));
|
||||
@@ -1649,8 +1592,6 @@ BOOST_AUTO_TEST_CASE(bytes_in_arguments)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
string innercalldata1 = asString(util::selectorFromSignatureH32("f(uint256,uint256)").asBytes() + encodeArgs(8, 9));
|
||||
@@ -1702,8 +1643,6 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_abi)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode);
|
||||
bytes valueSequence;
|
||||
for (size_t i = 0; i < 101; ++i)
|
||||
@@ -2138,8 +2077,6 @@ BOOST_AUTO_TEST_CASE(string_as_mapping_key)
|
||||
};
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "Test");
|
||||
for (unsigned i = 0; i < strings.size(); i++)
|
||||
ABI_CHECK(callContractFunction(
|
||||
@@ -2308,7 +2245,6 @@ BOOST_AUTO_TEST_CASE(library_call)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f(uint256)", u256(33)), encodeArgs(u256(33) * 9));
|
||||
@@ -2326,7 +2262,6 @@ BOOST_AUTO_TEST_CASE(library_function_external)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "Lib");
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f(bytes)", u256(0x20), u256(5), "abcde"), encodeArgs("c"));
|
||||
@@ -2478,7 +2413,6 @@ BOOST_AUTO_TEST_CASE(short_strings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "A");
|
||||
ABI_CHECK(callContractFunction("data1()"), encodeDyn(string("123")));
|
||||
ABI_CHECK(callContractFunction("lengthChange()"), encodeArgs(u256(0)));
|
||||
@@ -2522,7 +2456,6 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "lib");
|
||||
Address libraryAddress = m_contractAddress;
|
||||
compileAndRun(sourceCode, 10, "c");
|
||||
@@ -2737,7 +2670,6 @@ BOOST_AUTO_TEST_CASE(non_payable_throw)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunctionWithValue("f()", 27), encodeArgs());
|
||||
BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 0);
|
||||
@@ -2784,7 +2716,6 @@ BOOST_AUTO_TEST_CASE(receive_external_function_type)
|
||||
)";
|
||||
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction(
|
||||
"f(function)",
|
||||
@@ -2839,8 +2770,6 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
|
||||
contract C2 {}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
|
||||
compileAndRun(sourceCode, 0, "C1");
|
||||
compileAndRun(sourceCode, 0, "C2");
|
||||
)
|
||||
@@ -3308,7 +3237,6 @@ BOOST_AUTO_TEST_CASE(bare_call_return_data)
|
||||
}
|
||||
)DELIMITER";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_bool()"))), encodeArgs(true, 0x40, 0x20, true));
|
||||
ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_int32()"))), encodeArgs(true, 0x40, 0x20, u256(-32)));
|
||||
@@ -3369,7 +3297,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
ABI_CHECK(callContractFunction("f0()"), encodeArgs(0x20, 0));
|
||||
@@ -3447,7 +3374,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_storage)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4);
|
||||
@@ -3521,7 +3447,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_memory)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4);
|
||||
@@ -3568,7 +3493,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_functionPtr)
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n";
|
||||
compileAndRun(prefix + sourceCode, 0, "C");
|
||||
string directEncoding = asString(fromHex("08" "1112131400000000000011121314000000000087" "26121ff0" "02"));
|
||||
@@ -3611,7 +3535,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_structs)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes structEnc = encodeArgs(int(0x12), u256(-7), int(2), int(3), u256(-7), u256(-8));
|
||||
ABI_CHECK(callContractFunction("testStorage()"), encodeArgs());
|
||||
@@ -3647,7 +3570,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_nestedArray)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes structEnc = encodeArgs(1, 2, 3, 0, 0, 0, 0, 4);
|
||||
ABI_CHECK(callContractFunction("testNestedArrays()"), encodeArgs());
|
||||
@@ -3678,7 +3600,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_arrayOfStrings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
bytes arrayEncoding = encodeArgs("abc", "0123456789012345678901234567890123456789");
|
||||
ABI_CHECK(callContractFunction("testStorage()"), encodeArgs());
|
||||
@@ -3798,7 +3719,6 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
compileAndRun(sourceCode, 0, "ClientReceipt", bytes());
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, h160>{{":ClientReceipt", m_contractAddress}});
|
||||
|
||||
@@ -3874,7 +3794,6 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings)
|
||||
}
|
||||
)";
|
||||
ALSO_VIA_YUL(
|
||||
DISABLE_EWASM_TESTRUN()
|
||||
m_revertStrings = RevertStrings::Default;
|
||||
compileAndRun(sourceCode, 0, "C");
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
|
||||
entry.second = addPreamble(entry.second);
|
||||
|
||||
m_compiler.reset();
|
||||
m_compiler.enableEwasmGeneration(m_compileToEwasm);
|
||||
m_compiler.setSources(sourcesWithPreamble);
|
||||
m_compiler.setLibraries(_libraryAddresses);
|
||||
m_compiler.setRevertStringBehaviour(m_revertStrings);
|
||||
@@ -83,46 +82,41 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
|
||||
evmasm::LinkerObject obj;
|
||||
if (m_compileViaYul)
|
||||
{
|
||||
if (m_compileToEwasm)
|
||||
obj = m_compiler.ewasmObject(contractName);
|
||||
else
|
||||
// Try compiling twice: If the first run fails due to stack errors, forcefully enable
|
||||
// the optimizer.
|
||||
for (bool forceEnableOptimizer: {false, true})
|
||||
{
|
||||
// Try compiling twice: If the first run fails due to stack errors, forcefully enable
|
||||
// the optimizer.
|
||||
for (bool forceEnableOptimizer: {false, true})
|
||||
OptimiserSettings optimiserSettings = m_optimiserSettings;
|
||||
if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser)
|
||||
{
|
||||
OptimiserSettings optimiserSettings = m_optimiserSettings;
|
||||
if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser)
|
||||
{
|
||||
// Enable some optimizations on the first run
|
||||
optimiserSettings.runYulOptimiser = true;
|
||||
optimiserSettings.yulOptimiserSteps = "uljmul jmul";
|
||||
}
|
||||
else if (forceEnableOptimizer)
|
||||
optimiserSettings = OptimiserSettings::full();
|
||||
// Enable some optimizations on the first run
|
||||
optimiserSettings.runYulOptimiser = true;
|
||||
optimiserSettings.yulOptimiserSteps = "uljmul jmul";
|
||||
}
|
||||
else if (forceEnableOptimizer)
|
||||
optimiserSettings = OptimiserSettings::full();
|
||||
|
||||
yul::YulStack asmStack(
|
||||
m_evmVersion,
|
||||
m_eofVersion,
|
||||
yul::YulStack::Language::StrictAssembly,
|
||||
optimiserSettings,
|
||||
DebugInfoSelection::All()
|
||||
);
|
||||
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
|
||||
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");
|
||||
yul::YulStack asmStack(
|
||||
m_evmVersion,
|
||||
m_eofVersion,
|
||||
yul::YulStack::Language::StrictAssembly,
|
||||
optimiserSettings,
|
||||
DebugInfoSelection::All()
|
||||
);
|
||||
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
|
||||
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");
|
||||
|
||||
try
|
||||
{
|
||||
asmStack.optimize();
|
||||
obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
||||
obj.link(_libraryAddresses);
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full())
|
||||
throw;
|
||||
}
|
||||
try
|
||||
{
|
||||
asmStack.optimize();
|
||||
obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
||||
obj.link(_libraryAddresses);
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full())
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ protected:
|
||||
std::optional<uint8_t> m_eofVersion;
|
||||
CompilerStack m_compiler;
|
||||
bool m_compileViaYul = false;
|
||||
bool m_compileToEwasm = false;
|
||||
bool m_showMetadata = false;
|
||||
bool m_appendCBORMetadata = true;
|
||||
CompilerStack::MetadataHash m_metadataHash = CompilerStack::MetadataHash::IPFS;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
contract Errort6 {
|
||||
using foo for ; // missing type name
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError 3546: (36-37): Expected type name
|
||||
// Warning 3796: (59-60): Recovered in ContractDefinition at '}'.
|
||||
|
||||
@@ -15,7 +15,6 @@ contract SendCoin {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError 6635: (235-236): Expected identifier but got '}'
|
||||
// ParserError 6635: (276-284): Expected ';' but got 'contract'
|
||||
|
||||
@@ -40,7 +40,6 @@ function free() pure
|
||||
// ^^^^^^^^ @FunctionInFreeFunction
|
||||
// ^ @CursorInFreeFunction
|
||||
}
|
||||
|
||||
// ----
|
||||
// -> textDocument/rename {
|
||||
// "newName": "Renamed",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user