26#include <com/sun/star/uno/Exception.hpp>
27#include <com/sun/star/uno/RuntimeException.hpp>
28#include <com/sun/star/uno/genfunc.hxx>
51 sal_Int32 nVtableIndex,
52 void * pRegisterReturn,
53 typelib_TypeClass eReturnType,
54 sal_Int32 * pStackLongs,
59 void * pRegisterReturn,
60 typelib_TypeClass eReturnType,
61#
if OSL_DEBUG_LEVEL > 0
62 sal_Int32 * pStackLongs,
63 sal_Int32 nStackLongs)
72 assert(pStackLongs && pAdjustedThisPtr);
73 static_assert( (
sizeof(
void *) == 4) &&
74 (
sizeof(sal_Int32) == 4),
"### unexpected size of int!" );
75 assert(nStackLongs && pStackLongs &&
"### no stack in callVirtualMethod !");
83 volatile long long saveReg[7];
90 "add %%l0, 8, %%l0\n\t"
91 "std %%l2, [%%l0]\n\t"
92 "add %%l0, 8, %%l0\n\t"
93 "std %%l4, [%%l0]\n\t"
94 "add %%l0, 8, %%l0\n\t"
95 "std %%o0, [%%l0]\n\t"
96 "add %%l0, 8, %%l0\n\t"
97 "std %%o2, [%%l0]\n\t"
98 "add %%l0, 8, %%l0\n\t"
99 "std %%o4, [%%l0]\n\t"
100 "add %%l0, 8, %%l0\n\t"
101 "std %%l6, [%%l0]\n\t"
107 "subcc %%i5, 7, %%l0\n\t"
111 "sll %%l0, 2, %%l0\n\t"
112 "add %%l0, 96, %%l0\n\t"
114 "sub %%sp, %%l0, %%l0\n\t"
115 "andcc %%l0, 7, %%g0\n\t"
118 "sub %%l0, 4, %%l0\n"
121 "add %%g0, 16, %%o4\n"
126 "ld [%%l1], %%l2\n\t"
128 "add %%l0, 4, %%l0\n\t"
129 "add %%l1, 4, %%l1\n\t"
130 "subcc %%o4, 1, %%o4\n\t"
137 "sub %%i5, 7, %%l0\n\t"
138 "add %%i4, 28, %%l1\n\t"
139 "add %%sp, 92, %%l2\n"
141 "ld [%%l1], %%o0\n\t"
142 "st %%o0, [%%l2]\n\t"
143 "add %%l1, 4, %%l1\n\t"
144 "add %%l2, 4, %%l2\n\t"
145 "subcc %%l0, 1, %%l0\n\t"
153 "ld [%%l1], %%o0\n\t"
154 "st %%o0, [%%sp+64]\n\t"
155 "sub %%l0, 1, %%l0\n\t"
156 "add %%l1, 4, %%l1\n\t"
158 "ld [%%l1], %%o0\n\t"
159 "subcc %%l0, 1, %%l0\n\t"
163 "add %%l1, 4, %%l1\n\t"
164 "ld [%%l1], %%o1\n\t"
165 "subcc %%l0, 1, %%l0\n\t"
169 "add %%l1, 4, %%l1\n\t"
170 "ld [%%l1], %%o2\n\t"
171 "subcc %%l0, 1, %%l0\n\t"
175 "add %%l1, 4, %%l1\n\t"
176 "ld [%%l1], %%o3\n\t"
177 "subcc %%l0, 1, %%l0\n\t"
181 "add %%l1, 4, %%l1\n\t"
182 "ld [%%l1], %%o4\n\t"
183 "subcc %%l0, 1, %%l0\n\t"
187 "add %%l1, 4, %%l1\n\t"
191 "ld [%%i0], %%l0\n\t"
193"sll %%i1, 2, %%l6\n\t"
195 "add %%l6, %%l0, %%l0\n\t"
205 "ld [%%l0], %%l0\n\t"
207 "ld [%%i4], %%l2\n\t"
208 "subcc %%l2, %%g0, %%l2\n\t"
209 "bne .LcomplexCall\n\t"
213 "ba .LcallReturned\n\t"
220 ".LcallReturned:\n\t"
228 "ldd [%%l7], %%l0\n\t"
229 "add %%l7, 8, %%l7\n\t"
230 "ldd [%%l7], %%l2\n\t"
231 "add %%l7, 8, %%l7\n\t"
232 "ldd [%%l7], %%l4\n\t"
233 "add %%l7, 8, %%l7\n\t"
234 "ldd [%%l7], %%o0\n\t"
235 "add %%l7, 8, %%l7\n\t"
236 "ldd [%%l7], %%o2\n\t"
237 "add %%l7, 8, %%l7\n\t"
238 "ldd [%%l7], %%o4\n\t"
239 "add %%l7, 8, %%l7\n\t"
240 "ldd [%%l7], %%l6\n\t"
251 switch( eReturnType )
253 case typelib_TypeClass_HYPER:
254 case typelib_TypeClass_UNSIGNED_HYPER:
255 ((
long*)pRegisterReturn)[1] = o1;
256 case typelib_TypeClass_LONG:
257 case typelib_TypeClass_UNSIGNED_LONG:
258 case typelib_TypeClass_ENUM:
259 ((
long*)pRegisterReturn)[0] = o0;
261 case typelib_TypeClass_CHAR:
262 case typelib_TypeClass_SHORT:
263 case typelib_TypeClass_UNSIGNED_SHORT:
264 *(
unsigned short*)pRegisterReturn = (
unsigned short)o0;
266 case typelib_TypeClass_BOOLEAN:
267 case typelib_TypeClass_BYTE:
268 *(
unsigned char*)pRegisterReturn = (
unsigned char)o0;
270 case typelib_TypeClass_FLOAT:
271 *(
float*)pRegisterReturn = f0f;
273 case typelib_TypeClass_DOUBLE:
274 *(
double*)pRegisterReturn = f0d;
284 typelib_TypeDescriptionReference * pReturnTypeRef,
285 sal_Int32 nParams, typelib_MethodParameter * pParams,
286 void * pUnoReturn,
void * pUnoArgs[],
uno_Any ** ppUnoExc )
290 (
char *)alloca( (nParams+2) *
sizeof(sal_Int64) );
291 char * pCppStackStart = pCppStack;
295 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
296 assert(pReturnTypeDescr);
298 void * pCppReturn = 0;
300 if (pReturnTypeDescr)
304 pCppReturn = pUnoReturn;
305 *(
void**)pCppStack = NULL;
311 ? alloca( pReturnTypeDescr->nSize )
314 pCppStack +=
sizeof(
void*);
317 void * pAdjustedThisPtr =
reinterpret_cast< void **
>(pThis->
getCppI())
319 *(
void**)pCppStack = pAdjustedThisPtr;
320 pCppStack +=
sizeof(
void* );
323 static_assert(
sizeof(
void *) ==
sizeof(sal_Int32),
"### unexpected size!");
325 void ** pCppArgs = (
void **)alloca( 3 *
sizeof(
void *) * nParams );
327 sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
331 sal_Int32 nTempIndices = 0;
333 for ( sal_Int32 nPos = 0;
nPos < nParams; ++
nPos )
335 const typelib_MethodParameter & rParam = pParams[
nPos];
337 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
342 switch (pParamTypeDescr->eTypeClass)
344 case typelib_TypeClass_HYPER:
345 case typelib_TypeClass_UNSIGNED_HYPER:
346 case typelib_TypeClass_DOUBLE:
347 static_assert(
sizeof (double) ==
sizeof (sal_Int64),
"boo");
348 *
reinterpret_cast< sal_Int32 *
>(pCppStack) =
349 *
reinterpret_cast< sal_Int32
const *
>(pUnoArgs[ nPos ]);
350 pCppStack +=
sizeof (sal_Int32);
351 *
reinterpret_cast< sal_Int32 *
>(pCppStack) =
352 *(
reinterpret_cast< sal_Int32
const *
>(pUnoArgs[ nPos ] ) + 1);
356 pCppArgs[nPos], pUnoArgs[nPos], pParamTypeDescr,
361 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
369 *(
void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
371 pTempIndices[nTempIndices] =
nPos;
373 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
380 *(
void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
381 pUnoArgs[nPos], pParamTypeDescr,
384 pTempIndices[nTempIndices] =
nPos;
386 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
390 *(
void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
392 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
395 pCppStack +=
sizeof(sal_Int32);
400 int nStackLongs = (pCppStack - pCppStackStart)/
sizeof(sal_Int32);
401 assert( !( (pCppStack - pCppStackStart ) & 3) &&
"UNALIGNED STACK !!! (Please DO panic" );
403 if( nStackLongs & 1 )
411 pReturnTypeDescr->eTypeClass,
412 (sal_Int32 *)pCppStackStart,
414 }
catch (css::uno::Exception &) {
416 }
catch (std::exception & e) {
417 throw css::uno::RuntimeException(
421 throw css::uno::RuntimeException(
"C++ code threw unknown exception");
427 for ( ; nTempIndices--; )
429 sal_Int32
nIndex = pTempIndices[nTempIndices];
432 if (pParams[nIndex].bIn)
434 if (pParams[nIndex].bOut)
449 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
452 if (pCppReturn && pUnoReturn != pCppReturn)
465 for ( ; nTempIndices--; )
467 sal_Int32
nIndex = pTempIndices[nTempIndices];
469 uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
470 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
473 if (pReturnTypeDescr)
474 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
484 void * pReturn,
void * pArgs[],
uno_Any ** ppException )
486#if defined BRIDGES_DEBUG
487 OString cstr(
OUStringToOString( pMemberDescr->pTypeName, RTL_TEXTENCODING_ASCII_US ) );
488 fprintf( stderr,
"received dispatch( %s )\n", cstr.getStr() );
496 switch (pMemberDescr->eTypeClass)
498 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
500 VtableSlot aVtableSlot(
503 typelib_InterfaceAttributeTypeDescription
const *
>(
510 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
512 pReturn, pArgs, ppException );
517 typelib_MethodParameter aParam;
519 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
523 typelib_TypeDescriptionReference * pReturnTypeRef = 0;
524 OUString aVoidName(
"void");
526 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
529 aVtableSlot.
index += 1;
534 pReturn, pArgs, ppException );
541 case typelib_TypeClass_INTERFACE_METHOD:
543 VtableSlot aVtableSlot(
546 typelib_InterfaceMethodTypeDescription
const *
>(
548 switch (aVtableSlot.
index)
552 (*pUnoI->acquire)( pUnoI );
556 (*pUnoI->release)( pUnoI );
562 TYPELIB_DANGER_GET( &pTD,
reinterpret_cast< Type *
>( pArgs[0] )->getTypeLibType() );
565 uno_Interface * pInterface = 0;
568 (
void **)&pInterface, pThis->
oid.pData, (typelib_InterfaceTypeDescription *)pTD );
573 reinterpret_cast< uno_Any *
>( pReturn ),
574 &pInterface, pTD, 0 );
575 (*pInterface->release)( pInterface );
576 TYPELIB_DANGER_RELEASE( pTD );
580 TYPELIB_DANGER_RELEASE( pTD );
587 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
588 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
589 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
590 pReturn, pArgs, ppException );
596 ::com::sun::star::uno::RuntimeException aExc(
597 "illegal member type description!",
602 ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
uno_Mapping * getUno2Cpp()
uno_ExtEnvironment * getUnoEnv()
uno_Mapping * getCpp2Uno()
A uno proxy wrapping a cpp interface.
com::sun::star::uno::XInterface * getCppI()
void SAL_CALL uno_destructData(void *pValue, typelib_TypeDescription *pTypeDescr, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
void SAL_CALL uno_constructData(void *pMem, typelib_TypeDescription *pTypeDescr) SAL_THROW_EXTERN_C()
void SAL_CALL uno_copyAndConvertData(void *pDest, void *pSource, typelib_TypeDescription *pTypeDescr, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
register sal_uInt32 r28 __asm__("%r28")
void callVirtualMethod(void *pThis, sal_uInt32 nVtableIndex, void *pRegisterReturn, typelib_TypeDescription *pReturnTypeDescr, bool bRegisterReturn, sal_uInt32 *pStack, sal_uInt32 nStack, sal_uInt32 *pGPR, double *pFPR) __attribute__((noinline))
static void cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy *pThis, bridges::cpp_uno::shared::VtableSlot aVtableSlot, typelib_TypeDescriptionReference *pReturnTypeRef, sal_Int32 nParams, typelib_MethodParameter *pParams, void *pUnoReturn, void *pUnoArgs[], uno_Any **ppUnoExc)
struct _typelib_TypeDescription typelib_TypeDescription
void dummy_can_throw_anything(char const *)
void fillUnoException(uno_Any *pUnoExc, uno_Mapping *pCpp2Uno)
char * adjustPointer(char *pIn, typelib_TypeDescription *pType)
void unoInterfaceProxyDispatch(uno_Interface *pUnoI, typelib_TypeDescription const *pMemberDescr, void *pReturn, void **pArgs, uno_Any **ppException)
VtableSlot getVtableSlot(typelib_InterfaceAttributeTypeDescription const *ifcMember)
Calculates the vtable slot associated with an interface attribute member.
bool isSimpleType(typelib_TypeClass typeClass)
Determines whether a type is a "simple" type (VOID, BOOLEAN, BYTE, SHORT, UNSIGNED SHORT,...
bool relatesToInterfaceType(typelib_TypeDescription const *type)
Determines whether a type relates to an interface type (is itself an interface type,...
OUString runtimeToOUString(char const *runtimeString)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Represents a vtable slot of a C++ class.
sal_Int32 index
The index within the vtable.
sal_Int32 offset
The offset of the vtable.
void SAL_CALL typelib_typedescriptionreference_new(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
unsigned _Unwind_Word __attribute__((__mode__(__word__)))