diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index dfaea3b0092..6ee8bad8e0c 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -147,19 +147,20 @@ endif # ifeq ($(OS_ARCH),SunOS) ifeq (x86_64,$(OS_TEST)) -CPPSRCS := xptcstubs_x86_64_solaris.cpp ifndef GNU_CC -CPPSRCS += xptcinvoke_x86_64_solaris.cpp +CPPSRCS := xptcstubs_x86_64_solaris.cpp xptcinvoke_x86_64_solaris.cpp ASFILES := xptcstubs_asm_x86_64_solaris_SUNW.s else -CPPSRCS += xptcinvoke_x86_64_unix.cpp +CPPSRCS := xptcstubs_x86_64_linux.cpp xptcinvoke_x86_64_unix.cpp endif else ifeq (86,$(findstring 86,$(OS_TEST))) -CPPSRCS := xptcinvoke_x86_solaris.cpp xptcstubs_x86_solaris.cpp # 28817: if Solaris Intel OS, and native compiler, always build optimised. ifndef GNU_CC +CPPSRCS := xptcinvoke_x86_solaris.cpp xptcstubs_x86_solaris.cpp ASFILES := xptcinvoke_asm_x86_solaris_SUNW.s xptcstubs_asm_x86_solaris_SUNW.s +else +CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp endif endif endif diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp index 0dbab796d88..c4074782ccb 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp @@ -45,9 +45,6 @@ extern "C" { // Remember that these 'words' are 32bit DWORDS -#if !defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ -static -#endif PRUint32 invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) { @@ -72,9 +69,6 @@ invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) return result; } -#if !defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ -static -#endif void invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d) { @@ -104,66 +98,3 @@ invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d) } } - -#if !defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ -EXPORT_XPCOM_API(nsresult) -NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, - PRUint32 paramCount, nsXPTCVariant* params) -{ -#ifdef __GNUC__ /* Gnu compiler. */ - PRUint32 result; - PRUint32 n = invoke_count_words (paramCount, params) * 4; - void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; - int temp1, temp2, temp3; - - __asm__ __volatile__( - "subl %8, %%esp\n\t" /* make room for params */ - "pushl %%esp\n\t" - "pushl %7\n\t" - "pushl %6\n\t" - "call *%0\n\t" /* copy params */ - "addl $0xc, %%esp\n\t" - "movl %4, %%ecx\n\t" -#ifdef CFRONT_STYLE_THIS_ADJUST - "movl (%%ecx), %%edx\n\t" - "movl %5, %%eax\n\t" /* function index */ - "shl $3, %%eax\n\t" /* *= 8 */ - "addl $8, %%eax\n\t" /* += 8 skip first entry */ - "addl %%eax, %%edx\n\t" - "movswl (%%edx), %%eax\n\t" /* 'this' offset */ - "addl %%eax, %%ecx\n\t" - "pushl %%ecx\n\t" - "addl $4, %%edx\n\t" /* += 4, method pointer */ -#else /* THUNK_BASED_THIS_ADJUST */ - "pushl %%ecx\n\t" - "movl (%%ecx), %%edx\n\t" - "movl %5, %%eax\n\t" /* function index */ -#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ - "leal (%%edx,%%eax,4), %%edx\n\t" -#else /* not G++ V3 ABI */ - "leal 8(%%edx,%%eax,4), %%edx\n\t" -#endif /* G++ V3 ABI */ -#endif - "call *(%%edx)\n\t" /* safe to not cleanup esp */ - "addl $4, %%esp\n\t" - "addl %8, %%esp" - : "=a" (result), /* %0 */ - "=c" (temp1), /* %1 */ - "=d" (temp2), /* %2 */ - "=g" (temp3) /* %3 */ - : "g" (that), /* %4 */ - "g" (methodIndex), /* %5 */ - "1" (paramCount), /* %6 */ - "2" (params), /* %7 */ - "g" (n), /* %8 */ - "0" (fn_copy) /* %3 */ - : "memory" - ); - - return result; -#else -#error "can't find a compiler to use" -#endif /* __GNUC__ */ - -} -#endif diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp index bf129c647b7..3ca8bd51754 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp @@ -158,80 +158,7 @@ PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex, return result; } -#ifdef __SUNPRO_CC #define STUB_ENTRY(n) -#else -#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ -// Linux/x86-64 uses gcc >= 3.1 -#define STUB_ENTRY(n) \ -asm(".section \".text\"\n\t" \ - ".align 2\n\t" \ - ".if " #n " < 10\n\t" \ - ".globl _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ - ".hidden _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ - ".type _ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \ - "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \ - ".elseif " #n " < 100\n\t" \ - ".globl _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ - ".hidden _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ - ".type _ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \ - "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \ - ".elseif " #n " < 1000\n\t" \ - ".globl _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ - ".hidden _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ - ".type _ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \ - "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \ - ".else\n\t" \ - ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \ - ".endif\n\t" \ - "movl $" #n ", %eax\n\t" \ - "jmp SharedStub\n\t" \ - ".if " #n " < 10\n\t" \ - ".size _ZN14nsXPTCStubBase5Stub" #n "Ev,.-_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ - ".elseif " #n " < 100\n\t" \ - ".size _ZN14nsXPTCStubBase6Stub" #n "Ev,.-_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ - ".else\n\t" \ - ".size _ZN14nsXPTCStubBase7Stub" #n "Ev,.-_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ - ".endif"); - -// static nsresult SharedStub(PRUint32 methodIndex) -asm(".section \".text\"\n\t" - ".align 2\n\t" - ".type SharedStub,@function\n\t" - "SharedStub:\n\t" - // make room for gpregs (48), fpregs (64) - "pushq %rbp\n\t" - "movq %rsp,%rbp\n\t" - "subq $112,%rsp\n\t" - // save GP registers - "movq %rdi,-112(%rbp)\n\t" - "movq %rsi,-104(%rbp)\n\t" - "movq %rdx, -96(%rbp)\n\t" - "movq %rcx, -88(%rbp)\n\t" - "movq %r8 , -80(%rbp)\n\t" - "movq %r9 , -72(%rbp)\n\t" - "leaq -112(%rbp),%rcx\n\t" - // save FP registers - "movsd %xmm0,-64(%rbp)\n\t" - "movsd %xmm1,-56(%rbp)\n\t" - "movsd %xmm2,-48(%rbp)\n\t" - "movsd %xmm3,-40(%rbp)\n\t" - "movsd %xmm4,-32(%rbp)\n\t" - "movsd %xmm5,-24(%rbp)\n\t" - "movsd %xmm6,-16(%rbp)\n\t" - "movsd %xmm7, -8(%rbp)\n\t" - "leaq -64(%rbp),%r8\n\t" - // rdi has the 'self' pointer already - "movl %eax,%esi\n\t" - "leaq 16(%rbp),%rdx\n\t" - "call PrepareAndDispatch@plt\n\t" - "leave\n\t" - "ret\n\t" - ".size SharedStub,.-SharedStub"); -#else -#error "Unsupported compiler. Use gcc >= 3.1 for Linux/x86-64." -#endif /* GNUC */ -#endif /* Sun Studio */ #define SENTINEL_ENTRY(n) \ nsresult nsXPTCStubBase::Sentinel##n() \ diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp index e43c9b2fb0e..42b2ca2ab7c 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp @@ -42,9 +42,6 @@ #include "xptiprivate.h" #include "xptc_platforms_unixish_x86.h" -#if !defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ -static -#endif nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) { @@ -101,37 +98,8 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) return result; } -#ifdef __GNUC__ /* Gnu Compiler. */ -#define STUB_ENTRY(n) \ -nsresult nsXPTCStubBase::Stub##n() \ -{ \ - register nsresult (*method) (nsXPTCStubBase *, uint32, PRUint32 *) = PrepareAndDispatch; \ - int temp0, temp1; \ - register nsresult result; \ - __asm__ __volatile__( \ - "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ - "pushl %%ecx\n\t" \ - "pushl $"#n"\n\t" /* method index */ \ - "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ - "pushl %%ecx\n\t" \ - "call *%%edx\n\t" /* PrepareAndDispatch */ \ - "addl $12, %%esp" \ - : "=a" (result), /* %0 */ \ - "=&c" (temp0), /* %1 */ \ - "=d" (temp1) /* %2 */ \ - : "2" (method) /* %2 */ \ - : "memory" ); \ - return result; \ -} - -#elif defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ - #define STUB_ENTRY(n) -#else -#error "can't find a compiler to use" -#endif /* __GNUC__ */ - #define SENTINEL_ENTRY(n) \ nsresult nsXPTCStubBase::Sentinel##n() \ { \