From c00458de39bebe3d67951c90cb64a9d3b2e11b06 Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Mon, 19 Jul 1999 20:18:02 +0000 Subject: [PATCH] Fixed MI dispatch and cleaned up branch slots. --- .../md/unix/xptcinvoke_asm_sparc_solaris.s | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s index 912c78e28559..337accd676de 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s @@ -17,7 +17,6 @@ */ /* Platform specific code to invoke XPCOM methods on native objects */ - .global XPTC_InvokeByIndex /* XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, @@ -28,43 +27,41 @@ XPTC_InvokeByIndex: save %sp,-(64 + 16),%sp ! room for the register window and ! struct pointer, rounded up to 0 % 16 mov %i2,%o0 ! paramCount - mov %i3,%o1 ! params call invoke_count_words ! returns the required stack size in %o0 - nop - sll %o0,2,%l0 ! number of bytes + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes sub %sp,%l0,%sp ! create the additional stack space mov %sp,%o0 ! pointer for copied args add %o0,72,%o0 ! step past the register window, the ! struct result pointer and the 'this' slot mov %i2,%o1 ! paramCount - mov %i3,%o2 ! params call invoke_copy_to_stack - nop + mov %i3,%o2 ! params ! ! calculate the target address from the vtable ! - sll %i1,3,%l0 ! index *= 8 - add %l0,12,%l0 ! += 12 (there's 1 extra entry in the vTable) - ! and we need the fn ptr which is the second - ! half of the 8 byte vTable entry - ld [%i0],%l1 ! *that --> address of vtable - ld [%l0 + %l1],%l0 ! that->vtable[index * 8 + 12] --> target address -! -! set 'that' as the 'this' pointer and then load the next arguments -! into the outgoing registers -! - mov %i0,%o0 - ld [%sp + 72],%o1 - ld [%sp + 76],%o2 - ld [%sp + 80],%o3 - ld [%sp + 84],%o4 - ld [%sp + 88],%o5 + add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) + ld [%i0],%l1 ! *that --> vTable + sll %i1,3,%i1 + add %i1,%l1,%l1 ! vTable[index * 8], l1 now points to vTable entry + lduh [%l1],%l0 ! this adjustor + sll %l0,16,%l0 ! sign extend to 32 bits + sra %l0,16,%l0 + add %l0,%i0,%i0 ! adjust this + ld [%l1 + 4],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: jmpl %l0,%o7 ! call the routine - nop - mov %o0,%i0 ! propogate return value - b .LL1 - nop -.LL1: +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propogate return value ret restore