Issue #187: Remove solaris 1st party code OS checks.

This commit is contained in:
wolfbeast 2019-03-30 20:03:33 +01:00 committed by Roy Tam
commit 0a50553673
31 changed files with 7 additions and 1500 deletions

View file

@ -290,7 +290,7 @@ MAKE_SYM_STORE_PATH := $(DIST)/bin
endif
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
endif
ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
ifeq (,$(filter-out Linux,$(OS_ARCH)))
MAKE_SYM_STORE_ARGS := -c --vcs-info
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
MAKE_SYM_STORE_PATH := $(DIST)/bin

View file

@ -89,7 +89,6 @@ flavors = {
'Android': 'android',
'Linux': 'linux',
'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios',
'SunOS': 'solaris',
'GNU/kFreeBSD': 'freebsd',
'DragonFly': 'dragonfly',
'FreeBSD': 'freebsd',

View file

@ -43,20 +43,6 @@ endif
# Default
HAVE_FREEBL_LIBS = 1
# SunOS SPARC
ifeq ($(OS_ARCH), SunOS)
ifneq (86,$(findstring 86,$(OS_TEST)))
ifdef HAVE_64BIT_BUILD
HAVE_FREEBL_LIBS =
HAVE_FREEBL_LIBS_64 = 1
else
HAVE_FREEBL_LIBS =
HAVE_FREEBL_LIBS_32FPU = 1
HAVE_FREEBL_LIBS_32INT64 = 1
endif
endif
endif
ifeq ($(OS_TARGET),Linux)
HAVE_FREEBL_LIBS =
HAVE_FREEBL_LIBS_PRIV = 1
@ -331,11 +317,6 @@ NSS_DIST_DLL_DEST := $(DIST)/bin
NSS_DIST_DLL_TARGET := target
INSTALL_TARGETS += NSS_DIST_DLL
ifeq ($(OS_ARCH)_$(1), SunOS_softokn3)
# has to use copy mode on Solaris, see #665509
$(DIST)/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): INSTALL := $(INSTALL) -t
endif
NSS_SDK_LIB_FILES := \
$(addprefix $(DIST)/lib/$(LIB_PREFIX),$(addsuffix .$(LIB_SUFFIX),$(SDK_LIBS))) \
$(addprefix $(DIST)/bin/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(NSS_DLLS))) \

View file

@ -24,7 +24,7 @@
typedef unsigned long long uint64_t;
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
/*
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
* AIX ships an inttypes.h header that defines [u]int32_t,
* but not bool for C.
*/
#include <inttypes.h>

View file

@ -27,7 +27,7 @@ var htmlEditor = document.getElementById("htmlEditor");
const kIsMac = navigator.platform.indexOf("Mac") == 0;
const kIsWin = navigator.platform.indexOf("Win") == 0;
const kIsLinux = navigator.platform.indexOf("Linux") == 0 || navigator.platform.indexOf("SunOS") == 0 ;
const kIsLinux = navigator.platform.indexOf("Linux") == 0;
function runTests()
{

View file

@ -13,8 +13,6 @@ if (/Windows/.test(ua)) {
}
else if (/Linux/.test(ua))
id = "linux";
else if (/SunOS/.test(ua))
id = "linux";
else if (/Mac OS X/.test(ua))
id = "mac";

View file

@ -146,16 +146,6 @@ ifeq ($(OS_ARCH),AIX)
# 1540-1608: anonymous unions using static data members
CFLAGS += -qsuppress=1540-1281 -qsuppress=1540-1608
CXXFLAGS += -qsuppress=1540-1281 -qsuppress=1540-1608
endif
endif
ifeq ($(OS_ARCH),SunOS)
ifeq ($(TARGET_CPU),sparc)
ifdef GNU_CC
CFLAGS += -mcpu=v9
CXXFLAGS += -mcpu=v9
endif # GNU_CC
endif
endif

View file

@ -32,21 +32,11 @@ int main (void)
f = 3.14159;
#if 1
/* This is ifdef'd out for now. long double support under SunOS/gcc
is pretty much non-existent. You'll get the odd bus error in library
routines like printf(). */
printf ("%Lf\n", ldblit(f));
#endif
ld = 666;
ffi_call(&cif, FFI_FN(ldblit), &ld, values);
#if 1
/* This is ifdef'd out for now. long double support under SunOS/gcc
is pretty much non-existent. You'll get the odd bus error in library
routines like printf(). */
printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
#endif
/* These are not always the same!! Check for a reasonable delta */
if (ld - ldblit(f) < LDBL_EPSILON)

View file

@ -722,14 +722,6 @@ if CONFIG['OS_ARCH'] == 'Linux':
'dl',
]
if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [
'posix4',
'dl',
'nsl',
'socket',
]
OS_LIBS += CONFIG['REALTIME_LIBS']
CFLAGS += CONFIG['MOZ_ICU_CFLAGS']

View file

@ -13,11 +13,6 @@ SOURCES += [
]
FINAL_LIBRARY = 'memory'
# See bug 422055.
if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
and CONFIG['MOZ_OPTIMIZE']:
CFLAGS += ['-xO5']
# For non release/esr builds, enable (some) fatal jemalloc assertions. This
# helps us catch memory errors.
if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release', 'esr'):

View file

