Merge pull request #11944 from ethereum/debug-info-selection

Debug info selection
This commit is contained in:
chriseth
2021-10-12 16:39:50 +02:00
committed by GitHub
109 changed files with 2427 additions and 91 deletions
@@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info all
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,213 @@
======= debug_info_in_yul_and_evm_asm_print_all/input.sol:C =======
EVM assembly:
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":77:99 function f() public {} */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101 "contract C {..."
function constructor_C_6() {
/// @src 0:60:101 "contract C {..."
}
/// @src 0:60:101 "contract C {..."
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @ast-id 5
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
code {
{
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6_deployed" {
code {
{
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
@@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info location,all,none
@@ -0,0 +1 @@
Invalid value for --debug-info option: location,all,none
@@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info location
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,212 @@
======= debug_info_in_yul_and_evm_asm_print_location_only/input.sol:C =======
EVM assembly:
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":77:99 */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
code {
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101
function constructor_C_6() {
/// @src 0:60:101
}
/// @src 0:60:101
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @src 0:77:99
function fun_f_5() {
}
/// @src 0:60:101
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6_deployed" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
@@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info none
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,201 @@
======= debug_info_in_yul_and_evm_asm_print_none/input.sol:C =======
EVM assembly:
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
code {
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function constructor_C_6() {
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6_deployed" {
code {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function fun_f_5() {
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6_deployed" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
@@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info snippet
@@ -0,0 +1 @@
To use 'snippet' with --debug-info you must select also 'location'.
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_all/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["*"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}
@@ -0,0 +1,230 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " /* \"C\":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* \"C\":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* \"C\":77:99 function f() public {} */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101 \"contract C {...\"
function constructor_C_6() {
/// @src 0:60:101 \"contract C {...\"
}
/// @src 0:60:101 \"contract C {...\"
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @ast-id 5
/// @src 0:77:99 \"function f() public {}\"
function fun_f_5() {
}
/// @src 0:60:101 \"contract C {...\"
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_location_only/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["location"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}
@@ -0,0 +1,229 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " /* \"C\":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* \"C\":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* \"C\":77:99 */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101
function constructor_C_6() {
/// @src 0:60:101
}
/// @src 0:60:101
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @src 0:77:99
function fun_f_5() {
}
/// @src 0:60:101
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_none/in.sol"]}
},
"settings": {
"debug": {"debugInfo": []},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}
@@ -0,0 +1,218 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function constructor_C_6() {
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function fun_f_5() {
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_snippet_only/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["snippet"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}
@@ -0,0 +1,12 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"message": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"severity": "error",
"type": "JSONError"
}
]
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_all/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["*"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}
@@ -0,0 +1,36 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " /* \"input.sol\":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
/* \"input.sol\":77:99 */
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"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"
}
]
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_location_only/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["location"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}
@@ -0,0 +1,36 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " /* \"input.sol\":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
/* \"input.sol\":77:99 */
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"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"
}
]
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_none/in.yul"]}
},
"settings": {
"debug": {"debugInfo": []},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}
@@ -0,0 +1,34 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"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"
}
]
}
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_snippet_only/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["snippet"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}
@@ -0,0 +1,12 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"message": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"severity": "error",
"type": "JSONError"
}
]
}
@@ -0,0 +1 @@
--strict-assembly --debug-info all
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,32 @@
======= strict_asm_debug_info_print_all/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
fun_f_5()
/// @src 0:77:99
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
/* "input.sol":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
/* "input.sol":77:99 */
jump(tag_3)
tag_1:
jump // out
tag_3:
@@ -0,0 +1 @@
--strict-assembly --debug-info location
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,32 @@
======= strict_asm_debug_info_print_location_only/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
fun_f_5()
/// @src 0:77:99
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
/* "input.sol":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
/* "input.sol":77:99 */
jump(tag_3)
tag_1:
jump // out
tag_3:
@@ -0,0 +1 @@
--strict-assembly --debug-info none
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
@@ -0,0 +1,28 @@
======= strict_asm_debug_info_print_none/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
mstore(64, 128)
fun_f_5()
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
jump(tag_3)
tag_1:
jump // out
tag_3:
@@ -0,0 +1 @@
--strict-assembly --debug-info snippet
@@ -0,0 +1 @@
To use 'snippet' with --debug-info you must select also 'location'.
@@ -0,0 +1 @@
1
@@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}
+20 -4
View File
@@ -28,8 +28,9 @@
#include <libyul/AssemblyStack.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libevmasm/Assembly.h>
@@ -59,7 +60,12 @@ std::optional<Error> parseAndReturnFirstError(
AssemblyStack::Machine _machine = AssemblyStack::Machine::EVM
)
{
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), _language, solidity::frontend::OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
_language,
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::None()
);
bool success = false;
try
{
@@ -125,7 +131,12 @@ Error expectError(
void parsePrintCompare(string const& _source, bool _canWarn = false)
{
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), AssemblyStack::Language::Assembly, OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::Assembly,
OptimiserSettings::none(),
DebugInfoSelection::None()
);
BOOST_REQUIRE(stack.parseAndAnalyze("", _source));
if (_canWarn)
BOOST_REQUIRE(!Error::containsErrors(stack.errors()));
@@ -210,7 +221,12 @@ BOOST_AUTO_TEST_CASE(print_string_literal_unicode)
{
string source = "{ let x := \"\\u1bac\" }";
string parsed = "object \"object\" {\n code { let x := \"\\xe1\\xae\\xac\" }\n}\n";
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), AssemblyStack::Language::Assembly, OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::Assembly,
OptimiserSettings::none(),
DebugInfoSelection::None()
);
BOOST_REQUIRE(stack.parseAndAnalyze("", source));
BOOST_REQUIRE(stack.errors().empty());
BOOST_CHECK_EQUAL(stack.print(), parsed);
@@ -21,17 +21,22 @@
* Framework for executing Solidity contracts and testing them against C++ implementation.
*/
#include <cstdlib>
#include <iostream>
#include <boost/test/framework.hpp>
#include <test/libsolidity/SolidityExecutionFramework.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <boost/test/framework.hpp>
#include <cstdlib>
#include <iostream>
using namespace solidity;
using namespace solidity::test;
using namespace solidity::frontend;
using namespace solidity::frontend::test;
using namespace solidity::langutil;
using namespace solidity::test;
using namespace std;
bytes SolidityExecutionFramework::multiSourceCompileContract(
@@ -91,8 +96,12 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
else if (forceEnableOptimizer)
optimiserSettings = OptimiserSettings::full();
yul::AssemblyStack
asmStack(m_evmVersion, yul::AssemblyStack::Language::StrictAssembly, optimiserSettings);
yul::AssemblyStack asmStack(
m_evmVersion,
yul::AssemblyStack::Language::StrictAssembly,
optimiserSettings,
DebugInfoSelection::All()
);
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");
+5 -4
View File
@@ -23,8 +23,6 @@
#include <test/Common.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libyul/optimiser/Disambiguator.h>
#include <libyul/AsmAnalysis.h>
#include <libyul/AsmPrinter.h>
@@ -33,8 +31,10 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <boost/test/unit_test.hpp>
@@ -60,7 +60,8 @@ pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(strin
_yul ? AssemblyStack::Language::Yul : AssemblyStack::Language::StrictAssembly,
solidity::test::CommonOptions::get().optimize ?
solidity::frontend::OptimiserSettings::standard() :
solidity::frontend::OptimiserSettings::minimal()
solidity::frontend::OptimiserSettings::minimal(),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("", _source) || !stack.errors().empty())
BOOST_FAIL("Invalid source.");
+6 -1
View File
@@ -47,7 +47,12 @@ TestCase::TestResult EVMCodeTransformTest::run(ostream& _stream, string const& _
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::none();
settings.runYulOptimiser = false;
settings.optimizeStackAllocation = m_stackOpt;
AssemblyStack stack(EVMVersion{}, AssemblyStack::Language::StrictAssembly, settings);
AssemblyStack stack(
EVMVersion{},
AssemblyStack::Language::StrictAssembly,
settings,
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("", m_source))
{
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl;
+3 -1
View File
@@ -30,6 +30,7 @@
#include <libyul/AST.h>
#include <libyul/Object.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/SourceReferenceFormatter.h>
@@ -82,7 +83,8 @@ bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bo
m_stack = AssemblyStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
if (m_stack.parseAndAnalyze("", m_source))
{
-1
View File
@@ -27,7 +27,6 @@
#include <libyul/optimiser/FullInliner.h>
#include <libyul/optimiser/FunctionHoister.h>
#include <libyul/optimiser/FunctionGrouper.h>
#include <libyul/AsmPrinter.h>
#include <libyul/AST.h>
#include <boost/test/unit_test.hpp>
+3 -1
View File
@@ -26,6 +26,7 @@
#include <libevmasm/Instruction.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <boost/algorithm/string.hpp>
@@ -64,7 +65,8 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li
AssemblyStack stack(
EVMVersion(),
m_wasm ? AssemblyStack::Language::Ewasm : AssemblyStack::Language::StrictAssembly,
OptimiserSettings::preset(m_optimisationPreset)
OptimiserSettings::preset(m_optimisationPreset),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", m_source))
{
+5 -2
View File
@@ -23,6 +23,7 @@
#include <test/libsolidity/ErrorCheck.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Scanner.h>
#include <libyul/AssemblyStack.h>
@@ -60,7 +61,8 @@ pair<bool, ErrorList> parse(string const& _source)
AssemblyStack asmStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
bool success = asmStack.parseAndAnalyze("source", _source);
return {success, asmStack.errors()};
@@ -181,7 +183,8 @@ BOOST_AUTO_TEST_CASE(to_string)
AssemblyStack asmStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
BOOST_REQUIRE(asmStack.parseAndAnalyze("source", code));
BOOST_CHECK_EQUAL(asmStack.print(), expectation);
+3 -1
View File
@@ -26,6 +26,7 @@
#include <libyul/AssemblyStack.h>
#include <libyul/AsmAnalysisInfo.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/SourceReferenceFormatter.h>
@@ -67,7 +68,8 @@ bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
if (stack.parseAndAnalyze("", m_source))
{
-1
View File
@@ -61,7 +61,6 @@
#include <libyul/backends/evm/EVMMetrics.h>
#include <libyul/backends/wasm/WordSizeTransform.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <libyul/AsmPrinter.h>
#include <libyul/AsmAnalysis.h>
#include <libyul/CompilabilityChecker.h>
+4
View File
@@ -127,6 +127,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
"--evm-version=spuriousDragon",
"--experimental-via-ir",
"--revert-strings=strip",
"--debug-info=location",
"--pretty-json",
"--json-indent=7",
"--no-color",
@@ -180,6 +181,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
expectedOptions.output.evmVersion = EVMVersion::spuriousDragon();
expectedOptions.output.experimentalViaIR = true;
expectedOptions.output.revertStrings = RevertStrings::Strip;
expectedOptions.output.debugInfoSelection = DebugInfoSelection::fromString("location");
expectedOptions.formatting.json = JsonFormat{JsonFormat::Pretty, 7};
expectedOptions.linker.libraries = {
{"dir1/file1.sol:L", h160("1234567890123456789012345678901234567890")},
@@ -269,6 +271,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
"--overwrite",
"--evm-version=spuriousDragon",
"--revert-strings=strip", // Accepted but has no effect in assembly mode
"--debug-info=location",
"--pretty-json",
"--json-indent=1",
"--no-color",
@@ -315,6 +318,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
expectedOptions.output.overwriteFiles = true;
expectedOptions.output.evmVersion = EVMVersion::spuriousDragon();
expectedOptions.output.revertStrings = RevertStrings::Strip;
expectedOptions.output.debugInfoSelection = DebugInfoSelection::fromString("location");
expectedOptions.formatting.json = JsonFormat {JsonFormat::Pretty, 1};
expectedOptions.assembly.targetMachine = expectedMachine;
expectedOptions.assembly.inputLanguage = expectedLanguage;
+4 -1
View File
@@ -23,6 +23,8 @@
#include <libsolidity/interface/OptimiserSettings.h>
#include <liblangutil/DebugInfoSelection.h>
namespace solidity::test::fuzzer
{
class YulAssembler
@@ -36,7 +38,8 @@ public:
m_stack(
_version,
solidity::yul::AssemblyStack::Language::StrictAssembly,
_optSettings
_optSettings,
langutil::DebugInfoSelection::All()
),
m_yulProgram(_yulSource),
m_optimiseYul(_optSettings.runYulOptimiser)
@@ -17,9 +17,11 @@
// SPDX-License-Identifier: GPL-3.0
#include <libyul/AssemblyStack.h>
#include <liblangutil/EVMVersion.h>
#include <libyul/backends/evm/EVMCodeTransform.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
using namespace solidity;
using namespace solidity::yul;
using namespace std;
@@ -38,7 +40,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
langutil::DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", input))
@@ -22,6 +22,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/EVMVersion.h>
@@ -61,7 +62,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
try
{
+5 -1
View File
@@ -17,9 +17,12 @@
// SPDX-License-Identifier: GPL-3.0
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
using namespace solidity;
using namespace solidity::langutil;
using namespace solidity::util;
using namespace solidity::yul;
using namespace std;
@@ -38,7 +41,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", input))
+4 -2
View File
@@ -30,15 +30,16 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
#include <src/libfuzzer/libfuzzer_macro.h>
using namespace solidity;
using namespace solidity::langutil;
using namespace solidity::yul;
using namespace solidity::yul::test;
using namespace solidity::yul::test::yul_fuzzer;
using namespace solidity::langutil;
using namespace std;
DEFINE_PROTO_FUZZER(Program const& _input)
@@ -64,7 +65,8 @@ DEFINE_PROTO_FUZZER(Program const& _input)
AssemblyStack stack(
version,
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
// Parse protobuf mutated YUL code
+3 -1
View File
@@ -30,6 +30,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/Exceptions.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceReferenceFormatter.h>
@@ -63,7 +64,8 @@ DEFINE_PROTO_FUZZER(Program const& _input)
AssemblyStack stack(
version,
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
// Parse protobuf mutated YUL code
+3 -1
View File
@@ -27,6 +27,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceReferenceFormatter.h>
@@ -58,7 +59,8 @@ pair<shared_ptr<Block>, shared_ptr<AsmAnalysisInfo>> parse(string const& _source
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::Default()
);
if (stack.parseAndAnalyze("--INPUT--", _source))
{