/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#if OSL_DEBUG_LEVEL > 2 // Let's figure out what is really going on here
{
fprintf( stderr, "= nStack is %d\n", nStack );
fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR ); for ( unsignedint i = 0; i < nGPR; ++i )
fprintf( stderr, "0x%lx, ", pGPR[i] );
fprintf( stderr, "\nFPR's (%d): ", nFPR ); for ( unsignedint i = 0; i < nFPR; ++i )
fprintf( stderr, "0x%lx (%f), ", pFPR[i], pFPR[i] );
fprintf( stderr, "\nStack (%d): ", nStack ); for ( unsignedint i = 0; i < nStack; ++i )
fprintf( stderr, "0x%lx, ", pStack[i] );
fprintf( stderr, "\n" );
fprintf( stderr, "pRegisterReturn is %p\n", pRegisterReturn);
} #endif
// Load parameters to stack, if necessary // Stack, if used, must be 8-bytes aligned
sal_uInt64 *stack = (sal_uInt64 *) __builtin_alloca( nStack * 8 );
memcpy( stack, pStack, nStack * 8 );
// To get pointer to method // a) get the address of the vtable
sal_uInt64 pMethod = *((sal_uInt64 *)pThis); // b) get the address from the vtable entry at offset
pMethod += 8 * nVtableIndex;
pMethod = *((sal_uInt64 *)pMethod);
switch (pParamTypeDescr->eTypeClass)
{ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER:
INSERT_INT64( pCppArgs[nPos], nRegs, pGPR, pStack ); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_ENUM:
INSERT_INT32( pCppArgs[nPos], nRegs, pGPR, pStack ); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_CHAR: case typelib_TypeClass_UNSIGNED_SHORT:
INSERT_INT16( pCppArgs[nPos], nRegs, pGPR, pStack ); break; case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BYTE:
INSERT_INT8( pCppArgs[nPos], nRegs, pGPR, pStack ); break; case typelib_TypeClass_FLOAT:
INSERT_FLOAT( pCppArgs[nPos], nRegs, pFPR, pStack ); break; case typelib_TypeClass_DOUBLE:
INSERT_DOUBLE( pCppArgs[nPos], nRegs, pFPR, pStack ); break; default: break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} else// ptr to complex value | ref
{ if (! rParam.bIn) // is pure out
{ // cpp out is constructed mem, uno out is not!
uno_constructData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pParamTypeDescr );
pTempIndices[nTempIndices] = nPos; // default constructed for cpp call // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} // is in/inout elseif (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
uno_copyAndConvertData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} else// direct way
{
pCppArgs[nPos] = pUnoArgs[nPos]; // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
INSERT_INT64( &(pCppArgs[nPos]), nRegs, pGPR, pStack );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.