@ -585,17 +585,10 @@
} else if (Const._STAT_VER != undefined) {
const ver = Const._STAT_VER;
let xstat_name, lxstat_name, fxstat_name;
if (OS.Constants.Sys.Name == "SunOS") {
// Solaris
xstat_name = "_xstat";
lxstat_name = "_lxstat";
fxstat_name = "_fxstat";
} else {
// Linux, all widths
xstat_name = "__xstat";
lxstat_name = "__lxstat";
fxstat_name = "__fxstat";
}
// Linux, all widths
xstat_name = "__xstat";
lxstat_name = "__lxstat";
fxstat_name = "__fxstat";
let Stat = {};
libc.declareLazyFFI(Stat, "xstat",

View file

@ -270,15 +270,6 @@ if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
if CONFIG['MOZ_ENABLE_LIBPROXY']:
OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [
'elf',
]
if CONFIG['GNU_CC']:
OS_LIBS += [
'demangle',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',

View file

@ -54,15 +54,3 @@ xptcstubs_asm_ppc_aix.s: xptcstubs_asm_ppc_aix.s.m4 $(DIST)/include/xptcstubsdef
endif
endif
ifeq ($(OS_ARCH),SunOS)
ifeq (86,$(findstring 86,$(OS_TEST)))
ifndef GNU_CC
xptcstubsdef_asm.solx86: $(DIST)/include/xptcstubsdef.inc
sed \
-e 's/^\(STUB_ENTRY\)(\([0-9]\))/\11\(\2\)/' \
-e 's/^\(STUB_ENTRY\)(\([0-9][0-9]\))/\12\(\2\)/' \
-e 's/^\(STUB_ENTRY\)(\([0-9][0-9][0-9]\))/\13\(\2\)/' \
$(DIST)/include/xptcstubsdef.inc > $@
endif
endif
endif

View file

@ -46,36 +46,6 @@ if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
'xptcstubs_ipf64.cpp'
]
if CONFIG['OS_ARCH'] == 'SunOS' and '86' in CONFIG['OS_TEST']:
GENERATED_FILES = [
'xptcstubsdef_asm.solx86',
]
if CONFIG['OS_TEST'] == 'x86_64':
if CONFIG['GNU_CC']:
SOURCES += [
'xptcinvoke_x86_64_unix.cpp',
'xptcstubs_x86_64_linux.cpp'
]
else:
ASFLAGS += ['-xarch=amd64']
SOURCES += [
'xptcinvoke_x86_64_solaris.cpp',
'xptcstubs_asm_x86_64_solaris_SUNW.s',
'xptcstubs_x86_64_solaris.cpp',
]
else:
if CONFIG['GNU_CC']:
SOURCES += [
'xptcinvoke_gcc_x86_unix.cpp',
'xptcstubs_gcc_x86_unix.cpp'
]
else:
SOURCES += [
'xptcinvoke_asm_x86_solaris_SUNW.s',
'xptcinvoke_x86_solaris.cpp',
'xptcstubs_asm_x86_solaris_SUNW.s',
'xptcstubs_x86_solaris.cpp'
]
if CONFIG['OS_TEST'] == 'alpha':
if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD'):
@ -247,35 +217,6 @@ if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD') and CONFIG['OS_TEST'] == 'sparc64
'xptcstubs_sparc64_openbsd.cpp',
]
if CONFIG['OS_ARCH'] == 'SunOS' and '86' not in CONFIG['OS_TEST']:
if CONFIG['HAVE_64BIT_BUILD']:
ASFLAGS += ['-xarch=v9']
SOURCES += [
'xptcinvoke_sparcv9_solaris.cpp',
'xptcstubs_sparcv9_solaris.cpp',
]
else:
SOURCES += [
'xptcinvoke_sparc_solaris.cpp',
'xptcstubs_sparc_solaris.cpp',
]
if CONFIG['GNU_CC']:
SOURCES += [
'xptcinvoke_asm_sparc_solaris_GCC3.s',
'xptcstubs_asm_sparc_solaris.s',
]
else:
if CONFIG['HAVE_64BIT_BUILD']:
SOURCES += [
'xptcinvoke_asm_sparcv9_solaris_SUNW.s',
'xptcstubs_asm_sparcv9_solaris.s',
]
else:
SOURCES += [
'xptcinvoke_asm_sparc_solaris_SUNW.s',
'xptcstubs_asm_sparc_solaris.s',
]
if CONFIG['OS_ARCH'] == 'Linux':
if CONFIG['OS_TEST'] == 's390':
SOURCES += [

View file

@ -1,52 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Platform specific code to invoke XPCOM methods on native objects for
* solaris/sparc with gcc 3 ABI.
*/
.global NS_InvokeByIndex
/*
* NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
* uint32_t paramCount, nsXPTCVariant* params);
*/
NS_InvokeByIndex:
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
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
call invoke_copy_to_stack
mov %i3,%o2 ! params
!
! calculate the target address from the vtable
!
ld [%i0],%l1 ! *that --> vTable
sll %i1,2,%i1 ! multiply index by 4
add %i1,%l1,%l1 ! l1 now points to vTable entry
ld [%l1],%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
! always have a 'this', from the incoming 'that'
mov %i0,%o0
mov %o0,%i0 ! propagate return value
ret
restore

View file

@ -1,56 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Platform specific code to invoke XPCOM methods on native objects */
.global NS_InvokeByIndex
.type NS_InvokeByIndex, #function
/*
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params);
*/
NS_InvokeByIndex:
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,
be .invoke ! no need to copy args to stack
sub %sp,%l0,%sp ! create the additional stack space
add %sp,72,%o0 ! step past the register window, the
! struct result pointer and the 'this' slot
mov %i2,%o1 ! paramCount
call invoke_copy_to_stack
mov %i3,%o2 ! params
!
! load arguments from stack into the outgoing registers
!
ld [%sp + 72],%o1
ld [%sp + 76],%o2
ld [%sp + 80],%o3
ld [%sp + 84],%o4
ld [%sp + 88],%o5
!
! calculate the target address from the vtable
!
.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
ld [%l0 + %l1],%l0 ! that->vtable[index * 4 + 8] --> address
jmpl %l0,%o7 ! call the routine
mov %i0,%o0 ! move 'this' pointer to out register
mov %o0,%i0 ! propagate return value
ret
restore
.size NS_InvokeByIndex, .-NS_InvokeByIndex

View file

@ -1,85 +0,0 @@
/* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
Platform specific code to invoke XPCOM methods on native objects
for sparcv9 Solaris.
See the SPARC Compliance Definition (SCD) Chapter 3
for more information about what is going on here, including
the use of BIAS (0x7ff).
The SCD is available from http://www.sparc.com/.
*/
.global NS_InvokeByIndex
.type NS_InvokeByIndex, #function
/*
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params);
*/
NS_InvokeByIndex:
save %sp,-(128 + 64),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 64
sll %i2,4,%l0 ! assume the worst case
! paramCount * 2 * 8 bytes
cmp %l0, 0 ! are there any args? If not,
be .invoke ! no need to copy args to stack
sub %sp,%l0,%sp ! create the additional stack space
add %sp,0x7ff+136,%o0 ! step past the register window, the
! struct result pointer and the 'this' slot
mov %i2,%o1 ! paramCount
call invoke_copy_to_stack
mov %i3,%o2 ! params
!
! load arguments from stack into the outgoing registers
! BIAS is 0x7ff (2047)
!
! load the %o1..5 64bit (extended word) output registers registers
ldx [%sp + 0x7ff + 136],%o1 ! %i1
ldx [%sp + 0x7ff + 144],%o2 ! %i2
ldx [%sp + 0x7ff + 152],%o3 ! %i3
ldx [%sp + 0x7ff + 160],%o4 ! %i4
ldx [%sp + 0x7ff + 168],%o5 ! %i5
! load the even number double registers starting with %d2
ldd [%sp + 0x7ff + 136],%d2
ldd [%sp + 0x7ff + 144],%d4
ldd [%sp + 0x7ff + 152],%d6
ldd [%sp + 0x7ff + 160],%d8
ldd [%sp + 0x7ff + 168],%d10
ldd [%sp + 0x7ff + 176],%d12
ldd [%sp + 0x7ff + 184],%d14
ldd [%sp + 0x7ff + 192],%d16
ldd [%sp + 0x7ff + 200],%d18
ldd [%sp + 0x7ff + 208],%d20
ldd [%sp + 0x7ff + 216],%d22
ldd [%sp + 0x7ff + 224],%d24
ldd [%sp + 0x7ff + 232],%d26
ldd [%sp + 0x7ff + 240],%d28
ldd [%sp + 0x7ff + 248],%d30
!
! calculate the target address from the vtable
!
.invoke:
sll %i1,3,%l0 ! index *= 8
add %l0,16,%l0 ! there are 2 extra entries in the vTable (16bytes)
ldx [%i0],%l1 ! *that --> address of vtable
ldx [%l0 + %l1],%l0 ! that->vtable[index * 8 + 16] --> address
jmpl %l0,%o7 ! call the routine
mov %i0,%o0 ! move 'this' pointer to out register
mov %o0,%i0 ! propagate return value
ret
restore
.size NS_InvokeByIndex, .-NS_InvokeByIndex

View file

@ -1,55 +0,0 @@
.globl NS_InvokeByIndex
.type NS_InvokeByIndex, @function
NS_InvokeByIndex:
push %ebp
movl %esp,%ebp
push %ebx
call .CG0.66
.CG0.66:
pop %ebx
addl $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
push 20(%ebp)
push 16(%ebp)
push 12(%ebp)
push 8(%ebp)
/ INLINE: invoke_by_index
pushl %ebx
pushl %esi
movl %esp, %ebx
pushl 0x14(%ebp)
pushl 0x10(%ebp)
call invoke_count_words
mov %ebx, %esp
sall $0x2 , %eax
subl %eax, %esp
movl %esp, %esi
pushl %esp
pushl 0x14(%ebp)
pushl 0x10(%ebp)
call invoke_copy_to_stack
movl %esi, %esp
movl 0x8(%ebp), %ecx
pushl %ecx
movl (%ecx), %edx
movl 0xc(%ebp), %eax
movl 0x8(%edx, %eax, 4), %edx
call *%edx
mov %ebx, %esp
popl %esi
popl %ebx
/ INLINE_END
addl $16,%esp
pop %ebx
movl %ebp,%esp
pop %ebp
ret
.size NS_InvokeByIndex, . - NS_InvokeByIndex

View file

@ -1,131 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Platform specific code to invoke XPCOM methods on native objects */
#include "xptcprivate.h"
/* solaris defines __sparc for workshop compilers and
linux defines __sparc__ */
#if !defined(__sparc) && !defined(__sparc__)
#error "This code is for Sparc only"
#endif
typedef unsigned nsXPCVariant;
extern "C" uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
uint32_t result = 0;
for(uint32_t i = 0; i < paramCount; i++, s++)
{
if(s->IsPtrData())
{
result++;
continue;
}
switch(s->type)
{
case nsXPTType::T_I8 :
case nsXPTType::T_I16 :
case nsXPTType::T_I32 :
result++;
break;
case nsXPTType::T_I64 :
result+=2;
break;
case nsXPTType::T_U8 :
case nsXPTType::T_U16 :
case nsXPTType::T_U32 :
result++;
break;
case nsXPTType::T_U64 :
result+=2;
break;
case nsXPTType::T_FLOAT :
result++;
break;
case nsXPTType::T_DOUBLE :
result+=2;
break;
case nsXPTType::T_BOOL :
case nsXPTType::T_CHAR :
case nsXPTType::T_WCHAR :
result++;
break;
default:
// all the others are plain pointer types
result++;
break;
}
}
// nuts, I know there's a cooler way of doing this, but it's late
// now and it'll probably come to me in the morning.
if (result & 0x3) result += 4 - (result & 0x3); // ensure q-word alignment
return result;
}
extern "C" uint32_t
invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
{
/*
We need to copy the parameters for this function to locals and use them
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint32_t *l_d = d;
nsXPTCVariant *l_s = s;
uint32_t l_paramCount = paramCount;
uint32_t regCount = 0; // return the number of registers to load from the stack
typedef struct {
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if(l_s->IsPtrData())
{
if(l_s->type == nsXPTType::T_JSVAL)
{
// On SPARC, we need to pass a pointer to HandleValue
*((void**)l_d) = &l_s->ptr;
} else
{
*((void**)l_d) = l_s->ptr;
}
continue;
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi;
if (regCount < 5) regCount++;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;
break;
}
}
return regCount;
}

View file

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Platform specific code to invoke XPCOM methods on native objects */
#include "xptcprivate.h"
#if !defined(__sparc) && !defined(__sparc__)
#error "This code is for Sparc only"
#endif
/* Prototype specifies unmangled function name */
extern "C" uint64_t
invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s);
extern "C" uint64_t
invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
{
/*
We need to copy the parameters for this function to locals and use them
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint64_t *l_d = d;
nsXPTCVariant *l_s = s;
uint64_t l_paramCount = paramCount;
uint64_t regCount = 0; // return the number of registers to load from the stack
for(uint64_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if (l_s->IsPtrData())
{
*l_d = (uint64_t)l_s->ptr;
continue;
}
switch (l_s->type)
{
case nsXPTType::T_I8 : *((int64_t*)l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int64_t*)l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int64_t*)l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 : *((int64_t*)l_d) = l_s->val.i64; break;
case nsXPTType::T_U8 : *((uint64_t*)l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint64_t*)l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint64_t*)l_d) = l_s->val.u32; break;
case nsXPTType::T_U64 : *((uint64_t*)l_d) = l_s->val.u64; break;
/* in the case of floats, we want to put the bits in to the
64bit space right justified... floats in the parameter array on
sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
the space that would be occupied by %f0, %f2, etc.
*/
case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break;
case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break;
case nsXPTType::T_BOOL : *((uint64_t*)l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint64_t*)l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int64_t*)l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;
break;
}
}
return regCount;
}

