зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
fc66e176ec
Коммит
74fe1b2524
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
XPTC_InvokeByIndex:
|
XPTC_InvokeByIndex:
|
||||||
save %sp,-(64 + 16),%sp ! room for the register window and
|
save %sp,-(64 + 32),%sp ! room for the register window and
|
||||||
! struct pointer, rounded up to 0 % 16
|
! struct pointer, rounded up to 0 % 32
|
||||||
mov %i2,%o0 ! paramCount
|
mov %i2,%o0 ! paramCount
|
||||||
call invoke_count_words ! returns the required stack size in %o0
|
call invoke_count_words ! returns the required stack size in %o0
|
||||||
mov %i3,%o1 ! params
|
mov %i3,%o1 ! params
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
XPTC_InvokeByIndex:
|
XPTC_InvokeByIndex:
|
||||||
save %sp,-(64 + 16),%sp ! room for the register window and
|
save %sp,-(64 + 32),%sp ! room for the register window and
|
||||||
! struct pointer, rounded up to 0 % 16
|
! struct pointer, rounded up to 0 % 32
|
||||||
sll %i2,3,%l0 ! assume the worst case
|
sll %i2,3,%l0 ! assume the worst case
|
||||||
! paramCount * 2 * 4 bytes
|
! paramCount * 2 * 4 bytes
|
||||||
cmp %l0, 0 ! are there any args? If not,
|
cmp %l0, 0 ! are there any args? If not,
|
||||||
|
@ -56,7 +56,7 @@ XPTC_InvokeByIndex:
|
||||||
!
|
!
|
||||||
! calculate the target address from the vtable
|
! calculate the target address from the vtable
|
||||||
!
|
!
|
||||||
invoke:
|
.invoke:
|
||||||
sll %i1,2,%l0 ! index *= 4
|
sll %i1,2,%l0 ! index *= 4
|
||||||
add %l0,8,%l0 ! there are 2 extra entries in the vTable
|
add %l0,8,%l0 ! there are 2 extra entries in the vTable
|
||||||
ld [%i0],%l1 ! *that --> address of vtable
|
ld [%i0],%l1 ! *that --> address of vtable
|
||||||
|
@ -68,3 +68,5 @@ invoke:
|
||||||
mov %o0,%i0 ! propogate return value
|
mov %o0,%i0 ! propogate return value
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
|
.size XPTC_InvokeByIndex, .-XPTC_InvokeByIndex
|
||||||
|
|
|
@ -43,8 +43,8 @@ SharedStub:
|
||||||
st %i4, [%fp + 84]
|
st %i4, [%fp + 84]
|
||||||
st %i5, [%fp + 88]
|
st %i5, [%fp + 88]
|
||||||
! now we can build our own stack frame
|
! now we can build our own stack frame
|
||||||
save %sp,-(64 + 16),%sp ! room for the register window and
|
save %sp,-(64 + 32),%sp ! room for the register window and
|
||||||
! struct pointer, rounded up to 0 % 16
|
! struct pointer, rounded up to 0 % 32
|
||||||
! our function now appears to have been called
|
! our function now appears to have been called
|
||||||
! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
|
! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
|
||||||
! so we can just copy these through
|
! so we can just copy these through
|
||||||
|
@ -60,3 +60,6 @@ SharedStub:
|
||||||
.LL1:
|
.LL1:
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
|
.size SharedStub, .-SharedStub
|
||||||
|
.type SharedStub, #function
|
||||||
|
|
|
@ -110,13 +110,14 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int SharedStub(int);
|
extern "C" int SharedStub(int, int*);
|
||||||
|
|
||||||
#define STUB_ENTRY(n) \
|
#define STUB_ENTRY(n) \
|
||||||
nsresult nsXPTCStubBase::Stub##n() \
|
nsresult nsXPTCStubBase::Stub##n() \
|
||||||
{ \
|
{ \
|
||||||
return SharedStub(n); \
|
int dummy; /* defeat tail-call optimization */ \
|
||||||
} \
|
return SharedStub(n, &dummy); \
|
||||||
|
}
|
||||||
|
|
||||||
#define SENTINEL_ENTRY(n) \
|
#define SENTINEL_ENTRY(n) \
|
||||||
nsresult nsXPTCStubBase::Sentinel##n() \
|
nsresult nsXPTCStubBase::Sentinel##n() \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче