File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
test/libsolidity/semanticTests/functionCall Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -679,13 +679,22 @@ LinkerObject const& Assembly::assemble() const
679679 // Append an INVALID here to help tests find miscompilation.
680680 ret.bytecode .push_back (static_cast <uint8_t >(Instruction::INVALID));
681681
682- for (auto const & [subIdPath, bytecodeOffset]: subRef)
683682 {
684- bytesRef r (ret.bytecode .data () + bytecodeOffset, bytesPerDataRef);
685- toBigEndian (ret.bytecode .size (), r);
686- ret.append (subAssemblyById (subIdPath)->assemble ());
683+ std::map<Assembly const *, size_t > subAssemblyOffsets;
684+ for (auto const & [subIdPath, bytecodeOffset]: subRef)
685+ {
686+ Assembly const * subAssembly = subAssemblyById (subIdPath);
687+ bytesRef r (ret.bytecode .data () + bytecodeOffset, bytesPerDataRef);
688+ if (size_t * subAssemblyOffset = util::valueOrNullptr (subAssemblyOffsets, subAssembly))
689+ toBigEndian (*subAssemblyOffset, r);
690+ else
691+ {
692+ toBigEndian (ret.bytecode .size (), r);
693+ subAssemblyOffsets[subAssembly] = ret.bytecode .size ();
694+ ret.append (subAssembly->assemble ());
695+ }
696+ }
687697 }
688-
689698 for (auto const & i: tagRef)
690699 {
691700 size_t subId;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ contract C {
1717// EVMVersion: >=byzantium
1818// ----
1919// constructor(), 20 wei
20- // gas irOptimized: 184005
20+ // gas irOptimized: 179697
2121// gas legacy: 294335
2222// gas legacyOptimized: 173427
2323// f(uint256): 20 -> 0x137aa4dfc0911524504fcd4d98501f179bc13b4a
You can’t perform that action at this time.
0 commit comments