Fix to prevent tail-call optimisation. Fix also includes adjustment to

stack size, plus ASM niceities.
a=leaf r=rogerl
Bug id #15604
This commit is contained in:
rich.burridge%sun.com 2000-04-06 18:28:06 +00:00
Родитель fc66e176ec
Коммит 74fe1b2524
4 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -28,8 +28,8 @@
*/
XPTC_InvokeByIndex:
save %sp,-(64 + 16),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 16
save %sp,-(64 + 32),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 32
mov %i2,%o0 ! paramCount
call invoke_count_words ! returns the required stack size in %o0
mov %i3,%o1 ! params

Просмотреть файл

@ -30,8 +30,8 @@
*/
XPTC_InvokeByIndex:
save %sp,-(64 + 16),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 16
save %sp,-(64 + 32),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 32
sll %i2,3,%l0 ! assume the worst case
! paramCount * 2 * 4 bytes
cmp %l0, 0 ! are there any args? If not,
@ -56,7 +56,7 @@ XPTC_InvokeByIndex:
!
! calculate the target address from the vtable
!
invoke:
.invoke:
sll %i1,2,%l0 ! index *= 4
add %l0,8,%l0 ! there are 2 extra entries in the vTable
ld [%i0],%l1 ! *that --> address of vtable
@ -68,3 +68,5 @@ invoke:
mov %o0,%i0 ! propogate return value
ret
restore
.size XPTC_InvokeByIndex, .-XPTC_InvokeByIndex

Просмотреть файл

@ -43,8 +43,8 @@ SharedStub:
st %i4, [%fp + 84]
st %i5, [%fp + 88]
! now we can build our own stack frame
save %sp,-(64 + 16),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 16
save %sp,-(64 + 32),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 32
! our function now appears to have been called
! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
! so we can just copy these through
@ -60,3 +60,6 @@ SharedStub:
.LL1:
ret
restore
.size SharedStub, .-SharedStub
.type SharedStub, #function

Просмотреть файл

@ -110,13 +110,14 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
return result;
}
extern "C" int SharedStub(int);
extern "C" int SharedStub(int, int*);
#define STUB_ENTRY(n) \
nsresult nsXPTCStubBase::Stub##n() \
{ \
return SharedStub(n); \
} \
int dummy; /* defeat tail-call optimization */ \
return SharedStub(n, &dummy); \
}
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \