23#include <com/sun/star/uno/genfunc.hxx>
39 void * pAdjustedThisPtr, sal_Int32 nVtableIndex,
40 void * pRegisterReturn, typelib_TypeClass eReturnTypeClass,
41 sal_Int32 * pStackLongs, sal_Int32 nStackLongs )
46 assert(pStackLongs && pAdjustedThisPtr);
47 static_assert( (
sizeof(
void *) == 4) &&
48 (
sizeof(sal_Int32) == 4),
"### unexpected size of int!" );
65 mov ecx, pAdjustedThisPtr
74 mov ecx, eReturnTypeClass
75 cmp ecx, typelib_TypeClass_VOID
77 mov ebx, pRegisterReturn
79 cmp ecx, typelib_TypeClass_LONG
81 cmp ecx, typelib_TypeClass_UNSIGNED_LONG
83 cmp ecx, typelib_TypeClass_ENUM
86 cmp ecx, typelib_TypeClass_BOOLEAN
88 cmp ecx, typelib_TypeClass_BYTE
91 cmp ecx, typelib_TypeClass_CHAR
93 cmp ecx, typelib_TypeClass_SHORT
95 cmp ecx, typelib_TypeClass_UNSIGNED_SHORT
98 cmp ecx, typelib_TypeClass_FLOAT
101 cmp ecx, typelib_TypeClass_DOUBLE
104 cmp ecx, typelib_TypeClass_HYPER
106 cmp ecx, typelib_TypeClass_UNSIGNED_HYPER
110 mov
byte ptr [ebx], al
113 mov word ptr [ebx], ax
122 mov dword ptr [ebx], eax
123 mov dword ptr [ebx+4], edx
126 mov dword ptr [ebx], eax
140 typelib_TypeDescriptionReference * pReturnTypeRef,
142 typelib_MethodParameter * pParams,
148 char * pCppStack = (
char *)alloca(
sizeof(sal_Int32) + (nParams *
sizeof(sal_Int64)) );
149 char * pCppStackStart = pCppStack;
153 TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
156 void * pCppReturn =
nullptr;
162 pCppReturn = pUnoReturn;
167 pCppReturn = *(
void **)pCppStack
170 ? alloca( pReturnTD->nSize )
172 pCppStack +=
sizeof(
void *);
178 static_assert(
sizeof(
void *) ==
sizeof(sal_Int32),
"### unexpected size!");
180 void ** pCppArgs = (
void **)alloca( 3 *
sizeof(
void *) * nParams );
182 sal_Int32 * pTempIndexes = (sal_Int32 *)(pCppArgs + nParams);
186 sal_Int32 nTempIndexes = 0;
188 for (
int nPos = 0;
nPos < nParams; ++
nPos)
190 const typelib_MethodParameter & rParam = pParams[
nPos];
192 TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
196 ::uno_copyAndConvertData(
197 pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTD,
198 pThis->getBridge()->getUno2Cpp() );
200 switch (pParamTD->eTypeClass)
202 case typelib_TypeClass_HYPER:
203 case typelib_TypeClass_UNSIGNED_HYPER:
204 case typelib_TypeClass_DOUBLE:
205 pCppStack +=
sizeof(sal_Int32);
211 TYPELIB_DANGER_RELEASE( pParamTD );
219 *(
void **)pCppStack = pCppArgs[nPos] = alloca( pParamTD->nSize ),
223 pTempIndexes[nTempIndexes] =
nPos;
226 pTempParamTD[nTempIndexes++] = pParamTD;
231 ::uno_copyAndConvertData(
232 *(
void **)pCppStack = pCppArgs[nPos] = alloca( pParamTD->nSize ),
233 pUnoArgs[nPos], pParamTD,
234 pThis->getBridge()->getUno2Cpp() );
237 pTempIndexes[nTempIndexes] =
nPos;
240 pTempParamTD[nTempIndexes++] = pParamTD;
244 *(
void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
246 TYPELIB_DANGER_RELEASE( pParamTD );
249 pCppStack +=
sizeof(sal_Int32);
256 reinterpret_cast< void **
>(pThis->getCppI()) + aVtableSlot.offset,
258 pCppReturn, pReturnTD->eTypeClass,
259 (sal_Int32 *)pCppStackStart,
260 (pCppStack - pCppStackStart) /
sizeof(sal_Int32) );
263 GetExceptionInformation(),
264 *ppUnoExc, pThis->getBridge()->getCpp2Uno() ))
268 while (nTempIndexes--)
270 sal_Int32
nIndex = pTempIndexes[nTempIndexes];
273 pCppArgs[nIndex], pTempParamTD[nTempIndexes],
275 TYPELIB_DANGER_RELEASE( pTempParamTD[nTempIndexes] );
280 TYPELIB_DANGER_RELEASE( pReturnTD );
289 while (nTempIndexes--)
291 int nIndex = pTempIndexes[nTempIndexes];
293 pTempParamTD[nTempIndexes];
295 if (pParams[nIndex].bIn)
297 if (pParams[nIndex].bOut)
300 pUnoArgs[nIndex], pParamTD,
nullptr );
301 ::uno_copyAndConvertData(
302 pUnoArgs[nIndex], pCppArgs[nIndex], pParamTD,
303 pThis->getBridge()->getCpp2Uno() );
308 ::uno_copyAndConvertData(
309 pUnoArgs[nIndex], pCppArgs[nIndex], pParamTD,
310 pThis->getBridge()->getCpp2Uno() );
315 pCppArgs[nIndex], pParamTD, uno::cpp_release );
317 TYPELIB_DANGER_RELEASE( pParamTD );
321 if (pCppReturn && pUnoReturn != pCppReturn)
323 ::uno_copyAndConvertData(
324 pUnoReturn, pCppReturn, pReturnTD,
325 pThis->getBridge()->getCpp2Uno() );
327 pCppReturn, pReturnTD, uno::cpp_release );
332 TYPELIB_DANGER_RELEASE( pReturnTD );
340 uno_Interface * pUnoI,
350 switch (pMemberTD->eTypeClass)
352 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
354 VtableSlot aVtableSlot(
357 typelib_InterfaceAttributeTypeDescription
const *
>(
364 reinterpret_cast<typelib_InterfaceAttributeTypeDescription
const *
>(pMemberTD)->pAttributeTypeRef,
366 pReturn, pArgs, ppException );
371 typelib_MethodParameter aParam;
373 reinterpret_cast<typelib_InterfaceAttributeTypeDescription
const *
>(pMemberTD)->pAttributeTypeRef;
377 typelib_TypeDescriptionReference * pReturnTypeRef =
nullptr;
378 OUString aVoidName(
"void");
380 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
382 aVtableSlot.index += 1;
387 pReturn, pArgs, ppException );
394 case typelib_TypeClass_INTERFACE_METHOD:
396 VtableSlot aVtableSlot(
399 typelib_InterfaceMethodTypeDescription
const *
>(
402 switch (aVtableSlot.index)
405 (*pUnoI->acquire)( pUnoI );
406 *ppException =
nullptr;
409 (*pUnoI->release)( pUnoI );
410 *ppException =
nullptr;
415 TYPELIB_DANGER_GET( &pTD,
static_cast< uno::Type *
>( pArgs[0] )->getTypeLibType() );
419 uno_Interface * pInterface =
nullptr;
422 reinterpret_cast<void **
>(&pInterface), pThis->
oid.pData,
reinterpret_cast<typelib_InterfaceTypeDescription *
>(pTD) );
427 static_cast< uno_Any *
>( pReturn ),
428 &pInterface, pTD,
nullptr );
429 (*pInterface->release)( pInterface );
430 TYPELIB_DANGER_RELEASE( pTD );
431 *ppException =
nullptr;
434 TYPELIB_DANGER_RELEASE( pTD );
439 typelib_InterfaceMethodTypeDescription
const* pMethodTD
440 =
reinterpret_cast<typelib_InterfaceMethodTypeDescription
const *
>(pMemberTD);
442 cpp_call(pThis, aVtableSlot, pMethodTD->pReturnTypeRef, pMethodTD->nParams, pMethodTD->pParams,
443 pReturn, pArgs, ppException);
449 uno::RuntimeException aExc(
"Illegal member type description!", uno::Reference<uno::XInterface>());
453 ::uno_type_any_construct(*ppException, &aExc, rExcType.getTypeLibType(),
nullptr);
uno_ExtEnvironment * getUnoEnv()
A uno proxy wrapping a cpp interface.
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
int msvc_filterCppException(EXCEPTION_POINTERS *pPointers, uno_Any *pUnoExc, uno_Mapping *pCpp2Uno)
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,...
Represents a vtable slot of a C++ class.
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()