mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add InlineArrayType to support literals conversion to statically and dynamically allocated arrays.
This commit is contained in:
@@ -13,8 +13,8 @@ contract Test {
|
||||
// ----
|
||||
// set(uint24[3][]): 0x20, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 -> 0x06
|
||||
// gas irOptimized: 186766
|
||||
// gas legacy: 211149
|
||||
// gas legacyOptimized: 206054
|
||||
// gas legacy: 211155
|
||||
// gas legacyOptimized: 206060
|
||||
// data(uint256,uint256): 0x02, 0x02 -> 0x09
|
||||
// data(uint256,uint256): 0x05, 0x01 -> 0x11
|
||||
// data(uint256,uint256): 0x06, 0x00 -> FAILURE
|
||||
|
||||
@@ -21,6 +21,6 @@ contract c {
|
||||
// ----
|
||||
// store(uint256[9],uint8[3][]): 21, 22, 23, 24, 25, 26, 27, 28, 29, 0x140, 4, 1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33 -> 32
|
||||
// gas irOptimized: 648324
|
||||
// gas legacy: 694515
|
||||
// gas legacyOptimized: 694013
|
||||
// gas legacy: 694519
|
||||
// gas legacyOptimized: 694017
|
||||
// retrieve() -> 9, 28, 9, 28, 4, 3, 32
|
||||
|
||||
@@ -47,5 +47,5 @@ contract C {
|
||||
// ----
|
||||
// f() -> true
|
||||
// gas irOptimized: 146936
|
||||
// gas legacy: 155961
|
||||
// gas legacyOptimized: 153588
|
||||
// gas legacy: 155962
|
||||
// gas legacyOptimized: 153589
|
||||
|
||||
@@ -20,5 +20,5 @@ contract c {
|
||||
// ----
|
||||
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000
|
||||
// gas irOptimized: 208149
|
||||
// gas legacy: 221856
|
||||
// gas legacyOptimized: 220680
|
||||
// gas legacy: 221858
|
||||
// gas legacyOptimized: 220682
|
||||
|
||||
+2
-2
@@ -24,5 +24,5 @@ contract c {
|
||||
// ----
|
||||
// test() -> 3, 4
|
||||
// gas irOptimized: 189690
|
||||
// gas legacy: 195353
|
||||
// gas legacyOptimized: 192441
|
||||
// gas legacy: 195355
|
||||
// gas legacyOptimized: 192443
|
||||
|
||||
@@ -21,4 +21,4 @@ contract c {
|
||||
// test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000
|
||||
// gas irOptimized: 124910
|
||||
// gas legacy: 187414
|
||||
// gas legacyOptimized: 165659
|
||||
// gas legacyOptimized: 165660
|
||||
|
||||
@@ -11,8 +11,8 @@ contract Test {
|
||||
// ----
|
||||
// set(uint24[]): 0x20, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 -> 18
|
||||
// gas irOptimized: 99616
|
||||
// gas legacy: 103563
|
||||
// gas legacyOptimized: 101397
|
||||
// gas legacy: 103564
|
||||
// gas legacyOptimized: 101398
|
||||
// data(uint256): 7 -> 8
|
||||
// data(uint256): 15 -> 16
|
||||
// data(uint256): 18 -> FAILURE
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// constructor()
|
||||
// gas irOptimized: 237351
|
||||
// gas legacy: 221315
|
||||
// gas legacyOptimized: 185247
|
||||
// gas irOptimized: 192200
|
||||
// gas legacy: 237108
|
||||
// gas legacyOptimized: 190689
|
||||
// f() -> 0
|
||||
|
||||
+2
-2
@@ -17,5 +17,5 @@ contract C {
|
||||
// ----
|
||||
// test() -> 7
|
||||
// gas irOptimized: 122483
|
||||
// gas legacy: 205196
|
||||
// gas legacyOptimized: 204987
|
||||
// gas legacy: 205197
|
||||
// gas legacyOptimized: 204988
|
||||
|
||||
+2
-2
@@ -21,6 +21,6 @@ contract C {
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// one() -> 3
|
||||
// gas legacy: 140260
|
||||
// gas legacyOptimized: 140097
|
||||
// gas legacy: 140261
|
||||
// gas legacyOptimized: 140098
|
||||
// two() -> FAILURE, hex"4e487b71", 0x51
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
function f() public returns (uint8[3] memory) {
|
||||
uint8[3][] memory x = new uint8[3][](1);
|
||||
x[0] = [1, 2, 3];
|
||||
return x[0];
|
||||
}
|
||||
|
||||
function g() public returns (uint8[] memory) {
|
||||
uint8[][] memory x = new uint8[][](1);
|
||||
x[0] = [4, 5, 6];
|
||||
return x[0];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1, 2, 3
|
||||
// g() -> 0x20, 3, 4, 5, 6
|
||||
@@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
uint8[3][] x;
|
||||
uint8[][] y;
|
||||
|
||||
constructor() {
|
||||
x = new uint8[3][](1);
|
||||
x[0] = [1, 2, 3];
|
||||
|
||||
y = new uint8[][](1);
|
||||
y[0] = [4, 5, 6];
|
||||
}
|
||||
|
||||
function f() public returns (uint8[3] memory) {
|
||||
return x[0];
|
||||
}
|
||||
|
||||
function g() public returns (uint8[] memory) {
|
||||
return y[0];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1, 2, 3
|
||||
// g() -> 0x20, 3, 4, 5, 6
|
||||
@@ -0,0 +1,15 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
string sString = "text2";
|
||||
|
||||
function f(string calldata cString) public returns (string[] memory) {
|
||||
string memory mString = "text3";
|
||||
return ["", "text1", sString, mString, cString];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f(string): 0x20, 5, "text4" -> 0x20, 5, 0xa0, 0xc0, 0x0100, 0x0140, 0x0180, 0, 5, 52647573331277248417481526129911949709942841133814091230869433742303074189312, 5, 52647573331382560709150083316609867737626511566132986326269982853557385166848, 5, 52647573331487873000818640503307785765310181998451881421670531964811696144384, 5, 52647573331593185292487197690005703792993852430770776517071081076066007121920
|
||||
@@ -0,0 +1,27 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
function f() public returns (uint8[] memory) {
|
||||
return [1, 2, 3, 4, 5];
|
||||
}
|
||||
|
||||
function g() public returns (uint8[][] memory) {
|
||||
return [[1, 2], [3], []];
|
||||
}
|
||||
|
||||
function h() public returns (uint8[][3] memory) {
|
||||
return [[1, 2], [3], []];
|
||||
}
|
||||
|
||||
function i() public returns (uint8[2][] memory) {
|
||||
return [[1, 2], [3,4], [5,6]];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 0x20, 5, 1, 2, 3, 4, 5
|
||||
// g() -> 0x20, 3, 0x60, 0xc0, 0x0100, 2, 1, 2, 1, 3, 0
|
||||
// h() -> 0x20, 0x60, 0xc0, 0x0100, 2, 1, 2, 1, 3, 0
|
||||
// i() -> 0x20, 3, 1, 2, 3, 4, 5, 6
|
||||
@@ -0,0 +1,63 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
|
||||
struct CustomStruct{
|
||||
uint16 index;
|
||||
string text;
|
||||
}
|
||||
|
||||
function statically_sized_uint_array() public returns (uint8[3] memory) {
|
||||
uint8[3] memory a = [1, 2, 3];
|
||||
return a;
|
||||
}
|
||||
|
||||
function dynamically_sized_uint_array() public returns (uint8[] memory) {
|
||||
uint8[] memory a = [1, 2, 3];
|
||||
return a;
|
||||
}
|
||||
|
||||
function statically_sized_int_array() public returns (int8[3] memory) {
|
||||
int8[3] memory a = [-1, -2, -3];
|
||||
return a;
|
||||
}
|
||||
|
||||
function dynamically_sized_int_array() public returns (int8[] memory) {
|
||||
int8[] memory a = [-1, -2, -3];
|
||||
return a;
|
||||
}
|
||||
|
||||
function statically_sized_string_array() public returns (string[2] memory) {
|
||||
string[2] memory a = ["foo", "bar"];
|
||||
return a;
|
||||
}
|
||||
|
||||
function dynamically_sized_string_array() public returns (string[] memory) {
|
||||
string[] memory a = ["foo", "bar"];
|
||||
return a;
|
||||
}
|
||||
|
||||
function statically_sized_struct_array() public returns (CustomStruct[2] memory) {
|
||||
CustomStruct[2] memory s = [CustomStruct(1, "foo"), CustomStruct(2, "bar")];
|
||||
return s;
|
||||
}
|
||||
|
||||
function dynamically_sized_struct_array() public returns (CustomStruct[] memory) {
|
||||
CustomStruct[] memory s = [CustomStruct(1, "foo"), CustomStruct(2, "bar")];
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// statically_sized_uint_array() -> 1, 2, 3
|
||||
// dynamically_sized_uint_array() -> 0x20, 3, 1, 2, 3
|
||||
// statically_sized_int_array() -> -1, -2, -3
|
||||
// dynamically_sized_int_array() -> 0x20, 3, -1, -2, -3
|
||||
// statically_sized_string_array() -> 0x20, 0x40, 0x80, 3, "foo", 3, "bar"
|
||||
// dynamically_sized_string_array() -> 0x20, 2, 0x40, 0x80, 3, 46332796673528066027243215619882264990369332300865266851730502456685210107904, 3, 44498830125527143464827115118378702402016761369235290884359940707316142178304
|
||||
// statically_sized_struct_array() -> 0x20, 0x40, 0xc0, 1, 0x40, 3, 46332796673528066027243215619882264990369332300865266851730502456685210107904, 2, 0x40, 3, 44498830125527143464827115118378702402016761369235290884359940707316142178304
|
||||
// dynamically_sized_struct_array() -> 0x20, 2, 0x40, 0xc0, 1, 0x40, 3, 46332796673528066027243215619882264990369332300865266851730502456685210107904, 2, 0x40, 3, 44498830125527143464827115118378702402016761369235290884359940707316142178304
|
||||
@@ -0,0 +1,20 @@
|
||||
contract C {
|
||||
uint8[3] st = [1, 2, 3];
|
||||
uint8[] public dt = [4, 5, 6];
|
||||
|
||||
function s() public returns (uint8[3] memory) {
|
||||
return st;
|
||||
}
|
||||
|
||||
function d() public returns (uint8[] memory) {
|
||||
return dt;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// s() -> 1, 2, 3
|
||||
// d() -> 0x20, 3, 4, 5, 6
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
uint8[3][2] st = [[1, 2, 3], [4, 5, 6]];
|
||||
uint8[][] dt = [[1, 2], [3, 4, 5, 6]];
|
||||
|
||||
function s() public returns (uint8[3][2] memory) {
|
||||
return st;
|
||||
}
|
||||
|
||||
function d() public returns (uint8[][] memory) {
|
||||
return dt;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// s() -> 1, 2, 3, 4, 5, 6
|
||||
// d() -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 4, 3, 4, 5, 6
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
function f() external pure returns (string[2] memory rdatas) {
|
||||
rdatas = [hex'74000001', hex'c4a40001'];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x20, 0x40, 0x80, 4, "t\0\0\x01", 4, "\xc4\xa4\0\x01"
|
||||
@@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
bytes[2] public staticBytesArray = [hex"616263", hex"646566"];
|
||||
bytes[] public dynamicBytesArray = [hex"616263", hex"646566"];
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// staticBytesArray(uint256): 0 -> 0x20, 3, 0x6162630000000000000000000000000000000000000000000000000000000000
|
||||
// staticBytesArray(uint256): 1 -> 0x20, 3, 0x6465660000000000000000000000000000000000000000000000000000000000
|
||||
// dynamicBytesArray(uint256): 0 -> 0x20, 3, 0x6162630000000000000000000000000000000000000000000000000000000000
|
||||
// dynamicBytesArray(uint256): 1 -> 0x20, 3, 0x6465660000000000000000000000000000000000000000000000000000000000
|
||||
@@ -0,0 +1,16 @@
|
||||
contract C {
|
||||
string[4] public staticArray = ["foo", "", "a very long string that needs more than 32 bytes", "bar"];
|
||||
string[] public dynamicArray = ["foo", "", "a very long string that needs more than 32 bytes", "bar"];
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// staticArray(uint256): 0 -> 0x20, 3, "foo"
|
||||
// staticArray(uint256): 1 -> 0x20, 0
|
||||
// staticArray(uint256): 2 -> 0x20, 0x30, 0x612076657279206c6f6e6720737472696e672074686174206e65656473206d6f, 0x7265207468616E20333220627974657300000000000000000000000000000000
|
||||
// staticArray(uint256): 3 -> 0x20, 3, "bar"
|
||||
// dynamicArray(uint256): 0 -> 0x20, 3, "foo"
|
||||
// dynamicArray(uint256): 1 -> 0x20, 0
|
||||
// dynamicArray(uint256): 2 -> 0x20, 0x30, 0x612076657279206c6f6e6720737472696e672074686174206e65656473206d6f, 0x7265207468616E20333220627974657300000000000000000000000000000000
|
||||
// dynamicArray(uint256): 3 -> 0x20, 3, "bar"
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
|
||||
function test1() public returns (uint8[1][] memory) {
|
||||
uint8[1][] memory a = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16]];
|
||||
return a;
|
||||
}
|
||||
|
||||
function test2() public returns (int8[2][] memory) {
|
||||
int8[2][] memory a = [[-1, -2], [-3, -4], [-5, -6]];
|
||||
return a;
|
||||
}
|
||||
|
||||
function test3() public returns (uint16[][2] memory) {
|
||||
uint16[][2] memory a = [[1, 2, 3],[4, 5, 6, 7, 8, 9, 10, 11, 12, 13]];
|
||||
return a;
|
||||
}
|
||||
|
||||
function test4() public returns (uint8[][2][] memory) {
|
||||
uint8[][2][] memory a = [[[1, 2, 3], [4, 5]], [[6], [7]], [[8, 9, 10, 11], [12, 13, 14, 15, 16]]];
|
||||
return a;
|
||||
}
|
||||
|
||||
function test5() public returns (string[2][] memory) {
|
||||
string[2][] memory a = [["this", "is"], ["just", "a"], ["test", "array"]];
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1() -> 0x20, 0x10, 0x01, 0x02, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10
|
||||
// test2() -> 0x20, 0x03, -1, -2, -3, -4, -5, -6
|
||||
// test3() -> 0x20, 0x40, 0xc0, 0x03, 1, 2, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
|
||||
// test4() -> 0x20, 0x03, 0x60, 0x0180, 0x0240, 0x40, 0xc0, 3, 1, 2, 3, 2, 4, 5, 0x40, 0x80, 1, 6, 1, 7, 0x40, 0xe0, 4, 8, 9, 10, 11, 5, 12, 13, 14, 15, 0x10
|
||||
// test5() -> 0x20, 3, 0x60, 288, 0x01e0, 0x40, 0x80, 4, 52652770314156132753103522558211245866589054961607131434777992190478746910720, 2, 47696036513692484977101116032555085334762927796157333774492759403894270853120, 0x40, 0x80, 4, 48152679884589002438443377966044670264050608660991796074848385302132292583424, 1, 43874346312576839672212443538448152585028080127215369968075725190498334277632, 0x40, 0x80, 4, 52647538817385212172903286807934654968315727694643370704309751478220717293568, 5, 44076556304902723615564186688849689667362290371271333483270849954029028507648
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
uint8[1][] array1 = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16]];
|
||||
int8[2][] array2 = [[1, 2], [3, 4], [5, 6]];
|
||||
uint16[][2] array3 = [[1, 2, 3],[4, 5, 6, 7, 8, 9, 10, 11, 12, 13]];
|
||||
uint8[][2][] array4 = [[[1, 2, 3], [4, 5]], [[6], [7]], [[8, 9, 10, 11], [12, 13, 14, 15, 16]]];
|
||||
string[2][] array5 = [["this", "is"], ["just", "a"], ["test", "array"]];
|
||||
|
||||
function test1() public returns (uint8[1][] memory) {
|
||||
return array1;
|
||||
}
|
||||
|
||||
function test2() public returns (int8[2][] memory) {
|
||||
return array2;
|
||||
}
|
||||
|
||||
function test3() public returns (uint16[][2] memory) {
|
||||
return array3;
|
||||
}
|
||||
|
||||
function test4() public returns (uint8[][2][] memory) {
|
||||
return array4;
|
||||
}
|
||||
|
||||
function test5() public returns (string[2][] memory) {
|
||||
return array5;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1() -> 0x20, 0x10, 0x01, 0x02, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10
|
||||
// test2() -> 0x20, 0x03, 0x01, 0x02, 3, 4, 5, 6
|
||||
// test3() -> 0x20, 0x40, 0xc0, 0x03, 1, 2, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
|
||||
// test4() -> 0x20, 0x03, 0x60, 0x0180, 0x0240, 0x40, 0xc0, 3, 1, 2, 3, 2, 4, 5, 0x40, 0x80, 1, 6, 1, 7, 0x40, 0xe0, 4, 8, 9, 10, 11, 5, 12, 13, 14, 15, 0x10
|
||||
// test5() -> 0x20, 3, 0x60, 288, 0x01e0, 0x40, 0x80, 4, 52652770314156132753103522558211245866589054961607131434777992190478746910720, 2, 47696036513692484977101116032555085334762927796157333774492759403894270853120, 0x40, 0x80, 4, 48152679884589002438443377966044670264050608660991796074848385302132292583424, 1, 43874346312576839672212443538448152585028080127215369968075725190498334277632, 0x40, 0x80, 4, 52647538817385212172903286807934654968315727694643370704309751478220717293568, 5, 44076556304902723615564186688849689667362290371271333483270849954029028507648
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
uint8[] array1 = [1,2,3,4,5,6,7,8,9,10,11,12,13, 14, 15, 16];
|
||||
uint8[][] array2 = [[1, 2, 3],[4, 5],[6,7,8,9,10,11,12], [13,14,15,16]];
|
||||
uint8[][][] array3 = [[[1, 2, 3],[4, 5],[6]], [[7, 8, 9, 10,11],[12, 13,14,15,16]]];
|
||||
|
||||
|
||||
function test1() public returns (uint8[] memory) {
|
||||
return array1;
|
||||
}
|
||||
|
||||
function test2() public returns (uint8[][] memory) {
|
||||
return array2;
|
||||
}
|
||||
|
||||
function test3() public returns (uint8[][][] memory) {
|
||||
return array3;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1() -> 0x20, 0x10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0x10
|
||||
// test2() -> 0x20, 4, 0x80, 0x0100, 0x0160, 0x0260, 3, 1, 2, 3, 2, 4, 5, 7, 6, 7, 8, 9, 10, 11, 12, 4, 13, 14, 15, 0x10
|
||||
// test3() -> 0x20, 0x02, 0x40, 0x01e0, 0x03, 0x60, 0xe0, 0x0140, 3, 1, 2, 3, 2, 4, 5, 1, 6, 2, 0x40, 0x0100, 5, 7, 8, 9, 10, 11, 5, 12, 13, 14, 15, 0x10
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
uint16[1][16] array1 = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16]];
|
||||
uint16[4][2] array2 = [[1, 2, 3, 4], [5, 6, 7, 8]];
|
||||
uint8[4][2][2] array3 = [[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]];
|
||||
|
||||
function test1() public returns (uint16[1][16] memory) {
|
||||
return array1;
|
||||
}
|
||||
|
||||
function test2() public returns (uint16[4][2] memory) {
|
||||
return array2;
|
||||
}
|
||||
|
||||
function test3() public returns (uint8[4][2][2] memory) {
|
||||
return array3;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1() -> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
|
||||
// test2() -> 1, 2, 3, 4, 5, 6, 7, 8
|
||||
// test3() -> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
|
||||
@@ -13,5 +13,5 @@ contract C {
|
||||
// ----
|
||||
// f(uint120[]): 0x20, 3, 1, 2, 3 -> 1
|
||||
// gas irOptimized: 112832
|
||||
// gas legacy: 113686
|
||||
// gas legacyOptimized: 113499
|
||||
// gas legacy: 113687
|
||||
// gas legacyOptimized: 113500
|
||||
|
||||
@@ -21,5 +21,5 @@ contract c {
|
||||
// ----
|
||||
// test() -> 2, 3, 4, 5
|
||||
// gas irOptimized: 135204
|
||||
// gas legacy: 147484
|
||||
// gas legacyOptimized: 146456
|
||||
// gas legacy: 147486
|
||||
// gas legacyOptimized: 146458
|
||||
|
||||
Reference in New Issue
Block a user