fix ARM64 OffsetPromise::value

I must have done a search-and-replace from 4 to TargetBytesPerWord
earlier, but in this case it should have been the instruction size
(4), not the word size.
This commit is contained in:
Joel Dice 2014-12-29 11:04:27 -07:00
parent 98a1fefefc
commit e3f50e6d67
2 changed files with 10 additions and 2 deletions

View File

@ -981,6 +981,8 @@ class MyAssembler : public Assembler {
bool jump = needJump(b);
if (jump) {
expect(&con, TargetBytesPerWord == 4);
write4(dst + dstOffset,
isa::b((poolSize + TargetBytesPerWord - 8) >> 2));
}

View File

@ -12,6 +12,12 @@
#include "fixup.h"
#include "block.h"
namespace {
const unsigned InstructionSize = 4;
} // namespace
namespace avian {
namespace codegen {
namespace arm {
@ -39,7 +45,7 @@ int64_t OffsetPromise::value()
unsigned o = offset - block->offset;
return block->start
+ padding(block, forTrace ? o - vm::TargetBytesPerWord : o) + o;
+ padding(block, forTrace ? o - InstructionSize : o) + o;
}
Promise* offsetPromise(Context* con, bool forTrace)
@ -115,7 +121,7 @@ void* updateOffset(vm::System* s, uint8_t* instruction, int64_t value)
*p = (v & mask) | ((~mask) & *p);
return instruction + 4;
return instruction + InstructionSize;
}
ConstantPoolEntry::ConstantPoolEntry(Context* con,