Skip to content

Commit 5d019d2

Browse files
committed
wip
1 parent 28ca802 commit 5d019d2

18 files changed

+26
-26
lines changed

libsolidity/codegen/ArrayUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ void ArrayUtils::clearArray(ArrayType const& _typeIn) const
608608
ArrayUtils(_context).convertLengthToSize(_type);
609609
_context << Instruction::ADD << Instruction::SWAP1;
610610
if (_type.baseType()->storageBytes() < 32)
611-
ArrayUtils(_context).clearStorageLoop(TypeProvider::uint256(), !_type.isDynamicallySized());
611+
ArrayUtils(_context).clearStorageLoop(TypeProvider::uint256(), /* _canOverflow */ true);
612612
else
613-
ArrayUtils(_context).clearStorageLoop(_type.baseType(), !_type.isDynamicallySized());
613+
ArrayUtils(_context).clearStorageLoop(_type.baseType(), /* _canOverflow */ true);
614614
_context << Instruction::POP;
615615
}
616616
solAssert(_context.stackHeight() == stackHeightStart - 2, "");
@@ -793,7 +793,7 @@ void ArrayUtils::clearStorageLoop(Type const* _type, bool _canOverflow) const
793793
{
794794
solAssert(_type->storageBytes() >= 32, "");
795795
m_context.callLowLevelFunction(
796-
"$clearStorageLoop_" + _type->identifier() + (_canOverflow ? "_canOverflow" : "cannotOverflow"),
796+
"$clearStorageLoop_" + _type->identifier() + (_canOverflow ? "_canOverflow" : "_cannotOverflow"),
797797
2,
798798
1,
799799
[_type, _canOverflow](CompilerContext& _context)

libsolidity/codegen/YulUtilFunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ std::string YulUtilFunctions::clearStorageRangeFunction(Type const& _type, bool
18221822
if (_type.storageBytes() < 32)
18231823
solAssert(_type.isValueType(), "");
18241824

1825-
std::string functionName = "clear_storage_range_" + _type.identifier();
1825+
std::string functionName = "clear_storage_range_" + _type.identifier() + (_canOverflow ? "_canOverflow" : "_cannotOverflow");
18261826

18271827
return m_functionCollector.createFunction(functionName, [&]() {
18281828
return Whiskers(R"(

test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ contract Test {
1313
// ----
1414
// set(uint24[3][]): 0x20, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 -> 0x06
1515
// gas irOptimized: 185216
16-
// gas legacy: 211036
17-
// gas legacyOptimized: 206077
16+
// gas legacy: 210694
17+
// gas legacyOptimized: 205741
1818
// data(uint256,uint256): 0x02, 0x02 -> 0x09
1919
// data(uint256,uint256): 0x05, 0x01 -> 0x11
2020
// data(uint256,uint256): 0x06, 0x00 -> FAILURE

test/libsolidity/semanticTests/array/constant_var_as_array_length.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ contract C {
1212
// gas irOptimized code: 14800
1313
// gas legacy: 134298
1414
// gas legacy code: 46200
15-
// gas legacyOptimized: 127166
15+
// gas legacyOptimized: 127147
1616
// gas legacyOptimized code: 23400
1717
// a(uint256): 0 -> 1
1818
// a(uint256): 1 -> 2

test/libsolidity/semanticTests/array/copying/array_copy_calldata_storage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ contract c {
2222
// store(uint256[9],uint8[3][]): 21, 22, 23, 24, 25, 26, 27, 28, 29, 0x140, 4, 1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33 -> 32
2323
// gas irOptimized: 647725
2424
// gas legacy: 694351
25-
// gas legacyOptimized: 693849
25+
// gas legacyOptimized: 693847
2626
// retrieve() -> 9, 28, 9, 28, 4, 3, 32

test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ contract c {
3737
// test() -> 0x02000202
3838
// gas irOptimized: 4549676
3939
// gas legacy: 4473198
40-
// gas legacyOptimized: 4445748
40+
// gas legacyOptimized: 4445469
4141
// storageEmpty -> 1
4242
// clear() -> 0, 0
4343
// gas irOptimized: 4478184

test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ contract c {
1414
// test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10
1515
// gas irOptimized: 689552
1616
// gas legacy: 686086
17-
// gas legacyOptimized: 685611
17+
// gas legacyOptimized: 685524

test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ contract c {
2121
}
2222
// ----
2323
// test() -> 3, 4
24-
// gas irOptimized: 169602
24+
// gas irOptimized: 169669
2525
// gas legacy: 175289
26-
// gas legacyOptimized: 172533
26+
// gas legacyOptimized: 172413

test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ contract c {
1616
// test() -> 8, 0
1717
// gas irOptimized: 196251
1818
// gas legacy: 194779
19-
// gas legacyOptimized: 194281
19+
// gas legacyOptimized: 194218

test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ contract c {
1818
// ----
1919
// test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000
2020
// gas irOptimized: 100496
21-
// gas legacy: 158106
22-
// gas legacyOptimized: 141019
21+
// gas legacy: 158049
22+
// gas legacyOptimized: 140962

test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ contract c {
2020
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0
2121
// gas irOptimized: 273543
2222
// gas legacy: 282541
23-
// gas legacyOptimized: 281510
23+
// gas legacyOptimized: 281453

test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ contract c {
2020
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00
2121
// gas irOptimized: 232995
2222
// gas legacy: 235688
23-
// gas legacyOptimized: 235193
23+
// gas legacyOptimized: 235187

test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ contract Test {
3838
}
3939
// ----
4040
// test() -> 24
41-
// gas irOptimized: 226734
41+
// gas irOptimized: 226728
4242
// gas legacy: 227083
4343
// gas legacyOptimized: 226529
4444
// test1() -> 3
4545
// test2() -> 6
4646
// test3() -> 24
47-
// gas irOptimized: 141319
47+
// gas irOptimized: 141257
4848
// gas legacy: 142238
4949
// gas legacyOptimized: 141365

test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ contract C {
2626
// compileViaYul: true
2727
// ----
2828
// f() -> 3, 3, 3, 1
29-
// gas irOptimized: 181928
29+
// gas irOptimized: 181919

test/libsolidity/semanticTests/array/copying/copy_internal_function_array_to_storage.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ contract C {
1818
}
1919
// ----
2020
// one() -> 3
21-
// gas legacy: 140250
22-
// gas legacyOptimized: 140093
21+
// gas legacy: 140193
22+
// gas legacyOptimized: 140036
2323
// two() -> FAILURE, hex"4e487b71", 0x51

test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_storage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ contract C {
8080
// test3() ->
8181
// gas irOptimized: 124300
8282
// gas legacy: 125330
83-
// gas legacyOptimized: 125127
83+
// gas legacyOptimized: 125124
8484
// test4() -> FAILURE

test/libsolidity/semanticTests/array/push/array_push_struct.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ contract c {
2121
// ----
2222
// test() -> 2, 3, 4, 5
2323
// gas irOptimized: 135329
24-
// gas legacy: 147434
25-
// gas legacyOptimized: 148715
24+
// gas legacy: 147377
25+
// gas legacyOptimized: 146373

test/libsolidity/semanticTests/types/mapping/copy_from_mapping_to_mapping.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ contract C {
3030
// ----
3131
// f() -> 0x20, 7, 8, 9, 0xa0, 13, 2, 0x40, 0xa0, 2, 3, 4, 2, 3, 4
3232
// gas irOptimized: 197102
33-
// gas legacy: 199884
33+
// gas legacy: 199827
3434
// gas legacyOptimized: 203694

0 commit comments

Comments
 (0)