Merge pull request #11604 from ethereum/make-yul-tests-independent-of-optimizer

Make Yul tests independent of optimizer
This commit is contained in:
chriseth 2021-07-01 18:33:09 +02:00 committed by GitHub
commit 98e1dee45f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 472 additions and 402 deletions

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test.sol:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test.sol:L\") sstore(0, addr) } }"
}
},
"settings": {

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test\\\".sol:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test\\\".sol:L\") sstore(0, addr) } }"
}
},
"settings": {

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr1 := linkersymbol(\"contract/test.sol:L1\") let addr2 := linkersymbol(\"contract/test.sol:L2\") } }"
"content": "object \"a\" { code { let addr1 := linkersymbol(\"contract/test.sol:L1\") let addr2 := linkersymbol(\"contract/test.sol:L2\") sstore(0, addr1) sstore(1, addr2) } }"
}
},
"settings": {

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("contract/test.sol:L")
sstore(0, addr)
}
}

View File

@ -5,14 +5,21 @@ Pretty printed source:
object "a" {
code {
let addr := linkersymbol("contract/test.sol:L")
sstore(0, addr)
}
}
Binary representation:
73123456789012345678901234567890123456789050
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612")
/* "linking_strict_assembly/input.yul":22:85 */
/* "linking_strict_assembly/input.yul":98:102 */
dup1
/* "linking_strict_assembly/input.yul":95:96 */
0x00
/* "linking_strict_assembly/input.yul":88:103 */
sstore
/* "linking_strict_assembly/input.yul":22:109 */
pop

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("library.sol:L")
sstore(0, addr)
}
}

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}

View File

