mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8378 from mijovic/yulSourceLocations
Adding source location support to AssemblyStack
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
sstore
|
||||
/* \"A\":0:42 */
|
||||
pop
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":""}},"ir":"object \"object\" {
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||
code {
|
||||
let x := mload(0)
|
||||
sstore(add(x, 0), 0)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
pop
|
||||
stop
|
||||
data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":""}},"ir":"object \"NamedObject\" {
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
||||
code {
|
||||
let x := dataoffset(\"DataName\")
|
||||
sstore(add(x, 0), 0)
|
||||
|
||||
@@ -22,7 +22,7 @@ sub_0: assembly {
|
||||
/* \"A\":137:149 */
|
||||
revert
|
||||
}
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":""}},"ir":"object \"NamedObject\" {
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"NamedObject\" {
|
||||
code {
|
||||
let x := dataoffset(\"DataName\")
|
||||
sstore(add(x, 0), 0)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
mload
|
||||
/* \"A\":20:40 */
|
||||
sstore
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":""}},"ir":"object \"object\" {
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||
code {
|
||||
let x := mload(0)
|
||||
sstore(add(x, 0), 0)
|
||||
|
||||
@@ -74,6 +74,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li
|
||||
|
||||
MachineAssemblyObject obj = stack.assemble(AssemblyStack::Machine::EVM);
|
||||
solAssert(obj.bytecode, "");
|
||||
solAssert(obj.sourceMappings, "");
|
||||
|
||||
m_obtainedResult = "Assembly:\n" + obj.assembly;
|
||||
if (obj.bytecode->bytecode.empty())
|
||||
@@ -84,6 +85,8 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li
|
||||
toHex(obj.bytecode->bytecode) +
|
||||
"\nOpcodes: " +
|
||||
boost::trim_copy(evmasm::disassemble(obj.bytecode->bytecode)) +
|
||||
"\nSourceMappings:" +
|
||||
(obj.sourceMappings->empty() ? "" : " " + *obj.sourceMappings) +
|
||||
"\n";
|
||||
|
||||
if (m_expectation != m_obtainedResult)
|
||||
|
||||
@@ -9,3 +9,4 @@ object "a" {
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: fe
|
||||
// Opcodes: INVALID
|
||||
// SourceMappings:
|
||||
|
||||
@@ -46,3 +46,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: 600b600d600039600b6000f3fe6000600055600d600052fe
|
||||
// Opcodes: PUSH1 0xB PUSH1 0xD PUSH1 0x0 CODECOPY PUSH1 0xB PUSH1 0x0 RETURN INVALID PUSH1 0x0 PUSH1 0x0 SSTORE PUSH1 0xD PUSH1 0x0 MSTORE INVALID
|
||||
// SourceMappings: 26:47:0:-:0;;35:1;26:47;78:26;85:1;78:26
|
||||
|
||||
@@ -27,3 +27,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: 6006600055fe6008600055fe
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID PUSH1 0x8 PUSH1 0x0 SSTORE INVALID
|
||||
// SourceMappings: 22:28:0:-:0;29:1;22:28
|
||||
|
||||
@@ -14,3 +14,4 @@ object "a" {
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: 6006600055fe48656c6c6f2c20576f726c6421
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID 0x48 PUSH6 0x6C6C6F2C2057 PUSH16 0x726C6421000000000000000000000000
|
||||
// SourceMappings: 22:30:0:-:0;29:1;22:30
|
||||
|
||||
@@ -14,3 +14,4 @@ object "a" {
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: 6000600055fe
|
||||
// Opcodes: PUSH1 0x0 PUSH1 0x0 SSTORE INVALID
|
||||
// SourceMappings: 22:26:0:-:0;29:1;22:26
|
||||
|
||||
@@ -27,3 +27,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: 6006600055fe
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID
|
||||
// SourceMappings: 22:26:0:-:0;29:1;22:26
|
||||
|
||||
@@ -14,3 +14,4 @@ object "a" {
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: 600d600055fe
|
||||
// Opcodes: PUSH1 0xD PUSH1 0x0 SSTORE INVALID
|
||||
// SourceMappings: 22:28:0:-:0;29:1;22:28
|
||||
|
||||
@@ -14,3 +14,4 @@ object "a" {
|
||||
// data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
// Bytecode: 6006600055fe
|
||||
// Opcodes: PUSH1 0x6 PUSH1 0x0 SSTORE INVALID
|
||||
// SourceMappings: 22:24:0:-:0;29:1;22:24
|
||||
|
||||
@@ -28,3 +28,4 @@ object "Contract" {
|
||||
// sstore
|
||||
// Bytecode: 6009565b5b565b5b565b6001600055
|
||||
// Opcodes: PUSH1 0x9 JUMP JUMPDEST JUMPDEST JUMP JUMPDEST JUMPDEST JUMP JUMPDEST PUSH1 0x1 PUSH1 0x0 SSTORE
|
||||
// SourceMappings: 33:15:0:-:0;;;46:2;;53:15;66:2;;;83:1;80;73:12
|
||||
|
||||
@@ -11,3 +11,4 @@ object "a" {
|
||||
// sstore
|
||||
// Bytecode: 6001600055
|
||||
// Opcodes: PUSH1 0x1 PUSH1 0x0 SSTORE
|
||||
// SourceMappings: 32:1:0:-:0;29;22:12
|
||||
|
||||
@@ -38,3 +38,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: 600060003555fe
|
||||
// Opcodes: PUSH1 0x0 PUSH1 0x0 CALLDATALOAD SSTORE INVALID
|
||||
// SourceMappings: 48:1:0:-:0;;35:15;107:20
|
||||
|
||||
@@ -11,3 +11,4 @@
|
||||
// sstore
|
||||
// Bytecode: 6001600055
|
||||
// Opcodes: PUSH1 0x1 PUSH1 0x0 SSTORE
|
||||
// SourceMappings: 14:1:0:-:0;11;4:12
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
// sstore
|
||||
// Bytecode: 600060003555
|
||||
// Opcodes: PUSH1 0x0 PUSH1 0x0 CALLDATALOAD SSTORE
|
||||
// SourceMappings: 26:1:0:-:0;;13:15;79:20
|
||||
|
||||
@@ -19,3 +19,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: fe
|
||||
// Opcodes: INVALID
|
||||
// SourceMappings:
|
||||
|
||||
@@ -37,3 +37,4 @@ object "a" {
|
||||
// }
|
||||
// Bytecode: fe
|
||||
// Opcodes: INVALID
|
||||
// SourceMappings:
|
||||
|
||||
Reference in New Issue
Block a user