View file

@ -1,149 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Platform specific code to invoke XPCOM methods on native objects
#include "xptcprivate.h"
#include "alloca.h"
// 6 integral parameters are passed in registers
const uint32_t GPR_COUNT = 6;
// 8 floating point parameters are passed in SSE registers
const uint32_t FPR_COUNT = 8;
// Remember that these 'words' are 64-bit long
static inline void
invoke_count_words(uint32_t paramCount, nsXPTCVariant * s,
uint32_t & nr_gpr, uint32_t & nr_fpr, uint32_t & nr_stack)
{
nr_gpr = 1; // skip one GP register for 'that'
nr_fpr = 0;
nr_stack = 0;
/* Compute number of eightbytes of class MEMORY. */
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (!s->IsPtrData()
&& (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
if (nr_fpr < FPR_COUNT)
nr_fpr++;
else
nr_stack++;
}
else {
if (nr_gpr < GPR_COUNT)
nr_gpr++;
else
nr_stack++;
}
}
}
static void
invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
uint64_t * gpregs, double * fpregs)
{
uint32_t nr_gpr = 1; // skip one GP register for 'that'
uint32_t nr_fpr = 0;
uint64_t value;
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (s->IsPtrData())
value = (uint64_t) s->ptr;
else {
switch (s->type) {
case nsXPTType::T_FLOAT: break;
case nsXPTType::T_DOUBLE: break;
case nsXPTType::T_I8: value = s->val.i8; break;
case nsXPTType::T_I16: value = s->val.i16; break;
case nsXPTType::T_I32: value = s->val.i32; break;
case nsXPTType::T_I64: value = s->val.i64; break;
case nsXPTType::T_U8: value = s->val.u8; break;
case nsXPTType::T_U16: value = s->val.u16; break;
case nsXPTType::T_U32: value = s->val.u32; break;
case nsXPTType::T_U64: value = s->val.u64; break;
case nsXPTType::T_BOOL: value = s->val.b; break;
case nsXPTType::T_CHAR: value = s->val.c; break;
case nsXPTType::T_WCHAR: value = s->val.wc; break;
default: value = (uint64_t) s->val.p; break;
}
}
if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
if (nr_fpr < FPR_COUNT)
fpregs[nr_fpr++] = s->val.d;
else {
*((double *)d) = s->val.d;
d++;
}
}
else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
if (nr_fpr < FPR_COUNT)
// The value in %xmm register is already prepared to
// be retrieved as a float. Therefore, we pass the
// value verbatim, as a double without conversion.
fpregs[nr_fpr++] = s->val.d;
else {
*((float *)d) = s->val.f;
d++;
}
}
else {
if (nr_gpr < GPR_COUNT)
gpregs[nr_gpr++] = value;
else
*d++ = value;
}
}
}
// Avoid AddressSanitizer instrumentation for the next function because it
// depends on __builtin_alloca behavior and alignment that cannot be relied on
// once the function is compiled with a version of ASan that has dynamic-alloca
// instrumentation enabled.
MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant * params)
{
uint32_t nr_gpr, nr_fpr, nr_stack;
invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
// Stack, if used, must be 16-bytes aligned
if (nr_stack)
nr_stack = (nr_stack + 1) & ~1;
// Load parameters to stack, if necessary
uint64_t *stack = (uint64_t *) __builtin_alloca(nr_stack * 8);
uint64_t gpregs[GPR_COUNT];
double fpregs[FPR_COUNT];
invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
switch (nr_fpr) {
case 8: asm("movupd %0, %xmm7" : : "xmm7" (fpregs[7]));
case 7: asm("movupd %0, %xmm6" : : "xmm6" (fpregs[6]));
case 6: asm("movupd %0, %xmm5" : : "xmm5" (fpregs[5]));
case 5: asm("movupd %0, %xmm4" : : "xmm4" (fpregs[4]));
case 4: asm("movupd %0, %xmm3" : : "xmm3" (fpregs[3]));
case 3: asm("movupd %0, %xmm2" : : "xmm2" (fpregs[2]));
case 2: asm("movupd %0, %xmm1" : : "xmm1" (fpregs[1]));
case 1: asm("movupd %0, %xmm0" : : "xmm0" (fpregs[0]));
case 0:;
}
// Ensure that assignments to SSE registers won't be optimized away
asm("" ::: "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
// Get pointer to method
uint64_t methodAddress = *((uint64_t *)that);
methodAddress += 16 + 8 * methodIndex;
methodAddress = *((uint64_t *)methodAddress);
typedef uint32_t (*Method)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
uint32_t result = ((Method)methodAddress)((uint64_t)that, gpregs[1], gpregs[2], gpregs[3], gpregs[4], gpregs[5]);
return result;
}

View file

@ -1,67 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Platform specific code to invoke XPCOM methods on native objects */
#include "xptcprivate.h"
extern "C" {
// Remember that these 'words' are 32bit DWORDS
uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
uint32_t result = 0;
for(uint32_t i = 0; i < paramCount; i++, s++)
{
if(s->IsPtrData())
{
result++;
continue;
}
result++;
switch(s->type)
{
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE :
result++;
break;
}
}
return result;
}
void
invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d)
{
for(uint32_t i = 0; i < paramCount; i++, d++, s++)
{
if(s->IsPtrData())
{
*((void**)d) = s->ptr;
continue;
}
/* XXX: the following line is here (rather than as the default clause in
* the following switch statement) so that the Sun native compiler
* will generate the correct assembly code on the Solaris Intel
* platform. See the comments in bug #28817 for more details.
*/
*((void**)d) = s->val.p;
switch(s->type)
{
case nsXPTType::T_I64 : *((int64_t*) d) = s->val.i64; d++; break;
case nsXPTType::T_U64 : *((uint64_t*)d) = s->val.u64; d++; break;
case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break;
}
}
}
}