@ -3,14 +3,23 @@
Pretty printed source:
object "a" {
code { let addr := linkersymbol("L") }
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
Binary representation:
73123456789012345678901234567890123456789050
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8")
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":22:67 */
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":80:84 */
dup1
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":77:78 */
0x00
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":70:85 */
sstore
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":22:91 */
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
7311111111111111111111111111111111111111117322222222222222222222222222222222222222225050
73111111111111111111111111111111111111111173222222222222222222222222222222222222222281600055806001555050
Text representation:
linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
/* "linking_strict_assembly_same_library_name_different_files/input.yul":32:75 */
linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
/* "linking_strict_assembly_same_library_name_different_files/input.yul":22:133 */
/* "linking_strict_assembly_same_library_name_different_files/input.yul":146:151 */
dup2
/* "linking_strict_assembly_same_library_name_different_files/input.yul":143:144 */
0x00
/* "linking_strict_assembly_same_library_name_different_files/input.yul":136:152 */
sstore
/* "linking_strict_assembly_same_library_name_different_files/input.yul":171:176 */
dup1
/* "linking_strict_assembly_same_library_name_different_files/input.yul":168:169 */
0x01
/* "linking_strict_assembly_same_library_name_different_files/input.yul":161:177 */
sstore
/* "linking_strict_assembly_same_library_name_different_files/input.yul":22:183 */
pop
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__5050
73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__81600055806001555050
Text representation:
linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":32:75 */
linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":22:133 */
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":146:151 */
dup2
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":143:144 */
0x00
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":136:152 */
sstore
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":171:176 */
dup1
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":168:169 */
0x01
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":161:177 */
sstore
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":22:183 */
pop
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("contract/test.sol:L1")
let addr2 := linkersymbol("contract/test.sol:L2")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("contract/test.sol:L1")
let addr2 := linkersymbol("contract/test.sol:L2")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__5050
73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__81600055806001555050
Text representation:
linkerSymbol("05b0326038374a21e0895480a58bda0768cdcc04c8d18f154362d1ca5223d245")
/* "linking_strict_assembly_unresolved_references/input.yul":32:81 */
linkerSymbol("fb58009a6b1ecea3b9d99bedd645df4ec308f17bc0087e5f39d078f77f809177")
/* "linking_strict_assembly_unresolved_references/input.yul":22:145 */
/* "linking_strict_assembly_unresolved_references/input.yul":158:163 */
dup2
/* "linking_strict_assembly_unresolved_references/input.yul":155:156 */
0x00
/* "linking_strict_assembly_unresolved_references/input.yul":148:164 */
sstore
/* "linking_strict_assembly_unresolved_references/input.yul":183:188 */
dup1
/* "linking_strict_assembly_unresolved_references/input.yul":180:181 */
0x01
/* "linking_strict_assembly_unresolved_references/input.yul":173:189 */
sstore
/* "linking_strict_assembly_unresolved_references/input.yul":22:195 */
pop
pop

View File

@ -0,0 +1,36 @@
{
"language": "Yul",
"sources":
{
"A":
{
"content": "{
{
let x := 1
sstore(0, x)
}
{
let y := 2
sstore(32, y)
}
}"
}
},
"settings":
{
"optimizer": {
"enabled": false,
"details": {
"yul": true,
"yulDetails": {
"stackAllocation": true,
"optimizerSteps": "c"
}
}
},
"outputSelection":
{
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,17 @@
{"contracts":{"A":{"object":{"evm":{"assembly":" /* \"A\":16:17 */
0x01
dup1
/* \"A\":27:28 */
0x00
/* \"A\":20:32 */
sstore
pop
/* \"A\":50:51 */
0x02
dup1
/* \"A\":61:63 */
0x20
/* \"A\":54:67 */
sstore
pop
"}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}

View File

@ -0,0 +1,36 @@
{
"language": "Yul",
"sources":
{
"A":
{
"content": "{
{
let x := 1
sstore(0, x)
}
{
let y := 2
sstore(32, y)
}
}"
}
},
"settings":
{
"optimizer": {
"enabled": false,
"details": {
"yul": true,
"yulDetails": {
"stackAllocation": false,
"optimizerSteps": "c"
}
}
},
"outputSelection":
{
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,18 @@
{"contracts":{"A":{"object":{"evm":{"assembly":" /* \"A\":16:17 */
0x01
dup1
/* \"A\":27:28 */
0x00
/* \"A\":20:32 */
sstore
/* \"A\":50:51 */
0x02
dup1
/* \"A\":61:63 */
0x20
/* \"A\":54:67 */
sstore
/* \"A\":0:72 */
pop
pop
"}}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}

View File

@ -14,7 +14,7 @@ object "C_6" {
let selector := shift_right_224_unsigned(calldataload(0))
pop(selector)
}
pop(iszero(calldatasize()))
sstore(0, iszero(calldatasize()))
revert(0, 0)
}

View File

@ -16,6 +16,7 @@ object "C_6" {
{
mstore(64, 128)
pop(iszero(lt(calldatasize(), 4)))
sstore(0, iszero(calldatasize()))
revert(0, 0)
}
}
@ -24,7 +25,7 @@ object "C_6" {
Binary representation:
60806040523415600f5760006000fd5b6010601d60003960106000f3fe608060405260043610155060006000fd
60806040523415600f5760006000fd5b6015601d60003960156000f3fe6080604052600436101550361560005560006000fd
Text representation:
/* "strict_asm_optimizer_steps/input.yul":45:48 */
@ -79,10 +80,18 @@ sub_0: assembly {
iszero
/* "strict_asm_optimizer_steps/input.yul":319:321 */
pop
/* "strict_asm_optimizer_steps/input.yul":570:571 */
/* "strict_asm_optimizer_steps/input.yul":533:547 */
calldatasize
/* "strict_asm_optimizer_steps/input.yul":526:548 */
iszero
/* "strict_asm_optimizer_steps/input.yul":523:524 */
0x00
/* "strict_asm_optimizer_steps/input.yul":567:568 */
/* "strict_asm_optimizer_steps/input.yul":516:549 */
sstore
/* "strict_asm_optimizer_steps/input.yul":576:577 */
0x00
/* "strict_asm_optimizer_steps/input.yul":560:572 */
/* "strict_asm_optimizer_steps/input.yul":573:574 */
0x00
/* "strict_asm_optimizer_steps/input.yul":566:578 */
revert
}

View File

@ -1 +0,0 @@
--strict-assembly --optimize

View File

@ -1 +0,0 @@
Warning: Yul is still experimental. Please use the output with care.

View File

@ -1,39 +0,0 @@
{
function fun() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
let a := 1
let b := 1
let z3 := 1
sstore(a, b)
sstore(add(a, 1), b)
sstore(add(a, 2), b)
sstore(add(a, 3), b)
sstore(add(a, 4), b)
sstore(add(a, 5), b)
sstore(add(a, 6), b)
sstore(add(a, 7), b)
sstore(add(a, 8), b)
sstore(add(a, 9), b)
sstore(add(a, 10), b)
sstore(add(a, 11), b)
sstore(add(a, 12), b)
a3 := 1
b3 := 1
c3 := 1
d3 := 1
e3 := 1
f3 := 1
g3 := 1
h3 := 1
i3 := 1
j3 := 1
k3 := 1
l3 := 1
m3 := 1
o3 := 1
p3 := 1
}
let a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1 := fun()
let a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2 := fun()
sstore(a1, a2)
}

View File

@ -1,205 +0,0 @@
======= yul_stack_opt/input.yul (EVM) =======
Pretty printed source:
object "object" {
code {
{
let _1 := 1
sstore(_1, _1)
sstore(2, _1)
sstore(3, _1)
sstore(4, _1)
sstore(5, _1)
sstore(6, _1)
sstore(7, _1)
sstore(8, _1)
sstore(9, _1)
sstore(10, _1)
sstore(11, _1)
sstore(12, _1)
sstore(13, _1)
sstore(_1, _1)
sstore(2, _1)
sstore(3, _1)
sstore(4, _1)
sstore(5, _1)
sstore(6, _1)
sstore(7, _1)
sstore(8, _1)
sstore(9, _1)
sstore(10, _1)
sstore(11, _1)
sstore(12, _1)
sstore(13, _1)
sstore(_1, _1)
}
}
}
Binary representation:
6001808155806002558060035580600455806005558060065580600755806008558060095580600a5580600b5580600c5580600d55808155806002558060035580600455806005558060065580600755806008558060095580600a5580600b5580600c5580600d5580815550
Text representation:
/* "yul_stack_opt/input.yul":98:99 */
0x01
dup1
dup2
/* "yul_stack_opt/input.yul":129:141 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":151:160 */
0x02
/* "yul_stack_opt/input.yul":144:164 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":174:183 */
0x03
/* "yul_stack_opt/input.yul":167:187 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":197:206 */
0x04
/* "yul_stack_opt/input.yul":190:210 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":220:229 */
0x05
/* "yul_stack_opt/input.yul":213:233 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":243:252 */
0x06
/* "yul_stack_opt/input.yul":236:256 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":266:275 */
0x07
/* "yul_stack_opt/input.yul":259:279 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":289:298 */
0x08
/* "yul_stack_opt/input.yul":282:302 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":312:321 */
0x09
/* "yul_stack_opt/input.yul":305:325 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":335:344 */
0x0a
/* "yul_stack_opt/input.yul":328:348 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":358:368 */
0x0b
/* "yul_stack_opt/input.yul":351:372 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":382:392 */
0x0c
/* "yul_stack_opt/input.yul":375:396 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":406:416 */
0x0d
/* "yul_stack_opt/input.yul":399:420 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
dup2
/* "yul_stack_opt/input.yul":129:141 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":151:160 */
0x02
/* "yul_stack_opt/input.yul":144:164 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":174:183 */
0x03
/* "yul_stack_opt/input.yul":167:187 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":197:206 */
0x04
/* "yul_stack_opt/input.yul":190:210 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":220:229 */
0x05
/* "yul_stack_opt/input.yul":213:233 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":243:252 */
0x06
/* "yul_stack_opt/input.yul":236:256 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":266:275 */
0x07
/* "yul_stack_opt/input.yul":259:279 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":289:298 */
0x08
/* "yul_stack_opt/input.yul":282:302 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":312:321 */
0x09
/* "yul_stack_opt/input.yul":305:325 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":335:344 */
0x0a
/* "yul_stack_opt/input.yul":328:348 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":358:368 */
0x0b
/* "yul_stack_opt/input.yul":351:372 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":382:392 */
0x0c
/* "yul_stack_opt/input.yul":375:396 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
/* "yul_stack_opt/input.yul":406:416 */
0x0d
/* "yul_stack_opt/input.yul":399:420 */
sstore
/* "yul_stack_opt/input.yul":98:99 */
dup1
dup2
/* "yul_stack_opt/input.yul":729:743 */
sstore
pop

View File

@ -1 +0,0 @@
--strict-assembly

View File

@ -1,5 +0,0 @@
Warning: Yul is still experimental. Please use the output with care.
Exception while assembling:
Dynamic exception type:
std::exception::what: Variable a1 is 17 slot(s) too deep inside the stack.
[solidity::util::tag_comment*] = Variable a1 is 17 slot(s) too deep inside the stack.

View File

@ -1 +0,0 @@
1

View File

@ -1,24 +0,0 @@
{
function fun() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
let a := 1
let b := 1
let z3 := 1
sstore(a, b)
sstore(add(a, 1), b)
sstore(add(a, 2), b)
sstore(add(a, 3), b)
sstore(add(a, 4), b)
sstore(add(a, 5), b)
sstore(add(a, 6), b)
sstore(add(a, 7), b)
sstore(add(a, 8), b)
sstore(add(a, 9), b)
sstore(add(a, 10), b)
sstore(add(a, 11), b)
sstore(add(a, 12), b)
}
let a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1 := fun()
let a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2 := fun()
sstore(a1, a2)
}

View File

@ -1,30 +0,0 @@
======= yul_stack_opt_disabled/input.yul (EVM) =======
Pretty printed source:
object "object" {
code {
function fun() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
let a := 1
let b := 1
let z3 := 1
sstore(a, b)
sstore(add(a, 1), b)
sstore(add(a, 2), b)
sstore(add(a, 3), b)
sstore(add(a, 4), b)
sstore(add(a, 5), b)
sstore(add(a, 6), b)
sstore(add(a, 7), b)
sstore(add(a, 8), b)
sstore(add(a, 9), b)
sstore(add(a, 10), b)
sstore(add(a, 11), b)
sstore(add(a, 12), b)
}
let a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1 := fun()
let a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2 := fun()
sstore(a1, a2)
}
}

View File

@ -924,7 +924,7 @@ BOOST_AUTO_TEST_CASE(linking_yul)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"fileB:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"fileB:L\") sstore(0, addr) } }"
}
}
}
@ -956,7 +956,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_empty_link_reference)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"\") sstore(0, addr) } }"
}
}
}
@ -988,7 +988,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_no_filename_in_link_reference)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"L\") sstore(0, addr) } }"
}
}
}
@ -1020,7 +1020,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_same_library_name_different_files)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"fileC:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"fileC:L\") sstore(0, addr) } }"
}
}
}

