Properly offset jumpdests

This commit is contained in:
Alex Beregszaszi 2022-12-03 14:03:39 +01:00 committed by Rodrigo Q. Saramago
parent ab2f46639c
commit 8d62b96b2c
No known key found for this signature in database
GPG Key ID: 9B36B2525704A359

View File

@ -680,7 +680,7 @@ LinkerObject const& Assembly::assemble(bool eof) const
size_t tagId = static_cast<size_t>(i.data());
assertThrow(ret.bytecode.size() < 0xffffffffL, AssemblyException, "Tag too large.");
assertThrow(m_tagPositionsInBytecode[tagId] == numeric_limits<size_t>::max(), AssemblyException, "Duplicate tag position.");
m_tagPositionsInBytecode[tagId] = ret.bytecode.size();
m_tagPositionsInBytecode[tagId] = ret.bytecode.size() - codeStart;
ret.bytecode.push_back(static_cast<uint8_t>(Instruction::JUMPDEST));
break;
}