Replace stack optimization command-line test with Standard JSON ones

- It's not possible to run optimizer with only stack optimization enabled on the CLI.
This commit is contained in:
Kamil Śliwak 2021-07-01 14:35:12 +02:00
parent 9d08b5001f
commit 753f359157
11 changed files with 366 additions and 244 deletions

View File

@ -1,4 +1,10 @@
{
"language": "Yul",
"sources":
{
"A":
{
"content": "{
function fun() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
let a := 1
@ -36,4 +42,24 @@
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)
}"
}
},
"settings":
{
"optimizer": {
"enabled": false,
"details": {
"yul": true,
"yulDetails": {
"stackAllocation": true,
"optimizerSteps": "c"
}
}
},
"outputSelection":
{
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,304 @@
{"contracts":{"A":{"object":{"evm":{"assembly":" /* \"A\":645:650 */
tag_1
tag_2
jump\t// in
tag_1:
/* \"A\":575:650 */
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
/* \"A\":722:727 */
tag_3
tag_2
jump\t// in
tag_3:
/* \"A\":652:727 */
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
/* \"A\":740:742 */
dup1
/* \"A\":736:738 */
dup3
/* \"A\":729:743 */
sstore
pop
pop
/* \"A\":3:573 */
jump(tag_4)
tag_2:
/* \"A\":98:99 */
0x01
0x01
/* \"A\":129:141 */
sstore
/* \"A\":98:99 */
0x01
0x01
0x01
/* \"A\":151:160 */
add
/* \"A\":144:164 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":181:182 */
0x02
/* \"A\":98:99 */
0x01
/* \"A\":174:183 */
add
/* \"A\":167:187 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":204:205 */
0x03
/* \"A\":98:99 */
0x01
/* \"A\":197:206 */
add
/* \"A\":190:210 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":227:228 */
0x04
/* \"A\":98:99 */
0x01
/* \"A\":220:229 */
add
/* \"A\":213:233 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":250:251 */
0x05
/* \"A\":98:99 */
0x01
/* \"A\":243:252 */
add
/* \"A\":236:256 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":273:274 */
0x06
/* \"A\":98:99 */
0x01
/* \"A\":266:275 */
add
/* \"A\":259:279 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":296:297 */
0x07
/* \"A\":98:99 */
0x01
/* \"A\":289:298 */
add
/* \"A\":282:302 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":319:320 */
0x08
/* \"A\":98:99 */
0x01
/* \"A\":312:321 */
add
/* \"A\":305:325 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":342:343 */
0x09
/* \"A\":98:99 */
0x01
/* \"A\":335:344 */
add
/* \"A\":328:348 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":365:367 */
0x0a
/* \"A\":98:99 */
0x01
/* \"A\":358:368 */
add
/* \"A\":351:372 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":389:391 */
0x0b
/* \"A\":98:99 */
0x01
/* \"A\":382:392 */
add
/* \"A\":375:396 */
sstore
/* \"A\":98:99 */
0x01
/* \"A\":413:415 */
0x0c
/* \"A\":98:99 */
0x01
/* \"A\":406:416 */
add
/* \"A\":399:420 */
sstore
/* \"A\":21:23 */
0x00
/* \"A\":25:27 */
0x00
/* \"A\":29:31 */
0x00
/* \"A\":33:35 */
0x00
/* \"A\":37:39 */
0x00
/* \"A\":41:43 */
0x00
/* \"A\":45:47 */
0x00
/* \"A\":49:51 */
0x00
/* \"A\":53:55 */
0x00
/* \"A\":57:59 */
0x00
/* \"A\":61:63 */
0x00
/* \"A\":65:67 */
0x00
/* \"A\":69:71 */
0x00
/* \"A\":73:75 */
0x00
/* \"A\":77:79 */
0x00
/* \"A\":81:83 */
0x00
/* \"A\":98:99 */
0x01
/* \"A\":423:430 */
swap16
pop
/* \"A\":98:99 */
dup16
/* \"A\":433:440 */
swap15
pop
/* \"A\":98:99 */
dup16
/* \"A\":443:450 */
swap14
pop
/* \"A\":98:99 */
dup16
/* \"A\":453:460 */
swap13
pop
/* \"A\":98:99 */
dup16
/* \"A\":463:470 */
swap12
pop
/* \"A\":98:99 */
dup16
/* \"A\":473:480 */
swap11
pop
/* \"A\":98:99 */
dup16
/* \"A\":483:490 */
swap10
pop
/* \"A\":98:99 */
dup16
/* \"A\":493:500 */
swap9
pop
/* \"A\":98:99 */
dup16
/* \"A\":503:510 */
swap8
pop
/* \"A\":98:99 */
dup16
/* \"A\":513:520 */
swap7
pop
/* \"A\":98:99 */
dup16
/* \"A\":523:530 */
swap6
pop
/* \"A\":98:99 */
dup16
/* \"A\":533:540 */
swap5
pop
/* \"A\":98:99 */
dup16
/* \"A\":543:550 */
swap4
pop
/* \"A\":98:99 */
dup16
/* \"A\":553:560 */
swap2
pop
/* \"A\":98:99 */
dup16
/* \"A\":563:570 */
swap1
pop
/* \"A\":85:573 */
tag_5:
swap1
swap2
swap3
swap4
swap5
swap6
swap7
swap8
swap9
swap10
swap11
swap12
swap13
swap14
swap15
swap16
jump\t// out
tag_4:
"}}}},"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

@ -1,4 +1,10 @@
{
"language": "Yul",
"sources":
{
"A":
{
"content": "{
function fun() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
let a := 1
@ -22,3 +28,24 @@
let a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2 := fun()
sstore(a1, a2)
}
"
}
},
"settings":
{
"optimizer": {
"enabled": false,
"details": {
"yul": true,
"yulDetails": {
"stackAllocation": false,
"optimizerSteps": "c"
}
}
},
"outputSelection":
{
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,9 @@
{"errors":[{"component":"general","formattedMessage":"Internal exception in StandardCompiler::compile: /solidity/libyul/backends/evm/EVMObjectCompiler.cpp(70): Throw in function void solidity::yul::EVMObjectCompiler::run(solidity::yul::Object&, bool)
Dynamic exception type: boost::wrapexcept<solidity::yul::StackTooDeepError>
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.
","message":"Internal exception in StandardCompiler::compile: /solidity/libyul/backends/evm/EVMObjectCompiler.cpp(70): Throw in function void solidity::yul::EVMObjectCompiler::run(solidity::yul::Object&, bool)
Dynamic exception type: boost::wrapexcept<solidity::yul::StackTooDeepError>
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.
","severity":"error","type":"InternalCompilerError"}]}

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,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,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)
}
}