mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add inlining for old optimizer.
This commit is contained in:
@@ -174,9 +174,9 @@ BOOST_AUTO_TEST_CASE(location_test)
|
||||
if (solidity::test::CommonOptions::get().optimize)
|
||||
locations =
|
||||
vector<SourceLocation>(31, SourceLocation{23, 103, sourceCode}) +
|
||||
vector<SourceLocation>(21, SourceLocation{41, 100, sourceCode}) +
|
||||
vector<SourceLocation>(1, SourceLocation{41, 100, sourceCode}) +
|
||||
vector<SourceLocation>(1, SourceLocation{93, 95, sourceCode}) +
|
||||
vector<SourceLocation>(2, SourceLocation{41, 100, sourceCode});
|
||||
vector<SourceLocation>(15, SourceLocation{41, 100, sourceCode});
|
||||
else
|
||||
locations =
|
||||
vector<SourceLocation>(hasShifts ? 31 : 32, SourceLocation{23, 103, sourceCode}) +
|
||||
@@ -209,7 +209,10 @@ BOOST_AUTO_TEST_CASE(jump_type)
|
||||
if (item.getJumpType() != AssemblyItem::JumpType::Ordinary)
|
||||
jumpTypes += item.getJumpTypeAsString() + "\n";
|
||||
|
||||
BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n");
|
||||
if (solidity::test::CommonOptions::get().optimize)
|
||||
BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n");
|
||||
else
|
||||
BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
if (CommonOptions::get().useABIEncoderV1)
|
||||
CHECK_DEPLOY_GAS(133045, 129731, evmVersion);
|
||||
else
|
||||
CHECK_DEPLOY_GAS(155553, 135201, evmVersion);
|
||||
CHECK_DEPLOY_GAS(155553, 132103, evmVersion);
|
||||
}
|
||||
// This is only correct on >=Constantinople.
|
||||
else if (!CommonOptions::get().useABIEncoderV1)
|
||||
@@ -110,9 +110,9 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
{
|
||||
// Costs with 0 are cases which cannot be triggered in tests.
|
||||
if (evmVersion < EVMVersion::istanbul())
|
||||
CHECK_DEPLOY_GAS(0, 122869, evmVersion);
|
||||
CHECK_DEPLOY_GAS(0, 120189, evmVersion);
|
||||
else
|
||||
CHECK_DEPLOY_GAS(0, 110701, evmVersion);
|
||||
CHECK_DEPLOY_GAS(0, 108541, evmVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,16 +131,16 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
{
|
||||
callContractFunction("f()");
|
||||
if (evmVersion == EVMVersion::byzantium())
|
||||
CHECK_GAS(21741, 21555, 20);
|
||||
CHECK_GAS(21741, 21522, 20);
|
||||
// This is only correct on >=Constantinople.
|
||||
else if (!CommonOptions::get().useABIEncoderV1)
|
||||
{
|
||||
if (CommonOptions::get().optimize)
|
||||
{
|
||||
if (evmVersion < EVMVersion::istanbul())
|
||||
CHECK_GAS(0, 21567, 20);
|
||||
CHECK_GAS(0, 21526, 20);
|
||||
else
|
||||
CHECK_GAS(0, 21351, 20);
|
||||
CHECK_GAS(0, 21318, 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -170,8 +170,8 @@ BOOST_AUTO_TEST_CASE(branches)
|
||||
}
|
||||
}
|
||||
)";
|
||||
testCreationTimeGas(sourceCode);
|
||||
testRunTimeGas("f(uint256)", vector<bytes>{encodeArgs(2), encodeArgs(8)});
|
||||
testCreationTimeGas(sourceCode, 1);
|
||||
testRunTimeGas("f(uint256)", vector<bytes>{encodeArgs(2), encodeArgs(8)}, 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_calls)
|
||||
|
||||
@@ -1230,7 +1230,7 @@ BOOST_AUTO_TEST_CASE(optimizer_settings_details_different)
|
||||
);
|
||||
BOOST_CHECK(optimizer["details"]["yulDetails"]["stackAllocation"].asBool() == true);
|
||||
BOOST_CHECK(optimizer["details"]["yulDetails"]["optimizerSteps"].asString() == OptimiserSettings::DefaultYulOptimiserSteps);
|
||||
BOOST_CHECK_EQUAL(optimizer["details"].getMemberNames().size(), 8);
|
||||
BOOST_CHECK_EQUAL(optimizer["details"].getMemberNames().size(), 9);
|
||||
BOOST_CHECK(optimizer["runs"].asUInt() == 600);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ contract C {
|
||||
// optimize-yul: true
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 588800
|
||||
// codeDepositCost: 583400
|
||||
// executionCost: 619
|
||||
// totalCost: 589419
|
||||
// totalCost: 584019
|
||||
// external:
|
||||
// a(): 1029
|
||||
// b(uint256): 2084
|
||||
// f1(uint256): 351
|
||||
// a(): 985
|
||||
// b(uint256): 2052
|
||||
// f1(uint256): 307
|
||||
// f2(uint256[],string[],uint16,address): infinite
|
||||
// f3(uint16[],string[],uint16,address): infinite
|
||||
// f4(uint32[],string[12],bytes[2][],address): infinite
|
||||
|
||||
@@ -27,29 +27,29 @@ contract Large {
|
||||
// optimize-runs: 2
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 270600
|
||||
// executionCost: 312
|
||||
// totalCost: 270912
|
||||
// codeDepositCost: 267000
|
||||
// executionCost: 306
|
||||
// totalCost: 267306
|
||||
// external:
|
||||
// a(): 1028
|
||||
// b(uint256): 2370
|
||||
// f0(uint256): 399
|
||||
// f1(uint256): 41539
|
||||
// f2(uint256): 21605
|
||||
// f3(uint256): 21693
|
||||
// f4(uint256): 21671
|
||||
// f5(uint256): 21649
|
||||
// f6(uint256): 21561
|
||||
// f7(uint256): 21341
|
||||
// f8(uint256): 21473
|
||||
// f9(uint256): 21495
|
||||
// g0(uint256): 639
|
||||
// g1(uint256): 41251
|
||||
// g2(uint256): 21339
|
||||
// g3(uint256): 21427
|
||||
// g4(uint256): 21405
|
||||
// g5(uint256): 21493
|
||||
// g6(uint256): 21273
|
||||
// g7(uint256): 21383
|
||||
// g8(uint256): 21361
|
||||
// g9(uint256): 21207
|
||||
// a(): 983
|
||||
// b(uint256): 2337
|
||||
// f0(uint256): 366
|
||||
// f1(uint256): 41506
|
||||
// f2(uint256): 21572
|
||||
// f3(uint256): 21660
|
||||
// f4(uint256): 21638
|
||||
// f5(uint256): 21616
|
||||
// f6(uint256): 21528
|
||||
// f7(uint256): 21308
|
||||
// f8(uint256): 21440
|
||||
// f9(uint256): 21462
|
||||
// g0(uint256): 606
|
||||
// g1(uint256): 41218
|
||||
// g2(uint256): 21306
|
||||
// g3(uint256): 21394
|
||||
// g4(uint256): 21372
|
||||
// g5(uint256): 21460
|
||||
// g6(uint256): 21240
|
||||
// g7(uint256): 21350
|
||||
// g8(uint256): 21328
|
||||
// g9(uint256): 21174
|
||||
|
||||
@@ -14,16 +14,16 @@ contract Medium {
|
||||
// optimize-runs: 2
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 161000
|
||||
// executionCost: 208
|
||||
// totalCost: 161208
|
||||
// codeDepositCost: 157400
|
||||
// executionCost: 202
|
||||
// totalCost: 157602
|
||||
// external:
|
||||
// a(): 1028
|
||||
// b(uint256): 2128
|
||||
// f1(uint256): 41319
|
||||
// f2(uint256): 21363
|
||||
// f3(uint256): 21407
|
||||
// g0(uint256): 397
|
||||
// g7(uint256): 21273
|
||||
// g8(uint256): 21251
|
||||
// g9(uint256): 21207
|
||||
// a(): 983
|
||||
// b(uint256): 2095
|
||||
// f1(uint256): 41286
|
||||
// f2(uint256): 21330
|
||||
// f3(uint256): 21374
|
||||
// g0(uint256): 364
|
||||
// g7(uint256): 21240
|
||||
// g8(uint256): 21218
|
||||
// g9(uint256): 21174
|
||||
|
||||
@@ -9,11 +9,11 @@ contract Small {
|
||||
// optimize-runs: 2
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 76200
|
||||
// codeDepositCost: 72600
|
||||
// executionCost: 123
|
||||
// totalCost: 76323
|
||||
// totalCost: 72723
|
||||
// external:
|
||||
// fallback: 118
|
||||
// a(): 1006
|
||||
// b(uint256): 2018
|
||||
// f1(uint256): 41253
|
||||
// a(): 961
|
||||
// b(uint256): 1985
|
||||
// f1(uint256): 41220
|
||||
|
||||
@@ -19,11 +19,11 @@ contract C {
|
||||
// optimize-yul: true
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 53200
|
||||
// executionCost: 105
|
||||
// totalCost: 53305
|
||||
// codeDepositCost: 47800
|
||||
// executionCost: 99
|
||||
// totalCost: 47899
|
||||
// external:
|
||||
// exp_neg_one(uint256): 1962
|
||||
// exp_one(uint256): 1915
|
||||
// exp_two(uint256): 1893
|
||||
// exp_zero(uint256): 1937
|
||||
// exp_neg_one(uint256): 1917
|
||||
// exp_one(uint256): 1870
|
||||
// exp_two(uint256): 1848
|
||||
// exp_zero(uint256): 1892
|
||||
|
||||
Reference in New Issue
Block a user