diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index acf655c82..37b6ea33a 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -38,6 +38,7 @@ #include #include +#include using namespace std; using namespace solidity; @@ -761,8 +762,16 @@ LinkerObject const& Assembly::assemble() const for (auto const& [name, tagInfo]: m_namedTags) { size_t position = m_tagPositionsInBytecode.at(tagInfo.id); + optional tagIndex; + for (auto&& [index, item]: m_items | ranges::views::enumerate) + if (item.type() == Tag && static_cast(item.data()) == tagInfo.id) + { + tagIndex = index; + break; + } ret.functionDebugData[name] = { position == numeric_limits::max() ? nullopt : optional{position}, + tagIndex, tagInfo.sourceID, tagInfo.params, tagInfo.returns diff --git a/libevmasm/LinkerObject.h b/libevmasm/LinkerObject.h index e512dd7ab..c23426882 100644 --- a/libevmasm/LinkerObject.h +++ b/libevmasm/LinkerObject.h @@ -48,6 +48,7 @@ struct LinkerObject struct FunctionDebugData { std::optional bytecodeOffset; + std::optional instructionIndex; std::optional sourceID; size_t params = {}; size_t returns = {}; diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp index e3308b2de..c044760a0 100644 --- a/libsolidity/codegen/Compiler.cpp +++ b/libsolidity/codegen/Compiler.cpp @@ -60,8 +60,3 @@ std::shared_ptr Compiler::runtimeAssemblyPtr() const solAssert(m_context.runtimeContext(), ""); return m_context.runtimeContext()->assemblyPtr(); } - -evmasm::AssemblyItem Compiler::functionEntryLabel(FunctionDefinition const& _function) const -{ - return m_runtimeContext.functionEntryLabelIfExists(_function); -} diff --git a/libsolidity/codegen/Compiler.h b/libsolidity/codegen/Compiler.h index 0d021b723..1267c1a2d 100644 --- a/libsolidity/codegen/Compiler.h +++ b/libsolidity/codegen/Compiler.h @@ -62,10 +62,6 @@ public: std::string generatedYulUtilityCode() const { return m_context.generatedYulUtilityCode(); } std::string runtimeGeneratedYulUtilityCode() const { return m_runtimeContext.generatedYulUtilityCode(); } - /// @returns the entry label of the given function. Might return an AssemblyItem of type - /// UndefinedItem if it does not exist yet. - evmasm::AssemblyItem functionEntryLabel(FunctionDefinition const& _function) const; - private: OptimiserSettings const m_optimiserSettings; CompilerContext m_runtimeContext; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 3b5fb8cb5..1703aa6cc 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -1054,16 +1054,10 @@ size_t CompilerStack::functionEntryPoint( if (m_stackState != CompilationSuccessful) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful.")); - shared_ptr const& compiler = contract(_contractName).compiler; - if (!compiler) - return 0; - evmasm::AssemblyItem tag = compiler->functionEntryLabel(_function); - if (tag.type() == evmasm::UndefinedItem) - return 0; - evmasm::AssemblyItems const& items = compiler->runtimeAssembly().items(); - for (size_t i = 0; i < items.size(); ++i) - if (items.at(i).type() == evmasm::Tag && items.at(i).data() == tag.data()) - return i; + for (auto&& [name, data]: contract(_contractName).runtimeObject.functionDebugData) + if (data.sourceID == _function.id()) + if (data.instructionIndex) + return *data.instructionIndex; return 0; } diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 824a4b025..3ae8d7144 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -252,7 +252,7 @@ void CodeTransform::operator()(FunctionCall const& _call) visitExpression(arg); m_assembly.setSourceLocation(locationOf(_call)); m_assembly.appendJumpTo( - functionEntryID(_call.functionName.name, *function), + functionEntryID(*function), static_cast(function->returns.size() - function->arguments.size()) - 1, AbstractAssembly::JumpType::IntoFunction ); @@ -374,7 +374,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) m_assembly.setSourceLocation(locationOf(_function)); int const stackHeightBefore = m_assembly.stackHeight(); - m_assembly.appendLabel(functionEntryID(_function.name, function)); + m_assembly.appendLabel(functionEntryID(function)); m_assembly.setStackHeight(static_cast(height)); @@ -563,6 +563,10 @@ void CodeTransform::operator()(Block const& _block) Scope* originalScope = m_scope; m_scope = m_info.scopes.at(&_block).get(); + for (auto const& statement: _block.statements) + if (auto function = get_if(&statement)) + createFunctionEntryID(*function); + int blockStartStackHeight = m_assembly.stackHeight(); visitStatements(_block.statements); @@ -572,17 +576,30 @@ void CodeTransform::operator()(Block const& _block) m_scope = originalScope; } -AbstractAssembly::LabelID CodeTransform::functionEntryID(YulString _name, Scope::Function const& _function) +void CodeTransform::createFunctionEntryID(FunctionDefinition const& _function) { - if (!m_context->functionEntryIDs.count(&_function)) - { - AbstractAssembly::LabelID id = - m_useNamedLabelsForFunctions ? - m_assembly.namedLabel(_name.str(), _function.arguments.size(), _function.returns.size(), {}) : - m_assembly.newLabelId(); - m_context->functionEntryIDs[&_function] = id; - } - return m_context->functionEntryIDs[&_function]; + Scope::Function& scopeFunction = std::get(m_scope->identifiers.at(_function.name)); + yulAssert(!m_context->functionEntryIDs.count(&scopeFunction), ""); + + optional astID; + if (_function.debugData) + astID = _function.debugData->astID; + + m_context->functionEntryIDs[&scopeFunction] = + m_useNamedLabelsForFunctions ? + m_assembly.namedLabel( + _function.name.str(), + _function.parameters.size(), + _function.returnVariables.size(), + astID + ) : + m_assembly.newLabelId(); +} + +AbstractAssembly::LabelID CodeTransform::functionEntryID(Scope::Function const& _scopeFunction) const +{ + yulAssert(m_context->functionEntryIDs.count(&_scopeFunction), ""); + return m_context->functionEntryIDs.at(&_scopeFunction); } void CodeTransform::visitExpression(Expression const& _expression) diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 8bbd3b818..8a605b472 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -142,7 +142,8 @@ public: private: AbstractAssembly::LabelID labelFromIdentifier(Identifier const& _identifier); - AbstractAssembly::LabelID functionEntryID(YulString _name, Scope::Function const& _function); + void createFunctionEntryID(FunctionDefinition const& _function); + AbstractAssembly::LabelID functionEntryID(Scope::Function const& _scopeFunction) const; /// Generates code for an expression that is supposed to return a single value. void visitExpression(Expression const& _expression); diff --git a/libyul/backends/evm/EVMObjectCompiler.cpp b/libyul/backends/evm/EVMObjectCompiler.cpp index f65f7f1e3..a526bf218 100644 --- a/libyul/backends/evm/EVMObjectCompiler.cpp +++ b/libyul/backends/evm/EVMObjectCompiler.cpp @@ -64,7 +64,16 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize) yulAssert(_object.code, "No code."); // We do not catch and re-throw the stack too deep exception here because it is a YulException, // which should be native to this part of the code. - CodeTransform transform{m_assembly, *_object.analysisInfo, *_object.code, m_dialect, context, _optimize}; + CodeTransform transform{ + m_assembly, + *_object.analysisInfo, + *_object.code, + m_dialect, + context, + _optimize, + {}, + true /* _useNamedLabelsForFunctions */ + }; transform(*_object.code); if (!transform.stackErrors().empty()) BOOST_THROW_EXCEPTION(transform.stackErrors().front()); diff --git a/test/cmdlineTests/asm_json/output b/test/cmdlineTests/asm_json/output index bd7a9c223..26ab87147 100644 --- a/test/cmdlineTests/asm_json/output +++ b/test/cmdlineTests/asm_json/output @@ -666,7 +666,7 @@ EVM assembly: "end": 205, "name": "tag", "source": 1, - "value": "15" + "value": "13" }, { "begin": 88, @@ -698,7 +698,7 @@ EVM assembly: "end": 411, "name": "tag", "source": 1, - "value": "19" + "value": "15" }, { "begin": 334, @@ -761,7 +761,7 @@ EVM assembly: "end": 539, "name": "tag", "source": 1, - "value": "21" + "value": "16" }, { "begin": 417, @@ -774,7 +774,7 @@ EVM assembly: "end": 514, "name": "PUSH [tag]", "source": 1, - "value": "23" + "value": "25" }, { "begin": 508, @@ -787,7 +787,7 @@ EVM assembly: "end": 514, "name": "PUSH [tag]", "source": 1, - "value": "19" + "value": "15" }, { "begin": 490, @@ -801,7 +801,7 @@ EVM assembly: "end": 514, "name": "tag", "source": 1, - "value": "23" + "value": "25" }, { "begin": 490, @@ -826,7 +826,7 @@ EVM assembly: "end": 533, "name": "PUSH [tag]", "source": 1, - "value": "24" + "value": "26" }, { "begin": 470, @@ -858,7 +858,7 @@ EVM assembly: "end": 533, "name": "tag", "source": 1, - "value": "24" + "value": "26" }, { "begin": 470, @@ -884,7 +884,7 @@ EVM assembly: "end": 684, "name": "tag", "source": 1, - "value": "25" + "value": "17" }, { "begin": 545, @@ -928,7 +928,7 @@ EVM assembly: "end": 678, "name": "PUSH [tag]", "source": 1, - "value": "27" + "value": "28" }, { "begin": 672, @@ -941,7 +941,7 @@ EVM assembly: "end": 678, "name": "PUSH [tag]", "source": 1, - "value": "21" + "value": "16" }, { "begin": 645, @@ -955,7 +955,7 @@ EVM assembly: "end": 678, "name": "tag", "source": 1, - "value": "27" + "value": "28" }, { "begin": 645, @@ -1056,7 +1056,7 @@ EVM assembly: "end": 885, "name": "PUSH [tag]", "source": 1, - "value": "29" + "value": "30" }, { "begin": 766, @@ -1069,14 +1069,14 @@ EVM assembly: "end": 883, "name": "PUSH [tag]", "source": 1, - "value": "30" + "value": "31" }, { "begin": 804, "end": 883, "name": "PUSH [tag]", "source": 1, - "value": "15" + "value": "13" }, { "begin": 804, @@ -1090,7 +1090,7 @@ EVM assembly: "end": 883, "name": "tag", "source": 1, - "value": "30" + "value": "31" }, { "begin": 804, @@ -1103,7 +1103,7 @@ EVM assembly: "end": 885, "name": "tag", "source": 1, - "value": "29" + "value": "30" }, { "begin": 766, @@ -1123,7 +1123,7 @@ EVM assembly: "end": 1002, "name": "PUSH [tag]", "source": 1, - "value": "31" + "value": "32" }, { "begin": 994, @@ -1154,7 +1154,7 @@ EVM assembly: "end": 1002, "name": "PUSH [tag]", "source": 1, - "value": "25" + "value": "17" }, { "begin": 949, @@ -1168,7 +1168,7 @@ EVM assembly: "end": 1002, "name": "tag", "source": 1, - "value": "31" + "value": "32" }, { "begin": 949, @@ -1230,7 +1230,7 @@ EVM assembly: "end": 1205, "name": "tag", "source": 1, - "value": "32" + "value": "18" }, { "begin": 1025, @@ -1336,7 +1336,7 @@ EVM assembly: "end": 1290, "name": "PUSH [tag]", "source": 1, - "value": "19" + "value": "15" }, { "begin": 1270, @@ -1388,7 +1388,7 @@ EVM assembly: "end": 1324, "name": "PUSH [tag]", "source": 1, - "value": "19" + "value": "15" }, { "begin": 1304, @@ -1484,7 +1484,7 @@ EVM assembly: "end": 1482, "name": "PUSH [tag]", "source": 1, - "value": "32" + "value": "18" }, { "begin": 1464, diff --git a/test/cmdlineTests/function_debug_info_via_yul/output b/test/cmdlineTests/function_debug_info_via_yul/output index 5af245ce4..8b952a9e9 100644 --- a/test/cmdlineTests/function_debug_info_via_yul/output +++ b/test/cmdlineTests/function_debug_info_via_yul/output @@ -4,7 +4,20 @@ "function_debug_info_via_yul/input.sol:C": { "function-debug": {}, - "function-debug-runtime": {} + "function-debug-runtime": + { + "abi_encode_uint256": + { + "parameterSlots": 2, + "returnSlots": 1 + }, + "calldata_array_index_access_uint256_dyn_calldata": + { + "entryPoint": 168, + "parameterSlots": 2, + "returnSlots": 1 + } + } } }, "version": "" diff --git a/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json b/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json index 56e0a6f31..3b25e108a 100644 --- a/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json +++ b/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json @@ -1,10 +1,10 @@ {"contracts":{"C":{"C":{"evm":{"assembly":" /* \"C\":79:428 contract C... */ mstore(0x40, 0xa0) - jumpi(tag_1, iszero(callvalue)) + jumpi(tag_2, iszero(callvalue)) 0x00 dup1 revert -tag_1: +tag_2: bytecodeSize codesize dup2 @@ -27,12 +27,12 @@ tag_1: lt or iszero - tag_2 + tag_3 jumpi mstore(0x00, shl(0xe0, 0x4e487b71)) mstore(0x04, 0x41) revert(0x00, 0x24) -tag_2: +tag_3: 0x40 mstore dup1 @@ -43,15 +43,15 @@ tag_2: dup2 slt iszero - tag_3 + tag_4 jumpi 0x00 dup1 revert -tag_3: +tag_4: pop pop - tag_4 + tag_5 mload(0xa0) /* \"C\":147:149 42 */ mstore(0x80, 0x2a) @@ -62,7 +62,7 @@ tag_3: /* \"C\":175:223 constructor(int _init)... */ jump /* \"C\":79:428 contract C... */ -tag_4: +tag_5: mload(0x40) dataSize(sub_0) dup1 @@ -80,7 +80,7 @@ stop sub_0: assembly { /* \"C\":79:428 contract C... */ mstore(0x40, 0x80) - jumpi(tag_1, lt(calldatasize, 0x04)) + jumpi(tag_8, lt(calldatasize, 0x04)) 0x00 dup1 calldataload @@ -89,38 +89,38 @@ sub_0: assembly { 0x26121ff0 dup2 eq - tag_3 + tag_10 jumpi 0x793816ec dup2 eq - tag_4 + tag_11 jumpi 0x9942ec6f dup2 eq - tag_5 + tag_12 jumpi - jump(tag_2) - tag_3: - jumpi(tag_6, iszero(callvalue)) + jump(tag_9) + tag_10: + jumpi(tag_13, iszero(callvalue)) dup2 dup3 revert - tag_6: - tag_7 + tag_13: + tag_14 calldatasize - tag_8 + tag_1 jump\t// in - tag_7: + tag_14: /* \"C\":279:298 constVar + immutVar */ - tag_9 + tag_15 /* \"C\":290:298 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":279:298 constVar + immutVar */ - tag_10 + tag_4 jump\t// in - tag_9: + tag_15: /* \"C\":79:428 contract C... */ mload(0x40) dup2 @@ -129,17 +129,17 @@ sub_0: assembly { 0x20 dup2 return - tag_4: - jumpi(tag_13, iszero(callvalue)) + tag_11: + jumpi(tag_17, iszero(callvalue)) dup2 dup3 revert - tag_13: - tag_14 + tag_17: + tag_18 calldatasize - tag_8 + tag_1 jump\t// in - tag_14: + tag_18: dup2 sload mload(0x40) @@ -149,50 +149,50 @@ sub_0: assembly { 0x20 dup2 return - tag_5: - jumpi(tag_16, iszero(callvalue)) + tag_12: + jumpi(tag_20, iszero(callvalue)) dup2 dup3 revert - tag_16: - tag_17 + tag_20: + tag_21 calldatasize - tag_8 + tag_1 jump\t// in - tag_17: + tag_21: /* \"C\":375:378 int */ - tag_9 - tag_19 + tag_15 + tag_6 jump\t// in /* \"C\":79:428 contract C... */ - tag_2: + tag_9: pop pop - tag_1: + tag_8: 0x00 dup1 revert - tag_8: + tag_1: 0x00 not(0x03) dup3 add slt iszero - tag_23 + tag_26 jumpi 0x00 dup1 revert - tag_23: + tag_26: pop jump\t// out /* \"C\":117:119 41 */ - tag_25: + tag_3: mstore(0x00, shl(0xe0, 0x4e487b71)) mstore(0x04, 0x11) revert(0x00, 0x24) - tag_10: + tag_4: 0x00 sub(shl(0xff, 0x01), 0x2a) dup3 @@ -200,18 +200,18 @@ sub_0: assembly { 0x01 and iszero - tag_29 + tag_31 jumpi - tag_29 - tag_25 + tag_31 + tag_3 jump\t// in - tag_29: + tag_31: pop 0x29 add swap1 jump\t// out - tag_30: + tag_5: 0x00 dup1 dup3 @@ -226,12 +226,12 @@ sub_0: assembly { sgt and iszero - tag_33 + tag_34 jumpi - tag_33 - tag_25 + tag_34 + tag_3 jump\t// in - tag_33: + tag_34: shl(0xff, 0x01) dup4 swap1 @@ -241,19 +241,19 @@ sub_0: assembly { dup2 and iszero - tag_35 + tag_36 jumpi - tag_35 - tag_25 + tag_36 + tag_3 jump\t// in - tag_35: + tag_36: pop pop add swap1 jump\t// out /* \"C\":304:341 modifier m()... */ - tag_19: + tag_6: 0x00 /* \"C\":79:428 contract C... */ dup1 @@ -266,12 +266,12 @@ sub_0: assembly { dup2 eq iszero - tag_38 + tag_39 jumpi - tag_38 - tag_25 + tag_39 + tag_3 jump\t// in - tag_38: + tag_39: /* \"C\":117:119 41 */ 0x01 /* \"C\":79:428 contract C... */ @@ -283,14 +283,14 @@ sub_0: assembly { address /* \"C\":403:411 this.f() */ extcodesize - tag_39 + tag_40 jumpi /* \"C\":79:428 contract C... */ dup2 dup3 revert /* \"C\":403:411 this.f() */ - tag_39: + tag_40: /* \"C\":79:428 contract C... */ mload(0x40) shl(0xe4, 0x026121ff) @@ -310,7 +310,7 @@ sub_0: assembly { gas staticcall dup1 - tag_40 + tag_41 jumpi /* \"C\":79:428 contract C... */ mload(0x40) @@ -322,13 +322,13 @@ sub_0: assembly { dup2 revert /* \"C\":403:411 this.f() */ - tag_40: + tag_41: /* \"C\":79:428 contract C... */ dup4 /* \"C\":403:411 this.f() */ dup2 iszero - tag_41 + tag_42 jumpi returndatasize /* \"C\":79:428 contract C... */ @@ -346,7 +346,7 @@ sub_0: assembly { lt or iszero - tag_42 + tag_43 jumpi shl(0xe0, 0x4e487b71) dup7 @@ -359,26 +359,26 @@ sub_0: assembly { 0x24 dup7 revert - tag_42: + tag_43: 0x40 mstore /* \"C\":403:411 this.f() */ - tag_43 + tag_44 returndatasize dup5 add dup5 - tag_44 + tag_7 jump\t// in - tag_43: + tag_44: swap1 pop - tag_41: + tag_42: /* \"C\":392:411 stateVar + this.f() */ tag_45 dup2 dup6 - tag_30 + tag_5 jump\t// in tag_45: swap5 @@ -393,7 +393,7 @@ sub_0: assembly { immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":392:422 stateVar + this.f() + immutVar */ dup3 - tag_30 + tag_5 jump\t// in tag_46: /* \"C\":336:337 _ */ @@ -404,7 +404,7 @@ sub_0: assembly { swap1 jump\t// out /* \"C\":79:428 contract C... */ - tag_44: + tag_7: 0x00 0x20 dup3 @@ -429,11 +429,11 @@ sub_0: assembly { } "}}},"D":{"D":{"evm":{"assembly":" /* \"D\":91:166 contract D is C(3)... */ mstore(0x40, 0xa0) - jumpi(tag_1, iszero(callvalue)) + jumpi(tag_2, iszero(callvalue)) 0x00 dup1 revert -tag_1: +tag_2: bytecodeSize codesize dup2 @@ -456,12 +456,12 @@ tag_1: lt or iszero - tag_2 + tag_3 jumpi mstore(0x00, shl(0xe0, 0x4e487b71)) mstore(0x04, 0x41) revert(0x00, 0x24) -tag_2: +tag_3: 0x40 mstore dup1 @@ -472,19 +472,19 @@ tag_2: dup2 slt iszero - tag_3 + tag_4 jumpi 0x00 dup1 revert -tag_3: - pop - pop - tag_4 - mload(0xa0) - tag_5 - jump\t// in tag_4: + pop + pop + tag_5 + mload(0xa0) + tag_1 + jump\t// in +tag_5: mload(0x40) dataSize(sub_0) dup1 @@ -498,7 +498,7 @@ tag_4: dup3 return /* \"D\":113:164 constructor(int _init2)... */ -tag_5: +tag_1: /* \"C\":147:149 42 */ mstore(0x80, 0x2a) /* \"D\":107:108 3 */ @@ -542,7 +542,7 @@ stop sub_0: assembly { /* \"D\":91:166 contract D is C(3)... */ mstore(0x40, 0x80) - jumpi(tag_1, lt(calldatasize, 0x04)) + jumpi(tag_8, lt(calldatasize, 0x04)) 0x00 dup1 calldataload @@ -551,38 +551,38 @@ sub_0: assembly { 0x26121ff0 dup2 eq - tag_3 + tag_10 jumpi 0x793816ec dup2 eq - tag_4 + tag_11 jumpi 0x9942ec6f dup2 eq - tag_5 + tag_12 jumpi - jump(tag_2) - tag_3: - jumpi(tag_6, iszero(callvalue)) + jump(tag_9) + tag_10: + jumpi(tag_13, iszero(callvalue)) dup2 dup3 revert - tag_6: - tag_7 + tag_13: + tag_14 calldatasize - tag_8 + tag_1 jump\t// in - tag_7: + tag_14: /* \"C\":279:298 constVar + immutVar */ - tag_9 + tag_15 /* \"C\":290:298 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":279:298 constVar + immutVar */ - tag_10 + tag_4 jump\t// in - tag_9: + tag_15: /* \"D\":91:166 contract D is C(3)... */ mload(0x40) dup2 @@ -591,17 +591,17 @@ sub_0: assembly { 0x20 dup2 return - tag_4: - jumpi(tag_13, iszero(callvalue)) + tag_11: + jumpi(tag_17, iszero(callvalue)) dup2 dup3 revert - tag_13: - tag_14 + tag_17: + tag_18 calldatasize - tag_8 + tag_1 jump\t// in - tag_14: + tag_18: dup2 sload mload(0x40) @@ -611,50 +611,50 @@ sub_0: assembly { 0x20 dup2 return - tag_5: - jumpi(tag_16, iszero(callvalue)) + tag_12: + jumpi(tag_20, iszero(callvalue)) dup2 dup3 revert - tag_16: - tag_17 + tag_20: + tag_21 calldatasize - tag_8 + tag_1 jump\t// in - tag_17: + tag_21: /* \"C\":375:378 int */ - tag_9 - tag_19 + tag_15 + tag_6 jump\t// in /* \"D\":91:166 contract D is C(3)... */ - tag_2: + tag_9: pop pop - tag_1: + tag_8: 0x00 dup1 revert - tag_8: + tag_1: 0x00 not(0x03) dup3 add slt iszero - tag_23 + tag_26 jumpi 0x00 dup1 revert - tag_23: + tag_26: pop jump\t// out /* \"C\":117:119 41 */ - tag_25: + tag_3: mstore(0x00, shl(0xe0, 0x4e487b71)) mstore(0x04, 0x11) revert(0x00, 0x24) - tag_10: + tag_4: 0x00 sub(shl(0xff, 0x01), 0x2a) dup3 @@ -662,18 +662,18 @@ sub_0: assembly { 0x01 and iszero - tag_29 + tag_31 jumpi - tag_29 - tag_25 + tag_31 + tag_3 jump\t// in - tag_29: + tag_31: pop 0x29 add swap1 jump\t// out - tag_30: + tag_5: 0x00 dup1 dup3 @@ -688,12 +688,12 @@ sub_0: assembly { sgt and iszero - tag_33 + tag_34 jumpi - tag_33 - tag_25 + tag_34 + tag_3 jump\t// in - tag_33: + tag_34: shl(0xff, 0x01) dup4 swap1 @@ -703,19 +703,19 @@ sub_0: assembly { dup2 and iszero - tag_35 + tag_36 jumpi - tag_35 - tag_25 + tag_36 + tag_3 jump\t// in - tag_35: + tag_36: pop pop add swap1 jump\t// out /* \"C\":304:341 modifier m()... */ - tag_19: + tag_6: 0x00 /* \"D\":91:166 contract D is C(3)... */ dup1 @@ -728,12 +728,12 @@ sub_0: assembly { dup2 eq iszero - tag_38 + tag_39 jumpi - tag_38 - tag_25 + tag_39 + tag_3 jump\t// in - tag_38: + tag_39: /* \"C\":117:119 41 */ 0x01 /* \"D\":91:166 contract D is C(3)... */ @@ -745,14 +745,14 @@ sub_0: assembly { address /* \"C\":403:411 this.f() */ extcodesize - tag_39 + tag_40 jumpi /* \"D\":91:166 contract D is C(3)... */ dup2 dup3 revert /* \"C\":403:411 this.f() */ - tag_39: + tag_40: /* \"D\":91:166 contract D is C(3)... */ mload(0x40) shl(0xe4, 0x026121ff) @@ -772,7 +772,7 @@ sub_0: assembly { gas staticcall dup1 - tag_40 + tag_41 jumpi /* \"D\":91:166 contract D is C(3)... */ mload(0x40) @@ -784,13 +784,13 @@ sub_0: assembly { dup2 revert /* \"C\":403:411 this.f() */ - tag_40: + tag_41: /* \"D\":91:166 contract D is C(3)... */ dup4 /* \"C\":403:411 this.f() */ dup2 iszero - tag_41 + tag_42 jumpi returndatasize /* \"D\":91:166 contract D is C(3)... */ @@ -808,7 +808,7 @@ sub_0: assembly { lt or iszero - tag_42 + tag_43 jumpi shl(0xe0, 0x4e487b71) dup7 @@ -821,26 +821,26 @@ sub_0: assembly { 0x24 dup7 revert - tag_42: + tag_43: 0x40 mstore /* \"C\":403:411 this.f() */ - tag_43 + tag_44 returndatasize dup5 add dup5 - tag_44 + tag_7 jump\t// in - tag_43: + tag_44: swap1 pop - tag_41: + tag_42: /* \"C\":392:411 stateVar + this.f() */ tag_45 dup2 dup6 - tag_30 + tag_5 jump\t// in tag_45: swap5 @@ -855,7 +855,7 @@ sub_0: assembly { immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":392:422 stateVar + this.f() + immutVar */ dup3 - tag_30 + tag_5 jump\t// in tag_46: /* \"C\":336:337 _ */ @@ -866,7 +866,7 @@ sub_0: assembly { swap1 jump\t// out /* \"D\":91:166 contract D is C(3)... */ - tag_44: + tag_7: 0x00 0x20 dup3 diff --git a/test/libyul/objectCompiler/function_series.yul b/test/libyul/objectCompiler/function_series.yul index cf4911997..f905c04b5 100644 --- a/test/libyul/objectCompiler/function_series.yul +++ b/test/libyul/objectCompiler/function_series.yul @@ -11,15 +11,15 @@ object "Contract" { // ---- // Assembly: // /* "source":33:48 */ -// jump(tag_1) -// tag_2: -// tag_3: +// jump(tag_3) +// tag_1: +// tag_4: // jump // out // /* "source":53:68 */ -// tag_4: +// tag_2: // tag_5: // jump // out -// tag_1: +// tag_3: // /* "source":83:84 */ // 0x01 // /* "source":80:81 */ diff --git a/test/libyul/objectCompiler/jump_tags.yul b/test/libyul/objectCompiler/jump_tags.yul index b78173d18..ba0984b10 100644 --- a/test/libyul/objectCompiler/jump_tags.yul +++ b/test/libyul/objectCompiler/jump_tags.yul @@ -11,21 +11,21 @@ object "Contract" { // ---- // Assembly: // /* "source":33:54 */ -// jump(tag_1) -// tag_2: +// jump(tag_3) +// tag_1: // /* "source":48:52 */ -// tag_4 +// tag_5 // /* "source":50:51 */ // 0x01 // /* "source":48:52 */ -// tag_5 +// tag_2 // jump // in -// tag_4: +// tag_5: // /* "source":33:54 */ -// tag_3: +// tag_4: // jump // out // /* "source":59:104 */ -// tag_5: +// tag_2: // /* "source":78:79 */ // dup1 // /* "source":75:89 */ @@ -46,20 +46,20 @@ object "Contract" { // /* "source":92:101 */ // add // /* "source":90:102 */ -// tag_5 +// tag_2 // jump // in // tag_8: // /* "source":59:104 */ // pop // tag_6: // jump // out -// tag_1: +// tag_3: // /* "source":109:113 */ // tag_9 // /* "source":111:112 */ // 0x01 // /* "source":109:113 */ -// tag_5 +// tag_2 // jump // in // tag_9: // Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b