mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
f
This commit is contained in:
parent
232cf2d1cb
commit
c51af38724
@ -580,6 +580,7 @@ LinkerObject const& Assembly::assemble() const
|
|||||||
case StaticJumpI:
|
case StaticJumpI:
|
||||||
{
|
{
|
||||||
ret.bytecode.push_back(static_cast<uint8_t>((i.type() == StaticJump) ? Instruction::RJUMP : Instruction::RJUMPI));
|
ret.bytecode.push_back(static_cast<uint8_t>((i.type() == StaticJump) ? Instruction::RJUMP : Instruction::RJUMPI));
|
||||||
|
cout << "Adding static jump" << i << "\n";
|
||||||
tagRef[ret.bytecode.size()] = i.splitForeignPushTag();
|
tagRef[ret.bytecode.size()] = i.splitForeignPushTag();
|
||||||
isStaticTagRef.insert(ret.bytecode.size());
|
isStaticTagRef.insert(ret.bytecode.size());
|
||||||
ret.bytecode.resize(ret.bytecode.size() + bytesPerStaticTag); // Place 0 as immediate for now
|
ret.bytecode.resize(ret.bytecode.size() + bytesPerStaticTag); // Place 0 as immediate for now
|
||||||
@ -710,10 +711,11 @@ LinkerObject const& Assembly::assemble() const
|
|||||||
assertThrow(tagId < tagPositions.size(), AssemblyException, "Reference to non-existing tag.");
|
assertThrow(tagId < tagPositions.size(), AssemblyException, "Reference to non-existing tag.");
|
||||||
cout << tagId << "\n";
|
cout << tagId << "\n";
|
||||||
size_t pos = tagPositions[tagId];
|
size_t pos = tagPositions[tagId];
|
||||||
assertThrow(pos != numeric_limits<size_t>::max(), AssemblyException, "Reference to tag without position.");
|
// assertThrow(pos != numeric_limits<size_t>::max(), AssemblyException, "Reference to tag without position.");
|
||||||
if (isStaticTagRef.count(i.first)) {
|
if (isStaticTagRef.count(i.first)) {
|
||||||
pos = pos - (i.first + bytesPerStaticTag); // TODO: calculate relative figure properly
|
pos = pos - (i.first + bytesPerStaticTag); // TODO: calculate relative figure properly
|
||||||
assertThrow(numberEncodingSize(pos) <= bytesPerStaticTag, AssemblyException, "Tag too large for reserved space.");
|
cout << "Change position of static jump to " << pos << "\n";
|
||||||
|
// assertThrow(numberEncodingSize(pos) <= bytesPerStaticTag, AssemblyException, "Tag too large for reserved space.");
|
||||||
//pos = static_cast<uint16_t>(spos);
|
//pos = static_cast<uint16_t>(spos);
|
||||||
bytesRef r(ret.bytecode.data() + i.first, bytesPerStaticTag);
|
bytesRef r(ret.bytecode.data() + i.first, bytesPerStaticTag);
|
||||||
toBigEndian(pos, r);
|
toBigEndian(pos, r);
|
||||||
|
@ -213,9 +213,11 @@ public:
|
|||||||
evmasm::AssemblyItem const& _tag,
|
evmasm::AssemblyItem const& _tag,
|
||||||
evmasm::AssemblyItem::JumpType _jumpType = evmasm::AssemblyItem::JumpType::Ordinary
|
evmasm::AssemblyItem::JumpType _jumpType = evmasm::AssemblyItem::JumpType::Ordinary
|
||||||
) {
|
) {
|
||||||
evmasm::AssemblyItem item = m_asm->appendStaticJump(_tag);
|
*m_asm << _tag.pushTag();
|
||||||
item.setJumpType(_jumpType);
|
return appendJump(_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.
|
/// Appends pushing of a new tag and @returns the new tag.
|
||||||
evmasm::AssemblyItem pushNewTag() { return m_asm->append(m_asm->newPushTag()).tag(); }
|
evmasm::AssemblyItem pushNewTag() { return m_asm->append(m_asm->newPushTag()).tag(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user