fix PowerPC tails and continuations builds

This commit is contained in:
Joel Dice 2011-01-30 19:11:23 -07:00
parent 8a46ee92b4
commit 309c1cac6d
2 changed files with 24 additions and 20 deletions

View File

@ -241,43 +241,42 @@ GLOBAL(vmJumpAndInvoke):
#ifdef AVIAN_CONTINUATIONS
// r3: thread
// r4: address
// r5: (unused)
// r6: stack
// r7: argumentFootprint
// r8: arguments
// r9: frameSize
// r5: stack
// r6: argumentFootprint
// r7: arguments
// r8: frameSize
// restore (pseudo)-stack pointer (we don't want to touch the real
// stack pointer, since we haven't copied the arguments yet)
lwz r6,0(r6)
lwz r5,0(r5)
// make everything between r1 and r6 one big stack frame while we
// make everything between r1 and r5 one big stack frame while we
// shuffle things around
stw r6,0(r1)
stw r5,0(r1)
// allocate new frame, adding room for callee-saved registers
subfic r10,r9,-80
stwux r6,r6,r10
subfic r10,r8,-80
stwux r5,r5,r10
mr r13,r3
// copy arguments into place
li r9,0
addi r11,r6,ARGUMENT_BASE
li r8,0
addi r11,r5,ARGUMENT_BASE
b LOCAL(vmJumpAndInvoke_argumentTest)
LOCAL(vmJumpAndInvoke_argumentLoop):
lwzx r12,r8,r9
stwx r12,r11,r9
addi r9,r9,4
lwzx r12,r7,r8
stwx r12,r11,r8
addi r8,r8,4
LOCAL(vmJumpAndInvoke_argumentTest):
cmplw r9,r7
cmplw r8,r6
ble LOCAL(vmJumpAndInvoke_argumentLoop)
// the arguments have been copied, so we can set the real stack
// pointer now
mr r1,r6
mr r1,r5
// set return address to vmInvoke_returnAddress
bl LOCAL(vmJumpAndInvoke_getPC)

View File

@ -1765,9 +1765,14 @@ nextFrame(ArchitectureContext* c UNUSED, int32_t* start, unsigned size UNUSED,
}
// check for post-non-tail-call stack adjustment of the form "lwzx
// r0,0(r1); stwux r0,offset(r1)":
// todo
// r0,0(r1); stwu r0,offset(r1)":
if (instruction < start + (size / BytesPerWord) - 1
and (static_cast<uint32_t>(instruction[1]) >> 16) == 0x9421)
{
offset += static_cast<int16_t>(instruction[1]);
} else if ((static_cast<uint32_t>(*instruction) >> 16) == 0x9421) {
offset += static_cast<int16_t>(*instruction);
}
// todo: check for and handle tail calls
}