27#include <com/sun/star/uno/Exception.hpp> 
   28#include <com/sun/star/uno/RuntimeException.hpp> 
   44        const typelib_CompoundTypeDescription * 
p 
   45            = 
reinterpret_cast< const typelib_CompoundTypeDescription * 
>(
type);
 
   48        for (sal_Int32 i = 0; 
i < 
p->nMembers; ++
i)
 
   50            if ((
p->ppTypeRefs[i]->eTypeClass != typelib_TypeClass_FLOAT &&
 
   51                 p->ppTypeRefs[i]->eTypeClass != typelib_TypeClass_DOUBLE) ||
 
   52                p->ppTypeRefs[
i]->eTypeClass != 
p->ppTypeRefs[0]->eTypeClass)
 
   58    bool return_in_x8( typelib_TypeDescriptionReference *pTypeRef )
 
   62        else if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT || pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION)
 
   65            TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
 
   68            bool bRet = pTypeDescr->nSize > 16;
 
   70            if (is_hfa_struct(pTypeDescr))
 
   73            TYPELIB_DANGER_RELEASE( pTypeDescr );
 
   80void MapReturn(sal_uInt64 *pGPR, 
double *pFPR, typelib_TypeDescriptionReference *pReturnType, sal_uInt64 *pRegisterReturn)
 
   82    switch( pReturnType->eTypeClass )
 
   84    case typelib_TypeClass_HYPER:
 
   85    case typelib_TypeClass_UNSIGNED_HYPER:
 
   86        pRegisterReturn[1] = pGPR[1];
 
   88    case typelib_TypeClass_LONG:
 
   89    case typelib_TypeClass_UNSIGNED_LONG:
 
   90    case typelib_TypeClass_ENUM:
 
   91    case typelib_TypeClass_CHAR:
 
   92    case typelib_TypeClass_SHORT:
 
   93    case typelib_TypeClass_UNSIGNED_SHORT:
 
   94    case typelib_TypeClass_BOOLEAN:
 
   95    case typelib_TypeClass_BYTE:
 
   96        pRegisterReturn[0] = pGPR[0];
 
   98    case typelib_TypeClass_FLOAT:
 
   99        *(
float*)pRegisterReturn = *(
float*)&pFPR[0];
 
  101    case typelib_TypeClass_DOUBLE:
 
  102        *(
double*)pRegisterReturn = pFPR[0];
 
  104    case typelib_TypeClass_STRUCT:
 
  105    case typelib_TypeClass_EXCEPTION:
 
  108            pRegisterReturn[0] = pGPR[0];
 
  109            pRegisterReturn[1] = pGPR[1];
 
  121    sal_Int32 nVtableIndex,
 
  122    void *pRegisterReturn,
 
  123    typelib_TypeDescriptionReference *pReturnType,
 
  136        sal_uInt32 nStackBytes = ( ( nStack + 3 ) >> 2 ) * 16;
 
  137        sal_uInt32 *stack = (sal_uInt32 *) alloca( nStackBytes );
 
  138        memcpy( stack, pStack, nStackBytes );
 
  141    sal_uInt64 pMethod = *((sal_uInt64*)pThis);
 
  142    pMethod += 8 * nVtableIndex;
 
  143    pMethod = *((sal_uInt64 *)pMethod);
 
  148     "  ldp x0, x1, %[pgpr_0]\n" 
  149     "  ldp x2, x3, %[pgpr_2]\n" 
  150     "  ldp x4, x5, %[pgpr_4]\n" 
  151     "  ldp x6, x7, %[pgpr_6]\n" 
  152     "  ldr x8, %[pregisterreturn]\n" 
  153     "  ldp d0, d1, %[pfpr_0]\n" 
  154     "  ldp d2, d3, %[pfpr_2]\n" 
  155     "  ldp d4, d5, %[pfpr_4]\n" 
  156     "  ldp d6, d7, %[pfpr_6]\n" 
  158     "  stp x0, x1, %[pgpr_0]\n" 
  159     "  str d0, %[pfpr_0]\n" 
  161     :: [pgpr_0]
"m" (pGPR[0]),
 
  162        [pgpr_2]
"m" (pGPR[2]),
 
  163        [pgpr_4]
"m" (pGPR[4]),
 
  164        [pgpr_6]
"m" (pGPR[6]),
 
  165        [pregisterreturn]
"m" (pRegisterReturn),
 
  166        [pfpr_0]