View file

@ -1,49 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.global SharedStub
/*
in the frame for the function that called SharedStub are the
rest of the parameters we need
*/
SharedStub:
! we don't create a new frame yet, but work within the frame of the calling
! function to give ourselves the other parameters we want
mov %o0, %o1 ! shuffle the index up to 2nd place
mov %i0, %o0 ! the original 'this'
add %fp, 72, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this')
! save off the original incoming parameters that arrived in
! registers, the ABI guarantees the space for us to do this
st %i1, [%fp + 72]
st %i2, [%fp + 76]
st %i3, [%fp + 80]
st %i4, [%fp + 84]
st %i5, [%fp + 88]
! now we can build our own stack frame
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, uint32_t index, uint32_t* args)
! so we can just copy these through
mov %i0, %o0
mov %i1, %o1
mov %i2, %o2
call PrepareAndDispatch
nop
mov %o0,%i0 ! propagate return value
b .LL1
nop
.LL1:
ret
restore
.size SharedStub, .-SharedStub
.type SharedStub, #function

View file

@ -1,50 +0,0 @@
/* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.global SharedStub
/*
in the frame for the function that called SharedStub are the
rest of the parameters we need
*/
SharedStub:
! we don't create a new frame yet, but work within the frame of the calling
! function to give ourselves the other parameters we want
mov %o0, %o1 ! shuffle the index up to 2nd place
mov %i0, %o0 ! the original 'this'
add %fp, 0x7ff + 136, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this')
! save off the original incoming parameters that arrived in
! registers, the ABI guarantees the space for us to do this
stx %i1, [%fp + 0x7ff + 136]
stx %i2, [%fp + 0x7ff + 144]
stx %i3, [%fp + 0x7ff + 152]
stx %i4, [%fp + 0x7ff + 160]
stx %i5, [%fp + 0x7ff + 168]
! now we can build our own stack frame
save %sp,-(128 + 64),%sp ! room for the register window and
! struct pointer, rounded up to 0 % 64
! our function now appears to have been called
! as SharedStub(nsISupports* that, uint32_t index, uint32_t* args)
! so we can just copy these through
mov %i0, %o0
mov %i1, %o1
mov %i2, %o2
call PrepareAndDispatch
nop
mov %o0,%i0 ! propagate return value
b .LL1
nop
.LL1:
ret
restore
.size SharedStub, .-SharedStub
.type SharedStub, #function