View File

@ -44,7 +44,7 @@ EVMCodeTransformTest::EVMCodeTransformTest(string const& _filename):
TestCase::TestResult EVMCodeTransformTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
{
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::full();
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::none();
settings.runYulOptimiser = false;
settings.optimizeStackAllocation = m_stackOpt;
AssemblyStack stack(EVMVersion{}, AssemblyStack::Language::StrictAssembly, settings);

View File

@ -1,11 +1,16 @@
object "A" {
code {
pop(datasize("x"))
pop(datasize("C"))
let x := datasize("x")
let c := datasize("C")
sstore(0, x)
sstore(32, c)
}
object "B" {
code { pop(dataoffset("other")) }
code {
let o := dataoffset("other")
sstore(0, o)
}
data ".metadata" "M1"
data "other" "Hello, World2!"
}
@ -16,17 +21,38 @@ object "A" {
}
// ----
// Assembly:
// /* "source":26:44 */
// pop(0x0e)
// /* "source":49:67 */
// pop(0x03)
// 0x0e
// /* "source":26:48 */
// 0x03
// /* "source":90:91 */
// dup2
// /* "source":87:88 */
// 0x00
// /* "source":80:92 */
// sstore
// /* "source":108:109 */
// dup1
// /* "source":104:106 */
// 0x20
// /* "source":97:110 */
// sstore
// /* "source":20:114 */
// pop
// pop
// stop
// data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221
// data_e1629b9dda060bb30c7908346f6af189c16773fa148d3366701fbaa35d54f3c8 414243
//
// sub_0: assembly {
// /* "source":99:123 */
// pop(data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336)
// data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336
// /* "source":193:194 */
// dup1
// /* "source":190:191 */
// 0x00
// /* "source":183:195 */
// sstore
// /* "source":140:201 */
// pop
// stop
// data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221
//
@ -34,6 +60,6 @@ object "A" {
// }
//
// auxdata: 0x4d32
// Bytecode: 600e50600350fe4d32
// Opcodes: PUSH1 0xE POP PUSH1 0x3 POP INVALID 0x4D ORIGIN
// SourceMappings: 26:18:0:-:0;;49;
// Bytecode: 600e600381600055806020555050fe4d32
// Opcodes: PUSH1 0xE PUSH1 0x3 DUP2 PUSH1 0x0 SSTORE DUP1 PUSH1 0x20 SSTORE POP POP INVALID 0x4D ORIGIN
// SourceMappings: :::-:0;26:22:0;90:1;87;80:12;108:1;104:2;97:13;20:94;

View File

@ -1,32 +1,56 @@
object "A" {
code {
pop(dataoffset("A"))
pop(datasize("A"))
pop(dataoffset("B"))
pop(datasize("B"))
pop(dataoffset("B.C"))
pop(datasize("B.C"))
pop(dataoffset("B.E"))
pop(datasize("B.E"))
pop(dataoffset("B.C.D"))
pop(datasize("B.C.D"))
let a_o := dataoffset("A")
let a_s := datasize("A")
let b_o := dataoffset("B")
let b_s := datasize("B")
let bc_o := dataoffset("B.C")
let bc_s := datasize("B.C")
let be_o := dataoffset("B.E")
let be_s := datasize("B.E")
let bcd_o := dataoffset("B.C.D")
let bcd_s := datasize("B.C.D")
sstore(0, a_o)
sstore(32, a_s)
sstore(64, b_o)
sstore(96, b_s)
sstore(128, bc_o)
sstore(160, bc_s)
sstore(192, be_o)
sstore(224, be_s)
sstore(256, bcd_o)
sstore(288, bcd_s)
return(0, 320)
}
data "data1" "Hello, World!"
object "B" {
code {
pop(dataoffset("C"))
pop(datasize("C"))
pop(dataoffset("E"))
pop(datasize("E"))
pop(dataoffset("C.D"))
pop(datasize("C.D"))
let c_o := dataoffset("C")
let c_s := datasize("C")
let e_o := dataoffset("E")
let e_s := datasize("E")
let cd_o := dataoffset("C.D")
let cd_s := datasize("C.D")
sstore(0, c_o)
sstore(32, c_s)
sstore(64, e_o)
sstore(96, e_s)
sstore(128, cd_o)
sstore(160, cd_s)
return(0, 192)
}
object "C" {
code {
pop(dataoffset("D"))
pop(datasize("D"))
let d_o := dataoffset("D")
let d_s := datasize("D")
sstore(0, d_o)
sstore(32, d_s)
return(0, 64)
}
object "D" {
code {
@ -43,62 +67,206 @@ object "A" {
}
// ----
// Assembly:
// /* "source":26:46 */
// pop(0x00)
// /* "source":51:69 */
// pop(bytecodeSize)
// /* "source":74:94 */
// pop(dataOffset(sub_0))
// /* "source":99:117 */
// pop(dataSize(sub_0))
// /* "source":122:144 */
// pop(dataOffset(sub_0.sub_0))
// /* "source":149:169 */
// pop(dataSize(sub_0.sub_0))
// /* "source":174:196 */
// pop(dataOffset(sub_0.sub_1))
// /* "source":201:221 */
// pop(dataSize(sub_0.sub_1))
// /* "source":226:250 */
// pop(dataOffset(sub_0.sub_0.sub_0))
// /* "source":255:277 */
// pop(dataSize(sub_0.sub_0.sub_0))
// 0x00
// /* "source":26:52 */
// bytecodeSize
// /* "source":57:81 */
// dataOffset(sub_0)
// /* "source":86:112 */
// dataSize(sub_0)
// /* "source":117:141 */
// dataOffset(sub_0.sub_0)
// /* "source":146:175 */
// dataSize(sub_0.sub_0)
// /* "source":180:207 */
// dataOffset(sub_0.sub_1)
// /* "source":212:241 */
// dataSize(sub_0.sub_1)
// /* "source":246:273 */
// dataOffset(sub_0.sub_0.sub_0)
// /* "source":278:310 */
// dataSize(sub_0.sub_0.sub_0)
// /* "source":361:364 */
// dup10
// /* "source":358:359 */
// 0x00
// /* "source":351:365 */
// sstore
// /* "source":381:384 */
// dup9
// /* "source":377:379 */
// 0x20
// /* "source":370:385 */
// sstore
// /* "source":401:404 */
// dup8
// /* "source":397:399 */
// 0x40
// /* "source":390:405 */
// sstore
// /* "source":421:424 */
// dup7
// /* "source":417:419 */
// 0x60
// /* "source":410:425 */
// sstore
// /* "source":442:446 */
// dup6
// /* "source":437:440 */
// 0x80
// /* "source":430:447 */
// sstore
// /* "source":464:468 */
// dup5
// /* "source":459:462 */
// 0xa0
// /* "source":452:469 */
// sstore
// /* "source":486:490 */
// dup4
// /* "source":481:484 */
// 0xc0
// /* "source":474:491 */
// sstore
// /* "source":508:512 */
// dup3
// /* "source":503:506 */
// 0xe0
// /* "source":496:513 */
// sstore
// /* "source":530:535 */
// dup2
// /* "source":525:528 */
// 0x0100
// /* "source":518:536 */
// sstore
// /* "source":553:558 */
// dup1
// /* "source":548:551 */
// 0x0120
// /* "source":541:559 */
// sstore
// /* "source":574:577 */
// 0x0140
// /* "source":571:572 */
// 0x00
// /* "source":564:578 */
// return
// /* "source":20:582 */
// pop
// pop
// pop
// pop
// pop
// pop
// pop
// pop
// pop
// pop
// stop
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
//
// sub_0: assembly {
// /* "source":347:367 */
// pop(dataOffset(sub_0))
// /* "source":374:392 */
// pop(dataSize(sub_0))
// /* "source":399:419 */
// pop(dataOffset(sub_1))
// /* "source":426:444 */
// pop(dataSize(sub_1))
// /* "source":451:473 */
// pop(dataOffset(sub_0.sub_0))
// /* "source":480:500 */
// pop(dataSize(sub_0.sub_0))
// dataOffset(sub_0)
// /* "source":648:674 */
// dataSize(sub_0)
// /* "source":681:705 */
// dataOffset(sub_1)
// /* "source":712:738 */
// dataSize(sub_1)
// /* "source":745:769 */
// dataOffset(sub_0.sub_0)
// /* "source":776:805 */
// dataSize(sub_0.sub_0)
// /* "source":857:860 */
// dup6
// /* "source":854:855 */
// 0x00
// /* "source":847:861 */
// sstore
// /* "source":879:882 */
// dup5
// /* "source":875:877 */
// 0x20
// /* "source":868:883 */
// sstore
// /* "source":901:904 */
// dup4
// /* "source":897:899 */
// 0x40
// /* "source":890:905 */
// sstore
// /* "source":923:926 */
// dup3
// /* "source":919:921 */
// 0x60
// /* "source":912:927 */
// sstore
// /* "source":946:950 */
// dup2
// /* "source":941:944 */
// 0x80
// /* "source":934:951 */
// sstore
// /* "source":970:974 */
// dup1
// /* "source":965:968 */
// 0xa0
// /* "source":958:975 */
// sstore
// /* "source":992:995 */
// 0xc0
// /* "source":989:990 */
// 0x00
// /* "source":982:996 */
// return
// /* "source":640:1002 */
// pop
// pop
// pop
// pop
// pop
// pop
// stop
//
// sub_0: assembly {
// /* "source":545:565 */
// pop(dataOffset(sub_0))
// /* "source":574:592 */
// pop(dataSize(sub_0))
// dataOffset(sub_0)
// /* "source":1041:1067 */
// dataSize(sub_0)
// /* "source":1120:1123 */
// dup2
// /* "source":1117:1118 */
// 0x00
// /* "source":1110:1124 */
// sstore
// /* "source":1144:1147 */
// dup1
// /* "source":1140:1142 */
// 0x20
// /* "source":1133:1148 */
// sstore
// /* "source":1167:1169 */
// 0x40
// /* "source":1164:1165 */
// 0x00
// /* "source":1157:1170 */
// return
// /* "source":1031:1178 */
// pop
// pop
// stop
//
// sub_0: assembly {
// /* "source":645:654 */
// /* "source":1223:1232 */
// invalid
// }
// }
//
// sub_1: assembly {
// /* "source":717:726 */
// /* "source":1295:1304 */
// invalid
// }
// }
// Bytecode: 600050604650601f50601d50603e50600850603d50600150603c50600150fe601350600850601b50600150601c50600150fe600750600150fefefefefefe600750600150fefe
// Opcodes: PUSH1 0x0 POP PUSH1 0x46 POP PUSH1 0x1F POP PUSH1 0x1D POP PUSH1 0x3E POP PUSH1 0x8 POP PUSH1 0x3D POP PUSH1 0x1 POP PUSH1 0x3C POP PUSH1 0x1 POP INVALID PUSH1 0x13 POP PUSH1 0x8 POP PUSH1 0x1B POP PUSH1 0x1 POP PUSH1 0x1C POP PUSH1 0x1 POP INVALID PUSH1 0x7 POP PUSH1 0x1 POP INVALID INVALID INVALID INVALID INVALID INVALID PUSH1 0x7 POP PUSH1 0x1 POP INVALID INVALID
// SourceMappings: 26:20:0:-:0;;51:18;;74:20;;99:18;;122:22;;149:20;;174:22;;201:20;;226:24;;255:22;
// Bytecode: 600060ad604f604760986015609760016096600189600055886020558760405586606055856080558460a0558360c0558260e055816101005580610120556101406000f350505050505050505050fe60306015604560016046600185600055846020558360405582606055816080558060a05560c06000f3505050505050fe60146001816000558060205560406000f35050fefefefefefe60146001816000558060205560406000f35050fefe
// Opcodes: PUSH1 0x0 PUSH1 0xAD PUSH1 0x4F PUSH1 0x47 PUSH1 0x98 PUSH1 0x15 PUSH1 0x97 PUSH1 0x1 PUSH1 0x96 PUSH1 0x1 DUP10 PUSH1 0x0 SSTORE DUP9 PUSH1 0x20 SSTORE DUP8 PUSH1 0x40 SSTORE DUP7 PUSH1 0x60 SSTORE DUP6 PUSH1 0x80 SSTORE DUP5 PUSH1 0xA0 SSTORE DUP4 PUSH1 0xC0 SSTORE DUP3 PUSH1 0xE0 SSTORE DUP2 PUSH2 0x100 SSTORE DUP1 PUSH2 0x120 SSTORE PUSH2 0x140 PUSH1 0x0 RETURN POP POP POP POP POP POP POP POP POP POP INVALID PUSH1 0x30 PUSH1 0x15 PUSH1 0x45 PUSH1 0x1 PUSH1 0x46 PUSH1 0x1 DUP6 PUSH1 0x0 SSTORE DUP5 PUSH1 0x20 SSTORE DUP4 PUSH1 0x40 SSTORE DUP3 PUSH1 0x60 SSTORE DUP2 PUSH1 0x80 SSTORE DUP1 PUSH1 0xA0 SSTORE PUSH1 0xC0 PUSH1 0x0 RETURN POP POP POP POP POP POP INVALID PUSH1 0x14 PUSH1 0x1 DUP2 PUSH1 0x0 SSTORE DUP1 PUSH1 0x20 SSTORE PUSH1 0x40 PUSH1 0x0 RETURN POP POP INVALID INVALID INVALID INVALID INVALID INVALID PUSH1 0x14 PUSH1 0x1 DUP2 PUSH1 0x0 SSTORE DUP1 PUSH1 0x20 SSTORE PUSH1 0x40 PUSH1 0x0 RETURN POP POP INVALID INVALID
// SourceMappings: :::-:0;26:26:0;57:24;86:26;117:24;146:29;180:27;212:29;246:27;278:32;361:3;358:1;351:14;381:3;377:2;370:15;401:3;397:2;390:15;421:3;417:2;410:15;442:4;437:3;430:17;464:4;459:3;452:17;486:4;481:3;474:17;508:4;503:3;496:17;530:5;525:3;518:18;553:5;548:3;541:18;574:3;571:1;564:14;20:562;;;;;;;;;