summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2001-03-08 13:37:58 +0000
committerDaniel Boelzle <dbo@openoffice.org>2001-03-08 13:37:58 +0000
commit63d3fcd964d69d5383589215a05396b7f7edbf78 (patch)
tree4d3dc702445a2aa5a1b8797dcd305f365c641d2d
parent7db0f9fa2fd8d84fbb20c50f43b7d40ff4d460a1 (diff)
fixed exception bugs
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/call.s169
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/cpp2uno.cxx120
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk6
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx10
4 files changed, 146 insertions, 159 deletions
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/call.s b/bridges/source/cpp_uno/cc50_solaris_sparc/call.s
index c05a16c38..ec32921c3 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/call.s
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/call.s
@@ -1,28 +1,59 @@
+.global privateSnippetExecutor
+.type privateSnippetExecutor,2
+privateSnippetExecutor:
+ save %sp, -104, %sp
+ ! %i0 saved by codeSnippet
+ st %i1, [%fp+72]
+ st %i2, [%fp+76]
+ st %i3, [%fp+80]
+ st %i4, [%fp+84]
+ st %i5, [%fp+88]
+ mov %g1, %o0
+ mov %fp, %o1
+ call __1cHsunpro5Pcpp_vtable_call6Fippv_i_
+ nop
+.privateSnippetExecutorExceptionPosition:
+ subcc %o0, 11, %g0
+ bne .noDouble
+ nop
+ ld [%fp+68], %i0
+ ld [%fp+72], %i1
+ std %i0, [%fp-8]
+ ldd [%fp-8], %f0
+ ba .noFloat
+ nop
+.noDouble:
+ subcc %o0, 10, %g0
+ bne .noFloat
+ nop
+ ld [%fp+68], %f0
+.noFloat:
+ ld [%fp+68], %i0
+ ld [%fp+72], %i1
+ ld [%fp+76], %i2
+ ld [%fp+80], %i3
+ ld [%fp+84], %i4
+ ld [%fp+88], %i5
+ ret
+ restore
+.size privateSnippetExecutor,(.-privateSnippetExecutor)
+.align 8
+
+
.global callVirtualMethod
.type callVirtualMethod,2
callVirtualMethod:
! allocate FIRST stack to have own local registers
- save %sp, -96, %sp
- ! copy in to out parameters for second stackframe
- mov %i0, %o0
- mov %i1, %o1
- mov %i2, %o2
- mov %i3, %o3
- mov %i4, %o4
- mov %i5, %o5
-
- ! decide wether there are more than 6 parameter
- mov -96, %l3 ! default stack space
- subcc %i5, 6, %l5
- ble allocateSecondStack
- nop
- sll %l5, 2, %l5
- sub %l3, %l5, %l3
-allocateSecondStack:
- save %sp, %l3, %sp ! allocate new stack
+ sethi %hi(-96), %g1
+ or %g1, %lo(-96), %g1
+ subcc %g1, %o5, %g1
+ subcc %g1, %o5, %g1
+ subcc %g1, %o5, %g1
+ subcc %g1, %o5, %g1
+ save %sp, %g1, %sp
! copy stack longs if necessary
subcc %i5, 6, %l5
- ble copyRegisters
+ ble .copyRegisters
nop
! prepare source location
@@ -31,49 +62,49 @@ allocateSecondStack:
! prepare real stack
add %sp, 92, %l3
-copyLong:
- ld [%l4+0], %l0
- st %l0, [%l3]
+.copyLong:
+ ld [%l4+0], %l0
+ st %l0, [%l3]
add %l4, 4, %l4
add %l3, 4, %l3
deccc %l5
- bne copyLong
+ bne .copyLong
nop
-copyRegisters:
+.copyRegisters:
mov %i5, %l5
mov %i4, %l4
- ld [%l4], %o0
+ ld [%l4], %o0
add %l4, 4, %l4
deccc %l5
- ble doCall
+ ble .doCall
- ld [%l4], %o1
+ ld [%l4], %o1
add %l4, 4, %l4
deccc %l5
- ble doCall
+ ble .doCall
- ld [%l4], %o2
+ ld [%l4], %o2
add %l4, 4, %l4
deccc %l5
- ble doCall
+ ble .doCall
ld [%l4], %o3
add %l4, 4, %l4
deccc %l5
- ble doCall
+ ble .doCall
ld [%l4], %o4
add %l4, 4, %l4
deccc %l5
- ble doCall
+ ble .doCall
ld [%l4], %o5
add %l4, 4, %l4
! prepare complex return pointer
st %i2, [%sp+64]
-doCall:
+.doCall:
! get virtual table entry
mov %i1, %l1
add %l1, 2, %l1
@@ -83,83 +114,93 @@ doCall:
ld [%l1], %l0
jmpl %l0,%o7
nop
-.global callVirtualMethodExceptionHandler
-.type callVirtualMethodExceptionHandler,2
-callVirtualMethodExceptionHandler:
+.callVirtualMethodExceptionPosition:
! handle returns
!byte types
subcc %i3, 2, %l3 ! typelib_TypeClass_BOOLEAN
- be handleByte
+ be .handleByte
subcc %i3, 3, %l3 ! typelib_TypeClass_BYTE
- be handleByte
+ be .handleByte
! half word types
subcc %i3, 4, %l3 ! typelib_TypeClass_SHORT
- be handleShort
+ be .handleShort
subcc %i3, 5, %l3 ! typelib_TypeClass_UNSIGNED_SHORT
- be handleShort
+ be .handleShort
subcc %i3, 1, %l3 ! typelib_TypeClass_CHAR (sal_Unicode==sal_uInt16)
- be handleShort
+ be .handleShort
! word types
subcc %i3, 6, %l3 ! typelib_TypeClass_LONG
- be handleWord
+ be .handleWord
subcc %i3, 7, %l3 ! typelib_TypeClass_UNSIGNED_LONG
- be handleWord
+ be .handleWord
subcc %i3, 15, %l3 ! typelib_TypeClass_ENUM
- be handleWord
+ be .handleWord
! double word types
subcc %i3, 8, %l3 ! typelib_TypeClass_HYPER
- be handleDoubleWord
+ be .handleDoubleWord
subcc %i3, 9, %l3 ! typelib_TypeClass_UNSIGNED_HYPER
- be handleDoubleWord
+ be .handleDoubleWord
! float
subcc %i3, 10, %l3 ! typelib_TypeClass_FLOAT
- be handleFloat
+ be .handleFloat
! double
subcc %i3, 11, %l3 ! typelib_TypeClass_DOUBLE
- be handleDouble
+ be .handleDouble
! default: return void
nop ! empty prefetch
- ba doRestore
+ ba .doRestore
nop
-handleByte:
+.handleByte:
stb %o0, [%i2]
- ba doRestore
+ ba .doRestore
nop
-handleShort:
+.handleShort:
sth %o0, [%i2]
- ba doRestore
+ ba .doRestore
nop
-handleWord:
+.handleWord:
st %o0, [%i2]
- ba doRestore
+ ba .doRestore
nop
-handleDoubleWord:
+.handleDoubleWord:
st %o0, [%i2]
st %o1, [%i2+4]
- ba doRestore
+ ba .doRestore
nop
-handleFloat:
+.handleFloat:
st %f0, [%i2]
- ba doRestore
+ ba .doRestore
nop
-handleDouble:
+.handleDouble:
std %f0, [%fp-8]
ldd [%fp-8], %o0
st %o0, [%i2]
st %o1, [%i2+4]
- ba doRestore
+ ba .doRestore
nop
-doRestore:
- restore ! stack frame for called method
+.doRestore:
ret
restore ! stack frame for own locals
-.size callVirtualMethodExceptionHandler,(.-callVirtualMethodExceptionHandler)
.size callVirtualMethod,(.-callVirtualMethod)
.align 8
+
+.rethrow_handler:
+ call __1cG__CrunMex_rethrow_q6F_v_
+ nop
+
+.section ".exception_ranges",#alloc
+.word %r_disp32(.privateSnippetExecutorExceptionPosition)
+.word 0
+.word .rethrow_handler-.privateSnippetExecutorExceptionPosition
+.word 0,0
+.word %r_disp32(.callVirtualMethodExceptionPosition)
+.word 0
+.word .rethrow_handler-.callVirtualMethodExceptionPosition
+.word 0,0
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/cc50_solaris_sparc/cpp2uno.cxx
index b0b87724c..dc3d24729 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/cpp2uno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cpp2uno.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dbo $ $Date: 2000-12-21 14:47:44 $
+ * last change: $Author: dbo $ $Date: 2001-03-08 14:37:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,6 +58,8 @@
*
*
************************************************************************/
+#define SAL_THROW( exc ) throw exc
+
#define LEAK_STATIC_DATA
// #define TRACE(x) OSL_TRACE(x)
#define TRACE(x)
@@ -459,7 +461,7 @@ const MediateClassData::ClassDataBuffer* MediateClassData::getClassData( typelib
}
//==================================================================================================
-void cpp_vtable_call( int nTableEntry, void** pCallStack )
+int cpp_vtable_call( int nTableEntry, void** pCallStack )
{
long nRegReturn[2];
typelib_TypeClass aType =
@@ -488,10 +490,13 @@ void cpp_vtable_call( int nTableEntry, void** pCallStack )
pCallStack[ 17 ] = (void*) nRegReturn[ 0 ];
break;
}
+ return aType;
}
enum SpecialReturnType { None, ReturnFloat, ReturnDouble };
+extern "C" void privateSnippetExecutor();
+
//__________________________________________________________________________________________________
void MediateClassData::createVTable( ClassDataBuffer* pBuffer, typelib_InterfaceTypeDescription* pType )
{
@@ -551,7 +556,7 @@ void MediateClassData::createVTable( ClassDataBuffer* pBuffer, typelib_Interface
TYPELIB_DANGER_RELEASE( pMember );
}
- const int nSnippetSize = 256;
+ const int nSnippetSize = 32;
int nSize = aSpecialReturn.size();
char * pSpace = (char *)rtl_allocateMemory( ((nSize+3)*sizeof(void *)) + (nSize * nSnippetSize) );
pBuffer->m_pVTable = (void**)pSpace;
@@ -574,94 +579,29 @@ void MediateClassData::createVTable( ClassDataBuffer* pBuffer, typelib_Interface
nTablePos |= 0x80000000;
aComplexReturn.pop_front();
pvft[nPos+3] = codeSnip;
- /*generate this code:
- * save %sp, -104, %sp
- * st %i0, [ %fp + 68 ]
- * st %i1, [ %fp + 72 ]
- * st %i2, [ %fp + 76 ]
- * st %i3, [ %fp + 80 ]
- * st %i4, [ %fp + 84 ]
- * st %i5, [ %fp + 88 ]
- * prepare vtable entry
- * sethi %hi( nTablePos ), %o0
- * or %lo( nTablePos ), %o0
- *
- * ( if complex return, set high bit )
- *
- * mov %fp, %o1 prepare stack
- * call cpp_vtable_call
- * nop
- * ld [ %fp + 68 ], %i0 restore (perhaps changed) registers
- * ld [ %fp + 72 ], %i1
- * ld [ %fp + 76 ], %i2
- * ld [ %fp + 80 ], %i3
- * ld [ %fp + 84 ], %i4
- * ld [ %fp + 88 ], %i5
- *
- * ( if double return value, get (%i0, %i1) into %f0
- * std %i0, [ %fp - 8 ]
- * ldd [ %fp - 8 ], %f0
- *
- * ( if float return value, get (%i0) into %f0
- * ld [ %fp + 68 ], %f0
- *
- * jmp %i7+8 return
- * restore
- *exception cleanup code
- * call __Crun::ex_rethrow_q
- * nop
- */
- *codeSnip++ = 0x9de3bf98;
- *codeSnip++ = 0xf027a044;
- *codeSnip++ = 0xf227a048;
- *codeSnip++ = 0xf427a04c;
- *codeSnip++ = 0xf627a050;
- *codeSnip++ = 0xf827a054;
- *codeSnip++ = 0xfa27a058;
- *codeSnip++ = 0x11000000 | (nTablePos >> 10);
- *codeSnip++ = 0x90122000 | (nTablePos & 1023);
- *codeSnip++ = 0x9210001e;
- unsigned long rel32 = (unsigned long)cpp_vtable_call - ((unsigned long)codeSnip);
- *codeSnip++ = 0x40000000 | (rel32 >> 2 );
- *codeSnip++ = 0x01000000;
- *codeSnip++ = 0xf007a044;
- *codeSnip++ = 0xf207a048;
- *codeSnip++ = 0xf407a04c;
- *codeSnip++ = 0xf607a050;
- *codeSnip++ = 0xf807a054;
- *codeSnip++ = 0xfa07a058;
-
- switch( eRet )
- {
- case ReturnFloat:
- *codeSnip++ = 0xc107a044;
- break;
- case ReturnDouble:
- *codeSnip++ = 0xf03fbff8;
- *codeSnip++ = 0xc11fbff8;
- break;
- default:
- break;
- }
-
- unsigned long* exc_frame = codeSnip;
- *codeSnip++ = 0x81c7e008;
- *codeSnip++ = 0x81e80000;
- unsigned long* exc_handler = codeSnip;
- *codeSnip++ = 0x40000000 | (((unsigned long)__Crun::ex_rethrow_q) >> 2);
- *codeSnip++ = 0x01000000;
-
- unsigned long* frame_info = new unsigned long[5];
- memset( frame_info, 0, 5*sizeof(unsigned long) );
- frame_info[ 0 ] = (unsigned long)exc_frame;
- frame_info[ 2 ] = (unsigned long)(exc_handler);
- _ex_register( frame_info, 1 );
+ /* generate this code:
+ st %o0, [%sp+68]
+ sethi %hi(privateSnippetExecutor), %o0
+ or %lo(privateSnippetExecutor),%o0,%o0
+ sethi %hi(nTablePos), %g1
+ or %lo(nTablePos), %g1, %g1
+ jmpl %o0, %g0
+ nop
+ */
+ *codeSnip++ = 0xd023a044;
+ *codeSnip++ = 0x11000000 | ((unsigned long)privateSnippetExecutor >> 10);
+ *codeSnip++ = 0x90122000 | ((unsigned long)privateSnippetExecutor & 0x3ff);
+ *codeSnip++ = 0x03000000 | (nTablePos >> 10);
+ *codeSnip++ = 0x82106000 | (nTablePos & 0x3ff);
+ *codeSnip++ = 0x81c20000;
+ *codeSnip++ = 0x01000000;
}
}
//==================================================================================================
extern "C" void SAL_CALL cppu_cppInterfaceProxy_patchVtable(
- XInterface * pCppI, typelib_InterfaceTypeDescription * pTypeDescr ) throw ()
+ XInterface * pCppI, typelib_InterfaceTypeDescription * pTypeDescr )
+ SAL_THROW( () )
{
static MediateClassData * s_pMediateClassData = 0;
if (! s_pMediateClassData)
@@ -683,13 +623,15 @@ extern "C" void SAL_CALL cppu_cppInterfaceProxy_patchVtable(
}
//##################################################################################################
-extern "C" SAL_DLLEXPORT void SAL_CALL uno_initEnvironment( uno_Environment * pCppEnv ) throw ()
+extern "C" SAL_DLLEXPORT void SAL_CALL uno_initEnvironment( uno_Environment * pCppEnv )
+ SAL_THROW( () )
{
CPPU_CURRENT_NAMESPACE::cppu_cppenv_initEnvironment( pCppEnv );
}
//##################################################################################################
extern "C" SAL_DLLEXPORT void SAL_CALL uno_ext_getMapping(
- uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo ) throw ()
+ uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo )
+ SAL_THROW( () )
{
CPPU_CURRENT_NAMESPACE::cppu_ext_getMapping( ppMapping, pFrom, pTo );
}
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk b/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
index 0d49c628b..0439b732a 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.2 $
+# $Revision: 1.3 $
#
-# last change: $Author: hr $ $Date: 2000-10-27 12:28:15 $
+# last change: $Author: dbo $ $Date: 2001-03-08 14:37:58 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -107,5 +107,5 @@ SHL1STDLIBS= \
$(SLO)$/call.obj: call.s
- as -o $(SLO)$/call.o call.s ; touch $(SLO)$/call.obj
+ CC -c -o $(SLO)$/call.o call.s ; touch $(SLO)$/call.obj
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
index 92cd7ee8c..4ed8fa8d9 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: uno2cpp.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dbo $ $Date: 2000-12-21 14:47:44 $
+ * last change: $Author: dbo $ $Date: 2001-03-08 14:37:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,6 +58,7 @@
*
*
************************************************************************/
+#define SAL_THROW( exc ) throw exc
#include <alloca.h>
#include <map>
@@ -75,6 +76,8 @@
#include <bridges/cpp_uno/type_misc.hxx>
#endif
+//#include <com/sun/star/lang/IllegalArgumentException.hdl>
+
#include "cc50_solaris_sparc.hxx"
using namespace std;
@@ -297,7 +300,8 @@ static void cpp_call(
//==================================================================================================
extern "C" void SAL_CALL cppu_unoInterfaceProxy_dispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
- void * pReturn, void * pArgs[], uno_Any ** ppException ) throw ()
+ void * pReturn, void * pArgs[], uno_Any ** ppException )
+ SAL_THROW( () )
{
// is my surrogate
cppu_unoInterfaceProxy * pThis = (cppu_unoInterfaceProxy *)pUnoI;