"m" (pFPR[0]),
 
  167        [pfpr_2]
"m" (pFPR[2]),
 
  168        [pfpr_4]
"m" (pFPR[4]),
 
  169        [pfpr_6]
"m" (pFPR[6]),
 
  170        [pmethod]
"r" (pMethod)
 
  172     : 
"x0", 
"x1", 
"x2", 
"x3", 
"x4", 
"x5", 
"x6", 
"x7", 
"x8", 
"x9", 
"x10", 
"x11", 
"x12", 
"x13", 
"x14", 
"x15", 
"x16", 
"x17",
 
  173       "d0", 
"d1", 
"d2", 
"d3", 
"d4", 
"d5", 
"d6", 
"d7" 
  176    MapReturn(pGPR, pFPR, pReturnType, (sal_uInt64 *) pRegisterReturn);
 
  180#define INSERT_INT64( pSV, nr, pGPR, pDS ) \ 
  181        if ( nr < arm::MAX_GPR_REGS ) \ 
  182                pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \ 
  184                *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); 
  186#define INSERT_INT32( pSV, nr, pGPR, pDS ) \ 
  187        if ( nr < arm::MAX_GPR_REGS ) \ 
  188                pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ 
  190                *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV ); 
  192#define INSERT_INT16( pSV, nr, pGPR, pDS ) \ 
  193        if ( nr < arm::MAX_GPR_REGS ) \ 
  194                pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \ 
  196                *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV ); 
  198#define INSERT_INT8( pSV, nr, pGPR, pDS ) \ 
  199        if ( nr < arm::MAX_GPR_REGS ) \ 
  200                pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \ 
  202                *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV ); 
  204#define INSERT_DOUBLE( pSV, nr, pFPR, pDS ) \ 
  205        if ( nr < arm::MAX_FPR_REGS ) \ 
  206                pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \ 
  208                *pDS++ = *reinterpret_cast<double *>( pSV ); 
  210#define INSERT_FLOAT( pSV, nr, pFPR, pDS ) \ 
  211        INSERT_DOUBLE( pSV, nr, pGPR, pDS ) 
  217    typelib_TypeDescriptionReference * pReturnTypeRef,
 
  218    sal_Int32 nParams, typelib_MethodParameter * pParams,
 
  219    void * pUnoReturn, 
void * pUnoArgs[], 
uno_Any ** ppUnoExc )
 
  222    sal_uInt64 * pStack = (sal_uInt64 *)alloca( (nParams+2) * 
sizeof(sal_Int64) );
 
  223    sal_uInt64 * pStackStart = pStack;
 
  234    TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
 
  235    assert( pReturnTypeDescr);
 
  237    void * pCppReturn = 0; 
 
  239    if (pReturnTypeDescr)
 
  242            pCppReturn = pUnoReturn; 
 
  247                    ? alloca( pReturnTypeDescr->nSize )
 
  252    void * pAdjustedThisPtr = 
reinterpret_cast< void ** 
>(pThis->
getCppI())
 
  258    void ** pCppArgs  = (
void **)alloca( 
sizeof(
void *) * nParams );
 
  261    int * pTempIndices = (
int *)alloca( 
sizeof(
int) * nParams );
 
  266    sal_Int32 nTempIndices = 0;
 
  268    for ( sal_Int32 nPos = 0; 
nPos < nParams; ++
nPos )
 
  270        const typelib_MethodParameter & rParam = pParams[
nPos];
 
  272        TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
 
  279            switch (pParamTypeDescr->eTypeClass)
 
  281            case typelib_TypeClass_HYPER:
 
  282            case typelib_TypeClass_UNSIGNED_HYPER:
 
  285            case typelib_TypeClass_LONG:
 
  286            case typelib_TypeClass_UNSIGNED_LONG:
 
  287            case typelib_TypeClass_ENUM:
 
  290            case typelib_TypeClass_SHORT:
 
  291            case typelib_TypeClass_CHAR:
 
  292            case typelib_TypeClass_UNSIGNED_SHORT:
 
  295            case typelib_TypeClass_BOOLEAN:
 
  296            case typelib_TypeClass_BYTE:
 
  299            case typelib_TypeClass_FLOAT:
 
  302            case typelib_TypeClass_DOUBLE:
 
  309            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 
  317                    pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
 
  319                pTempIndices[nTempIndices] = 
nPos; 
 
  321                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
 
  327                    pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
 
  330                pTempIndices[nTempIndices] = 
