fix offset calculations in arm.cpp and powerpc.cpp

This commit is contained in:
Joel Dice 2011-09-30 18:25:44 -06:00
parent 5f05110f33
commit ed6945dec7
2 changed files with 7 additions and 5 deletions

View File

@ -2413,12 +2413,13 @@ class MyAssembler: public Assembler {
poolSize += TargetBytesPerWord;
}
if (needJump(b)) {
bool jump = needJump(b);
if (jump) {
write4
(dst + dstOffset, ::b((poolSize + TargetBytesPerWord - 8) >> 2));
}
dstOffset += poolSize + TargetBytesPerWord;
dstOffset += poolSize + (jump ? TargetBytesPerWord : 0);
}
unsigned size = b->size - blockOffset;

View File

@ -2733,11 +2733,12 @@ class MyAssembler: public Assembler {
assert(&c, jumpTableSize);
if (needJump(b)) {
bool jump = needJump(b);
if (jump) {
write4(dst + dstOffset, ::b(jumpTableSize + TargetBytesPerWord));
}
dstOffset += jumpTableSize + TargetBytesPerWord;
dstOffset += jumpTableSize + (jump ? TargetBytesPerWord : 0);
}
unsigned size = b->size - blockOffset;
@ -2749,7 +2750,7 @@ class MyAssembler: public Assembler {
dstOffset += size;
}
unsigned index = c.code.length();
unsigned index = dstOffset;
assert(&c, index % TargetBytesPerWord == 0);
for (ConstantPoolEntry* e = c.constantPool; e; e = e->next) {
e->address = dst + index;