View file

@ -1,63 +0,0 @@
#define STUB_ENTRY1(nn) \
.globl __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_; \
.hidden __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_: \
movl $/**/nn/**/, %eax; \
jmp SharedStub; \
.size __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_ \
#define STUB_ENTRY2(nn) \
.globl __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_; \
.hidden __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_: \
movl $/**/nn/**/, %eax; \
jmp SharedStub; \
.size __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_ \
#define STUB_ENTRY3(nn) \
.globl __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_; \
.hidden __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_: \
movl $/**/nn/**/, %eax; \
jmp SharedStub; \
.size __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_ \
// static nsresult SharedStub(uint32_t methodIndex)
.type SharedStub, @function;
SharedStub:
// make room for gpregs (48), fpregs (64)
pushq %rbp;
movq %rsp,%rbp;
subq $112,%rsp;
// save GP registers
movq %rdi,-112(%rbp);
movq %rsi,-104(%rbp);
movq %rdx, -96(%rbp);
movq %rcx, -88(%rbp);
movq %r8 , -80(%rbp);
movq %r9 , -72(%rbp);
leaq -112(%rbp),%rcx;
// save FP registers
movsd %xmm0,-64(%rbp);
movsd %xmm1,-56(%rbp);
movsd %xmm2,-48(%rbp);
movsd %xmm3,-40(%rbp);
movsd %xmm4,-32(%rbp);
movsd %xmm5,-24(%rbp);
movsd %xmm6,-16(%rbp);
movsd %xmm7, -8(%rbp);
leaq -64(%rbp),%r8;
// rdi has the 'self' pointer already
movl %eax,%esi;
leaq 16(%rbp),%rdx;
call PrepareAndDispatch@plt;
leave;
ret;
.size SharedStub, . - SharedStub
#define SENTINEL_ENTRY(nn)
#include "xptcstubsdef_asm.solx86"

