diff --git a/test/cmdlineTests/asm_json_export_yul_with_debug/args b/test/cmdlineTests/asm_json_export_yul_with_debug/args new file mode 100644 index 000000000..a639549cf --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_with_debug/args @@ -0,0 +1 @@ +--strict-assembly - --asm-json diff --git a/test/cmdlineTests/asm_json_export_yul_with_debug/output b/test/cmdlineTests/asm_json_export_yul_with_debug/output new file mode 100644 index 000000000..0cbab5cb2 --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_with_debug/output @@ -0,0 +1,3 @@ + +======= (EVM) ======= +{".code":[{"begin":0,"end":125,"name":"PUSH","source":0,"value":"80"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"40"},{"begin":0,"end":125,"name":"MSTORE","source":0},{"begin":0,"end":125,"name":"CALLVALUE","source":0},{"begin":0,"end":125,"name":"ISZERO","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"1"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"0"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"REVERT","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"1"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":56,"end":57,"name":"PUSH","source":0,"value":"2"},{"begin":33,"end":34,"name":"PUSH","source":0,"value":"0"},{"begin":0,"end":125,"name":"SSTORE","source":0},{"begin":33,"end":34,"name":"PUSH","source":0,"value":"0"},{"begin":33,"end":34,"name":"PUSH","source":0,"value":"1"},{"begin":0,"end":125,"name":"SSTORE","source":0},{"begin":0,"end":125,"name":"PUSH #[$]","source":0,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"PUSH [$]","source":0,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":0,"end":125,"name":"DUP4","source":0},{"begin":0,"end":125,"name":"CODECOPY","source":0},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"DUP3","source":0},{"begin":0,"end":125,"name":"RETURN","source":0}],".data":{"0":{".auxdata":"",".code":[{"begin":0,"end":125,"name":"PUSH","source":0,"value":"80"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"40"},{"begin":0,"end":125,"name":"MSTORE","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"4"},{"begin":0,"end":125,"name":"CALLDATASIZE","source":0},{"begin":0,"end":125,"name":"LT","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"1"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"0"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"CALLDATALOAD","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"E0"},{"begin":0,"end":125,"name":"SHR","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"B4F40C61"},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"EQ","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"3"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"E5AA3D58"},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"EQ","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"4"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"2"},{"begin":0,"end":125,"name":"JUMP","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"3"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"CALLVALUE","source":0},{"begin":0,"end":125,"name":"ISZERO","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"5"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"DUP3","source":0},{"begin":0,"end":125,"name":"REVERT","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"5"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"3"},{"begin":0,"end":125,"name":"NOT","source":0},{"begin":0,"end":125,"name":"CALLDATASIZE","source":0},{"begin":0,"end":125,"name":"ADD","source":0},{"begin":0,"end":125,"name":"SLT","source":0},{"begin":0,"end":125,"name":"ISZERO","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"6"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"DUP3","source":0},{"begin":0,"end":125,"name":"REVERT","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"6"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":40,"end":57,"name":"PUSH","source":0,"value":"1"},{"begin":0,"end":125,"name":"SLOAD","source":0},{"begin":0,"end":125,"name":"DUP4","source":0},{"begin":0,"end":125,"name":"MSTORE","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"20"},{"begin":0,"end":125,"name":"DUP4","source":0},{"begin":0,"end":125,"name":"RETURN","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"4"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"CALLVALUE","source":0},{"begin":0,"end":125,"name":"ISZERO","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"7"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"DUP3","source":0},{"begin":0,"end":125,"name":"REVERT","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"7"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"3"},{"begin":0,"end":125,"name":"NOT","source":0},{"begin":0,"end":125,"name":"CALLDATASIZE","source":0},{"begin":0,"end":125,"name":"ADD","source":0},{"begin":0,"end":125,"name":"SLT","source":0},{"begin":0,"end":125,"name":"ISZERO","source":0},{"begin":0,"end":125,"name":"PUSH [tag]","source":0,"value":"8"},{"begin":0,"end":125,"name":"JUMPI","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"DUP3","source":0},{"begin":0,"end":125,"name":"REVERT","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"8"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"SLOAD","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"40"},{"begin":0,"end":125,"name":"MLOAD","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"MSTORE","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"20"},{"begin":0,"end":125,"name":"DUP2","source":0},{"begin":0,"end":125,"name":"RETURN","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"2"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"POP","source":0},{"begin":0,"end":125,"name":"POP","source":0},{"begin":0,"end":125,"name":"tag","source":0,"value":"1"},{"begin":0,"end":125,"name":"JUMPDEST","source":0},{"begin":0,"end":125,"name":"PUSH","source":0,"value":"0"},{"begin":0,"end":125,"name":"DUP1","source":0},{"begin":0,"end":125,"name":"REVERT","source":0}]}},"sourceList":["state_var_initialization.sol"]} diff --git a/test/cmdlineTests/asm_json_export_yul_with_debug/stdin b/test/cmdlineTests/asm_json_export_yul_with_debug/stdin new file mode 100644 index 000000000..76acea75c --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_with_debug/stdin @@ -0,0 +1,50 @@ +/// @use-src 0:"state_var_initialization.sol" +object "C_23" { + code { + { + /// @src 0:0:125 "contract C {..." + let _1 := memoryguard(0x80) + mstore(64, _1) + if callvalue() { revert(0, 0) } + sstore(/** @src 0:33:34 "1" */ 0x00, /** @src 0:56:57 "2" */ 0x02) + /// @src 0:0:125 "contract C {..." + sstore(/** @src 0:33:34 "1" */ 0x01, 0x00) + /// @src 0:0:125 "contract C {..." + let _2 := datasize("C_23_deployed") + codecopy(_1, dataoffset("C_23_deployed"), _2) + return(_1, _2) + } + } + /// @use-src 0:"state_var_initialization.sol" + object "C_23_deployed" { + code { + { + /// @src 0:0:125 "contract C {..." + let _1 := memoryguard(0x80) + mstore(64, _1) + if iszero(lt(calldatasize(), 4)) + { + let _2 := 0 + switch shr(224, calldataload(_2)) + case 0xb4f40c61 { + if callvalue() { revert(_2, _2) } + if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) } + mstore(_1, sload(/** @src 0:40:57 "uint public k = 2" */ 1)) + /// @src 0:0:125 "contract C {..." + return(_1, 32) + } + case 0xe5aa3d58 { + if callvalue() { revert(_2, _2) } + if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) } + let _3 := sload(_2) + let memPos := mload(64) + mstore(memPos, _3) + return(memPos, 32) + } + } + revert(0, 0) + } + } + data ".metadata" hex"a2646970667358221220f04f800086d1bd95dea7e66c53d041963124c118e4dc70bc4b39a50865c2483f64736f6c63430008130033" + } +} \ No newline at end of file diff --git a/test/cmdlineTests/asm_json_export_yul_without_debug/args b/test/cmdlineTests/asm_json_export_yul_without_debug/args new file mode 100644 index 000000000..a639549cf --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_without_debug/args @@ -0,0 +1 @@ +--strict-assembly - --asm-json diff --git a/test/cmdlineTests/asm_json_export_yul_without_debug/output.orig b/test/cmdlineTests/asm_json_export_yul_without_debug/output.orig new file mode 100644 index 000000000..1415d157f --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_without_debug/output.orig @@ -0,0 +1,7 @@ + +======= (EVM) ======= +<<<<<<< HEAD +{".code":[{"begin":59,"end":76,"name":"PUSH","source":0,"value":"80"},{"begin":100,"end":102,"name":"DUP1","source":0},{"begin":96,"end":98,"name":"PUSH","source":0,"value":"40"},{"begin":89,"end":103,"name":"MSTORE","source":0},{"begin":119,"end":130,"name":"CALLVALUE","source":0},{"begin":116,"end":147,"name":"ISZERO","source":0},{"begin":116,"end":147,"name":"PUSH [tag]","source":0,"value":"1"},{"begin":116,"end":147,"name":"JUMPI","source":0},{"begin":143,"end":144,"name":"PUSH","source":0,"value":"0"},{"begin":140,"end":141,"name":"DUP1","source":0},{"begin":133,"end":145,"name":"REVERT","source":0},{"begin":116,"end":147,"name":"tag","source":0,"value":"1"},{"begin":116,"end":147,"name":"JUMPDEST","source":0},{"begin":173,"end":177,"name":"PUSH","source":0,"value":"2"},{"begin":167,"end":171,"name":"PUSH","source":0,"value":"0"},{"begin":160,"end":178,"name":"SSTORE","source":0},{"begin":204,"end":208,"name":"PUSH","source":0,"value":"0"},{"begin":198,"end":202,"name":"PUSH","source":0,"value":"1"},{"begin":191,"end":209,"name":"SSTORE","source":0},{"begin":232,"end":257,"name":"PUSH #[$]","source":0,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":312,"end":314,"name":"DUP1","source":0},{"begin":283,"end":310,"name":"PUSH [$]","source":0,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":279,"end":281,"name":"DUP4","source":0},{"begin":270,"end":315,"name":"CODECOPY","source":0},{"begin":339,"end":341,"name":"DUP1","source":0},{"begin":335,"end":337,"name":"DUP3","source":0},{"begin":328,"end":342,"name":"RETURN","source":0}],".data":{"0":{".auxdata":"",".code":[{"begin":443,"end":460,"name":"PUSH","source":0,"value":"80"},{"begin":488,"end":490,"name":"DUP1","source":0},{"begin":484,"end":486,"name":"PUSH","source":0,"value":"40"},{"begin":477,"end":491,"name":"MSTORE","source":0},{"begin":537,"end":538,"name":"PUSH","source":0,"value":"4"},{"begin":521,"end":535,"name":"CALLDATASIZE","source":0},{"begin":518,"end":539,"name":"LT","source":0},{"begin":508,"end":1367,"name":"PUSH [tag]","source":0,"value":"1"},{"begin":508,"end":1367,"name":"JUMPI","source":0},{"begin":589,"end":590,"name":"PUSH","source":0,"value":"0"},{"begin":640,"end":642,"name":"DUP1","source":0},{"begin":627,"end":643,"name":"CALLDATALOAD","source":0},{"begin":622,"end":625,"name":"PUSH","source":0,"value":"E0"},{"begin":618,"end":644,"name":"SHR","source":0},{"begin":670,"end":680,"name":"PUSH","source":0,"value":"B4F40C61"},{"begin":665,"end":970,"name":"DUP2","source":0},{"begin":665,"end":970,"name":"EQ","source":0},{"begin":665,"end":970,"name":"PUSH [tag]","source":0,"value":"3"},{"begin":665,"end":970,"name":"JUMPI","source":0},{"begin":996,"end":1006,"name":"PUSH","source":0,"value":"E5AA3D58"},{"begin":991,"end":1349,"name":"DUP2","source":0},{"begin":991,"end":1349,"name":"EQ","source":0},{"begin":991,"end":1349,"name":"PUSH [tag]","source":0,"value":"4"},{"begin":991,"end":1349,"name":"JUMPI","source":0},{"begin":611,"end":1349,"name":"PUSH [tag]","source":0,"value":"2"},{"begin":611,"end":1349,"name":"JUMP","source":0},{"begin":665,"end":970,"name":"tag","source":0,"value":"3"},{"begin":665,"end":970,"name":"JUMPDEST","source":0},{"begin":710,"end":721,"name":"CALLVALUE","source":0},{"begin":707,"end":740,"name":"ISZERO","source":0},{"begin":707,"end":740,"name":"PUSH [tag]","source":0,"value":"5"},{"begin":707,"end":740,"name":"JUMPI","source":0},{"begin":735,"end":737,"name":"DUP2","source":0},{"begin":731,"end":733,"name":"DUP3","source":0},{"begin":724,"end":738,"name":"REVERT","source":0},{"begin":707,"end":740,"name":"tag","source":0,"value":"5"},{"begin":707,"end":740,"name":"JUMPDEST","source":0},{"begin":801,"end":803,"name":"DUP2","source":0},{"begin":796,"end":797,"name":"PUSH","source":0,"value":"3"},{"begin":792,"end":798,"name":"NOT","source":0},{"begin":776,"end":790,"name":"CALLDATASIZE","source":0},{"begin":772,"end":799,"name":"ADD","source":0},{"begin":768,"end":804,"name":"SLT","source":0},{"begin":765,"end":823,"name":"ISZERO","source":0},{"begin":765,"end":823,"name":"PUSH [tag]","source":0,"value":"6"},{"begin":765,"end":823,"name":"JUMPI","source":0},{"begin":818,"end":820,"name":"DUP2","source":0},{"begin":814,"end":816,"name":"DUP3","source":0},{"begin":807,"end":821,"name":"REVERT","source":0},{"begin":765,"end":823,"name":"tag","source":0,"value":"6"},{"begin":765,"end":823,"name":"JUMPDEST","source":0},{"begin":906,"end":907,"name":"PUSH","source":0,"value":"1"},{"begin":859,"end":908,"name":"SLOAD","source":0},{"begin":855,"end":857,"name":"DUP4","source":0},{"begin":848,"end":909,"name":"MSTORE","source":0},{"begin":945,"end":947,"name":"PUSH","source":0,"value":"20"},{"begin":941,"end":943,"name":"DUP4","source":0},{"begin":934,"end":948,"name":"RETURN","source":0},{"begin":991,"end":1349,"name":"tag","source":0,"value":"4"},{"begin":991,"end":1349,"name":"JUMPDEST","source":0},{"begin":1036,"end":1047,"name":"CALLVALUE","source":0},{"begin":1033,"end":1066,"name":"ISZERO","source":0},{"begin":1033,"end":1066,"name":"PUSH [tag]","source":0,"value":"7"},{"begin":1033,"end":1066,"name":"JUMPI","source":0},{"begin":1061,"end":1063,"name":"DUP2","source":0},{"begin":1057,"end":1059,"name":"DUP3","source":0},{"begin":1050,"end":1064,"name":"REVERT","source":0},{"begin":1033,"end":1066,"name":"tag","source":0,"value":"7"},{"begin":1033,"end":1066,"name":"JUMPDEST","source":0},{"begin":1127,"end":1129,"name":"DUP2","source":0},{"begin":1122,"end":1123,"name":"PUSH","source":0,"value":"3"},{"begin":1118,"end":1124,"name":"NOT","source":0},{"begin":1102,"end":1116,"name":"CALLDATASIZE","source":0},{"begin":1098,"end":1125,"name":"ADD","source":0},{"begin":1094,"end":1130,"name":"SLT","source":0},{"begin":1091,"end":1149,"name":"ISZERO","source":0},{"begin":1091,"end":1149,"name":"PUSH [tag]","source":0,"value":"8"},{"begin":1091,"end":1149,"name":"JUMPI","source":0},{"begin":1144,"end":1146,"name":"DUP2","source":0},{"begin":1140,"end":1142,"name":"DUP3","source":0},{"begin":1133,"end":1147,"name":"REVERT","source":0},{"begin":1091,"end":1149,"name":"tag","source":0,"value":"8"},{"begin":1091,"end":1149,"name":"JUMPDEST","source":0},{"begin":1190,"end":1192,"name":"DUP2","source":0},{"begin":1184,"end":1193,"name":"SLOAD","source":0},{"begin":1238,"end":1240,"name":"PUSH","source":0,"value":"40"},{"begin":1232,"end":1241,"name":"MLOAD","source":0},{"begin":1281,"end":1283,"name":"DUP2","source":0},{"begin":1273,"end":1279,"name":"DUP2","source":0},{"begin":1266,"end":1284,"name":"MSTORE","source":0},{"begin":1324,"end":1326,"name":"PUSH","source":0,"value":"20"},{"begin":1316,"end":1322,"name":"DUP2","source":0},{"begin":1309,"end":1327,"name":"RETURN","source":0},{"begin":611,"end":1349,"name":"tag","source":0,"value":"2"},{"begin":611,"end":1349,"name":"JUMPDEST","source":0},{"begin":611,"end":1349,"name":"POP","source":0},{"begin":557,"end":1367,"name":"POP","source":0},{"begin":508,"end":1367,"name":"tag","source":0,"value":"1"},{"begin":508,"end":1367,"name":"JUMPDEST","source":0},{"begin":1394,"end":1395,"name":"PUSH","source":0,"value":"0"},{"begin":1391,"end":1392,"name":"DUP1","source":0},{"begin":1384,"end":1396,"name":"REVERT","source":0}]}},"sourceList":[""]} +======= +{".code":[{"begin":59,"end":76,"name":"PUSH","source":-1,"value":"80"},{"begin":100,"end":102,"name":"DUP1","source":-1},{"begin":96,"end":98,"name":"PUSH","source":-1,"value":"40"},{"begin":89,"end":103,"name":"MSTORE","source":-1},{"begin":119,"end":130,"name":"CALLVALUE","source":-1},{"begin":116,"end":147,"name":"ISZERO","source":-1},{"begin":116,"end":147,"name":"PUSH [tag]","source":-1,"value":"1"},{"begin":116,"end":147,"name":"JUMPI","source":-1},{"begin":143,"end":144,"name":"PUSH","source":-1,"value":"0"},{"begin":140,"end":141,"name":"DUP1","source":-1},{"begin":133,"end":145,"name":"REVERT","source":-1},{"begin":116,"end":147,"name":"tag","source":-1,"value":"1"},{"begin":116,"end":147,"name":"JUMPDEST","source":-1},{"begin":173,"end":177,"name":"PUSH","source":-1,"value":"2"},{"begin":167,"end":171,"name":"PUSH","source":-1,"value":"0"},{"begin":160,"end":178,"name":"SSTORE","source":-1},{"begin":204,"end":208,"name":"PUSH","source":-1,"value":"0"},{"begin":198,"end":202,"name":"PUSH","source":-1,"value":"1"},{"begin":191,"end":209,"name":"SSTORE","source":-1},{"begin":232,"end":257,"name":"PUSH #[$]","source":-1,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":312,"end":314,"name":"DUP1","source":-1},{"begin":283,"end":310,"name":"PUSH [$]","source":-1,"value":"0000000000000000000000000000000000000000000000000000000000000000"},{"begin":279,"end":281,"name":"DUP4","source":-1},{"begin":270,"end":315,"name":"CODECOPY","source":-1},{"begin":339,"end":341,"name":"DUP1","source":-1},{"begin":335,"end":337,"name":"DUP3","source":-1},{"begin":328,"end":342,"name":"RETURN","source":-1}],".data":{"0":{".auxdata":"",".code":[{"begin":443,"end":460,"name":"PUSH","source":-1,"value":"80"},{"begin":488,"end":490,"name":"DUP1","source":-1},{"begin":484,"end":486,"name":"PUSH","source":-1,"value":"40"},{"begin":477,"end":491,"name":"MSTORE","source":-1},{"begin":537,"end":538,"name":"PUSH","source":-1,"value":"4"},{"begin":521,"end":535,"name":"CALLDATASIZE","source":-1},{"begin":518,"end":539,"name":"LT","source":-1},{"begin":508,"end":1367,"name":"PUSH [tag]","source":-1,"value":"1"},{"begin":508,"end":1367,"name":"JUMPI","source":-1},{"begin":589,"end":590,"name":"PUSH","source":-1,"value":"0"},{"begin":640,"end":642,"name":"DUP1","source":-1},{"begin":627,"end":643,"name":"CALLDATALOAD","source":-1},{"begin":622,"end":625,"name":"PUSH","source":-1,"value":"E0"},{"begin":618,"end":644,"name":"SHR","source":-1},{"begin":670,"end":680,"name":"PUSH","source":-1,"value":"B4F40C61"},{"begin":665,"end":970,"name":"DUP2","source":-1},{"begin":665,"end":970,"name":"EQ","source":-1},{"begin":665,"end":970,"name":"PUSH [tag]","source":-1,"value":"3"},{"begin":665,"end":970,"name":"JUMPI","source":-1},{"begin":996,"end":1006,"name":"PUSH","source":-1,"value":"E5AA3D58"},{"begin":991,"end":1349,"name":"DUP2","source":-1},{"begin":991,"end":1349,"name":"EQ","source":-1},{"begin":991,"end":1349,"name":"PUSH [tag]","source":-1,"value":"4"},{"begin":991,"end":1349,"name":"JUMPI","source":-1},{"begin":611,"end":1349,"name":"PUSH [tag]","source":-1,"value":"2"},{"begin":611,"end":1349,"name":"JUMP","source":-1},{"begin":665,"end":970,"name":"tag","source":-1,"value":"3"},{"begin":665,"end":970,"name":"JUMPDEST","source":-1},{"begin":710,"end":721,"name":"CALLVALUE","source":-1},{"begin":707,"end":740,"name":"ISZERO","source":-1},{"begin":707,"end":740,"name":"PUSH [tag]","source":-1,"value":"5"},{"begin":707,"end":740,"name":"JUMPI","source":-1},{"begin":735,"end":737,"name":"DUP2","source":-1},{"begin":731,"end":733,"name":"DUP3","source":-1},{"begin":724,"end":738,"name":"REVERT","source":-1},{"begin":707,"end":740,"name":"tag","source":-1,"value":"5"},{"begin":707,"end":740,"name":"JUMPDEST","source":-1},{"begin":801,"end":803,"name":"DUP2","source":-1},{"begin":796,"end":797,"name":"PUSH","source":-1,"value":"3"},{"begin":792,"end":798,"name":"NOT","source":-1},{"begin":776,"end":790,"name":"CALLDATASIZE","source":-1},{"begin":772,"end":799,"name":"ADD","source":-1},{"begin":768,"end":804,"name":"SLT","source":-1},{"begin":765,"end":823,"name":"ISZERO","source":-1},{"begin":765,"end":823,"name":"PUSH [tag]","source":-1,"value":"6"},{"begin":765,"end":823,"name":"JUMPI","source":-1},{"begin":818,"end":820,"name":"DUP2","source":-1},{"begin":814,"end":816,"name":"DUP3","source":-1},{"begin":807,"end":821,"name":"REVERT","source":-1},{"begin":765,"end":823,"name":"tag","source":-1,"value":"6"},{"begin":765,"end":823,"name":"JUMPDEST","source":-1},{"begin":906,"end":907,"name":"PUSH","source":-1,"value":"1"},{"begin":859,"end":908,"name":"SLOAD","source":-1},{"begin":855,"end":857,"name":"DUP4","source":-1},{"begin":848,"end":909,"name":"MSTORE","source":-1},{"begin":945,"end":947,"name":"PUSH","source":-1,"value":"20"},{"begin":941,"end":943,"name":"DUP4","source":-1},{"begin":934,"end":948,"name":"RETURN","source":-1},{"begin":991,"end":1349,"name":"tag","source":-1,"value":"4"},{"begin":991,"end":1349,"name":"JUMPDEST","source":-1},{"begin":1036,"end":1047,"name":"CALLVALUE","source":-1},{"begin":1033,"end":1066,"name":"ISZERO","source":-1},{"begin":1033,"end":1066,"name":"PUSH [tag]","source":-1,"value":"7"},{"begin":1033,"end":1066,"name":"JUMPI","source":-1},{"begin":1061,"end":1063,"name":"DUP2","source":-1},{"begin":1057,"end":1059,"name":"DUP3","source":-1},{"begin":1050,"end":1064,"name":"REVERT","source":-1},{"begin":1033,"end":1066,"name":"tag","source":-1,"value":"7"},{"begin":1033,"end":1066,"name":"JUMPDEST","source":-1},{"begin":1127,"end":1129,"name":"DUP2","source":-1},{"begin":1122,"end":1123,"name":"PUSH","source":-1,"value":"3"},{"begin":1118,"end":1124,"name":"NOT","source":-1},{"begin":1102,"end":1116,"name":"CALLDATASIZE","source":-1},{"begin":1098,"end":1125,"name":"ADD","source":-1},{"begin":1094,"end":1130,"name":"SLT","source":-1},{"begin":1091,"end":1149,"name":"ISZERO","source":-1},{"begin":1091,"end":1149,"name":"PUSH [tag]","source":-1,"value":"8"},{"begin":1091,"end":1149,"name":"JUMPI","source":-1},{"begin":1144,"end":1146,"name":"DUP2","source":-1},{"begin":1140,"end":1142,"name":"DUP3","source":-1},{"begin":1133,"end":1147,"name":"REVERT","source":-1},{"begin":1091,"end":1149,"name":"tag","source":-1,"value":"8"},{"begin":1091,"end":1149,"name":"JUMPDEST","source":-1},{"begin":1190,"end":1192,"name":"DUP2","source":-1},{"begin":1184,"end":1193,"name":"SLOAD","source":-1},{"begin":1238,"end":1240,"name":"PUSH","source":-1,"value":"40"},{"begin":1232,"end":1241,"name":"MLOAD","source":-1},{"begin":1281,"end":1283,"name":"DUP2","source":-1},{"begin":1273,"end":1279,"name":"DUP2","source":-1},{"begin":1266,"end":1284,"name":"MSTORE","source":-1},{"begin":1324,"end":1326,"name":"PUSH","source":-1,"value":"20"},{"begin":1316,"end":1322,"name":"DUP2","source":-1},{"begin":1309,"end":1327,"name":"RETURN","source":-1},{"begin":611,"end":1349,"name":"tag","source":-1,"value":"2"},{"begin":611,"end":1349,"name":"JUMPDEST","source":-1},{"begin":611,"end":1349,"name":"POP","source":-1},{"begin":557,"end":1367,"name":"POP","source":-1},{"begin":508,"end":1367,"name":"tag","source":-1,"value":"1"},{"begin":508,"end":1367,"name":"JUMPDEST","source":-1},{"begin":1394,"end":1395,"name":"PUSH","source":-1,"value":"0"},{"begin":1391,"end":1392,"name":"DUP1","source":-1},{"begin":1384,"end":1396,"name":"REVERT","source":-1}]}},"sourceList":[]} +>>>>>>> a9f8f4ed9 (Yul to EVM assembly json export: Add simple cmdline tests.) diff --git a/test/cmdlineTests/asm_json_export_yul_without_debug/stdin b/test/cmdlineTests/asm_json_export_yul_without_debug/stdin new file mode 100644 index 000000000..91fa43622 --- /dev/null +++ b/test/cmdlineTests/asm_json_export_yul_without_debug/stdin @@ -0,0 +1,43 @@ +object "C_23" { + code { + { + let _1 := memoryguard(0x80) + mstore(64, _1) + if callvalue() { revert(0, 0) } + sstore(0x00, 0x02) + sstore(0x01, 0x00) + let _2 := datasize("C_23_deployed") + codecopy(_1, dataoffset("C_23_deployed"), _2) + return(_1, _2) + } + } + object "C_23_deployed" { + code { + { + let _1 := memoryguard(0x80) + mstore(64, _1) + if iszero(lt(calldatasize(), 4)) + { + let _2 := 0 + switch shr(224, calldataload(_2)) + case 0xb4f40c61 { + if callvalue() { revert(_2, _2) } + if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) } + mstore(_1, sload(/** @src 0:40:57 "uint public k = 2" */ 1)) + return(_1, 32) + } + case 0xe5aa3d58 { + if callvalue() { revert(_2, _2) } + if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) } + let _3 := sload(_2) + let memPos := mload(64) + mstore(memPos, _3) + return(memPos, 32) + } + } + revert(0, 0) + } + } + data ".metadata" hex"a2646970667358221220f04f800086d1bd95dea7e66c53d041963124c118e4dc70bc4b39a50865c2483f64736f6c63430008130033" + } +} \ No newline at end of file diff --git a/test/cmdlineTests/asm_json_import_untagged_jumpdest/err b/test/cmdlineTests/asm_json_import_untagged_jumpdest/err index a66226c20..ff4cd27bc 100644 --- a/test/cmdlineTests/asm_json_import_untagged_jumpdest/err +++ b/test/cmdlineTests/asm_json_import_untagged_jumpdest/err @@ -1 +1 @@ -Assembly Import Error: JUMPDEST instruction found that was not followed by tag. +Assembly Import Error: JUMPDEST instruction without a tag