diff --git a/test/cmdlineTests/yul_stack_opt/input.yul b/test/cmdlineTests/standard_yul_stack_opt/input.json similarity index 70% rename from test/cmdlineTests/yul_stack_opt/input.yul rename to test/cmdlineTests/standard_yul_stack_opt/input.json index d60620ecf..b9e5141ac 100644 --- a/test/cmdlineTests/yul_stack_opt/input.yul +++ b/test/cmdlineTests/standard_yul_stack_opt/input.json @@ -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"]} + } + } } diff --git a/test/cmdlineTests/standard_yul_stack_opt/output.json b/test/cmdlineTests/standard_yul_stack_opt/output.json new file mode 100644 index 000000000..1e50cec28 --- /dev/null +++ b/test/cmdlineTests/standard_yul_stack_opt/output.json @@ -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"}]} diff --git a/test/cmdlineTests/yul_stack_opt_disabled/input.yul b/test/cmdlineTests/standard_yul_stack_opt_disabled/input.json similarity index 65% rename from test/cmdlineTests/yul_stack_opt_disabled/input.yul rename to test/cmdlineTests/standard_yul_stack_opt_disabled/input.json index 772a6d4df..ad1057aea 100644 --- a/test/cmdlineTests/yul_stack_opt_disabled/input.yul +++ b/test/cmdlineTests/standard_yul_stack_opt_disabled/input.json @@ -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"]} + } + } +} diff --git a/test/cmdlineTests/standard_yul_stack_opt_disabled/output.json b/test/cmdlineTests/standard_yul_stack_opt_disabled/output.json new file mode 100644 index 000000000..9529dddc5 --- /dev/null +++ b/test/cmdlineTests/standard_yul_stack_opt_disabled/output.json @@ -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 +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 +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"}]} diff --git a/test/cmdlineTests/yul_stack_opt/args b/test/cmdlineTests/yul_stack_opt/args deleted file mode 100644 index 20fe41eb5..000000000 --- a/test/cmdlineTests/yul_stack_opt/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly --optimize diff --git a/test/cmdlineTests/yul_stack_opt/err b/test/cmdlineTests/yul_stack_opt/err deleted file mode 100644 index 014a1178f..000000000 --- a/test/cmdlineTests/yul_stack_opt/err +++ /dev/null @@ -1 +0,0 @@ -Warning: Yul is still experimental. Please use the output with care. diff --git a/test/cmdlineTests/yul_stack_opt/output b/test/cmdlineTests/yul_stack_opt/output deleted file mode 100644 index 7c0e8ca66..000000000 --- a/test/cmdlineTests/yul_stack_opt/output +++ /dev/null @@ -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 diff --git a/test/cmdlineTests/yul_stack_opt_disabled/args b/test/cmdlineTests/yul_stack_opt_disabled/args deleted file mode 100644 index 2c89c24e0..000000000 --- a/test/cmdlineTests/yul_stack_opt_disabled/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly diff --git a/test/cmdlineTests/yul_stack_opt_disabled/err b/test/cmdlineTests/yul_stack_opt_disabled/err deleted file mode 100644 index 3ff22e160..000000000 --- a/test/cmdlineTests/yul_stack_opt_disabled/err +++ /dev/null @@ -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. diff --git a/test/cmdlineTests/yul_stack_opt_disabled/exit b/test/cmdlineTests/yul_stack_opt_disabled/exit deleted file mode 100644 index d00491fd7..000000000 --- a/test/cmdlineTests/yul_stack_opt_disabled/exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/cmdlineTests/yul_stack_opt_disabled/output b/test/cmdlineTests/yul_stack_opt_disabled/output deleted file mode 100644 index c65f6f367..000000000 --- a/test/cmdlineTests/yul_stack_opt_disabled/output +++ /dev/null @@ -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) - } -}