From 2632adf3ca1511556f5893a0a65b90545a87ceb9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 17 Apr 2022 17:43:00 +0200 Subject: [PATCH] f --- libevmasm/Assembly.cpp | 4 ++-- libsolidity/codegen/CompilerContext.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index d16f482c0..f45063505 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -580,10 +580,9 @@ LinkerObject const& Assembly::assemble() const case StaticJumpI: { ret.bytecode.push_back(static_cast((i.type() == StaticJump) ? Instruction::RJUMP : Instruction::RJUMPI)); - ret.bytecode.push_back(tagPush); tagRef[ret.bytecode.size()] = i.splitForeignPushTag(); isStaticTagRef.insert(ret.bytecode.size()); - ret.bytecode.resize(ret.bytecode.size() + bytesPerStaticTag); + ret.bytecode.resize(ret.bytecode.size() + bytesPerStaticTag); // Place 0 as immediate for now break; } case PushData: @@ -709,6 +708,7 @@ LinkerObject const& Assembly::assemble() const m_tagPositionsInBytecode : m_subs[subId]->m_tagPositionsInBytecode; assertThrow(tagId < tagPositions.size(), AssemblyException, "Reference to non-existing tag."); + cout << tagId << "\n"; size_t pos = tagPositions[tagId]; assertThrow(pos != numeric_limits::max(), AssemblyException, "Reference to tag without position."); if (isStaticTagRef.count(i.first)) { diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index 7fe1c0f37..76da39813 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -212,7 +212,11 @@ public: CompilerContext& appendJumpTo( evmasm::AssemblyItem const& _tag, evmasm::AssemblyItem::JumpType _jumpType = evmasm::AssemblyItem::JumpType::Ordinary - ) { evmasm::AssemblyItem item = m_asm->appendStaticJump(_tag); item.setJumpType(_jumpType); return *this << item; } + ) { + evmasm::AssemblyItem item = m_asm->appendStaticJump(_tag); + item.setJumpType(_jumpType); + return *this << item; + } /// Appends pushing of a new tag and @returns the new tag. evmasm::AssemblyItem pushNewTag() { return m_asm->append(m_asm->newPushTag()).tag(); } /// @returns a new tag without pushing any opcodes or data