View file

@ -1,78 +0,0 @@
#define STUB_ENTRY1(nn) \
.globl __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_: \
push %ebp; \
movl %esp,%ebp; \
andl $-16,%esp; \
push %ebx; \
call .CG4./**/nn/**/; \
.CG4./**/nn/**/: \
pop %ebx; \
addl $_GLOBAL_OFFSET_TABLE_+0x1,%ebx; \
leal 0xc(%ebp), %ecx; \
pushl %ecx; \
pushl $/**/nn/**/; \
movl 0x8(%ebp), %ecx; \
pushl %ecx; \
call __1cSPrepareAndDispatch6FpnOnsXPTCStubBase_IpI_I_; \
addl $0xc , %esp; \
pop %ebx; \
movl %ebp,%esp; \
pop %ebp; \
ret ; \
.size __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseFStub/**/nn/**/6M_I_ \
#define STUB_ENTRY2(nn) \
.globl __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_: \
push %ebp; \
movl %esp,%ebp; \
andl $-16,%esp; \
push %ebx; \
call .CG4./**/nn/**/; \
.CG4./**/nn/**/: \
pop %ebx; \
addl $_GLOBAL_OFFSET_TABLE_+0x1,%ebx; \
leal 0xc(%ebp), %ecx; \
pushl %ecx; \
pushl $/**/nn/**/; \
movl 0x8(%ebp), %ecx; \
pushl %ecx; \
call __1cSPrepareAndDispatch6FpnOnsXPTCStubBase_IpI_I_; \
addl $0xc , %esp; \
pop %ebx; \
movl %ebp,%esp; \
pop %ebp; \
ret ; \
.size __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseGStub/**/nn/**/6M_I_ \
#define STUB_ENTRY3(nn) \
.globl __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_; \
.type __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_, @function; \
__1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_: \
push %ebp; \
movl %esp,%ebp; \
andl $-16,%esp; \
push %ebx; \
call .CG4./**/nn/**/; \
.CG4./**/nn/**/: \
pop %ebx; \
addl $_GLOBAL_OFFSET_TABLE_+0x1,%ebx; \
leal 0xc(%ebp), %ecx; \
pushl %ecx; \
pushl $/**/nn/**/; \
movl 0x8(%ebp), %ecx; \
pushl %ecx; \
call __1cSPrepareAndDispatch6FpnOnsXPTCStubBase_IpI_I_; \
addl $0xc , %esp; \
pop %ebx; \
movl %ebp,%esp; \
pop %ebp; \
ret ; \
.size __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_, . - __1cOnsXPTCStubBaseHStub/**/nn/**/6M_I_ \
#define SENTINEL_ENTRY(nn)
#include "xptcstubsdef_asm.solx86"

View file

