diff options
author | Sakura286 <sakura286@outlook.com> | 2024-03-29 11:39:28 +0800 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-04-02 14:16:01 +0200 |
commit | de0a269a6ed54716e03e1ff3cc52857b745853e2 (patch) | |
tree | 8b57bfb9611eeb3017f900de1f43ae04c04538f7 | |
parent | db8b19a77ba0c115c1e0b0ad067ef433a3aa3a79 (diff) |
riscv64 bridge: replace some preprocessor directives to macros for debugging
Change-Id: Ic53d4a462e12e8448b14e750c4ef2824385b8f28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165502
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_riscv64/abi.cxx | 15 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx | 178 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx | 83 |
3 files changed, 80 insertions, 196 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/abi.cxx index 2f35f0f86455..98c8afa2c028 100644 --- a/bridges/source/cpp_uno/gcc3_linux_riscv64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/abi.cxx @@ -12,11 +12,8 @@ #include <typelib/typedescription.hxx> #include "types.hxx" #include "abi.hxx" -#include <stdio.h> #include <cstring> -//#define BRIDGE_DEBUG - namespace abi_riscv64 { /* @@ -133,10 +130,8 @@ ReturnKind getReturnKind(const typelib_TypeDescription* pTypeDescr) void fillUNOStruct(const typelib_TypeDescription* pTypeDescr, sal_Int64* gret, double* fret, void* pRegisterReturn) { -#ifdef BRIDGE_DEBUG - printf("In fillStruct, pTypeDescr = %p, gret = %p, fret = %p, pRegisterReturn = %p\n", - pTypeDescr, gret, fret, pRegisterReturn); -#endif + BRIDGE_LOG("In fillStruct, pTypeDescr = %p, gret = %p, fret = %p, pRegisterReturn = %p\n", + pTypeDescr, gret, fret, pRegisterReturn); ReturnKind returnKind = getReturnKind(pTypeDescr); switch (returnKind) { @@ -186,10 +181,8 @@ void fillUNOStruct(const typelib_TypeDescription* pTypeDescr, sal_Int64* gret, d void splitUNOStruct(const typelib_TypeDescription* pTypeDescr, sal_uInt64* pTarget, sal_uInt64* pSource, sal_Int32& returnType) { -#ifdef BRIDGE_DEBUG - printf("In splitUNOStruct, pTypeDescr = %p, pTarget = %p, pSource = %p\n", pTypeDescr, pTarget, - pSource); -#endif + BRIDGE_LOG("In splitUNOStruct, pTypeDescr = %p, pTarget = %p, pSource = %p\n", pTypeDescr, + pTarget, pSource); sal_uInt64* pTemp = (sal_uInt64*)calloc(2, sizeof(sal_uInt64)); ReturnKind returnKind = getReturnKind(pTypeDescr); switch (returnKind) diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx index 6754f23fde16..731eb12cf96d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx @@ -29,21 +29,9 @@ #include "share.hxx" #include "abi.hxx" -#include <stdio.h> -//#include <string.h> #include <cstring> #include <typeinfo> -//#define BRIDGE_DEBUG - -#ifdef BRIDGE_DEBUG -#include <rtl/strbuf.hxx> -#include <rtl/ustrbuf.hxx> -using namespace ::std; -using namespace ::osl; -using namespace ::rtl; -#endif - using namespace com::sun::star::uno; namespace CPPU_CURRENT_NAMESPACE @@ -103,20 +91,17 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, sal_Int32 nParams, typelib_MethodParameter* pParams, void** gpreg, void** fpreg, void** ovrflw, sal_uInt64* pRegisterReturn /* space for register return */) { -#ifdef BRIDGE_DEBUG - printf("In cpp2uno_call, pThis = %p, pMemberTypeDescr = %p, pReturnTypeRef = %p\n", pThis, - pMemberTypeDescr, pReturnTypeRef); - printf("In cpp2uno_call, nParams = %d, pParams = %p, pRegisterReturn = %p\n", nParams, pParams, - pRegisterReturn); - printf("In cpp2uno_call, gpreg = %p, fpreg = %p, ovrflw = %p\n", gpreg, fpreg, ovrflw); -#endif + BRIDGE_LOG("In cpp2uno_call, pThis = %p, pMemberTypeDescr = %p, pReturnTypeRef = %p\n", pThis, + pMemberTypeDescr, pReturnTypeRef); + BRIDGE_LOG("In cpp2uno_call, nParams = %d, pParams = %p, pRegisterReturn = %p\n", nParams, + pParams, pRegisterReturn); + BRIDGE_LOG("In cpp2uno_call, gpreg = %p, fpreg = %p, ovrflw = %p\n", gpreg, fpreg, ovrflw); unsigned int nr_gpr = 0; unsigned int nr_fpr = 0; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:begin\n"); -#endif + BRIDGE_LOG("cpp2uno_call:begin\n"); + // return typelib_TypeDescription* pReturnTypeDescr = 0; if (pReturnTypeRef) @@ -135,16 +120,12 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(pReturnTypeDescr) ? alloca(pReturnTypeDescr->nSize) : pCppReturn); // direct way -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:complexreturn\n"); -#endif + BRIDGE_LOG("cpp2uno_call:complexreturn\n"); } else { pUnoReturn = pRegisterReturn; // direct way for simple types -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:simplereturn\n"); -#endif + BRIDGE_LOG("cpp2uno_call:simplereturn\n"); } } @@ -166,9 +147,8 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, sal_Int32 nTempIndices = 0; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:nParams=%d\n", nParams); -#endif + BRIDGE_LOG("cpp2uno_call:nParams=%d\n", nParams); + for (sal_Int32 nPos = 0; nPos < nParams; ++nPos) { const typelib_MethodParameter& rParam = pParams[nPos]; @@ -178,34 +158,26 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTypeDescr)) // value { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:Param %u, type %u\n", nPos, pParamTypeDescr->eTypeClass); -#endif + BRIDGE_LOG("cpp2uno_call:Param %u, type %u\n", nPos, pParamTypeDescr->eTypeClass); switch (pParamTypeDescr->eTypeClass) { case typelib_TypeClass_FLOAT: case typelib_TypeClass_DOUBLE: if (nr_fpr < MAX_FP_REGS) { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:fpr=%p\n", *fpreg); -#endif + BRIDGE_LOG("cpp2uno_call:fpr=%p\n", *fpreg); pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++; nr_fpr++; } else if (nr_gpr < MAX_GP_REGS) { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:fpr=%p\n", *gpreg); -#endif + BRIDGE_LOG("cpp2uno_call:fpr=%p\n", *gpreg); pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++; nr_gpr++; } else { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:fpr=%p\n", *ovrflw); -#endif + BRIDGE_LOG("cpp2uno_call:fpr=%p\n", *ovrflw); pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw++; } @@ -214,17 +186,13 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, default: if (nr_gpr < MAX_GP_REGS) { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:gpr=%p\n", *gpreg); -#endif + BRIDGE_LOG("cpp2uno_call:gpr=%p\n", *gpreg); pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++; nr_gpr++; } else { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:gpr=%p\n", *ovrflw); -#endif + BRIDGE_LOG("cpp2uno_call:gpr=%p\n", *ovrflw); pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw++; } break; @@ -234,9 +202,7 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, } else // ptr to complex value | ref { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:ptr|ref\n"); -#endif + BRIDGE_LOG("cpp2uno_call:ptr|ref\n"); void* pCppStack; if (nr_gpr < MAX_GP_REGS) { @@ -247,9 +213,7 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, { pCppArgs[nPos] = pCppStack = *ovrflw++; } -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:pCppStack=%p\n", pCppStack); -#endif + BRIDGE_LOG("cpp2uno_call:pCppStack=%p\n", pCppStack); if (!rParam.bIn) // is pure out { @@ -267,45 +231,34 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, pTempIndices[nTempIndices] = nPos; // has to be reconverted // will be released at reconversion ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:related to interface,%p,%d,pUnoargs[%d]=%p\n", - pCppStack, pParamTypeDescr->nSize, nPos, pUnoArgs[nPos]); -#endif + BRIDGE_LOG("cpp2uno_call:related to interface,%p,%d,pUnoargs[%d]=%p\n", pCppStack, + pParamTypeDescr->nSize, nPos, pUnoArgs[nPos]); } else // direct way { pUnoArgs[nPos] = pCppStack; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call:direct,pUnoArgs[%d]=%p\n", nPos, pUnoArgs[nPos]); -#endif + BRIDGE_LOG("cpp2uno_call:direct,pUnoArgs[%d]=%p\n", nPos, pUnoArgs[nPos]); // no longer needed TYPELIB_DANGER_RELEASE(pParamTypeDescr); } } } -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call2,%p,unoargs=%p\n", pThis->getUnoI()->pDispatcher, pUnoArgs); - printf("pMemberTypeDescr=%p,pUnoReturn=%p\n", pMemberTypeDescr, pUnoReturn); -#endif + BRIDGE_LOG("cpp2uno_call2,%p,unoargs=%p\n", pThis->getUnoI()->pDispatcher, pUnoArgs); + BRIDGE_LOG("pMemberTypeDescr=%p,pUnoReturn=%p\n", pMemberTypeDescr, pUnoReturn); // ExceptionHolder uno_Any aUnoExc; // Any will be constructed by callee uno_Any* pUnoExc = &aUnoExc; -#ifdef BRIDGE_DEBUG - printf("pThis=%p,pThis->getUnoI()=%p,pMemberTypeDescr=%p\npUnoReturn=%p,pUnoArgs=%p", pThis, - pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs); -#endif + BRIDGE_LOG("pThis=%p,pThis->getUnoI()=%p,pMemberTypeDescr=%p\npUnoReturn=%p,pUnoArgs=%p", pThis, + pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs); // invoke uno dispatch call (*pThis->getUnoI()->pDispatcher)(pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc); -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp2uno_call2,after dispatch\n"); -#endif + BRIDGE_LOG("cpp2uno_call2,after dispatch\n"); // in case an exception occurred... if (pUnoExc) { - fflush(stdout); // destruct temporary in/inout params for (; nTempIndices--;) { @@ -423,9 +376,7 @@ cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy* pThis, { std::memcpy(pRegisterReturn, pUnoReturn, 16); } -#ifdef BRIDGE_DEBUG - printf("Unhandled Type: %d\n", pReturnTypeDescr->eTypeClass); -#endif + BRIDGE_LOG("Unhandled Type: %d\n", pReturnTypeDescr->eTypeClass); } } else @@ -453,11 +404,9 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi { static_assert(sizeof(sal_Int64) == sizeof(void*), "### unexpected!"); -#ifdef BRIDGE_DEBUG - fprintf(stdout, "in cpp_vtable_call nFunctionIndex is %d\n", nFunctionIndex); - fprintf(stdout, "in cpp_vtable_call nVtableOffset is %d\n", nVtableOffset); - fprintf(stdout, "in cpp_vtable_call gp=%p, fp=%p, ov=%p\n", gpreg, fpreg, ovrflw); -#endif + BRIDGE_LOG("in cpp_vtable_call nFunctionIndex is %d\n", nFunctionIndex); + BRIDGE_LOG("in cpp_vtable_call nVtableOffset is %d\n", nVtableOffset); + BRIDGE_LOG("in cpp_vtable_call gp=%p, fp=%p, ov=%p\n", gpreg, fpreg, ovrflw); // gpreg: [ret *], this, [other gpr params] // fpreg: [fpr params] @@ -472,17 +421,13 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi { pThis = gpreg[0]; } -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call, pThis=%p, nFunctionIndex=%d, nVtableOffset=%d\n", pThis, - nFunctionIndex, nVtableOffset); -#endif + BRIDGE_LOG("cpp_vtable_call, pThis=%p, nFunctionIndex=%d, nVtableOffset=%d\n", pThis, + nFunctionIndex, nVtableOffset); pThis = static_cast<char*>(pThis) - nVtableOffset; bridges::cpp_uno::shared::CppInterfaceProxy* pCppI = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(pThis); -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call, pCppI=%p\n", pCppI); -#endif + BRIDGE_LOG("cpp_vtable_call, pCppI=%p\n", pCppI); typelib_InterfaceTypeDescription* pTypeDescr = pCppI->getTypeDescr(); @@ -503,18 +448,12 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi TypeDescription aMemberDescr(pTypeDescr->ppAllMembers[nMemberPos]); -#ifdef BRIDGE_DEBUG - //OString cstr( OUStringToOString( aMemberDescr.get()->pTypeName, RTL_TEXTENCODING_ASCII_US ) ); - //fprintf(stdout, "calling %s, nFunctionIndex=%d\n", cstr.getStr(), nFunctionIndex ); -#endif sal_Int32 eRet; switch (aMemberDescr.get()->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call interface attribute\n"); -#endif + BRIDGE_LOG("cpp_vtable_call interface attribute\n"); typelib_TypeDescriptionReference* pAttrTypeRef = reinterpret_cast<typelib_InterfaceAttributeTypeDescription*>(aMemberDescr.get()) ->pAttributeTypeRef; @@ -541,31 +480,23 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi } case typelib_TypeClass_INTERFACE_METHOD: { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call interface method\n"); -#endif + BRIDGE_LOG("cpp_vtable_call interface method\n"); // is METHOD switch (nFunctionIndex) { case 1: // acquire() -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call method acquire\n"); -#endif + BRIDGE_LOG("cpp_vtable_call method acquire\n"); pCppI->acquireProxy(); // non virtual call! eRet = 0; break; case 2: // release() -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call method release\n"); -#endif + BRIDGE_LOG("cpp_vtable_call method release\n"); pCppI->releaseProxy(); // non virtual call! eRet = 0; break; case 0: // queryInterface() opt { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call method query interface opt\n"); -#endif + BRIDGE_LOG("cpp_vtable_call method query interface opt\n"); typelib_TypeDescription* pTD = 0; TYPELIB_DANGER_GET(&pTD, reinterpret_cast<Type*>(gpreg[2])->getTypeLibType()); if (pTD) @@ -593,9 +524,7 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi [[fallthrough]]; } // else perform queryInterface() default: -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call method query interface\n"); -#endif + BRIDGE_LOG("cpp_vtable_call method query interface\n"); typelib_InterfaceMethodTypeDescription* pMethodTD = reinterpret_cast<typelib_InterfaceMethodTypeDescription*>( aMemberDescr.get()); @@ -608,9 +537,7 @@ sal_Int32 cpp_vtable_call(sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, voi } default: { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "cpp_vtable_call no member\n"); -#endif + BRIDGE_LOG("cpp_vtable_call no member\n"); throw RuntimeException("no member description found!", (XInterface*)pThis); } } @@ -625,15 +552,11 @@ int const codeSnippetSize = 0x6c; unsigned char* codeSnippet(unsigned char* code, sal_Int32 functionIndex, sal_Int32 vtableOffset, bool bHasHiddenParam) { -#ifdef BRIDGE_DEBUG - fprintf(stdout, "in codeSnippet functionIndex is %d\n", functionIndex); - fprintf(stdout, "in codeSnippet vtableOffset is %d\n", vtableOffset); - fprintf(stdout, "in codeSnippet privateSnippetExecutor is %lx\n", - (unsigned long)privateSnippetExecutor); - fprintf(stdout, "in codeSnippet cpp_vtable_call is %lx\n", (unsigned long)cpp_vtable_call); - - fflush(stdout); -#endif + BRIDGE_LOG("in codeSnippet functionIndex is %d\n", functionIndex); + BRIDGE_LOG("in codeSnippet vtableOffset is %d\n", vtableOffset); + BRIDGE_LOG("in codeSnippet privateSnippetExecutor is %lx\n", + (unsigned long)privateSnippetExecutor); + BRIDGE_LOG("in codeSnippet cpp_vtable_call is %lx\n", (unsigned long)cpp_vtable_call); if (bHasHiddenParam) functionIndex |= 0x80000000; @@ -767,12 +690,9 @@ unsigned char* bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( (*slots) -= functionCount; Slot* s = *slots; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "in addLocalFunctions functionOffset is %d\n", functionOffset); - fprintf(stdout, "in addLocalFunctions vtableOffset is %d\n", vtableOffset); - fprintf(stdout, "nMembers=%d\n", type->nMembers); - fflush(stdout); -#endif + BRIDGE_LOG("in addLocalFunctions functionOffset is %d\n", functionOffset); + BRIDGE_LOG("in addLocalFunctions vtableOffset is %d\n", vtableOffset); + BRIDGE_LOG("nMembers=%d\n", type->nMembers); for (sal_Int32 i = 0; i < type->nMembers; ++i) { diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx index 495fefa4d173..278944953888 100644 --- a/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx @@ -38,11 +38,6 @@ #include "share.hxx" #include "abi.hxx" -//#define BRIDGE_DEBUG -#ifdef BRIDGE_DEBUG -#include <stdio.h> -#endif - using namespace ::com::sun::star::uno; namespace @@ -60,21 +55,19 @@ static void callVirtualMethod(void* pAdjustedThisPtr, sal_Int32 nVtableIndex, vo sal_uInt64* pStack, sal_uInt32 nStack, sal_uInt64* pGPR, double* pFPR, typelib_TypeDescription* pReturnTypeDescr) { -#ifdef BRIDGE_DEBUG - printf("In callVirtualMethod:\n"); - printf("pAdjustedThisPtr = %p, nVtableIndex = %d, pRegisterReturn = %p, pReturnTypeRef = %p\n", - pAdjustedThisPtr, nVtableIndex, pRegisterReturn, pReturnTypeRef); - printf("bSimpleReturn = %d, pStack = %p, nStack = %d, pGPR = %p, pFPR = %p, pReturnTypeDescr = " - "%p\n", - bSimpleReturn, pStack, nStack, pGPR, pFPR, pReturnTypeDescr); -#endif + BRIDGE_LOG("In callVirtualMethod:\n"); + BRIDGE_LOG( + "pAdjustedThisPtr = %p, nVtableIndex = %d, pRegisterReturn = %p, pReturnTypeRef = %p\n", + pAdjustedThisPtr, nVtableIndex, pRegisterReturn, pReturnTypeRef); + BRIDGE_LOG( + "bSimpleReturn = %d, pStack = %p, nStack = %d, pGPR = %p, pFPR = %p, pReturnTypeDescr = " + "%p\n", + bSimpleReturn, pStack, nStack, pGPR, pFPR, pReturnTypeDescr); // Get pointer to method sal_uInt64 pMethod = *((sal_uInt64*)pAdjustedThisPtr); pMethod += 8 * nVtableIndex; void* mfunc = (void*)*((sal_uInt64*)pMethod); -#ifdef BRIDGE_DEBUG - fprintf(stdout, "calling function %p\n", mfunc); -#endif + BRIDGE_LOG("calling function %p\n", mfunc); // Load parameters to stack, if necessary sal_uInt64* pCallStack = NULL; @@ -127,9 +120,7 @@ static void callVirtualMethod(void* pAdjustedThisPtr, sal_Int32 nVtableIndex, vo pCallStack) // dummy input to prevent the compiler from optimizing the alloca out : "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "ra", "fa0", "fa1", "fa2", "fa3", "fa4", "fa5", "fa6", "fa7", "memory"); -#ifdef BRIDGE_DEBUG - printf("In callVirtualMethod, fret = %p, gret = %p\n", fret, gret); -#endif + BRIDGE_LOG("In callVirtualMethod, fret = %p, gret = %p\n", fret, gret); switch (pReturnTypeRef->eTypeClass) { @@ -153,9 +144,7 @@ static void callVirtualMethod(void* pAdjustedThisPtr, sal_Int32 nVtableIndex, vo case typelib_TypeClass_EXCEPTION: { sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize; -#ifdef BRIDGE_DEBUG - printf("nRetSize = %d\n", nRetSize); -#endif + BRIDGE_LOG("nRetSize = %d\n", nRetSize); if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0) { typelib_TypeDescription* pTypeDescr = 0; @@ -166,9 +155,7 @@ static void callVirtualMethod(void* pAdjustedThisPtr, sal_Int32 nVtableIndex, vo break; } default: -#ifdef BRIDGE_DEBUG - fprintf(stdout, "unhandled return type %u\n", pReturnTypeRef->eTypeClass); -#endif + BRIDGE_LOG("unhandled return type %u\n", pReturnTypeRef->eTypeClass); break; } } @@ -179,12 +166,10 @@ static void cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy* pThis, typelib_MethodParameter* pParams, void* pUnoReturn, void* pUnoArgs[], uno_Any** ppUnoExc) { -#ifdef BRIDGE_DEBUG - printf("In cpp_call\n"); - printf("pThis = %p, aVtableSlot = %p, pReturnTypeRef = %p, nParams = %d\n", pThis, aVtableSlot, - pReturnTypeRef, nParams); - printf("pParams = %p , pUnoReturn = %p, pUnoArgs = %p\n", pParams, pUnoReturn, pUnoArgs); -#endif + BRIDGE_LOG("In cpp_call\n"); + BRIDGE_LOG("pThis = %p, aVtableSlot = %p, pReturnTypeRef = %p, nParams = %d\n", pThis, + aVtableSlot, pReturnTypeRef, nParams); + BRIDGE_LOG("pParams = %p , pUnoReturn = %p, pUnoArgs = %p\n", pParams, pUnoReturn, pUnoArgs); // max space for: [complex ret ptr], values|ptr ... sal_uInt64* pStack = (sal_uInt64*)__builtin_alloca(((nParams + 3) * sizeof(sal_Int64))); sal_uInt64* pStackStart = pStack; @@ -194,9 +179,7 @@ static void cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy* pThis, double pFPR[MAX_FP_REGS]; sal_uInt32 nFPR = 0; -#ifdef BRIDGE_DEBUG - printf("pGPR = %p, pFPR = %p\n", pGPR, pFPR); -#endif + BRIDGE_LOG("pGPR = %p, pFPR = %p\n", pGPR, pFPR); // return typelib_TypeDescription* pReturnTypeDescr = 0; @@ -236,30 +219,22 @@ static void cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy* pThis, = (typelib_TypeDescription**)(pCppArgs + (2 * nParams)); sal_Int32 nTempIndices = 0; -#ifdef BRIDGE_DEBUG - printf("In cpp_call, nParams = %d\n", nParams); - printf("pCppArgs = %p, pStack = %p\n", pCppArgs, pStack); -#endif + BRIDGE_LOG("In cpp_call, nParams = %d\n", nParams); + BRIDGE_LOG("pCppArgs = %p, pStack = %p\n", pCppArgs, pStack); for (sal_Int32 nPos = 0; nPos < nParams; ++nPos) { -#ifdef BRIDGE_DEBUG - printf("In cpp_call, nPos = %d\n", nPos); -#endif + BRIDGE_LOG("In cpp_call, nPos = %d\n", nPos); const typelib_MethodParameter& rParam = pParams[nPos]; typelib_TypeDescription* pParamTypeDescr = 0; TYPELIB_DANGER_GET(&pParamTypeDescr, rParam.pTypeRef); if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType(pParamTypeDescr)) { -#ifdef BRIDGE_DEBUG - printf("Before uno_copyAndConvertData and tons of switch.\n"); -#endif + BRIDGE_LOG("Before uno_copyAndConvertData and tons of switch.\n"); uno_copyAndConvertData(pCppArgs[nPos] = alloca(8), pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp()); -#ifdef BRIDGE_DEBUG - printf("Type = %d, Param = 0x%lx\n", pParamTypeDescr->eTypeClass, - *reinterpret_cast<sal_uInt64*>(pCppArgs[nPos])); -#endif + BRIDGE_LOG("Type = %d, Param = 0x%lx\n", pParamTypeDescr->eTypeClass, + *reinterpret_cast<sal_uInt64*>(pCppArgs[nPos])); switch (pParamTypeDescr->eTypeClass) { // In types.h: @@ -450,19 +425,15 @@ namespace bridges::cpp_uno::shared void unoInterfaceProxyDispatch(uno_Interface* pUnoI, const typelib_TypeDescription* pMemberDescr, void* pReturn, void* pArgs[], uno_Any** ppException) { -#ifdef BRIDGE_DEBUG - printf("In unoInterfaceProxyDispatch:\n"); - printf("pMemberDescr = %p, pReturn = %p, pArgs = %p, ppExeption = %p\n", pMemberDescr, pReturn, - pArgs, ppException); -#endif + BRIDGE_LOG("In unoInterfaceProxyDispatch:\n"); + BRIDGE_LOG("pMemberDescr = %p, pReturn = %p, pArgs = %p, ppExeption = %p\n", pMemberDescr, + pReturn, pArgs, ppException); // is my surrogate bridges::cpp_uno::shared::UnoInterfaceProxy* pThis = static_cast<bridges::cpp_uno::shared::UnoInterfaceProxy*>(pUnoI); //typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr; -#ifdef BRIDGE_DEBUG - fprintf(stdout, "in dispatch\n"); -#endif + BRIDGE_LOG("in dispatch\n"); switch (pMemberDescr->eTypeClass) { |