nPos; 
 
  332                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
 
  338                TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 
  351                pAdjustedThisPtr, aVtableSlot.
index,
 
  352                pCppReturn, pReturnTypeRef,
 
  354                (pStack - pStackStart),
 
  357        } 
catch (css::uno::Exception &) {
 
  359        } 
catch (std::exception & e) {
 
  360            throw css::uno::RuntimeException(
 
  364            throw css::uno::RuntimeException(
"C++ code threw unknown exception");
 
  371        for ( ; nTempIndices--; )
 
  373            sal_Int32 
nIndex = pTempIndices[nTempIndices];
 
  376            if (pParams[nIndex].bIn)
 
  378                if (pParams[nIndex].bOut) 
 
  393            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 
  396        if (pCppReturn && pUnoReturn != pCppReturn)
 
  409        for ( ; nTempIndices--; )
 
  411            sal_Int32 
nIndex = pTempIndices[nTempIndices];
 
  413            uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
 
  414            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
 
  418        if (pReturnTypeDescr)
 
  419            TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
 
  428    void * pReturn, 
void * pArgs[], 
uno_Any ** ppException )
 
  433#if OSL_DEBUG_LEVEL > 0 
  434    typelib_InterfaceTypeDescription * pTypeDescr = pThis->
pTypeDescr;
 
  437    switch (pMemberDescr->eTypeClass)
 
  439    case typelib_TypeClass_INTERFACE_ATTRIBUTE:
 
  441#if OSL_DEBUG_LEVEL > 0 
  443        sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
 
  444        assert( nMemberPos < pTypeDescr->nAllMembers && 
"### member pos out of range!");
 
  447        VtableSlot aVtableSlot(
 
  449            reinterpret_cast<typelib_InterfaceAttributeTypeDescription 
const *
> 
  457                ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
 
  459                pReturn, pArgs, ppException );
 
  464            typelib_MethodParameter aParam;
 
  466                ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
 
  470            typelib_TypeDescriptionReference * pReturnTypeRef = 0;
 
  471            OUString aVoidName(
"void");
 
  473                &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
 
  476            aVtableSlot.
index += 1;
 
  481                pReturn, pArgs, ppException );
 
  488    case typelib_TypeClass_INTERFACE_METHOD:
 
  490#if OSL_DEBUG_LEVEL > 0 
  492        sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
 
  493        assert(nMemberPos < pTypeDescr->nAllMembers && 
"### member pos out of range!");
 
  496        VtableSlot aVtableSlot(
 
  498            reinterpret_cast<typelib_InterfaceMethodTypeDescription 
const *
> 
  501        switch (aVtableSlot.
index)
 
  505            (*pUnoI->acquire)( pUnoI );
 
  509            (*pUnoI->release)( pUnoI );
 
  515            TYPELIB_DANGER_GET( &pTD, 
reinterpret_cast< Type * 
>( pArgs[0] )->getTypeLibType() );
 
  518                uno_Interface * pInterface = 0;
 
  521                    (
void **)&pInterface, pThis->
oid.pData, (typelib_InterfaceTypeDescription *)pTD );
 
  526                        reinterpret_cast< uno_Any * 
>( pReturn ),
 
  527                        &pInterface, pTD, 0 );
 
  528                    (*pInterface->release)( pInterface );
 
  529                    TYPELIB_DANGER_RELEASE( pTD );
 
  533                TYPELIB_DANGER_RELEASE( pTD );
 
  541                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
 
  542                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
 
  543                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
 
  544                pReturn, pArgs, ppException );
 
  550        ::com::sun::star::uno::RuntimeException aExc(
 
  551            "illegal member type description!",
 
  556        ::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()
 
typelib_InterfaceTypeDescription * pTypeDescr
 
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()
 
#define INSERT_INT32(pSV, nr, pGPR, pDS)
 
void MapReturn(long r0, typelib_TypeClass eTypeClass, sal_uInt64 *pRegisterReturn)
 
#define INSERT_INT8(pSV, nr, pGPR, pDS)
 
#define INSERT_FLOAT(pSV, nr, pFPR, pDS)
 
#define INSERT_INT16(pSV, nr, pGPR, pDS)
 
#define INSERT_INT64(pSV, nr, pGPR, pDS)
 
#define INSERT_DOUBLE(pSV, nr, pFPR, pDS)
 
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)
 
bool return_in_x8(typelib_TypeDescriptionReference *pTypeRef)
 
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)
 
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()