@ -1,112 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Implement shared vtbl methods. */
#include "xptcprivate.h"
#include "xptiprivate.h"
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
typedef struct {
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
#define PARAM_BUFFER_COUNT 16
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = nullptr;
const nsXPTMethodInfo* info;
uint8_t paramCount;
uint8_t i;
nsresult result = NS_ERROR_FAILURE;
NS_ASSERTION(self,"no self");
self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
paramCount = info->GetParamCount();
// setup variant array pointer
if(paramCount > PARAM_BUFFER_COUNT)
dispatchParams = new nsXPTCMiniVariant[paramCount];
else
dispatchParams = paramBuffer;
NS_ASSERTION(dispatchParams,"no place for params");
uint32_t* ap = args;
for(i = 0; i < paramCount; i++, ap++)
{
const nsXPTParamInfo& param = info->GetParam(i);
const nsXPTType& type = param.GetType();
nsXPTCMiniVariant* dp = &dispatchParams[i];
if(param.IsOut() || !type.IsArithmetic())
{
if (type == nsXPTType::T_JSVAL)
dp->val.p = *((void**) *ap);
else
dp->val.p = (void*) *ap;
continue;
}
// else
switch(type)
{
case nsXPTType::T_I8 : dp->val.i8 = *((int32_t*) ap); break;
case nsXPTType::T_I16 : dp->val.i16 = *((int32_t*) ap); break;
case nsXPTType::T_I32 : dp->val.i32 = *((int32_t*) ap); break;
case nsXPTType::T_DOUBLE :
case nsXPTType::T_U64 :
case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi;
((DU *)dp)->lo = ((DU *)ap)->lo;
ap++;
break;
case nsXPTType::T_U8 : dp->val.u8 = *((uint32_t*)ap); break;
case nsXPTType::T_U16 : dp->val.u16 = *((uint32_t*)ap); break;
case nsXPTType::T_U32 : dp->val.u32 = *((uint32_t*)ap); break;
case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break;
case nsXPTType::T_BOOL : dp->val.b = *((uint32_t*)ap); break;
case nsXPTType::T_CHAR : dp->val.c = *((uint32_t*)ap); break;
case nsXPTType::T_WCHAR : dp->val.wc = *((int32_t*) ap); break;
default:
NS_ERROR("bad type");
break;
}
}
result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;
return result;
}
extern "C" nsresult SharedStub(int, int*);
#define STUB_ENTRY(n) \
nsresult nsXPTCStubBase::Stub##n() \
{ \
int dummy; /* defeat tail-call optimization */ \
return SharedStub(n, &dummy); \
}
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \
{ \
NS_ERROR("nsXPTCStubBase::Sentinel called"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
#include "xptcstubsdef.inc"
#endif /* sparc || __sparc__ */

View file

@ -1,101 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Implement shared vtbl methods. */
#include "xptcprivate.h"
#include "xptiprivate.h"
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args)
{
#define PARAM_BUFFER_COUNT 16
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = nullptr;
const nsXPTMethodInfo* info;
uint8_t paramCount;
uint8_t i;
nsresult result = NS_ERROR_FAILURE;
NS_ASSERTION(self,"no self");
self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
paramCount = info->GetParamCount();
// setup variant array pointer
if(paramCount > PARAM_BUFFER_COUNT)
dispatchParams = new nsXPTCMiniVariant[paramCount];
else
dispatchParams = paramBuffer;
NS_ASSERTION(dispatchParams,"no place for params");
uint64_t* ap = args;
for(i = 0; i < paramCount; i++, ap++)
{
const nsXPTParamInfo& param = info->GetParam(i);
const nsXPTType& type = param.GetType();
nsXPTCMiniVariant* dp = &dispatchParams[i];
if(param.IsOut() || !type.IsArithmetic())
{
dp->val.p = (void*) *ap;
continue;
}
// else
switch(type)
{
case nsXPTType::T_I8 : dp->val.i8 = *((int64_t*) ap); break;
case nsXPTType::T_I16 : dp->val.i16 = *((int64_t*) ap); break;
case nsXPTType::T_I32 : dp->val.i32 = *((int64_t*) ap); break;
case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); break;
case nsXPTType::T_U64 : dp->val.u64 = *((uint64_t*)ap); break;
case nsXPTType::T_I64 : dp->val.i64 = *((int64_t*) ap); break;
case nsXPTType::T_U8 : dp->val.u8 = *((uint64_t*)ap); break;
case nsXPTType::T_U16 : dp->val.u16 = *((uint64_t*)ap); break;
case nsXPTType::T_U32 : dp->val.u32 = *((uint64_t*)ap); break;
case nsXPTType::T_FLOAT : dp->val.f = ((float*) ap)[1]; break;
case nsXPTType::T_BOOL : dp->val.b = *((uint64_t*)ap); break;
case nsXPTType::T_CHAR : dp->val.c = *((uint64_t*)ap); break;
case nsXPTType::T_WCHAR : dp->val.wc = *((int64_t*) ap); break;
default:
NS_ERROR("bad type");
break;
}
}
result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;
return result;
}
extern "C" nsresult SharedStub(int, int*);
#define STUB_ENTRY(n) \
nsresult nsXPTCStubBase::Stub##n() \
{ \
int dummy; /* defeat tail-call optimization */ \
return SharedStub(n, &dummy); \
}
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \
{ \
NS_ERROR("nsXPTCStubBase::Sentinel called"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
#include "xptcstubsdef.inc"
#endif /* sparc || __sparc__ */

View file

@ -1,139 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Implement shared vtbl methods.
// Keep this in sync with the darwin version.
#include "xptcprivate.h"
#include "xptiprivate.h"
// The Linux/x86-64 ABI passes the first 6 integer parameters and the
// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx,
// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the
// caller. The rest of the parameters are passed in the callers stack
// area.
const uint32_t PARAM_BUFFER_COUNT = 16;
const uint32_t GPR_COUNT = 6;
const uint32_t FPR_COUNT = 8;
// PrepareAndDispatch() is called by SharedStub() and calls the actual method.
//
// - 'args[]' contains the arguments passed on stack
// - 'gpregs[]' contains the arguments passed in integer registers
// - 'fpregs[]' contains the arguments passed in floating point registers
//
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gpregs, double *fpregs)
{
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = nullptr;
const nsXPTMethodInfo* info;
uint32_t paramCount;
uint32_t i;
nsresult result = NS_ERROR_FAILURE;
NS_ASSERTION(self,"no self");
self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
NS_ASSERTION(info,"no method info");
if (!info)
return NS_ERROR_UNEXPECTED;
paramCount = info->GetParamCount();
// setup variant array pointer
if (paramCount > PARAM_BUFFER_COUNT)
dispatchParams = new nsXPTCMiniVariant[paramCount];
else
dispatchParams = paramBuffer;
NS_ASSERTION(dispatchParams,"no place for params");
if (!dispatchParams)
return NS_ERROR_OUT_OF_MEMORY;
uint64_t* ap = args;
uint32_t nr_gpr = 1; // skip one GPR register for 'that'
uint32_t nr_fpr = 0;
uint64_t value;
for (i = 0; i < paramCount; i++) {
const nsXPTParamInfo& param = info->GetParam(i);
const nsXPTType& type = param.GetType();
nsXPTCMiniVariant* dp = &dispatchParams[i];
if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
if (nr_fpr < FPR_COUNT)
dp->val.d = fpregs[nr_fpr++];
else
dp->val.d = *(double*) ap++;
continue;
}
else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
if (nr_fpr < FPR_COUNT)
// The value in %xmm register is already prepared to
// be retrieved as a float. Therefore, we pass the
// value verbatim, as a double without conversion.
dp->val.d = fpregs[nr_fpr++];
else
dp->val.f = *(float*) ap++;
continue;
}
else {
if (nr_gpr < GPR_COUNT)
value = gpregs[nr_gpr++];
else
value = *ap++;
}
if (param.IsOut() || !type.IsArithmetic()) {
dp->val.p = (void*) value;
continue;
}
switch (type) {
case nsXPTType::T_I8: dp->val.i8 = (int8_t) value; break;
case nsXPTType::T_I16: dp->val.i16 = (int16_t) value; break;
case nsXPTType::T_I32: dp->val.i32 = (int32_t) value; break;
case nsXPTType::T_I64: dp->val.i64 = (int64_t) value; break;
case nsXPTType::T_U8: dp->val.u8 = (uint8_t) value; break;
case nsXPTType::T_U16: dp->val.u16 = (uint16_t) value; break;
case nsXPTType::T_U32: dp->val.u32 = (uint32_t) value; break;
case nsXPTType::T_U64: dp->val.u64 = (uint64_t) value; break;
// Cast to uint8_t first, to remove garbage on upper 56 bits.
case nsXPTType::T_BOOL: dp->val.b = (bool)(uint8_t) value; break;
case nsXPTType::T_CHAR: dp->val.c = (char) value; break;
case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; break;
default:
NS_ERROR("bad type");
break;
}
}
result = self->mOuter->CallMethod((uint16_t) methodIndex, info, dispatchParams);
if (dispatchParams != paramBuffer)
delete [] dispatchParams;
return result;
}
#define STUB_ENTRY(n)
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \
{ \
NS_ERROR("nsXPTCStubBase::Sentinel called"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
#include "xptcstubsdef.inc"

View file

@ -1,77 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Implement shared vtbl methods. */
#include "xptcprivate.h"
#include "xptiprivate.h"
nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
nsXPTCMiniVariant* dispatchParams = nullptr;
const nsXPTMethodInfo* info;
uint8_t paramCount;
uint8_t i;
nsresult result = NS_ERROR_FAILURE;
NS_ASSERTION(self,"no self");
self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
NS_ASSERTION(info,"no interface info");
paramCount = info->GetParamCount();
// setup variant array pointer
if(paramCount > PARAM_BUFFER_COUNT)
dispatchParams = new nsXPTCMiniVariant[paramCount];
else
dispatchParams = paramBuffer;
NS_ASSERTION(dispatchParams,"no place for params");
uint32_t* ap = args;
for(i = 0; i < paramCount; i++, ap++)
{
const nsXPTParamInfo& param = info->GetParam(i);
const nsXPTType& type = param.GetType();
nsXPTCMiniVariant* dp = &dispatchParams[i];
if(param.IsOut() || !type.IsArithmetic())
{
dp->val.p = (void*) *ap;
continue;
}
// else
dp->val.p = (void*) *ap;
switch(type)
{
case nsXPTType::T_I64 : dp->val.i64 = *((int64_t*) ap); ap++; break;
case nsXPTType::T_U64 : dp->val.u64 = *((uint64_t*)ap); ap++; break;
case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break;
}
}
result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
if(dispatchParams != paramBuffer)
delete [] dispatchParams;
return result;
}
#define STUB_ENTRY(n)
#define SENTINEL_ENTRY(n) \
nsresult nsXPTCStubBase::Sentinel##n() \
{ \
NS_ERROR("nsXPTCStubBase::Sentinel called"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
#include "xptcstubsdef.inc"

View file

@ -239,20 +239,6 @@ a port.
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>SunOS x86</TD>
<TD>
<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:aljones@lbl.gov">Arthur Jones &lt;aljones@lbl.gov&gt;</a><BR>
<font color="red"><b>?</b></font>
<a href="mailto:ppokorny@mindspring.com">Philip Pokorny &lt;ppokorny@mindspring.com&gt;</a><BR>
</TD>
<TD>
The word I hear is that this is working and done
</TD>
</TR>
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>AIX PPC</TD>