summaryrefslogtreecommitdiff
path: root/bridges/source/cpp_uno
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/source/cpp_uno')
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_intel/except.cxx7
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx3
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx8
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk2
-rw-r--r--bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx3
-rw-r--r--bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx20
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx8
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_hppa/call.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx20
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx32
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx34
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx6
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/except.cxx6
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk7
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx8
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx14
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx6
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_mips/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx32
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx26
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx20
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx8
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx5
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx10
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk7
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_os2_intel/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx5
-rw-r--r--bridges/source/cpp_uno/mingw_intel/except.cxx4
-rw-r--r--bridges/source/cpp_uno/msvc_win32_intel/except.cxx4
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/asmbits.asm328
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/call.asm133
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx688
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx667
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/makefile.mk11
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx355
-rw-r--r--bridges/source/cpp_uno/shared/vtablefactory.cxx6
59 files changed, 1317 insertions, 1270 deletions
diff --git a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
index 8f13ad0d8654..1af3b7ac1352 100644
--- a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
@@ -49,7 +49,11 @@
#include <hash.cxx>
// need a += operator for OString and sal_Char
-namespace rtl
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringToOString;
+using ::rtl::OStringToOUString;
{
inline OString& operator+=( OString& rString, sal_Char cAdd )
{
@@ -62,7 +66,6 @@ namespace rtl
using namespace std;
using namespace osl;
-using namespace rtl;
using namespace com::sun::star::uno;
namespace CPPU_CURRENT_NAMESPACE
diff --git a/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx b/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
index b72ebc0ac1f3..287ca5deadd7 100644
--- a/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
@@ -42,9 +42,10 @@
#include "cc50_solaris_intel.hxx"
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+
namespace
{
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
index 916a42bb75e5..d0e8a4fc8bbb 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
@@ -50,7 +50,12 @@
#include <hash.cxx>
// need a += operator for OString and sal_Char
-namespace rtl
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringToOString;
+using ::rtl::OStringToOUString;
+
{
inline OString& operator+=( OString& rString, sal_Char cAdd )
{
@@ -63,7 +68,6 @@ namespace rtl
using namespace std;
using namespace osl;
-using namespace rtl;
using namespace com::sun::star::uno;
namespace CPPU_CURRENT_NAMESPACE
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk b/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
index 2af2f29a02a3..74d156abbf75 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/makefile.mk
@@ -44,8 +44,6 @@ CHECKFORPIC=
.IF "$(COM)" == "C52" && "$(CPU)"=="S"
-#CFLAGS += -O5 -xO5
-
.IF "$(cppu_no_leak)" == ""
CFLAGS += -DLEAK_STATIC_DATA
.ENDIF
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
index 6a0c7d2eec7f..9d0d139850ec 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
@@ -42,9 +42,10 @@
#include "cc50_solaris_sparc.hxx"
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+
namespace
{
diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx
index 908ec4fd56ca..b343edee7048 100644
--- a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx
@@ -497,7 +497,7 @@ static sal_uInt64 cpp_vtable_call(sal_Int32 r3, sal_Int32 r4, sal_Int32 r5,
register double d11 asm("fr12"); fpreg[11] = d11;
register double d12 asm("fr13"); fpreg[12] = d12;
-#if CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
for(int i = 0; i < 8; ++i)
{
fprintf(stderr, "general reg %d is %x\n", i, gpreg[i]);
diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
index c3b7818ab8df..2086ef7e7bba 100644
--- a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx
index f868b40b0f9e..d4f304f77841 100644
--- a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx
@@ -58,7 +58,7 @@ static typelib_TypeClass cpp2uno_call(
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_Int64 * pRegisterReturn /* space for register return */ )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "as far as cpp2uno_call\n");
#endif
int nregs = 0; //number of words passed in registers
@@ -115,13 +115,13 @@ static typelib_TypeClass cpp2uno_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "arg %d of %d\n", nPos, nParams);
#endif
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple type is %d\n", pParamTypeDescr->eTypeClass);
#endif
@@ -216,7 +216,7 @@ static typelib_TypeClass cpp2uno_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex, nregs is %d\n", nregs);
#endif
@@ -262,7 +262,7 @@ static typelib_TypeClass cpp2uno_call(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of params\n");
#endif
@@ -348,11 +348,11 @@ static typelib_TypeClass cpp_mediate(
sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "nVTableOffset, nFunctionIndex are %x %x\n", nVtableOffset, nFunctionIndex);
#endif
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= cpp_mediate () =\nGPR's (%d): ", 6 );
@@ -524,7 +524,7 @@ long cpp_vtable_call(long r16, long r17, long r18, long r19, long r20, long r21,
register double f21 asm("$f21"); fpreg[5] = f21;
volatile long nRegReturn[1];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "before mediate with %lx\n",nOffsetAndIndex);
fprintf(stderr, "non-doubles are %x %x %x %x %x %x\n", gpreg[0], gpreg[1], gpreg[2], gpreg[3], gpreg[4], gpreg[5]);
fprintf(stderr, "doubles are %f %f %f %f %f %f\n", fpreg[0], fpreg[1], fpreg[2], fpreg[3], fpreg[4], fpreg[5]);
@@ -532,7 +532,7 @@ long cpp_vtable_call(long r16, long r17, long r18, long r19, long r20, long r21,
typelib_TypeClass aType =
cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, (void**)sp,
(sal_Int64*)nRegReturn );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "after mediate ret is %lx %ld\n", nRegReturn[0], nRegReturn[0]);
#endif
@@ -625,7 +625,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
{
(*slots) -= functionCount;
Slot * s = *slots;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx
index 45b9860f8d05..db6d18800c4f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx
@@ -53,7 +53,7 @@ void MapReturn(long r0, typelib_TypeClass eTypeClass, sal_uInt64* pRegisterRetur
register float fret asm("$f0");
register double dret asm("$f0");
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr,"Mapping Return with %lx %ld %f\n", r0, r0, dret);
#endif
switch (eTypeClass)
@@ -85,7 +85,7 @@ void MapReturn(long r0, typelib_TypeClass eTypeClass, sal_uInt64* pRegisterRetur
default:
break;
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of MapReturn with %x\n", pRegisterReturn ? *pRegisterReturn : 0);
#endif
}
@@ -146,7 +146,7 @@ void callVirtualMethod(
if ( nGPR > axp::MAX_GPR_REGS )
nGPR = axp::MAX_GPR_REGS;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= nStack is %d\n", nStack );
@@ -406,7 +406,7 @@ void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "unoInterfaceProxyDispatch\n");
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
index 89718405b4bf..937f38784e41 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
@@ -27,7 +27,7 @@
************************************************************************/
#include <malloc.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/alloc.h>
#include <osl/mutex.hxx>
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
index 97130aedeb53..b7f44b2b5bb0 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
@@ -30,7 +30,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -101,7 +101,7 @@ namespace CPPU_CURRENT_NAMESPACE
//=====================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
index ea5438616464..5b02678b8fbf 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
@@ -394,7 +394,7 @@ static void cpp_call(
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
#endif
INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, pStackStart, bOverFlow );
@@ -402,7 +402,7 @@ static void cpp_call(
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
#endif
INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/call.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/call.cxx
index 4974bf3f0e82..f434b7e0ba91 100644
--- a/bridges/source/cpp_uno/gcc3_linux_hppa/call.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_hppa/call.cxx
@@ -106,7 +106,7 @@ void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
pMethod += 4 * nVtableIndex;
pMethod = *((sal_uInt32 *)pMethod);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "this is %p\n", pGPR[0]);
for (int i = 0; i < hppa::MAX_GPR_REGS ; ++i)
fprintf(stderr, "normal reg %d is %d %x\n", i, pGPR[i], pGPR[i]);
diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx
index 52e5b7cf1a2b..e96217495ddb 100644
--- a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx
@@ -27,7 +27,7 @@
************************************************************************/
#include <malloc.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/alloc.h>
#include <osl/mutex.hxx>
@@ -65,7 +65,7 @@ namespace
void ** startovrflw = ovrflw;
int nregs = 0; //number of words passed in registers
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "cpp2uno_call\n");
#endif
// return
@@ -81,14 +81,14 @@ namespace
{
if (hppa::isRegisterReturn(pReturnTypeRef))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple return\n");
#endif
pUnoReturn = pRegisterReturn; // direct way for simple types
}
else
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex return via r8\n");
#endif
pCppReturn = (void *)r8;
@@ -295,14 +295,14 @@ namespace
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "before dispatch\n");
#endif
// invoke uno dispatch call
(*pThis->getUnoI()->pDispatcher)(
pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "after dispatch\n");
#endif
@@ -384,7 +384,7 @@ namespace
{
void ** ovrflw = (void**)(sp);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "cpp_mediate with\n");
fprintf(stderr, "%x %x\n", nFunctionIndex, nVtableOffset);
fprintf(stderr, "and %x %x\n", (long)(ovrflw[0]), (long)(ovrflw[-1]));
@@ -407,14 +407,14 @@ namespace
{
nFunctionIndex &= 0x7fffffff;
pThis = gpreg[1];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[1]\n");
#endif
}
else
{
pThis = gpreg[0];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[0]\n");
#endif
}
@@ -578,7 +578,7 @@ sal_Int64 cpp_vtable_call( sal_uInt32 in0, sal_uInt32 in1, sal_uInt32 in2, sal_u
register double d3 asm("fr7"); dpreg[3] = d3;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "got to cpp_vtable_call with %x %x\n", functionIndex, vtableOffset);
for (int i = 0; i < hppa::MAX_GPR_REGS; ++i)
fprintf(stderr, "reg %d is %d %x\n", i, gpreg[i], gpreg[i]);
diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
index 4147e3f2a4f8..b810833d6434 100644
--- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
@@ -30,7 +30,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -101,7 +101,7 @@ namespace CPPU_CURRENT_NAMESPACE
//=====================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx
index deddfcfed517..6c3b25c387fa 100644
--- a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx
@@ -248,7 +248,7 @@ static void cpp_call(
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "hyper is %llx\n", *((long long*)pCppArgs[nPos]));
#endif
INSERT_INT64( pCppArgs[nPos], nRegs, pGPR, pStack, pStackStart, bOverFlow );
@@ -256,7 +256,7 @@ static void cpp_call(
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
#endif
INSERT_INT32( pCppArgs[nPos], nRegs, pGPR, pStack, bOverFlow );
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
index 486f58e7bb41..e897397ce76b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
@@ -56,7 +56,7 @@ static typelib_TypeClass cpp2uno_call(
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_Int64 * pRegisterReturn /* space for register return */ )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "as far as cpp2uno_call\n");
#endif
@@ -121,14 +121,14 @@ static typelib_TypeClass cpp2uno_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "arg %d of %d\n", nPos, nParams);
#endif
//I think it is impossible to get UNO to pass structs as parameters by copy
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple\n");
#endif
@@ -194,7 +194,7 @@ static typelib_TypeClass cpp2uno_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex, ng is %d\n", ng);
#endif
void *pCppStack; //temporary stack pointer
@@ -238,7 +238,7 @@ static typelib_TypeClass cpp2uno_call(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of params\n");
#endif
@@ -336,25 +336,25 @@ static typelib_TypeClass cpp_mediate(
{
nFunctionIndex &= 0x7fffffff;
pThis = gpreg[1];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[1]\n");
#endif
}
else
{
pThis = gpreg[0];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[0]\n");
#endif
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is %p\n", pThis);
#endif
pThis = static_cast< char * >(pThis) - nVtableOffset;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is now %p\n", pThis);
#endif
@@ -364,7 +364,7 @@ static typelib_TypeClass cpp_mediate(
typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "indexes are %d %d\n", nFunctionIndex, pTypeDescr->nMapFunctionIndexToMemberIndex);
#endif
@@ -380,7 +380,7 @@ static typelib_TypeClass cpp_mediate(
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "members are %d %d\n", nMemberPos, pTypeDescr->nAllMembers);
#endif
@@ -468,7 +468,7 @@ static typelib_TypeClass cpp_mediate(
}
default:
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "screwed\n");
#endif
@@ -480,7 +480,7 @@ static typelib_TypeClass cpp_mediate(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of cpp_mediate\n");
#endif
return eRet;
@@ -520,7 +520,7 @@ extern "C" ia64::RegReturn cpp_vtable_call(
register double f14 asm("f14"); fpreg[6] = f14;
register double f15 asm("f15"); fpreg[7] = f15;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "cpp_vtable_call called with %lx\n", nOffsetAndIndex);
fprintf(stderr, "adump is %lx %lx %lx %lx %lx %lx %lx %lx\n", in0, in1, in2, in3, in4, in5, in6, in7);
fprintf(stderr, "bdump is %f %f %f %f %f %f %f %f\n", f8, f9, f10, f11, f12, f13, f14, f15);
@@ -576,7 +576,7 @@ const int codeSnippetSize = 40;
bridges::cpp_uno::shared::VtableFactory::Slot codeSnippet( unsigned char * code, sal_PtrDiff writetoexecdiff, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
bool bHasHiddenParam )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "size is %d\n", codeSnippetSize);
fprintf(stderr,"in codeSnippet functionIndex is %x\n", nFunctionIndex);
fprintf(stderr,"in codeSnippet vtableOffset is %x\n", nVtableOffset);
@@ -632,7 +632,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
{
(*in_slots) -= functionCount;
Slot * slots = *in_slots;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
index 393ed541ae3f..19b586b557f2 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
@@ -177,7 +177,7 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
if ( nGPR > ia64::MAX_GPR_REGS )
nGPR = ia64::MAX_GPR_REGS;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
@@ -337,7 +337,7 @@ static void cpp_call(
bool bSimpleReturn = true;
if (pReturnTypeDescr)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "return type is %d\n", pReturnTypeDescr->eTypeClass);
#endif
if ( ia64::return_in_hidden_param(pReturnTypeRef) || ia64::return_via_r8_buffer(pReturnTypeRef) )
@@ -346,7 +346,7 @@ static void cpp_call(
if ( bSimpleReturn )
{
pCppReturn = pUnoReturn; // direct way for simple types
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple return\n");
#endif
}
@@ -355,7 +355,7 @@ static void cpp_call(
// complex return via ptr
pCppReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize ) : pUnoReturn);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn, pUnoReturn);
#endif
if (!ia64::return_via_r8_buffer(pReturnTypeRef))
@@ -365,7 +365,7 @@ static void cpp_call(
// push "this" pointer
void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "this pointer is %p\n", pAdjustedThisPtr);
#endif
INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack, bOverFlow );
@@ -379,7 +379,7 @@ static void cpp_call(
sal_Int32 nTempIndizes = 0;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "n params is %d\n", nParams);
#endif
@@ -389,7 +389,7 @@ static void cpp_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "param %d is %d %d %d\n", nPos, rParam.bOut, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ),
pParamTypeDescr->eTypeClass);
#endif
@@ -403,7 +403,7 @@ static void cpp_call(
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "hyper is %lx\n", *(unsigned long*)(pCppArgs[nPos]));
#endif
INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
@@ -411,7 +411,7 @@ static void cpp_call(
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "long is %lx\n", *(unsigned int*)(pCppArgs[nPos]));
#endif
INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
@@ -419,27 +419,27 @@ static void cpp_call(
case typelib_TypeClass_SHORT:
case typelib_TypeClass_CHAR:
case typelib_TypeClass_UNSIGNED_SHORT:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "short is %x\n", *(unsigned short*)(pCppArgs[nPos]));
#endif
INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "byte is %x\n", *(unsigned char*)(pCppArgs[nPos]));
#endif
INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
break;
case typelib_TypeClass_FLOAT:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "a float is %f\n", *(float*)(pCppArgs[nPos]));
fprintf(stderr, "b float is %f\n", *(double*)(pCppArgs[nPos]));
#endif
INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, nGPR, pGPR, pStack, bOverFlow );
break;
case typelib_TypeClass_DOUBLE:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "double is %f\n", *(double*)(pCppArgs[nPos]));
#endif
INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, nGPR, pGPR, pStack, bOverFlow );
@@ -454,12 +454,12 @@ static void cpp_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex type again %d\n", rParam.bIn);
#endif
if (! rParam.bIn) // is pure out
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex size is %d\n", pParamTypeDescr->nSize );
#endif
// cpp out is constructed mem, uno out is not!
@@ -473,7 +473,7 @@ static void cpp_call(
// is in/inout
else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "this one\n");
#endif
uno_copyAndConvertData(
@@ -486,7 +486,7 @@ static void cpp_call(
}
else // direct way
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "that one, passing %lx through\n", pUnoArgs[nPos]);
#endif
pCppArgs[nPos] = pUnoArgs[nPos];
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
index 84c05578bf5b..3f91c558f1d0 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx
@@ -359,7 +359,8 @@ extern "C" typedef void (*PrivateSnippetExecutor)();
int const codeSnippetSize = 16;
-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX)
+#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX) || \
+ defined(DRAGONFLY)
namespace
{
PrivateSnippetExecutor returnsInRegister(typelib_TypeDescriptionReference * pReturnTypeRef)
@@ -407,7 +408,8 @@ unsigned char * codeSnippet(
break;
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX) || \
+ defined(DRAGONFLY)
exec = returnsInRegister(pReturnTypeRef);
if (!exec)
{
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index 8013a8248bab..c6529ed4f627 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -32,8 +32,9 @@
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
+#include <boost/unordered_map.hpp>
+
#include <cxxabi.h>
-#include <hash_map>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -47,7 +48,6 @@
#include "share.hxx"
-
using namespace ::std;
using namespace ::osl;
using namespace ::rtl;
@@ -103,7 +103,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
index 6e2b7529247f..beedf9dafa2a 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
@@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
.IF "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCLINUXIgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCOPENBSDIgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDIgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCNETBSDIgcc3"
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCOPENBSDIgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDIgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCNETBSDIgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCDRAGONFLYIgcc3"
.IF "$(cppu_no_leak)" == ""
CFLAGS += -DLEAK_STATIC_DATA
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
index de3e28ea8269..21febefad110 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD)
+#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
#include <stdlib.h>
#else
#include <malloc.h>
@@ -153,7 +153,8 @@ void callVirtualMethod(
break;
default:
{
-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX)
+#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX) || \
+ defined(DRAGONFLY)
sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
if (bSimpleReturn && nRetSize <= 8 && nRetSize > 0)
{
@@ -355,7 +356,8 @@ namespace x86
{
if (bridges::cpp_uno::shared::isSimpleType( pTD ))
return true;
-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || \
+ defined(MACOSX) || defined(DRAGONFLY)
// Only structs of exactly 1, 2, 4, or 8 bytes are returned through
// registers, see <http://developer.apple.com/documentation/DeveloperTools/
// Conceptual/LowLevelABI/Articles/IA32.html>:
diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx
index ad318a8f9e04..7c46d1a0b408 100644
--- a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx
@@ -27,7 +27,7 @@
************************************************************************/
#include <malloc.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/alloc.h>
#include <osl/mutex.hxx>
@@ -65,7 +65,7 @@ namespace
// pCallStack: ret, [return ptr], this, params
char * pTopStack = (char *)(pCallStack + 0);
char * pCppStack = pTopStack;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "cpp2uno_call\n");
#endif
// return
@@ -81,14 +81,14 @@ namespace
{
if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple return\n");
#endif
pUnoReturn = pRegisterReturn; // direct way for simple types
}
else // complex return via ptr (pCppReturn)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex return\n");
#endif
pCppReturn = (void *)r8;
@@ -190,14 +190,14 @@ namespace
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "before dispatch\n");
#endif
// invoke uno dispatch call
(*pThis->getUnoI()->pDispatcher)(
pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "after dispatch\n");
#endif
@@ -277,7 +277,7 @@ namespace
sal_Int64 * pRegisterReturn /* space for register return */ )
{
void ** pCallStack = (void**)(sp);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "cpp_mediate with\n");
fprintf(stderr, "%x %x\n", nFunctionIndex, nVtableOffset);
fprintf(stderr, "and %x %x\n", pCallStack, pRegisterReturn);
diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
index 4147e3f2a4f8..b810833d6434 100644
--- a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
@@ -30,7 +30,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -101,7 +101,7 @@ namespace CPPU_CURRENT_NAMESPACE
//=====================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx
index b84215bfadcc..0d0fd27678eb 100644
--- a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx
@@ -110,7 +110,7 @@ void callVirtualMethod(
memcpy( stack, pStack, nStackBytes );
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "\nStack (%d): ", nStack );
@@ -229,7 +229,7 @@ static void cpp_call(
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
#endif
INSERT_INT64( pCppArgs[nPos], pStack );
@@ -237,7 +237,7 @@ static void cpp_call(
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
#endif
INSERT_INT32( pCppArgs[nPos], pStack );
diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
index edba6396ce00..cc541fd02f27 100644
--- a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
@@ -29,7 +29,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -98,7 +98,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
index e4cf7307dde2..e9a5e8c6bb8b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
@@ -57,7 +57,7 @@ static typelib_TypeClass cpp2uno_call(
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_Int64 * pRegisterReturn /* space for register return */ )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "as far as cpp2uno_call\n");
#endif
@@ -115,13 +115,13 @@ static typelib_TypeClass cpp2uno_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "arg %d of %d\n", nPos, nParams);
#endif
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple\n");
#endif
@@ -213,7 +213,7 @@ static typelib_TypeClass cpp2uno_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex, ng is %d\n", ng);
#endif
void *pCppStack; //temporary stack pointer
@@ -257,7 +257,7 @@ static typelib_TypeClass cpp2uno_call(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of params\n");
#endif
@@ -356,25 +356,25 @@ static typelib_TypeClass cpp_mediate(
{
nFunctionIndex &= 0x7fffffff;
pThis = gpreg[1];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[1]\n");
#endif
}
else
{
pThis = gpreg[0];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is gpreg[0]\n");
#endif
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is %lx\n", pThis);
#endif
pThis = static_cast< char * >(pThis) - nVtableOffset;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pThis is now %lx\n", pThis);
#endif
@@ -384,7 +384,7 @@ static typelib_TypeClass cpp_mediate(
typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "indexes are %d %d\n", nFunctionIndex, pTypeDescr->nMapFunctionIndexToMemberIndex);
#endif
@@ -400,7 +400,7 @@ static typelib_TypeClass cpp_mediate(
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "members are %d %d\n", nMemberPos, pTypeDescr->nAllMembers);
#endif
@@ -488,7 +488,7 @@ static typelib_TypeClass cpp_mediate(
}
default:
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "screwed\n");
#endif
@@ -500,7 +500,7 @@ static typelib_TypeClass cpp_mediate(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of cpp_mediate\n");
#endif
return eRet;
@@ -605,7 +605,7 @@ const int codeSnippetSize = 24;
unsigned char * codeSnippet( unsigned char * code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
bool simpleRetType)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr,"in codeSnippet functionIndex is %x\n", nFunctionIndex);
fprintf(stderr,"in codeSnippet vtableOffset is %x\n", nVtableOffset);
#endif
@@ -618,7 +618,7 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 nFunctionIndex, sa
void ** raw = (void **)&code[0];
memcpy(raw, (char*) privateSnippetExecutor, 16);
raw[2] = (void*) nOffsetAndIndex;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in: offset/index is %x %x %d, %lx\n",
nFunctionIndex, nVtableOffset, !simpleRetType, raw[2]);
#endif
@@ -671,7 +671,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
{
(*slots) -= functionCount;
Slot * s = *slots;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
index 6fb1c4eb0d39..66db74288cb3 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
@@ -100,7 +100,7 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
if ( nGPR > ppc64::MAX_GPR_REGS )
nGPR = ppc64::MAX_GPR_REGS;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
@@ -267,13 +267,13 @@ static void cpp_call(
if (pReturnTypeDescr)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "return type is %d\n", pReturnTypeDescr->eTypeClass);
#endif
if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
{
pCppReturn = pUnoReturn; // direct way for simple types
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple return\n");
#endif
}
@@ -282,7 +282,7 @@ static void cpp_call(
// complex return via ptr
pCppReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize ) : pUnoReturn);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn, pUnoReturn);
#endif
INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack, bOverFlow );
@@ -290,7 +290,7 @@ static void cpp_call(
}
// push "this" pointer
void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "this pointer is %p\n", pAdjustedThisPtr);
#endif
INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack, bOverFlow );
@@ -304,7 +304,7 @@ static void cpp_call(
sal_Int32 nTempIndizes = 0;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "n params is %d\n", nParams);
#endif
@@ -314,7 +314,7 @@ static void cpp_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "param %d is %d %d %d\n", nPos, rParam.bOut, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ),
pParamTypeDescr->eTypeClass);
#endif
@@ -328,7 +328,7 @@ static void cpp_call(
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
#endif
INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
@@ -336,7 +336,7 @@ static void cpp_call(
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
#endif
INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
@@ -364,12 +364,12 @@ static void cpp_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex type again %d\n", rParam.bIn);
#endif
if (! rParam.bIn) // is pure out
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex size is %d\n", pParamTypeDescr->nSize );
#endif
// cpp out is constructed mem, uno out is not!
@@ -383,7 +383,7 @@ static void cpp_call(
// is in/inout
else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "this one\n");
#endif
uno_copyAndConvertData(
@@ -396,7 +396,7 @@ static void cpp_call(
}
else // direct way
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "that one, passing %lx through\n", pUnoArgs[nPos]);
#endif
pCppArgs[nPos] = pUnoArgs[nPos];
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
index 4112f48e9773..a29b7c38dba7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
@@ -471,7 +471,7 @@ static typelib_TypeClass cpp_mediate(
*/
static void privateSnippetExecutor( sal_uInt32 nOffsetAndIndex, void** gpregptr, void** fpregptr, void** ovrflw)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "privateSnippetExecutor\n");
#endif
@@ -644,7 +644,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
{
(*slots) -= functionCount;
Slot * s = *slots;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
index 11f9ba9c49d2..ddaf1f368413 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
@@ -508,7 +508,7 @@ void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "unoInterfaceProxyDispatch\n");
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx
index 815d59611216..fa3bd5fb687a 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx
@@ -53,7 +53,7 @@ static typelib_TypeClass cpp2uno_call(
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_Int64 * pRegisterReturn /* space for register return */ )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "as far as cpp2uno_call\n");
#endif
int ng = 0; //number of gpr registers used
@@ -109,13 +109,13 @@ static typelib_TypeClass cpp2uno_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "arg %d of %d\n", nPos, nParams);
#endif
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple\n");
#endif
@@ -203,7 +203,7 @@ static typelib_TypeClass cpp2uno_call(
}
else // ptr to complex value | ref
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex, ng is %d\n", ng);
#endif
@@ -247,7 +247,7 @@ static typelib_TypeClass cpp2uno_call(
}
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of params\n");
#endif
@@ -333,11 +333,11 @@ static typelib_TypeClass cpp_mediate(
sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "nVTableOffset, nFunctionIndex are %x %x\n", nVtableOffset, nFunctionIndex);
#endif
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= cpp_mediate () =\nGPR's (%d): ", 5 );
@@ -506,14 +506,14 @@ long privateSnippetExecutor(long r2, long r3, long r4, long r5, long r6, long fi
register double f6 asm("f6"); fpreg[3] = f6;
volatile long nRegReturn[1];
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "before mediate with %lx\n",nOffsetAndIndex);
fprintf(stderr, "doubles are %f %f %f %f\n", fpreg[0], fpreg[1], fpreg[2], fpreg[3]);
#endif
typelib_TypeClass aType =
cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, (void**)sp,
(sal_Int64*)nRegReturn );
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "after mediate ret is %lx %ld\n", nRegReturn[0], nRegReturn[0]);
#endif
@@ -606,7 +606,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
{
(*slots) -= functionCount;
Slot * s = *slots;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
index c0de95532515..ea4188bac998 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx
index 8761da53d604..379d086ce85a 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star::uno;
void MapReturn(long r2, double f0, typelib_TypeClass eTypeClass, sal_uInt64* pRegisterReturn)
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr,"Mapping Return with %lx %ld %f\n", r2, r2, f0);
#endif
switch (eTypeClass)
@@ -82,7 +82,7 @@ void MapReturn(long r2, double f0, typelib_TypeClass eTypeClass, sal_uInt64* pRe
default:
break;
}
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of MapReturn with %x\n", pRegisterReturn ? *pRegisterReturn : 0);
#endif
}
@@ -143,7 +143,7 @@ void callVirtualMethod(
if ( nGPR > s390x::MAX_GPR_REGS )
nGPR = s390x::MAX_GPR_REGS;
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
// Let's figure out what is really going on here
{
fprintf( stderr, "= nStack is %d\n", nStack );
@@ -411,7 +411,7 @@ void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
-#ifdef CMC_DEBUG
+#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "unoInterfaceProxyDispatch\n");
#endif
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
index bfde350cd2c4..a8dbc88730ce 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
@@ -32,7 +32,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -101,7 +101,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
index ffce7fa008d4..f99e60d0d6fd 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
@@ -39,9 +39,12 @@
#include "share.hxx"
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OUStringToOString;
+
namespace
{
//==================================================================================================
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
index e62f71d2c32a..938cbf5ded06 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
@@ -67,16 +67,6 @@
using namespace x86_64;
-typedef struct
-{
- /* Registers for argument passing. */
- long gpr[MAX_GPR_REGS];
- __int128_t sse[MAX_SSE_REGS];
-
- /* Stack space for arguments. */
- char argspace[0];
-} stackLayout;
-
/* Register class used for passing given 64bit part of the argument.
These represent classes as documented by the PS ABI, with the exception
of SSESF, SSEDF classes, that are basically SSE class, just gcc will
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index d61b843eabfc..c9b51856378d 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/alloc.h>
#include <osl/mutex.hxx>
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
index 4e15e6e36be3..fe4c19a3ca13 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
@@ -33,7 +33,7 @@
#include <string.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -103,7 +103,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
index 156ca4f27d4a..dd3543233827 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
@@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
.IF "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCLINUXXgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCOPENBSDXgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDXgcc3" || \
- "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCNETBSDXgcc3"
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCOPENBSDXgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDXgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCNETBSDXgcc3" || \
+ "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCDRAGONFLYXgcc3" \
.IF "$(cppu_no_leak)" == ""
CFLAGS += -DLEAK_STATIC_DATA
diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx
index f196ae734f71..ff7b42d064ae 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx
index abc3ad10fc37..274f99987cb8 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/except.cxx
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -101,7 +101,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_os2_intel/except.cxx b/bridges/source/cpp_uno/gcc3_os2_intel/except.cxx
index 10ddb37ad8eb..58c04f7355fd 100644
--- a/bridges/source/cpp_uno/gcc3_os2_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_os2_intel/except.cxx
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -117,7 +117,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
index 1516b2b02288..d2607365a8bf 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
index 4811d2528d02..9a24607e593f 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <dlfcn.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -100,7 +100,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
index c7636bb5b191..81dbb5dcea53 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
@@ -41,9 +41,12 @@
#include <sal/alloca.h>
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OUStringToOString;
+
namespace
{
//==================================================================================================
diff --git a/bridges/source/cpp_uno/mingw_intel/except.cxx b/bridges/source/cpp_uno/mingw_intel/except.cxx
index ccf4bb956af4..e76f15af03ad 100644
--- a/bridges/source/cpp_uno/mingw_intel/except.cxx
+++ b/bridges/source/cpp_uno/mingw_intel/except.cxx
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <string.h>
#include <cxxabi.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -102,7 +102,7 @@ static OUString toUNOname( char const * p ) SAL_THROW( () )
//==================================================================================================
class RTTI
{
- typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
index 5fff7444296e..e8ac31ebf3a7 100644
--- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
@@ -30,7 +30,7 @@
#include "precompiled_bridges.hxx"
#pragma warning( disable : 4237 )
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <sal/config.h>
#include <malloc.h>
#include <new.h>
@@ -97,7 +97,7 @@ static inline OUString toRTTIname( OUString const & rUNOname ) throw ()
//##################################################################################################
-typedef hash_map< OUString, void *, OUStringHash, equal_to< OUString > > t_string2PtrMap;
+typedef boost::unordered_map< OUString, void *, OUStringHash, equal_to< OUString > > t_string2PtrMap;
//==================================================================================================
class RTTInfos
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/asmbits.asm b/bridges/source/cpp_uno/msvc_win32_x86-64/asmbits.asm
deleted file mode 100644
index 09f1177b9a9e..000000000000
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/asmbits.asm
+++ /dev/null
@@ -1,328 +0,0 @@
-; -*- Mode: text; tab-width: 8; indent-tabs-mode: nil comment-column: 32; comment-start: "; " comment-start-skip: "; *" -*-
-
-;*************************************************************************
-;*
-;* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-;*
-;* Copyright 2000, 2011 Oracle and/or its affiliates.
-;*
-;* OpenOffice.org - a multi-platform office productivity suite
-;*
-;* This file is part of OpenOffice.org.
-;*
-;* OpenOffice.org is free software: you can redistribute it and/or modify
-;* it under the terms of the GNU Lesser General Public License version 3
-;* only, as published by the Free Software Foundation.
-;*
-;* OpenOffice.org is distributed in the hope that it will be useful,
-;* but WITHOUT ANY WARRANTY; without even the implied warranty of
-;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;* GNU Lesser General Public License version 3 for more details
-;* (a copy is included in the LICENSE file that accompanied this code).
-;*
-;* You should have received a copy of the GNU Lesser General Public License
-;* version 3 along with OpenOffice.org. If not, see
-;* <http://www.openoffice.org/license.html>
-;* for a copy of the LGPLv3 License.
-;*
-;************************************************************************
-
-; Emacs asm-mode is not really ideal for the convention in this
-; file. So I use text-mode with custom comment syntax... not really
-; ideal either. Maybe I should just re-format this to match asm-mode's
-; conventions?
-
-; NOTE: EXTREMELY UNFINISHED, I KNOW. WORK IN PROGRESS.
-
-; I really don't have a good high-level understanding of the big
-; picture and what the actual task of the C++/UNO bridge is yet... I
-; should debug the x86 version and see what is actually going on to
-; get an understanding.
-
-; This is in a separate file for x86-64 as MSVC doesn't have in-line
-; assembly for x64. The code here is still partly just a crude copy of
-; the in-line x86 code from ../msvc_win32_intel that is totally
-; pointless on x64. But parts have been properly changed into x64
-; calling convention and might even work.
-
-; Random web links and other documentation about low-level
-; implementation details for the C++/UNO bridge on x64 Windows kept
-; here:
-
-; Caolan's "Lazy Hackers Guide To Porting" is useful:
-; http://wiki.services.openoffice.org/wiki/Lazy_Hackers_Guide_To_Porting
-
-; As for details about the x64 Windows calling convention, register
-; usage, stack usage, exception handling etc, the official
-; documentation (?) on MSDN is a bit fragmented and split up into a
-; needlessly large number of short pages. But still:
-; http://msdn.microsoft.com/en-us/library/7kcdt6fy%28v=VS.90%29.aspx
-
-; Also see Raymond Chen's blog post:
-; http://blogs.msdn.com/b/oldnewthing/archive/2004/01/14/58579.aspx
-
-; This one is actually more readable: "Improving Automated Analysis of
-; Windows x64 Binaries":
-; http://www.uninformed.org/?v=4&a=1
-
-; The bridge uses dynamic code generation. For exception handling and
-; unwinding to work across that (as I assume we want?), one apparently
-; needs to use either RtlAddFunctionTable() or
-; RtlInstallFunctionTableCallback(). See Windows SDK documentation.
-
-; Random interesting discussion threads:
-; http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/300bd6d3-9381-4d2d-8129-e48b392c05d8
-
-; Ken Johnson's blog http://www.nynaeve.net/ has much interesting
-; information, for instance:
-; http://www.nynaeve.net/?p=11
-
-; From <typelib/typeclass.h>
-typelib_TypeClass_VOID = 0
-typelib_TypeClass_CHAR = 1
-typelib_TypeClass_BOOLEAN = 2
-typelib_TypeClass_BYTE = 3
-typelib_TypeClass_SHORT = 4
-typelib_TypeClass_UNSIGNED_SHORT = 5
-typelib_TypeClass_LONG = 6
-typelib_TypeClass_UNSIGNED_LONG = 7
-typelib_TypeClass_HYPER = 8
-typelib_TypeClass_UNSIGNED_HYPER = 9
-typelib_TypeClass_FLOAT = 10
-typelib_TypeClass_DOUBLE = 11
-typelib_TypeClass_ENUM = 15
-
-extrn __copyConstruct : proc
-extrn __destruct : proc
-extrn cpp_mediate: proc
-
-.code
-
-; First we have three code snippets that aren't real functions, but
-; "naked" (in x86 calling convention parlance) functions jumped to
-; from code generated in C++.
-
-; I think that for x64 Windows we shouldn't be jumping so wildly from
-; generated code snippets into fixed code snippets here. "Procedures"
-; should be continuous in memory, or the unwinding information will be
-; broken. (For dynamically generated code, that is dynamically
-; registered unwind information, obviously.)
-
-; So instead of generating jumps into here, we should just make the
-; C++ code copy the machine code that these three "naked" functions
-; compile to after the snippet it is generating. Of course, that means
-; the code here needs to be position independent, or (eek) that we
-; would need to come up with some home-brewed minimal relocation
-; mechanism.
-
-; Jumped to from code generated in except.cxx: ObjectFunction::ObjectFunction()
-
-copyConstruct proc
- ; ObjectFunction this already on stack
- push [rsp+8] ; source exc object this
- push rcx ; exc object
- call __copyConstruct
- add rsp, 12 ; + ObjectFunction this
- ret 4
-copyConstruct endp
-
-; Ditto
-
-destruct proc
- ; ObjectFunction this already on stack
- push rcx ; exc object
- call __destruct
- add rsp, 8 ; + ObjectFunction this
- ret
-destruct endp
-
-; Jumped to from code generated in cpp2uno.cxx:codeSnippet()
-
-cpp_vtable_call proc
- sub rsp, 8 ; space for immediate return type
- push rsp
- push rdx ; vtable offset
- push rax ; function index
- mov rax, rsp
- add rax, 20
- push rax ; original stack ptr
-
- call cpp_mediate
- add rsp, 16
-
- cmp rax, typelib_TypeClass_FLOAT
- je Lfloat
- cmp rax, typelib_TypeClass_DOUBLE
- je Ldouble
- cmp rax, typelib_TypeClass_HYPER
- je Lhyper
- cmp eax, typelib_TypeClass_UNSIGNED_HYPER
- je Lhyper
- ; rest is eax
- pop rax
- add rsp, 4
- ret
-Lhyper:
- pop rax
- pop rdx
- ret
-Lfloat:
- fld dword ptr [rsp]
- add rsp, 8
- ret
-Ldouble:
- fld qword ptr [rsp]
- add rsp, 8
- ret
-cpp_vtable_call endp
-
-; Called from uno2cpp.cxx
-
-; This one is now hopefully proper x64 Windows code following the
-; appropriate conventions and might actually work.
-
-; void callVirtualMethod( ; location on entry
-; void * pAdjustedThisPtr, ; rcx
-; sal_Int32 nVtableIndex, ; rdx
-; void * pReturn, ; r8
-; typelib_TypeClass eReturnTypeClass, ; r9
-; sal_Int64 * pStack, ; ((4+1)*8)[rsp]
-; sal_Int32 nStack ; ((5+1)*8)[rsp]
-; sal_uInt64 *pGPR, ; ((6+1)*8)[rsp]
-; double *pFPR) ; ((7+1)*8)[rsp]
-
-callVirtualMethod proc frame
- ; Prologue
- mov ((3+1)*8)[rsp], r9
- mov ((2+1)*8)[rsp], r8
- mov ((0+1)*8)[rsp], rcx
- push rsi
- .pushreg rsi
- push rdi
- .pushreg rdi
-
- ; Our stack frame size is 24 qwords (space for 20 parameters
- ; to pass, plus the two pushed registers rsi and rdi, plus
- ; return address, rounded up to 16 bytes)
-
- sub rsp, (20+1)*8
- .allocstack (20+1)*8
- .endprolog
-
- ; Stack parameters first
-
- ; nStack is number of qwords of stack space (including spilled
- ; registers). If four or less, 4 is passed in anyway to make
- ; code here simpler.
-
- mov rcx, ((24+5)*8)[rsp] ; nStack
- sub rcx, 4
- jle Lxmmregs
-
- mov rsi, ((24+4)*8)[rsp] ; pStack
- add rsi, 32
- lea rdi, 32[rsp]
- rep movsq
-
-Lxmmregs:
- ; Parameters passed in XMM registers
-
- ; We don't bother checking which actually needed, if any.
- mov rax, ((24+7)*8)[rsp] ; pFPR
- movsd xmm0, qword ptr [rax]
- movsd xmm1, qword ptr 8[rax]
- movsd xmm2, qword ptr 16[rax]
- movsd xmm3, qword ptr 24[rax]
-
- ; Prepare pointer to function to call
- mov rcx, ((24+0)*8)[rsp]
- mov r12, [rcx] ; pAdjustedThisPtr->vtable
- shl rdx, 3 ; nVtableIndex *= 8
- add r12, rdx
-
- ; Fill parameters passed in general purpose registers
- mov rax, ((24+6)*8)[rsp] ; pGPR
- mov rcx, (0*8)[rax]
- mov rdx, (1*8)[rax]
- mov r8, (2*8)[rax]
- mov r9, (3*8)[rax]
-
- call qword ptr [r12]
-
- ; Test return type
- mov r9, ((24+3)*8)[rsp]
- cmp r9, typelib_TypeClass_VOID
- je Lepilog
-
- ; int32
- cmp r9, typelib_TypeClass_LONG
- je Lint32
- cmp r9, typelib_TypeClass_UNSIGNED_LONG
- je Lint32
- cmp r9, typelib_TypeClass_ENUM
- je Lint32
-
- ; int8
- cmp r9, typelib_TypeClass_BOOLEAN
- je Lint8
- cmp r9, typelib_TypeClass_BYTE
- je Lint8
-
- ; int16
- cmp r9, typelib_TypeClass_CHAR
- je Lint16
- cmp r9, typelib_TypeClass_SHORT
- je Lint16
- cmp r9, typelib_TypeClass_UNSIGNED_SHORT
- je Lint16
-
- ; int64
- cmp r9, typelib_TypeClass_HYPER
- je Lint64
- cmp r9, typelib_TypeClass_UNSIGNED_HYPER
- je Lint64
-
- ; float
- cmp r9, typelib_TypeClass_FLOAT
- je Lfloat
-
- ; double
- cmp r9, typelib_TypeClass_DOUBLE
- je Ldouble
-
- jmp Lepilog ; no simple type
-
-Lint8:
- mov byte ptr [r8], al
- jmp Lepilog
-
-Lint16:
- mov word ptr [r8], ax
- jmp Lepilog
-
-Lint32:
- mov dword ptr [r8], eax
- jmp Lepilog
-
-Lint64:
- mov qword ptr [r8], rax
- jmp Lepilog
-
-Lfloat:
- movss dword ptr [r8], xmm0
- jmp Lepilog
-
-Ldouble:
- movsd qword ptr [r8], xmm0
-
-Lepilog:
- ; Epilogue
- add rsp, (20+1)*8
- pop rdi
- pop rsi
- ret
-callVirtualMethod endp
-
-end
-
-; vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/call.asm b/bridges/source/cpp_uno/msvc_win32_x86-64/call.asm
new file mode 100644
index 000000000000..406e78d397a1
--- /dev/null
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/call.asm
@@ -0,0 +1,133 @@
+; -*- Mode: text; tab-width: 8; indent-tabs-mode: nil comment-column: 44; comment-start: ";; " comment-start-skip: ";; *" -*-
+
+;; Version: MPL 1.1 / GPLv3+ / LGPLv3+
+;;
+;; The contents of this file are subject to the Mozilla Public License Version
+;; 1.1 (the "License"); you may not use this file except in compliance with
+;; the License or as specified alternatively below. You may obtain a copy of
+;; the License at http://www.mozilla.org/MPL/
+;;
+;; Software distributed under the License is distributed on an "AS IS" basis,
+;; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+;; for the specific language governing rights and limitations under the
+;; License.
+;;
+;; The Initial Developer of the Original Code is
+;; Novell, Inc.
+;; Portions created by the Initial Developer are Copyright (C) 2011
+;; Novell, Inc. All Rights Reserved.
+;;
+;; Major Contributor(s):
+;; Tor Lillqvist <tml@iki.fi>
+;; Portions created by Tor Lillqvist are Copyright (C) 2011 Tor Lillqvist. All Rights Reserved.
+;;
+;; For minor contributions see the git repository.
+;;
+;; Alternatively, the contents of this file may be used under the terms of
+;; either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+;; the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+;; in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+;; instead of those above.
+
+;; This is the function jumped to from the trampoline generated by
+;; codeSnippet() in cpp2uno.cxx. Here we call cpp_vtable_call() which
+;; then calls the actual UNO function.
+
+;; The code snippet generated is called from "normal" C++ code which
+;; has no idea that it is calling dynamically generated code.
+
+;; The generated short code snippet is not covered by any function
+;; table and unwind info, but that doesn't matter, as the instructions
+;; in it are not really going to cause any exception. Once it jumps
+;; here it is covered by a function table, and the calls further down
+;; through cpp_vtable_call() can be unwound cleanly.
+
+;; This is in a separate file for x86-64 as MSVC doesn't have in-line
+;; assembly for x64.
+
+;; Random web links and other documentation about low-level
+;; implementation details for the C++/UNO bridge on x64 Windows kept
+;; here:
+
+;; Caolan's "Lazy Hackers Guide To Porting" is useful:
+;; http://wiki.services.openoffice.org/wiki/Lazy_Hackers_Guide_To_Porting
+
+;; As for details about the x64 Windows calling convention, register
+;; usage, stack usage, exception handling etc, the official
+;; documentation (?) on MSDN is a bit fragmented and split up into a
+;; needlessly large number of short pages. But still:
+;; http://msdn.microsoft.com/en-us/library/7kcdt6fy%28v=VS.90%29.aspx
+
+;; Also see Raymond Chen's blog post:
+;; http://blogs.msdn.com/b/oldnewthing/archive/2004/01/14/58579.aspx
+
+;; This one is actually more readable: "Improving Automated Analysis
+;; of Windows x64 Binaries": http://www.uninformed.org/?v=4&a=1
+
+;; This one has a mass of information about different architectures
+;; and compilers, and contains some details about the x64 Windows
+;; calling convention in particular that Microsoft doesn't mention
+;; above:
+;; http://www.agner.org/optimize/calling_conventions.pdf
+
+;; Random interesting discussion threads:
+;; http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/300bd6d3-9381-4d2d-8129-e48b392c05d8
+
+;; Ken Johnson's blog http://www.nynaeve.net/ has much interesting
+;; information, for instance:
+;; http://www.nynaeve.net/?p=11
+
+typelib_TypeClass_FLOAT equ 10
+typelib_TypeClass_DOUBLE equ 11
+
+extern cpp_vtable_call: proc
+
+.code
+
+privateSnippetExecutor proc frame
+
+ ;; Make stack frame. Re-align RSP at 16 bytes. We need just one
+ ;; qword of stack for our own purposes: Where cpp_vtable_call()
+ ;; will store the return value of the UNO callee. But we of course
+ ;; must also allocate space for the functions we call (i.e., just
+ ;; cpp_vtable_call()) to spill their register parameters.
+
+ sub rsp, 40
+ .allocstack (40)
+ .endprolog
+
+ ;; Call cpp_vtable_call() with 2 parameters:
+
+ ;; 1 (rcx): nOffsetAndIndex (already put there in code generated by codeSnippet)
+ ;; 2 (rdx): pointer to where to store return value, followed by our
+ ;; return address (uninteresting to cpp_vtable_call()), followed
+ ;; by our spilled register parameters, as stored above, followed
+ ;; by the rest of our parameters, if any.
+
+ lea rdx, 32[rsp]
+
+ call cpp_vtable_call
+
+ ;; cpp_vtable_call() returns the typelib_TypeClass type of the
+ ;; return value of the called UNO function
+
+ cmp rax, typelib_TypeClass_FLOAT
+ je Lfloat
+
+ cmp rax, typelib_TypeClass_DOUBLE
+ je Lfloat
+
+ mov rax, qword ptr 32[rsp]
+ jmp Lepilogue
+
+Lfloat:
+ movsd xmm0, qword ptr 32[rsp]
+
+Lepilogue:
+ add rsp, 40
+ ret
+privateSnippetExecutor endp
+
+end
+
+; vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
index a2310cbd8d7d..ecfd957947c4 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
@@ -44,192 +44,182 @@
using namespace ::com::sun::star::uno;
-namespace
-{
-
-//==================================================================================================
static inline typelib_TypeClass cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
- const typelib_TypeDescription * pMemberTypeDescr,
- typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
- sal_Int32 nParams, typelib_MethodParameter * pParams,
- void ** pCallStack,
- sal_Int64 * pRegisterReturn /* space for register return */ )
+ const typelib_TypeDescription * pMemberTD,
+ typelib_TypeDescriptionReference * pReturnTypeRef, // NULL indicates void return
+ sal_Int32 nParams,
+ typelib_MethodParameter * pParams,
+ void ** pStack )
{
- // pCallStack: ret, this, [complex return ptr], params
- char * pCppStack = (char *)(pCallStack +2);
+ // Return type
+ typelib_TypeDescription * pReturnTD = NULL;
+ if ( pReturnTypeRef )
+ TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
- // return
- typelib_TypeDescription * pReturnTypeDescr = 0;
- if (pReturnTypeRef)
- {
- TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- }
+ int nFirstRealParam = 3; // Index into pStack, past return
+ // value, return address and 'this'
+ // pointer.
- void * pUnoReturn = 0;
- void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
+ void * pUnoReturn = NULL;
+ void * pCppReturn = NULL; // Complex return ptr: if != NULL && != pUnoReturn, reconversion need
- if (pReturnTypeDescr)
+ if ( pReturnTD )
{
- if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
+ if ( bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
{
- pUnoReturn = pRegisterReturn; // direct way for simple types
+ pUnoReturn = pStack;
}
- else // complex return via ptr (pCppReturn)
+ else
{
- pCppReturn = *(void **)pCppStack;
- pCppStack += sizeof(void *);
+ pCppReturn = pStack[nFirstRealParam++];
- pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(
- pReturnTypeDescr )
- ? alloca( pReturnTypeDescr->nSize )
- : pCppReturn); // direct way
+ pUnoReturn = ( bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTD )
+ ? alloca( pReturnTD->nSize )
+ : pCppReturn ); // direct way
}
}
- // parameters
- void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
- void ** pCppArgs = pUnoArgs + nParams;
- // indexes of values this have to be converted (interface conversion cpp<=>uno)
- sal_Int64 * pTempIndexes = (sal_Int64 *)(pUnoArgs + (2 * nParams));
- // type descriptions for reconversions
- typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
+ void ** pCppIncomingParams = pStack + nFirstRealParam;
+
+ // Unlike this method for other archs, prefer clarity to
+ // micro-optimization, and allocate these array separately
+
+ // Parameters passed to the UNO function
+ void ** pUnoArgs = (void **)alloca( sizeof(void *) * nParams );
- sal_Int32 nTempIndexes = 0;
+ // Parameters received from C++
+ void ** pCppArgs = (void **)alloca( sizeof(void *) * nParams );
- for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
+ // Indexes of values this have to be converted (interface conversion C++<=>UNO)
+ int * pTempIndexes =
+ (int *)alloca( sizeof(int) * nParams );
+
+ // Type descriptions for reconversions
+ typelib_TypeDescription ** ppTempParamTD =
+ (typelib_TypeDescription **)alloca( sizeof(void *) * nParams );
+
+ int nTempIndexes = 0;
+
+ for ( int nPos = 0; nPos < nParams; ++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 ))
- // value
+ typelib_TypeDescription * pParamTD = NULL;
+ TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
+
+ if ( !rParam.bOut &&
+ bridges::cpp_uno::shared::isSimpleType( pParamTD ) )
{
- pCppArgs[nPos] = pCppStack;
- pUnoArgs[nPos] = pCppStack;
- switch (pParamTypeDescr->eTypeClass)
- {
- case typelib_TypeClass_HYPER:
- case typelib_TypeClass_UNSIGNED_HYPER:
- case typelib_TypeClass_DOUBLE:
- pCppStack += sizeof(sal_Int64); // extra qword
- break;
- default:
- break;
- }
- // no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ pCppArgs[nPos] = pUnoArgs[nPos] = pCppIncomingParams++;
+
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
else // ptr to complex value | ref
{
- pCppArgs[nPos] = *(void **)pCppStack;
+ void * pCppStack;
- if (! rParam.bIn) // is pure out
+ pCppArgs[nPos] = pCppStack = *pCppIncomingParams++;
+
+ if ( !rParam.bIn ) // Pure out
{
- // uno out is unconstructed mem!
- pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
+ // UNO out is unconstructed mem
+ pUnoArgs[nPos] = alloca( pParamTD->nSize );
pTempIndexes[nTempIndexes] = nPos;
- // will be released at reconversion
- ppTempParamTypeDescr[nTempIndexes++] = pParamTypeDescr;
+ // pParamTD will be released at reconversion
+ ppTempParamTD[nTempIndexes++] = pParamTD;
}
- // is in/inout
- else if (bridges::cpp_uno::shared::relatesToInterfaceType(
- pParamTypeDescr ))
+ //
+ else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTD ) )
{
::uno_copyAndConvertData(
- pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
- *(void **)pCppStack, pParamTypeDescr,
+ pUnoArgs[nPos] = alloca( pParamTD->nSize ),
+ pCppStack, pParamTD,
pThis->getBridge()->getCpp2Uno() );
- pTempIndexes[nTempIndexes] = nPos; // has to be reconverted
- // will be released at reconversion
- ppTempParamTypeDescr[nTempIndexes++] = pParamTypeDescr;
+ pTempIndexes[nTempIndexes] = nPos; // Has to be reconverted
+ // pParamTD will be released at reconversion
+ ppTempParamTD[nTempIndexes++] = pParamTD;
}
else // direct way
{
- pUnoArgs[nPos] = *(void **)pCppStack;
- // no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ pUnoArgs[nPos] = pCppStack;
+ // No longer needed
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
}
- pCppStack += sizeof(sal_Int64); // standard parameter length
}
// ExceptionHolder
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
- // invoke uno dispatch call
+ // invoke UNO dispatch call
(*pThis->getUnoI()->pDispatcher)(
- pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
+ pThis->getUnoI(), pMemberTD, pUnoReturn, pUnoArgs, &pUnoExc );
// in case an exception occurred...
- if (pUnoExc)
+ if ( pUnoExc )
{
- // destruct temporary in/inout params
- while (nTempIndexes--)
+ // Destruct temporary in/inout params
+ while ( nTempIndexes-- )
{
- sal_Int32 nIndex = pTempIndexes[nTempIndexes];
+ int nIndex = pTempIndexes[nTempIndexes];
- if (pParams[nIndex].bIn) // is in/inout => was constructed
+ if ( pParams[nIndex].bIn ) // Is in/inout => was constructed
{
- ::uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndexes], 0 );
+ ::uno_destructData( pUnoArgs[nIndex], ppTempParamTD[nTempIndexes], 0 );
}
- TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndexes] );
- }
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+ TYPELIB_DANGER_RELEASE( ppTempParamTD[nTempIndexes] );
}
+ if ( pReturnTD )
+ TYPELIB_DANGER_RELEASE( pReturnTD );
CPPU_CURRENT_NAMESPACE::mscx_raiseException(
- &aUnoExc, pThis->getBridge()->getUno2Cpp() );
- // has to destruct the any
- // is here for dummy
+ &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // Has to destruct the any
+
+ // Is here for dummy
return typelib_TypeClass_VOID;
}
- else // else no exception occurred...
+ else // Else, no exception occurred...
{
- // temporary params
+ // Temporary params
while (nTempIndexes--)
{
- sal_Int32 nIndex = pTempIndexes[nTempIndexes];
- typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndexes];
+ int nIndex = pTempIndexes[nTempIndexes];
+ typelib_TypeDescription * pParamTD = ppTempParamTD[nTempIndexes];
- if (pParams[nIndex].bOut) // inout/out
+ if ( pParams[nIndex].bOut ) // inout/out
{
- // convert and assign
+ // Convert and assign
::uno_destructData(
- pCppArgs[nIndex], pParamTypeDescr, cpp_release );
+ pCppArgs[nIndex], pParamTD, cpp_release );
::uno_copyAndConvertData(
- pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
+ pCppArgs[nIndex], pUnoArgs[nIndex], pParamTD,
pThis->getBridge()->getUno2Cpp() );
}
- // destroy temp uno param
- ::uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
+ // Destroy temp UNO param
+ ::uno_destructData( pUnoArgs[nIndex], pParamTD, 0 );
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
- // return
- if (pCppReturn) // has complex return
+ // Return
+ if ( pCppReturn ) // Has complex return
{
- if (pUnoReturn != pCppReturn) // needs reconversion
+ if ( pUnoReturn != pCppReturn ) // Needs reconversion
{
::uno_copyAndConvertData(
- pCppReturn, pUnoReturn, pReturnTypeDescr,
+ pCppReturn, pUnoReturn, pReturnTD,
pThis->getBridge()->getUno2Cpp() );
- // destroy temp uno return
- ::uno_destructData(
- pUnoReturn, pReturnTypeDescr, 0 );
+ // Destroy temp UNO return
+ ::uno_destructData( pUnoReturn, pReturnTD, 0 );
}
- // complex return ptr is set to eax
- *(void **)pRegisterReturn = pCppReturn;
+ // Complex return ptr is set to eax
+ pStack[0] = pCppReturn;
}
- if (pReturnTypeDescr)
+ if ( pReturnTD )
{
- typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+ typelib_TypeClass eRet = (typelib_TypeClass)pReturnTD->eTypeClass;
+ TYPELIB_DANGER_RELEASE( pReturnTD );
return eRet;
}
else
@@ -237,219 +227,241 @@ static inline typelib_TypeClass cpp2uno_call(
}
}
-//==================================================================================================
-typelib_TypeClass __cdecl cpp_mediate(
- void ** pCallStack, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
- sal_Int64 * pRegisterReturn /* space for register return */ )
+extern "C" typelib_TypeClass cpp_vtable_call(
+ sal_Int64 nOffsetAndIndex,
+ void ** pStack )
{
- // pCallStack: ret adr, this, [ret *], params
- void * pThis = static_cast< char * >(pCallStack[1]) - nVtableOffset;
- bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
- = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
- pThis);
-
- typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
- OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex,
- "### illegal vtable index!" );
- if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
- {
- throw RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("illegal vtable index!") ),
- (XInterface *)pThis );
- }
+ sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
+ sal_Int32 nVtableOffset = ((nOffsetAndIndex >> 32) & 0xFFFFFFFF);
+
+ // pStack points to space for return value allocated by
+ // privateSnippetExecutor() in call.asm, after which follows our
+ // return address (uninteresting), then the integer or
+ // floating-point register parameters (spilled by
+ // privateSnippetExecutor()) from the call to the trampoline,
+ // followed by stacked parameters. The first parameter is the
+ // 'this' pointer. If the callee returns a large value, the
+ // parameter after that is actually a pointer to where the callee
+ // should store its return value.
+
+ void * pThis = static_cast<char *>( pStack[2] ) - nVtableOffset;
+
+ bridges::cpp_uno::shared::CppInterfaceProxy * pCppI =
+ bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( pThis );
- // determine called method
- sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
- OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
+ typelib_InterfaceTypeDescription * pTD = pCppI->getTypeDescr();
- TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
+ OSL_ENSURE( nFunctionIndex < pTD->nMapFunctionIndexToMemberIndex, "### illegal vtable index!\n" );
+ if ( nFunctionIndex >= pTD->nMapFunctionIndexToMemberIndex )
+ throw RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Illegal vtable index!")),
+ reinterpret_cast<XInterface *>( pCppI ) );
+
+ // Determine called method
+ int nMemberPos = pTD->pMapFunctionIndexToMemberIndex[nFunctionIndex];
+ OSL_ENSURE( nMemberPos < pTD->nAllMembers, "### illegal member index!\n" );
+
+ TypeDescription aMemberDescr( pTD->ppAllMembers[nMemberPos] );
typelib_TypeClass eRet;
- switch (aMemberDescr.get()->eTypeClass)
- {
- case typelib_TypeClass_INTERFACE_ATTRIBUTE:
- {
- if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
- {
- // is GET method
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
- 0, 0, // no params
- pCallStack, pRegisterReturn );
- }
- else
- {
- // is SET method
- typelib_MethodParameter aParam;
- aParam.pTypeRef =
- ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
- aParam.bIn = sal_True;
- aParam.bOut = sal_False;
-
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- 0, // indicates void return
- 1, &aParam,
- pCallStack, pRegisterReturn );
- }
- break;
- }
- case typelib_TypeClass_INTERFACE_METHOD:
+ switch ( aMemberDescr.get()->eTypeClass )
{
- // is METHOD
- switch (nFunctionIndex)
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
- // standard XInterface vtable calls
- case 1: // acquire()
- pCppI->acquireProxy(); // non virtual call!
- eRet = typelib_TypeClass_VOID;
- break;
- case 2: // release()
- pCppI->releaseProxy(); // non virtual call!
- eRet = typelib_TypeClass_VOID;
+ typelib_TypeDescriptionReference *pAttrTypeRef =
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( aMemberDescr.get() )->pAttributeTypeRef;
+
+ if ( pTD->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex )
+ {
+ // is GET method
+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
+ 0, NULL, // No params
+ pStack );
+ }
+ else
+ {
+ // is SET method
+ typelib_MethodParameter aParam;
+ aParam.pTypeRef = pAttrTypeRef;
+ aParam.bIn = sal_True;
+ aParam.bOut = sal_False;
+
+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
+ NULL, // Indicates void return
+ 1, &aParam,
+ pStack );
+ }
break;
- case 0: // queryInterface() opt
+ }
+ case typelib_TypeClass_INTERFACE_METHOD:
{
- typelib_TypeDescription * pTD = 0;
- TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pCallStack[3] )->getTypeLibType() );
- if (pTD)
+ // is METHOD
+ switch ( nFunctionIndex )
{
- XInterface * pInterface = 0;
- (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
- pCppI->getBridge()->getCppEnv(),
- (void **)&pInterface, pCppI->getOid().pData,
- (typelib_InterfaceTypeDescription *)pTD );
-
- if (pInterface)
- {
- ::uno_any_construct(
- reinterpret_cast< uno_Any * >( pCallStack[2] ),
- &pInterface, pTD, cpp_acquire );
- pInterface->release();
- TYPELIB_DANGER_RELEASE( pTD );
- *(void **)pRegisterReturn = pCallStack[2];
- eRet = typelib_TypeClass_ANY;
+ case 1: // acquire()
+ pCppI->acquireProxy(); // Non virtual call!
+ eRet = typelib_TypeClass_VOID;
break;
+ case 2: // release()
+ pCppI->releaseProxy(); // non virtual call!
+ eRet = typelib_TypeClass_VOID;
+ break;
+ case 0: // queryInterface() opt
+ {
+ typelib_TypeDescription * pTD = NULL;
+
+ // the incoming C++ parameters are: The this
+ // pointer, the hidden return value pointer, and
+ // then the actual queryInterface() only
+ // parameter. Thus pStack[4]..
+
+ TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( pStack[4] )->getTypeLibType() );
+
+ if ( pTD )
+ {
+ XInterface * pInterface = NULL;
+ (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
+ ( pCppI->getBridge()->getCppEnv(),
+ (void **)&pInterface,
+ pCppI->getOid().pData,
+ reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
+
+ if ( pInterface )
+ {
+ // pStack[3] = hidden return value pointer
+ ::uno_any_construct( reinterpret_cast<uno_Any *>( pStack[3] ),
+ &pInterface, pTD, cpp_acquire );
+
+ pInterface->release();
+ TYPELIB_DANGER_RELEASE( pTD );
+
+ eRet = typelib_TypeClass_ANY;
+ break;
+ }
+ TYPELIB_DANGER_RELEASE( pTD );
+ }
+ } // Fall through!
+ default:
+ {
+ typelib_InterfaceMethodTypeDescription * pMethodTD =
+ reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( aMemberDescr.get() );
+
+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
+ pMethodTD->pReturnTypeRef,
+ pMethodTD->nParams,
+ pMethodTD->pParams,
+ pStack );
}
- TYPELIB_DANGER_RELEASE( pTD );
}
- } // else perform queryInterface()
+ break;
+ }
default:
- eRet = cpp2uno_call(
- pCppI, aMemberDescr.get(),
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
- ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
- pCallStack, pRegisterReturn );
+ {
+ throw RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No member description found!")),
+ reinterpret_cast<XInterface *>( pCppI ) );
+ // is here for dummy
+ eRet = typelib_TypeClass_VOID;
}
- break;
- }
- default:
- {
- throw RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("no member description found!") ),
- (XInterface *)pThis );
- // is here for dummy
- eRet = typelib_TypeClass_VOID;
- }
}
return eRet;
}
-extern void *cpp_vtable_call;
+int const codeSnippetSize = 48;
-//==================================================================================================
-int const codeSnippetSize = 28;
+extern "C" char privateSnippetExecutor;
// This function generates the code that acts as a proxy for the UNO function to be called.
// The generated code does the following:
-// - Save register parametrs.
+// - Spills register parameters on stack
+// - Loads functionIndex and vtableOffset into scratch registers
+// - Jumps to privateSnippetExecutor
unsigned char * codeSnippet(
- unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset)
+ unsigned char * code,
+ char param_kind[4],
+ sal_Int32 nFunctionIndex,
+ sal_Int32 nVtableOffset )
{
- unsigned char * p = code;
-
- // mov eax, functionIndex:
- *p++ = 0xB8;
- *reinterpret_cast< sal_Int32 * >(p) = functionIndex;
- p += sizeof (sal_Int32);
-
- // mov edx, vtableOffset:
- *p++ = 0xBA;
- *reinterpret_cast< sal_Int32 * >(p) = vtableOffset;
- p += sizeof (sal_Int32);
-
-#if 0
- sub esp, 8 // space for immediate return type
- push esp
- push edx // vtable offset
- push eax // function index
- mov eax, esp
- add eax, 20
- push eax // original stack ptr
-
- call cpp_mediate
- add esp, 16
-
- cmp eax, typelib_TypeClass_FLOAT
- je Lfloat
- cmp eax, typelib_TypeClass_DOUBLE
- je Ldouble
- cmp eax, typelib_TypeClass_HYPER
- je Lhyper
- cmp eax, typelib_TypeClass_UNSIGNED_HYPER
- je Lhyper
- // rest is eax
- pop eax
- add esp, 4
- ret
-Lhyper:
- pop eax
- pop edx
- ret
-Lfloat:
- fld dword ptr [esp]
- add esp, 8
- ret
-Ldouble:
- fld qword ptr [esp]
- add esp, 8
- ret
-
-#endif
-
-#if 0
- // jmp rel64 cpp_vtable_call:
- *p++ = 0xE9;
- *reinterpret_cast< sal_Int64 * >(p)
- = ((unsigned char *) cpp_vtable_call) - p - sizeof (sal_Int64);
- p += sizeof (sal_Int64);
-#endif
- OSL_ASSERT(p - code <= codeSnippetSize);
- return code + codeSnippetSize;
-}
+ sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_uInt64) nFunctionIndex );
+ unsigned char *p = code;
+
+ // Spill parameters
+ if ( param_kind[0] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+ {
+ // mov qword ptr 8[rsp], rcx
+ *p++ = 0x48; *p++ = 0x89; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x08;
+ }
+ else
+ {
+ // movsd qword ptr 8[rsp], xmm0
+ *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x44; *p++ = 0x24; *p++ = 0x08;
+ }
+ if ( param_kind[1] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+ {
+ // mov qword ptr 16[rsp], rdx
+ *p++ = 0x48; *p++ = 0x89; *p++ = 0x54; *p++ = 0x24; *p++ = 0x10;
+ }
+ else
+ {
+ // movsd qword ptr 16[rsp], xmm1
+ *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x10;
+ }
+ if ( param_kind[2] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+ {
+ // mov qword ptr 24[rsp], r8
+ *p++ = 0x4C; *p++ = 0x89; *p++ = 0x44; *p++ = 0x24; *p++ = 0x18;
+ }
+ else
+ {
+ // movsd qword ptr 24[rsp], xmm2
+ *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x54; *p++ = 0x24; *p++ = 0x18;
+ }
+ if ( param_kind[3] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+ {
+ // mov qword ptr 32[rsp], r9
+ *p++ = 0x4C;*p++ = 0x89; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x20;
+ }
+ else
+ {
+ // movsd qword ptr 32[rsp], xmm3
+ *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x5C; *p++ = 0x24; *p++ = 0x20;
+ }
+
+ // mov rcx, nOffsetAndIndex
+ *p++ = 0x48; *p++ = 0xB9;
+ *((sal_uInt64 *)p) = nOffsetAndIndex; p += 8;
+
+ // mov r11, privateSnippetExecutor
+ *p++ = 0x49; *p++ = 0xBB;
+ *((void **)p) = &privateSnippetExecutor; p += 8;
+
+ // jmp r11
+ *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
+
+ OSL_ASSERT( p < code + codeSnippetSize );
+ return code + codeSnippetSize;
}
struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
bridges::cpp_uno::shared::VtableFactory::Slot *
-bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
+bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(
+ void * block )
{
return static_cast< Slot * >(block) + 1;
}
sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
- sal_Int32 slotCount)
+ sal_Int32 slotCount )
{
return (slotCount + 1) * sizeof (Slot) + slotCount * codeSnippetSize;
}
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
- void * block, sal_Int32 slotCount)
+ void * block,
+ sal_Int32 slotCount )
{
struct Rtti {
sal_Int32 n0, n1, n2;
@@ -468,107 +480,103 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock(
return slots + slotCount;
}
-#if 0
-
-#else
-
-static void whatthefuck(sal_Int64 i, ...)
-{
- MessageBoxA (NULL, "Shit!", "whatthefuck in cpp2uno.cxx", MB_OK);
-}
-
-#endif
-
unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
- Slot ** slots, unsigned char * code,
- typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
- sal_Int32 functionCount, sal_Int32 vtableOffset)
+ Slot ** slots,
+ unsigned char * code,
+ typelib_InterfaceTypeDescription const * type,
+ sal_Int32 nFunctionOffset,
+ sal_Int32 functionCount,
+ sal_Int32 nVtableOffset )
{
(*slots) -= functionCount;
Slot * s = *slots;
- for (int i = 0; i < functionCount; ++i) {
- typelib_TypeDescription * pTD = 0;
+ for (int member = 0; member < type->nMembers; ++member) {
+ typelib_TypeDescription * pTD = NULL;
- TYPELIB_DANGER_GET( &pTD, type->ppMembers[ i ] );
+ TYPELIB_DANGER_GET( &pTD, type->ppMembers[ member ] );
OSL_ASSERT( pTD );
- CPPU_CURRENT_NAMESPACE::RegParamKind param_kind[4];
+ char param_kind[4];
int nr = 0;
+ for (int i = 0; i < 4; ++i)
+ param_kind[i] = CPPU_CURRENT_NAMESPACE::REGPARAM_INT;
+
+ // 'this'
+ ++nr;
+
if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE )
{
- typelib_InterfaceAttributeTypeDescription *pAttrTD =
+ typelib_InterfaceAttributeTypeDescription * pIfaceAttrTD =
reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( pTD );
- // get method
-#if 0
- (s++)->fn = code;
- code = codeSnippet(code, functionOffset++, vtableOffset);
-#else
- (s++)->fn = whatthefuck;
-#endif
+ // Getter
- if ( ! pAttrTD->bReadOnly )
+ (s++)->fn = code;
+ code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
+ if ( ! pIfaceAttrTD->bReadOnly )
{
- // set method
-#if 0
+ typelib_TypeDescription * pAttrTD = NULL;
+ TYPELIB_DANGER_GET( &pAttrTD, pIfaceAttrTD->pAttributeTypeRef );
+ OSL_ASSERT( pAttrTD );
+
+ // Setter
+ if ( pAttrTD->eTypeClass == typelib_TypeClass_FLOAT ||
+ pAttrTD->eTypeClass == typelib_TypeClass_DOUBLE )
+ param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_FLT;
+
+ TYPELIB_DANGER_RELEASE( pAttrTD );
+
(s++)->fn = code;
- code = codeSnippet(code, functionOffset++, vtableOffset);
-#else
- (s++)->fn = whatthefuck;
-#endif
+ code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
}
}
else if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_METHOD )
{
- typelib_InterfaceMethodTypeDescription *pMethodTD =
+ typelib_InterfaceMethodTypeDescription * pMethodTD =
reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( pTD );
- typelib_TypeDescription *pReturnTD = 0;
+ typelib_TypeDescription * pReturnTD = NULL;
TYPELIB_DANGER_GET( &pReturnTD, pMethodTD->pReturnTypeRef );
OSL_ASSERT( pReturnTD );
- if ( pReturnTD->nSize > 8 ) {
- // Hidden return value
- param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_INT;
+ if ( !bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
+ {
+ // Return value
+ ++nr;
}
- TYPELIB_DANGER_RELEASE( pReturnTD );
-
- // 'this'
- param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_INT;
- for (int j = 0; nr < 4 && j < pMethodTD->nParams; ++j)
+ for (int param = 0; nr < 4 && param < pMethodTD->nParams; ++param, ++nr)
{
- typelib_TypeDescription *pParamTD = 0;
+ typelib_TypeDescription * pParamTD = NULL;
- TYPELIB_DANGER_GET( &pParamTD, pMethodTD->pParams[j].pTypeRef );
+ TYPELIB_DANGER_GET( &pParamTD, pMethodTD->pParams[param].pTypeRef );
OSL_ASSERT( pParamTD );
if ( pParamTD->eTypeClass == typelib_TypeClass_FLOAT ||
pParamTD->eTypeClass == typelib_TypeClass_DOUBLE )
- param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_FLT;
- else
- param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_INT;
+ param_kind[nr] = CPPU_CURRENT_NAMESPACE::REGPARAM_FLT;
TYPELIB_DANGER_RELEASE( pParamTD );
-
-#if 0
- (s++)->fn = code;
- code = codeSnippet(code, functionOffset++, vtableOffset);
-#else
- (s++)->fn = whatthefuck;
-#endif
}
+ (s++)->fn = code;
+ code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
+
+ TYPELIB_DANGER_RELEASE( pReturnTD );
}
else
OSL_ASSERT( false );
+
+ TYPELIB_DANGER_RELEASE( pTD );
}
return code;
}
void bridges::cpp_uno::shared::VtableFactory::flushCode(
- unsigned char const *, unsigned char const *)
-{}
+ unsigned char const *,
+ unsigned char const * )
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
index bb5c5b1922b8..2157568ad915 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
@@ -26,11 +26,227 @@
*
************************************************************************/
+// Interesting info can be found in:
+
+// MSDN, obviously
+
+// http://www.osronline.com/article.cfm?article=469
+
+// ONTL, "Open NT Native Template Library", a C++ STL-like library
+// that can be used even when writing Windows drivers. This is some
+// quite badass code. The author has done impressive heavy spelunking
+// of MSVCR structures. http://code.google.com/p/ontl/
+
+// Geoff Chappell's pages:
+// http://members.ozemail.com.au/~geoffch/samples/programming/msvc/language/index.html
+
+// The below is from ONTL's ntl/nt/exception.hxx, cleaned up to keep just the _M_X64 parts:
+
+#if 0
+
+/* This information until the corresponding '#endif // 0' is covered
+ * by ONTL's license, which is said to be the "zlib/libgng license"
+ * below, which as far as I see is permissive enough to allow this
+ * information to be included here in this source file. Note that no
+ * actual code from ONTL below gets compiled into the object file.
+ */
+
+/*
+ * Copyright (c) 2011 <copyright holders> (The ONTL main
+ * developer(s) don't tell their real name(s) on the ONTL site.)
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+typedef uint32_t rva_t;
+
+///\note the calling convention should not matter since this has no arguments
+typedef void generic_function_t();
+
+struct ptrtomember // _PMD
+{
+ typedef __w64 int32_t mdiff_t;
+ mdiff_t member_offset;
+ mdiff_t vbtable_offset; // -1 if not a virtual base
+ mdiff_t vdisp_offset; // offset to the displacement value inside the vbtable
+
+ template<typename T>
+ T * operator()(T * const thisptr) const
+ {
+ uintptr_t tp = reinterpret_cast<uintptr_t>(thisptr);
+ uintptr_t ptr = tp + member_offset;
+ if ( vbtable_offset != -1 ) // !(vbtable_offset < 0)
+ {
+ ptr += *reinterpret_cast<mdiff_t*>( static_cast<intptr_t>(vdisp_offset + *reinterpret_cast<mdiff_t*>(tp + vbtable_offset)) )
+ + vbtable_offset;
+ }
+ return reinterpret_cast<T*>(ptr);
+ }
+};
+
+struct eobject
+{
+ typedef void (* dtor_ptr )(eobject*);
+ typedef void (* ctor_ptr )(eobject*, eobject*);
+ typedef void (* ctor_ptr2)(eobject*, eobject*, int);
+};
+
+struct catchabletype
+{
+ /** is simple type */
+ uint32_t memmoveable : 1;
+ /** catchable as reference only */
+ uint32_t refonly : 1;
+ /** class with virtual base */
+ uint32_t hasvirtbase : 1;
+ /** offset to the type descriptor */
+ rva_t typeinfo;
+
+ /** catch type instance location within a thrown object */
+ ptrtomember thiscast;
+ /** size of the simple type or offset into buffer of \c this pointer for catch object */
+ uint32_t object_size;
+
+ union
+ {
+ rva_t copyctor;
+ rva_t copyctor2;
+ };
+};
+
+#pragma pack(push, 4)
+struct catchabletypearray
+{
+ uint32_t size;
+ rva_t type[1];
+};
+#pragma pack(pop)
+
+#pragma pack(push, 4)
+struct throwinfo
+{
+ typedef exception_disposition __cdecl forwardcompathandler_t(...);
+
+ /* 0x00 */ uint32_t econst : 1;
+ /* 0x00 */ uint32_t evolatile : 1;
+ /* 0x00 */ uint32_t : 1;
+ /* 0x00 */ uint32_t e8 : 1;
+ /* 0x04 */ rva_t exception_dtor;
+ /* 0x08 */ rva_t forwardcompathandler;
+ /* 0x0C */ rva_t catchabletypearray; ///< types able to catch the exception.
+};
+#pragma pack(pop)
+
+/// This type represents the catch clause
+struct ehandler
+{
+ // union { uint32_t adjectives; void * ptr; };
+ uint32_t isconst : 1;
+ uint32_t isvolatile : 1;
+ uint32_t isunaligned : 1;// guess it is not used on x86
+ uint32_t isreference : 1;
+
+ uint32_t :27;
+ uint32_t ishz : 1;
+
+ /** offset to the type descriptor of this catch object */
+ /*0x04*/ rva_t typeinfo; // dispType
+ /*0x08*/ int eobject_bpoffset; // dispCatchObj
+ /** offset to the catch clause funclet */
+ /*0x0C*/ rva_t handler; // dispOfHandler
+ /*0x10*/ uint32_t frame; // dispFrame
+}
+
+// ___BuildCatchObject
+/// 15.3/16 When the exception-declaration specifies a class type, a copy
+/// constructor is used to initialize either the object declared
+/// in the exception-declaration or,
+/// if the exception-declaration does not specify a name,
+/// a temporary object of that type.
+///\note This is the question may we optimize out the last case.
+///\warning If the copy constructor throws an exception, std::unexpected would be called
+void
+ constructcatchobject(
+ cxxregistration * cxxreg,
+ const ehandler * const catchblock,
+ catchabletype * const convertable,
+ const dispatcher_context* const dispatch
+ )
+ const
+{
+ _EH_TRACE_ENTER();
+ // build helper
+ __try {
+ struct typeinfo_t { void* vtbl; void* spare; char name[1]; };
+ enum catchable_info { cidefault, cicomplex, civirtual } cinfo = cidefault;
+
+ const typeinfo_t* ti = catchblock->typeinfo ? dispatch->va<typeinfo_t*>(catchblock->typeinfo) : NULL;
+ if(ti && *ti->name && (catchblock->eobject_bpoffset || catchblock->ishz)){
+ eobject** objplace = catchblock->ishz
+ ? reinterpret_cast<eobject**>(cxxreg)
+ : reinterpret_cast<eobject**>(catchblock->eobject_bpoffset + cxxreg->fp.FramePointers);
+ if(catchblock->isreference){
+ // just ref/pointer
+ *objplace = adjust_pointer(get_object(), convertable);
+ }else if(convertable->memmoveable){
+ // POD
+ std::memcpy(objplace, get_object(), convertable->object_size);
+ if(convertable->object_size == sizeof(void*) && *objplace)
+ *objplace = adjust_pointer((void*)*objplace, convertable);
+ }else{
+ // if copy ctor exists, call it; binary copy otherwise
+ if(convertable->copyctor){
+ cinfo = convertable->hasvirtbase ? civirtual : cicomplex;
+ }else{
+ std::memcpy(objplace, (const void*)adjust_pointer(get_object(), convertable), convertable->object_size);
+ }
+ }
+ }
+ // end of build helper
+ if(cinfo != cidefault){
+ eobject* objthis = catchblock->ishz
+ ? reinterpret_cast<eobject*>(cxxreg)
+ : reinterpret_cast<eobject*>(catchblock->eobject_bpoffset + cxxreg->fp.FramePointers);
+ void* copyctor = thrown_va(convertable->copyctor);
+ eobject* copyarg = adjust_pointer(get_object(), convertable);
+ if(cinfo == cicomplex)
+ (eobject::ctor_ptr (copyctor))(objthis, copyarg);
+ else
+ (eobject::ctor_ptr2(copyctor))(objthis, copyarg, 1);
+ }
+ }
+ __except(cxxregistration::unwindfilter(static_cast<nt::ntstatus>(_exception_code())))
+ {
+ nt::exception::inconsistency();
+ }
+ _EH_TRACE_LEAVE();
+}
+
+#endif // 0
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
#pragma warning( disable : 4237 )
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <sal/config.h>
#include <malloc.h>
#include <new.h>
@@ -45,7 +261,6 @@
#include "mscx.hxx"
-
#pragma pack(push, 8)
using namespace ::com::sun::star::uno;
@@ -56,8 +271,9 @@ using namespace ::rtl;
namespace CPPU_CURRENT_NAMESPACE
{
-//==================================================================================================
-static inline OUString toUNOname( OUString const & rRTTIname ) throw ()
+static inline OUString toUNOname(
+ OUString const & rRTTIname )
+ throw ()
{
OUStringBuffer aRet( 64 );
OUString aStr( rRTTIname.copy( 4, rRTTIname.getLength()-4-2 ) ); // filter .?AUzzz@yyy@xxx@@
@@ -74,8 +290,10 @@ static inline OUString toUNOname( OUString const & rRTTIname ) throw ()
}
return aRet.makeStringAndClear();
}
-//==================================================================================================
-static inline OUString toRTTIname( OUString const & rUNOname ) throw ()
+
+static inline OUString toRTTIname(
+ OUString const & rUNOname )
+ throw ()
{
OUStringBuffer aRet( 64 );
aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM(".?AV") ); // class ".?AV"; struct ".?AU"
@@ -91,15 +309,10 @@ static inline OUString toRTTIname( OUString const & rUNOname ) throw ()
return aRet.makeStringAndClear();
}
+//RTTI simulation
-//##################################################################################################
-//#### RTTI simulation #############################################################################
-//##################################################################################################
-
-
-typedef hash_map< OUString, void *, OUStringHash, equal_to< OUString > > t_string2PtrMap;
+typedef boost::unordered_map< OUString, void *, OUStringHash, equal_to< OUString > > t_string2PtrMap;
-//==================================================================================================
class RTTInfos
{
Mutex _aMutex;
@@ -113,7 +326,6 @@ public:
~RTTInfos();
};
-//==================================================================================================
class __type_info
{
friend type_info * RTTInfos::getRTTI( OUString const & ) throw ();
@@ -131,11 +343,11 @@ private:
void * _m_data;
char _m_d_name[1];
};
-//__________________________________________________________________________________________________
+
__type_info::~__type_info() throw ()
{
}
-//__________________________________________________________________________________________________
+
type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw ()
{
// a must be
@@ -164,11 +376,11 @@ type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw ()
return (type_info *)iFind->second;
}
}
-//__________________________________________________________________________________________________
+
RTTInfos::RTTInfos() throw ()
{
}
-//__________________________________________________________________________________________________
+
RTTInfos::~RTTInfos() throw ()
{
#if OSL_DEBUG_LEVEL > 1
@@ -185,208 +397,206 @@ RTTInfos::~RTTInfos() throw ()
}
}
-
-//##################################################################################################
-//#### Exception raising ###########################################################################
-//##################################################################################################
-
-
-//==================================================================================================
-struct ObjectFunction
-{
- char somecode[12];
- typelib_TypeDescription * _pTypeDescr; // type of object
-
- inline static void * operator new ( size_t nSize );
- inline static void operator delete ( void * pMem );
-
- ObjectFunction( typelib_TypeDescription * pTypeDescr, void * fpFunc ) throw ();
- ~ObjectFunction() throw ();
-};
-
-inline void * ObjectFunction::operator new ( size_t nSize )
-{
- void * pMem = rtl_allocateMemory( nSize );
- if (pMem != 0)
- {
- DWORD old_protect;
-#if OSL_DEBUG_LEVEL > 0
- BOOL success =
-#endif
- VirtualProtect( pMem, nSize, PAGE_EXECUTE_READWRITE, &old_protect );
- OSL_ENSURE( success, "VirtualProtect() failed!" );
- }
- return pMem;
-}
-
-inline void ObjectFunction::operator delete ( void * pMem )
-{
- rtl_freeMemory( pMem );
-}
-
-//__________________________________________________________________________________________________
-ObjectFunction::ObjectFunction( typelib_TypeDescription * pTypeDescr, void * fpFunc ) throw ()
- : _pTypeDescr( pTypeDescr )
-{
- ::typelib_typedescription_acquire( _pTypeDescr );
-
- unsigned char * pCode = (unsigned char *)somecode;
- // a must be!
- OSL_ENSURE( (void *)this == (void *)pCode, "### unexpected!" );
-
- // push ObjectFunction this
- *pCode++ = 0x68;
- *(void **)pCode = this;
- pCode += sizeof(void *);
- // jmp rel64 fpFunc
- *pCode++ = 0xe9;
- *(sal_Int64 *)pCode = ((unsigned char *)fpFunc) - pCode - sizeof(sal_Int64);
-}
-//__________________________________________________________________________________________________
-ObjectFunction::~ObjectFunction() throw ()
-{
- ::typelib_typedescription_release( _pTypeDescr );
-}
-
-//==================================================================================================
-void * __cdecl __copyConstruct( void * pExcThis, void * pSource, ObjectFunction * pThis )
- throw ()
+void * __cdecl copyConstruct(
+ void * pExcThis,
+ void * pSource,
+ typelib_TypeDescription * pTD ) throw ()
{
- ::uno_copyData( pExcThis, pSource, pThis->_pTypeDescr, cpp_acquire );
+ ::uno_copyData( pExcThis, pSource, pTD, cpp_acquire );
return pExcThis;
}
-//==================================================================================================
-void * __cdecl __destruct( void * pExcThis, ObjectFunction * pThis )
- throw ()
+
+void * __cdecl destruct(
+ void * pExcThis,
+ typelib_TypeDescription * pTD ) throw ()
{
- ::uno_destructData( pExcThis, pThis->_pTypeDescr, cpp_release );
+ ::uno_destructData( pExcThis, pTD, cpp_release );
return pExcThis;
}
+const int codeSnippetSize = 40;
-#if 0
+void GenerateConstructorTrampoline(
+ unsigned char * code,
+ typelib_TypeDescription * pTD ) throw ()
+{
+ unsigned char *p = code;
-// These are machine code snippets in asmbits.asm
+ // mov r8, pTD
+ *p++ = 0x49; *p++ = 0xB8;
+ *((void **)p) = pTD; p += 8;
-extern void *copyConstruct;
-extern void *destruct;
+ // mov r11, copyConstruct
+ *p++ = 0x49; *p++ = 0xBB;
+ *((void **)p) = &copyConstruct; p += 8;
-#else
+ // jmp r11
+ *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
-static void whatthefuck_copyctor(sal_Int64 i, ...)
-{
- MessageBoxA (NULL, "Shit!", "whatthefuck_copyctor in except.cxx", MB_OK);
+ OSL_ASSERT( p < code + codeSnippetSize );
}
-static void whatthefuck_dtor(sal_Int64 i, ...)
+void GenerateDestructorTrampoline(
+ unsigned char * code,
+ typelib_TypeDescription * pTD ) throw ()
{
- MessageBoxA (NULL, "Shit!", "whatthefuck_dtor in except.cxx", MB_OK);
+ unsigned char *p = code;
+
+ // mov rdx, pTD
+ *p++ = 0x48; *p++ = 0xBA;
+ *((void **)p) = pTD; p += 8;
+
+ // mov r11, destruct
+ *p++ = 0x49; *p++ = 0xBB;
+ *((void **)p) = &destruct; p += 8;
+
+ // jmp r11
+ *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
+
+ OSL_ASSERT( p < code + codeSnippetSize );
}
-#endif
+// This looks like it is the struct catchabletype above
-//==================================================================================================
struct ExceptionType
{
- sal_Int32 _n0;
- type_info * _pTypeInfo;
- sal_Int32 _n1, _n2, _n3, _n4;
- ObjectFunction * _pCopyCtor;
- sal_Int32 _n5;
-
- inline ExceptionType( typelib_TypeDescription * pTypeDescr ) throw ()
+ sal_Int32 _n0; // flags
+ sal_uInt32 _pTypeInfo; // typeinfo
+ sal_Int32 _n1, _n2, _n3; // thiscast
+ sal_Int32 _n4; // object_size
+ sal_uInt32 _pCopyCtor; // copyctor
+
+ inline ExceptionType(
+ sal_uChar * pCode,
+ sal_uInt64 pCodeBase,
+ typelib_TypeDescription * pTD ) throw ()
: _n0( 0 )
, _n1( 0 )
, _n2( -1 )
, _n3( 0 )
- , _n4( pTypeDescr->nSize )
-#if 0
- , _pCopyCtor( new ObjectFunction( pTypeDescr, copyConstruct ) )
-#else
- , _pCopyCtor( (ObjectFunction*) whatthefuck_copyctor )
-#endif
- , _n5( 0 )
- { _pTypeInfo = mscx_getRTTI( pTypeDescr->pTypeName ); }
+ , _n4( pTD->nSize )
+ {
+ // As _n0 is always initialized to zero, that means the
+ // hasvirtbase flag (see the ONTL catchabletype struct) is
+ // off, and thus the copyctor is of the ctor_ptr kind.
+ _pTypeInfo = (sal_uInt32) ((sal_uInt64) mscx_getRTTI( pTD->pTypeName ) - pCodeBase);
+ GenerateConstructorTrampoline( pCode, pTD );
+ _pCopyCtor = (sal_uInt32) ((sal_uInt64) pCode - pCodeBase);
+ }
inline ~ExceptionType() throw ()
- { delete _pCopyCtor; }
+ {
+ }
+};
+
+struct RaiseInfo;
+
+class ExceptionInfos
+{
+ Mutex _aMutex;
+ t_string2PtrMap _allRaiseInfos;
+
+public:
+ static RaiseInfo * getRaiseInfo( typelib_TypeDescription * pTD ) throw ();
+
+ static DWORD allocationGranularity;
+
+ ExceptionInfos() throw ();
+ ~ExceptionInfos() throw ();
};
-//==================================================================================================
+
+DWORD ExceptionInfos::allocationGranularity = 0;
+
+// This corresponds to the struct throwinfo described above.
+
struct RaiseInfo
{
sal_Int32 _n0;
- ObjectFunction * _pDtor;
+ sal_uInt32 _pDtor;
sal_Int32 _n2;
- void * _types;
- sal_Int32 _n3, _n4;
+ sal_uInt32 _types;
+
+ // Additional fields
+ typelib_TypeDescription * _pTD;
+ sal_uChar * _code;
+ sal_uInt64 _codeBase;
+
+ RaiseInfo( typelib_TypeDescription * pTD ) throw ();
- RaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ();
~RaiseInfo() throw ();
};
-//__________________________________________________________________________________________________
-RaiseInfo::RaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ()
+
+RaiseInfo::RaiseInfo( typelib_TypeDescription * pTD )throw ()
: _n0( 0 )
-#if 0
- , _pDtor( new ObjectFunction( pTypeDescr, destruct ) )
-#else
- , _pDtor( (ObjectFunction*) whatthefuck_dtor )
-#endif
, _n2( 0 )
- , _n3( 0 )
- , _n4( 0 )
+ , _pTD( pTD )
{
- typelib_CompoundTypeDescription * pCompTypeDescr;
+ typelib_CompoundTypeDescription * pCompTD;
+
+ // Count how many trampolines we need
+ int codeSize = codeSnippetSize;
- // info count
- sal_Int32 nLen = 0;
- for ( pCompTypeDescr = (typelib_CompoundTypeDescription*)pTypeDescr;
- pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
+ // Info count
+ int nLen = 0;
+ for ( pCompTD = (typelib_CompoundTypeDescription*)pTD;
+ pCompTD; pCompTD = pCompTD->pBaseTypeDescription )
{
++nLen;
+ codeSize += codeSnippetSize;
}
- // info count accompanied by type info ptrs: type, base type, base base type, ...
- _types = ::rtl_allocateMemory( sizeof(sal_Int64) + (sizeof(ExceptionType *) * nLen) );
- *(sal_Int64 *)_types = nLen;
+ sal_uChar * pCode = _code = (sal_uChar *)::rtl_allocateMemory( codeSize );
+
+ _codeBase = (sal_uInt64)pCode & ~(ExceptionInfos::allocationGranularity-1);
+
+ DWORD old_protect;
+#if OSL_DEBUG_LEVEL > 0
+ BOOL success =
+#endif
+ VirtualProtect( pCode, codeSize, PAGE_EXECUTE_READWRITE, &old_protect );
+ OSL_ENSURE( success, "VirtualProtect() failed!" );
+
+ ::typelib_typedescription_acquire( pTD );
+
+ GenerateDestructorTrampoline( pCode, pTD );
+ _pDtor = (sal_Int32)((sal_uInt64)pCode - _codeBase);
+ pCode += codeSnippetSize;
+
+ // Info count accompanied by type info ptrs: type, base type, base base type, ...
+ _types = (sal_Int32)((sal_uInt64)::rtl_allocateMemory( 4 + 4* nLen) - _codeBase);
+ *(sal_Int32 *)_types = nLen;
- ExceptionType ** ppTypes = (ExceptionType **)((sal_Int64 *)_types + 1);
+ ExceptionType ** ppTypes = (ExceptionType **)((sal_Int32 *)_types + 1);
- sal_Int32 nPos = 0;
- for ( pCompTypeDescr = (typelib_CompoundTypeDescription*)pTypeDescr;
- pCompTypeDescr; pCompTypeDescr = pCompTypeDescr->pBaseTypeDescription )
+ int nPos = 0;
+ for ( pCompTD = (typelib_CompoundTypeDescription*)pTD;
+ pCompTD; pCompTD = pCompTD->pBaseTypeDescription )
{
- ppTypes[nPos++] = new ExceptionType( (typelib_TypeDescription *)pCompTypeDescr );
+ ppTypes[nPos++] =
+ new ExceptionType( pCode, _codeBase,
+ (typelib_TypeDescription *)pCompTD );
+ pCode += codeSnippetSize;
}
}
-//__________________________________________________________________________________________________
+
RaiseInfo::~RaiseInfo() throw ()
{
- ExceptionType ** ppTypes = (ExceptionType **)((sal_Int64 *)_types + 1);
- for ( sal_Int32 nTypes = *(sal_Int64 *)_types; nTypes--; )
+ sal_uInt32 * pTypes =
+ (sal_uInt32 *)(_codeBase + _types) + 1;
+
+ for ( int nTypes = *(sal_uInt32 *)(_codeBase + _types); nTypes--; )
{
- delete ppTypes[nTypes];
+ delete (ExceptionType *) (_codeBase + pTypes[nTypes]);
}
- ::rtl_freeMemory( _types );
+ ::rtl_freeMemory( (void*)(_codeBase +_types) );
+ ::rtl_freeMemory( _code );
- delete _pDtor;
+ ::typelib_typedescription_release( _pTD );
}
-//==================================================================================================
-class ExceptionInfos
-{
- Mutex _aMutex;
- t_string2PtrMap _allRaiseInfos;
-
-public:
- static void * getRaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ();
-
- ExceptionInfos() throw ();
- ~ExceptionInfos() throw ();
-};
-//__________________________________________________________________________________________________
ExceptionInfos::ExceptionInfos() throw ()
{
}
-//__________________________________________________________________________________________________
+
ExceptionInfos::~ExceptionInfos() throw ()
{
#if OSL_DEBUG_LEVEL > 1
@@ -400,8 +610,8 @@ ExceptionInfos::~ExceptionInfos() throw ()
delete (RaiseInfo *)iPos->second;
}
}
-//__________________________________________________________________________________________________
-void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ()
+
+RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw ()
{
static ExceptionInfos * s_pInfos = 0;
if (! s_pInfos)
@@ -409,6 +619,10 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro
MutexGuard aGuard( Mutex::getGlobalMutex() );
if (! s_pInfos)
{
+ SYSTEM_INFO systemInfo;
+ GetSystemInfo( &systemInfo );
+ allocationGranularity = systemInfo.dwAllocationGranularity;
+
#ifdef LEAK_STATIC_DATA
s_pInfos = new ExceptionInfos();
#else
@@ -418,41 +632,36 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro
}
}
- OSL_ASSERT( pTypeDescr &&
- (pTypeDescr->eTypeClass == typelib_TypeClass_STRUCT ||
- pTypeDescr->eTypeClass == typelib_TypeClass_EXCEPTION) );
+ OSL_ASSERT( pTD &&
+ (pTD->eTypeClass == typelib_TypeClass_STRUCT ||
+ pTD->eTypeClass == typelib_TypeClass_EXCEPTION) );
- void * pRaiseInfo;
+ RaiseInfo * pRaiseInfo;
- OUString const & rTypeName = *reinterpret_cast< OUString * >( &pTypeDescr->pTypeName );
+ OUString const & rTypeName = *reinterpret_cast< OUString * >( &pTD->pTypeName );
MutexGuard aGuard( s_pInfos->_aMutex );
t_string2PtrMap::const_iterator const iFind(
s_pInfos->_allRaiseInfos.find( rTypeName ) );
if (iFind == s_pInfos->_allRaiseInfos.end())
{
- pRaiseInfo = new RaiseInfo( pTypeDescr );
- // put into map
+ pRaiseInfo = new RaiseInfo( pTD );
+
+ // Put into map
pair< t_string2PtrMap::iterator, bool > insertion(
- s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, pRaiseInfo ) ) );
+ s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, (void *)pRaiseInfo ) ) );
OSL_ENSURE( insertion.second, "### raise info insertion failed?!" );
}
else
{
- // reuse existing info
- pRaiseInfo = iFind->second;
+ // Reuse existing info
+ pRaiseInfo = (RaiseInfo *)iFind->second;
}
return pRaiseInfo;
}
-
-//##################################################################################################
-//#### exported ####################################################################################
-//##################################################################################################
-
-
-//##################################################################################################
-type_info * mscx_getRTTI( OUString const & rUNOname )
+type_info * mscx_getRTTI(
+ OUString const & rUNOname )
{
static RTTInfos * s_pRTTIs = 0;
if (! s_pRTTIs)
@@ -471,41 +680,46 @@ type_info * mscx_getRTTI( OUString const & rUNOname )
return s_pRTTIs->getRTTI( rUNOname );
}
-//##################################################################################################
-void mscx_raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
+void mscx_raiseException(
+ uno_Any * pUnoExc,
+ uno_Mapping * pUno2Cpp )
{
// no ctor/dtor in here: this leads to dtors called twice upon RaiseException()!
- // thus this obj file will be compiled without opt, so no inling of
+ // thus this obj file will be compiled without opt, so no inlining of
// ExceptionInfos::getRaiseInfo()
// construct cpp exception object
- typelib_TypeDescription * pTypeDescr = 0;
- TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
+ typelib_TypeDescription * pTD = NULL;
+ TYPELIB_DANGER_GET( &pTD, pUnoExc->pType );
- void * pCppExc = alloca( pTypeDescr->nSize );
- ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
+ void * pCppExc = alloca( pTD->nSize );
+ ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTD, pUno2Cpp );
- ULONG_PTR arFilterArgs[3];
+ ULONG_PTR arFilterArgs[4];
arFilterArgs[0] = MSVC_magic_number;
arFilterArgs[1] = (ULONG_PTR)pCppExc;
- arFilterArgs[2] = (ULONG_PTR)ExceptionInfos::getRaiseInfo( pTypeDescr );
+ arFilterArgs[2] = (ULONG_PTR)ExceptionInfos::getRaiseInfo( pTD );
+ arFilterArgs[3] = ((RaiseInfo *)arFilterArgs[2])->_codeBase;
- // destruct uno exception
+ // Destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
- TYPELIB_DANGER_RELEASE( pTypeDescr );
+ TYPELIB_DANGER_RELEASE( pTD );
// last point to release anything not affected by stack unwinding
RaiseException( MSVC_ExceptionCode, EXCEPTION_NONCONTINUABLE, 3, arFilterArgs );
}
-//##############################################################################
int mscx_filterCppException(
- EXCEPTION_POINTERS * pPointers, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
+ EXCEPTION_POINTERS * pPointers,
+ uno_Any * pUnoExc,
+ uno_Mapping * pCpp2Uno )
{
if (pPointers == 0)
return EXCEPTION_CONTINUE_SEARCH;
+
EXCEPTION_RECORD * pRecord = pPointers->ExceptionRecord;
- // handle only C++ exceptions:
+
+ // Handle only C++ exceptions:
if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;
@@ -514,13 +728,13 @@ int mscx_filterCppException(
if (rethrow && pRecord == pPointers->ExceptionRecord)
{
- // hack to get msvcrt internal _curexception field:
+ // Hack to get msvcrt internal _curexception field:
pRecord = *reinterpret_cast< EXCEPTION_RECORD ** >(
reinterpret_cast< char * >( __pxcptinfoptrs() ) +
- // as long as we don't demand msvcr source as build prerequisite
- // (->platform sdk), we have to code those offsets here.
+ // As long as we don't demand MSVCR source as build prerequisite,
+ // we have to code those offsets here.
//
- // crt\src\mtdll.h:
+ // MSVS9/crt/src/mtdll.h:
// offsetof (_tiddata, _curexception) -
// offsetof (_tiddata, _tpxcptinfoptrs):
#if _MSC_VER < 1500
@@ -532,34 +746,47 @@ int mscx_filterCppException(
#endif
);
}
- // rethrow: handle only C++ exceptions:
+
+ // Rethrow: handle only C++ exceptions:
if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;
- if (pRecord->NumberParameters == 3 &&
-// pRecord->ExceptionInformation[ 0 ] == MSVC_magic_number &&
- pRecord->ExceptionInformation[ 1 ] != 0 &&
- pRecord->ExceptionInformation[ 2 ] != 0)
+ if (pRecord->NumberParameters == 4 &&
+ pRecord->ExceptionInformation[0] == MSVC_magic_number &&
+ pRecord->ExceptionInformation[1] != 0 &&
+ pRecord->ExceptionInformation[2] != 0 &&
+ pRecord->ExceptionInformation[3] != 0)
{
- void * types = reinterpret_cast< RaiseInfo * >(
- pRecord->ExceptionInformation[ 2 ] )->_types;
- if (types != 0 && *reinterpret_cast< DWORD * >( types ) > 0) // count
+ // ExceptionInformation[1] is the address of the thrown object
+ // (or the address of a pointer to it, in most cases when it
+ // is a C++ class, obviously).
+
+ // [2] is the throwinfo pointer
+
+ // [3] is the image base address which is added the 32-bit
+ // rva_t fields in throwinfo to get actual 64-bit addresses
+
+ void * types =
+ (void *) (pRecord->ExceptionInformation[3] +
+ ((RaiseInfo *)pRecord->ExceptionInformation[2])->_types);
+
+ if (types != 0 && *(DWORD *)types > 0)
{
- ExceptionType * pType = *reinterpret_cast< ExceptionType ** >(
- reinterpret_cast< DWORD * >( types ) + 1 );
- if (pType != 0 && pType->_pTypeInfo != 0)
+ DWORD pType = *((DWORD *)types + 1);
+ if (pType != 0 &&
+ ((ExceptionType *)(pRecord->ExceptionInformation[3]+pType))->_pTypeInfo != 0)
{
OUString aRTTIname(
OStringToOUString(
reinterpret_cast< __type_info * >(
- pType->_pTypeInfo )->_m_d_name,
+ ((ExceptionType *)(pRecord->ExceptionInformation[3]+pType))->_pTypeInfo )->_m_d_name,
RTL_TEXTENCODING_ASCII_US ) );
OUString aUNOname( toUNOname( aRTTIname ) );
- typelib_TypeDescription * pExcTypeDescr = 0;
+ typelib_TypeDescription * pExcTD = 0;
typelib_typedescription_getByName(
- &pExcTypeDescr, aUNOname.pData );
- if (pExcTypeDescr == 0)
+ &pExcTD, aUNOname.pData );
+ if (pExcTD == NULL)
{
OUStringBuffer buf;
buf.appendAscii(
@@ -588,16 +815,16 @@ int mscx_filterCppException(
// construct uno exception any
uno_any_constructAndConvert(
pUnoExc, (void *) pRecord->ExceptionInformation[1],
- pExcTypeDescr, pCpp2Uno );
+ pExcTD, pCpp2Uno );
#if _MSC_VER < 1400 // msvcr80.dll cleans up, different from former msvcrs
if (! rethrow)
{
uno_destructData(
(void *) pRecord->ExceptionInformation[1],
- pExcTypeDescr, cpp_release );
+ pExcTD, cpp_release );
}
#endif
- typelib_typedescription_release( pExcTypeDescr );
+ typelib_typedescription_release( pExcTD );
}
return EXCEPTION_EXECUTE_HANDLER;
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/makefile.mk b/bridges/source/cpp_uno/msvc_win32_x86-64/makefile.mk
index 604799a18e5a..7f73ebe4bba2 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/makefile.mk
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/makefile.mk
@@ -51,10 +51,11 @@ CFLAGS += -DLEAK_STATIC_DATA
SLOFILES= \
- $(SLO)$/cpp2uno.obj \
- $(SLO)$/uno2cpp.obj \
- $(SLO)$/dllinit.obj \
- $(SLO)$/except.obj
+ $(SLO)$/cpp2uno.obj \
+ $(SLO)$/uno2cpp.obj \
+ $(SLO)$/dllinit.obj \
+ $(SLO)$/except.obj \
+ $(SLO)$/call.obj
NOOPTFILES= \
$(SLO)$/except.obj
@@ -70,7 +71,7 @@ SHL1OBJS = $(SLOFILES)
SHL1LIBS = $(SLB)$/cpp_uno_shared.lib
SHL1STDLIBS= \
- $(CPPULIB) \
+ $(CPPULIB) \
$(SALLIB)
DEF1NAME=$(SHL1TARGET)
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
index de6f5f212ec4..7271aa510847 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
@@ -51,76 +51,28 @@ using namespace ::com::sun::star::uno;
namespace
{
-// As "long" is 32 bit also in x64 Windows we don't use "longs" in names
-// to indicate pointer-sized stack slots etc like in the other x64 archs,
-// but "qword" as in ml64.
-
-//==================================================================================================
-// In asmbits.asm
-extern void callVirtualMethod(
- void * pAdjustedThisPtr, sal_Int32 nVtableIndex,
- void * pReturn, typelib_TypeClass eReturnTypeClass,
- sal_Int64 * pStack, sal_Int32 nStack,
- sal_uInt64 *pGPR,
- double *pFPR);
-
-#if OSL_DEBUG_LEVEL > 1
-inline void callVirtualMethodwrapper(
- void * pAdjustedThisPtr, sal_Int32 nVtableIndex,
- void * pReturn, typelib_TypeDescriptionReference * pReturnTypeRef,
- sal_Int64 * pStack, sal_Int32 nStack,
- sal_uInt64 *pGPR, sal_uInt32 nGPR,
- double *pFPR, sal_uInt32 nFPR)
-{
- // Let's figure out what is really going on here
- {
- fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
- for ( unsigned int i = 0; i < nGPR; ++i )
- fprintf( stderr, "0x%lx, ", pGPR[i] );
- fprintf( stderr, "\nFPR's (%d): ", nFPR );
- for ( unsigned int i = 0; i < nFPR; ++i )
- fprintf( stderr, "%f, ", pFPR[i] );
- fprintf( stderr, "\nStack (%d): ", nStack );
- for ( unsigned int i = 0; i < nStack; ++i )
- fprintf( stderr, "0x%lx, ", pStack[i] );
- fprintf( stderr, "\n" );
- }
-
- callVirtualMethod( pAdjustedThisPtr, nVtableIndex,
- pReturn, pReturnTypeRef->eTypeClass,
- pStack, nStack,
- pGPR,
- pFPR);
-}
-
-#define callVirtualMethod callVirtualMethodwrapper
-
-#endif
-
-//==================================================================================================
-static void cpp_call(
+static bool 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 ) throw ()
+ sal_Int32 nParams,
+ typelib_MethodParameter * pParams,
+ void * pUnoReturn,
+ void * pUnoArgs[],
+ uno_Any ** ppUnoExc ) throw ()
{
const int MAXPARAMS = 20;
- MessageBoxA (NULL, "Whoa!", "cpp_call in uno2cpp.cxx", MB_OK);
-
- if (nParams > MAXPARAMS)
+ if ( nParams > MAXPARAMS )
{
// We have a hard limit on the number of parameters so that we
- // don't need any assembler stuff but can call the function
- // using normal C++.
+ // don't need any assembler code here but can call the
+ // function using normal C++.
- // What is the proper way to abort with at least some
- // information given to the user?
- abort();
+ return false;
}
- // table with optional complex return value ptr, this pointer, and the parameters
+ // Table with this pointer, optional complex return value ptr, and the parameters
union {
sal_Int64 i;
void *p;
@@ -129,26 +81,28 @@ static void cpp_call(
int nCppParamIndex = 0;
// Return type
- typelib_TypeDescription * pReturnTypeDescr = 0;
- TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
+ typelib_TypeDescription * pReturnTD = NULL;
+ TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
+ OSL_ENSURE( pReturnTD, "### expected return type description!" );
+
+ // 'this'
+ void * pAdjustedThisPtr = (void **)( pThis->getCppI() ) + aVtableSlot.offset;
+ aCppParams[nCppParamIndex++].p = pAdjustedThisPtr;
bool bSimpleReturn = true;
- if (pReturnTypeDescr)
+ if ( pReturnTD )
{
- if (pReturnTypeDescr->nSize > 8)
+ if ( !bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
{
- // complex return via ptr
+ // Complex return via ptr
bSimpleReturn = false;
- aCppParams[nCppParamIndex++].p = alloca( pReturnTypeDescr->nSize );
+ aCppParams[nCppParamIndex++].p =
+ bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTD )?
+ alloca( pReturnTD->nSize ) : pUnoReturn;
}
}
- // "this"
- sal_Int64 * pCppThis = (sal_Int64 *) (pThis->getCppI()) + aVtableSlot.offset;
- aCppParams[nCppParamIndex++].p = pCppThis;
-
- // Indexes of values this have to be converted (interface conversion cpp<=>uno)
+ // Indexes of values this have to be converted (interface conversion C++<=>UNO)
int pTempCppIndexes[MAXPARAMS];
int pTempIndexes[MAXPARAMS];
int nTempIndexes = 0;
@@ -156,69 +110,66 @@ static void cpp_call(
// Type descriptions for reconversions
typelib_TypeDescription *pTempParamTypeDescr[MAXPARAMS];
- for ( int nPos = 0; nPos < nParams; ++nPos )
+ for ( int nPos = 0; nPos < nParams; ++nPos, ++nCppParamIndex )
{
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 ))
+ typelib_TypeDescription * pParamTD = NULL;
+ TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
+
+ if ( !rParam.bOut &&
+ bridges::cpp_uno::shared::isSimpleType( pParamTD ) )
{
::uno_copyAndConvertData(
- aCppParams[nCppParamIndex++].p, pUnoArgs[nPos], pParamTypeDescr,
+ &aCppParams[nCppParamIndex], pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
- // no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ // No longer needed
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
- else // ptr to complex value | ref
+ else // Ptr to complex value | ref
{
- if (! rParam.bIn) // is pure out
+ if ( !rParam.bIn ) // Is pure out
{
- // cpp out is constructed mem, uno out is not!
+ // C++ out is constructed mem, UNO out is not!
::uno_constructData(
- aCppParams[nCppParamIndex].p = alloca( pParamTypeDescr->nSize ),
- pParamTypeDescr );
+ aCppParams[nCppParamIndex].p = alloca( pParamTD->nSize ),
+ pParamTD );
pTempCppIndexes[nTempIndexes] = nCppParamIndex;
pTempIndexes[nTempIndexes] = nPos;
- // will be released at reconversion
- pTempParamTypeDescr[nTempIndexes++] = pParamTypeDescr;
+ // Will be released at reconversion
+ pTempParamTypeDescr[nTempIndexes++] = pParamTD;
- nCppParamIndex++;
}
- // is in/inout
- else if (bridges::cpp_uno::shared::relatesToInterfaceType(
- pParamTypeDescr ))
+ // Is in/inout
+ else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTD ) )
{
::uno_copyAndConvertData(
- aCppParams[nCppParamIndex].p = alloca( pParamTypeDescr->nSize ),
- pUnoArgs[nPos], pParamTypeDescr,
+ aCppParams[nCppParamIndex].p = alloca( pParamTD->nSize ),
+ pUnoArgs[nPos], pParamTD,
pThis->getBridge()->getUno2Cpp() );
pTempCppIndexes[nTempIndexes] = nCppParamIndex;
pTempIndexes[nTempIndexes] = nPos;
- // will be released at reconversion
- pTempParamTypeDescr[nTempIndexes++] = pParamTypeDescr;
-
- nCppParamIndex++;
+ // Will be released at reconversion
+ pTempParamTypeDescr[nTempIndexes++] = pParamTD;
}
else // direct way
{
- aCppParams[nCppParamIndex++].p = pUnoArgs[nPos];
- // no longer needed
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ aCppParams[nCppParamIndex].p = pUnoArgs[nPos];
+
+ // No longer needed
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
}
}
__try
{
- // The first real parameter is always a pointer: either the
- // address of where to store a complex return value or "this".
+ // The first real parameter is always 'this'.
// The Windows x64 calling convention is very regular and
// elegant (even if perhaps then slightly slower than the
@@ -238,91 +189,111 @@ static void cpp_call(
// registers, and the callee will find them where it
// expects. (The callee is not actually varargs, of course.)
- sal_Int64 (*pMethod)(sal_Int64, ...) =
+ sal_Int64 (*pIMethod)(sal_Int64, ...) =
(sal_Int64 (*)(sal_Int64, ...))
- (((sal_Int64 *)pCppThis) + aVtableSlot.index);
-
- // Pass parameters 2..4 as double so that it gets put in both XMM and integer
- // registers per the
- uRetVal.i =
- pMethod (aCppParams[0].i, aCppParams[1].d, aCppParams[2].d, aCppParams[3].d,
- aCppParams[4].i, aCppParams[5].i, aCppParams[6].i, aCppParams[7].i,
- aCppParams[8].i, aCppParams[9].i, aCppParams[10].i, aCppParams[11].i,
- aCppParams[12].i, aCppParams[13].i, aCppParams[14].i, aCppParams[15].i,
- aCppParams[16].i, aCppParams[17].i, aCppParams[18].i, aCppParams[19].i );
+ (*((sal_uInt64 **)pAdjustedThisPtr))[aVtableSlot.index];
+
+ double (*pFMethod)(sal_Int64, ...) =
+ (double (*)(sal_Int64, ...))
+ (*((sal_uInt64 **)pAdjustedThisPtr))[aVtableSlot.index];
+
+ // Pass parameters 2..4 as if it was a floating-point value so
+ // that it gets put in both XMM and integer registers per the
+ // calling convention. It doesn't matter if it actually is a
+ // fp or not.
+
+ if ( pReturnTD &&
+ (pReturnTD->eTypeClass == typelib_TypeClass_FLOAT ||
+ pReturnTD->eTypeClass == typelib_TypeClass_DOUBLE) )
+ uRetVal.d =
+ pFMethod (aCppParams[0].i, aCppParams[1].d, aCppParams[2].d, aCppParams[3].d,
+ aCppParams[4].i, aCppParams[5].i, aCppParams[6].i, aCppParams[7].i,
+ aCppParams[8].i, aCppParams[9].i, aCppParams[10].i, aCppParams[11].i,
+ aCppParams[12].i, aCppParams[13].i, aCppParams[14].i, aCppParams[15].i,
+ aCppParams[16].i, aCppParams[17].i, aCppParams[18].i, aCppParams[19].i );
+ else
+ uRetVal.i =
+ pIMethod (aCppParams[0].i, aCppParams[1].d, aCppParams[2].d, aCppParams[3].d,
+ aCppParams[4].i, aCppParams[5].i, aCppParams[6].i, aCppParams[7].i,
+ aCppParams[8].i, aCppParams[9].i, aCppParams[10].i, aCppParams[11].i,
+ aCppParams[12].i, aCppParams[13].i, aCppParams[14].i, aCppParams[15].i,
+ aCppParams[16].i, aCppParams[17].i, aCppParams[18].i, aCppParams[19].i );
}
__except (CPPU_CURRENT_NAMESPACE::mscx_filterCppException(
GetExceptionInformation(),
*ppUnoExc, pThis->getBridge()->getCpp2Uno() ))
{
- // *ppUnoExc was constructed by filter function
- // temporary params
- while (nTempIndexes--)
+ // *ppUnoExc was constructed by filter function.
+ // Temporary params
+ while ( nTempIndexes-- )
{
int nCppIndex = pTempCppIndexes[nTempIndexes];
- // destroy temp cpp param => cpp: every param was constructed
+ // Destroy temp C++ param => C++: every param was constructed
::uno_destructData(
aCppParams[nCppIndex].p, pTempParamTypeDescr[nTempIndexes],
cpp_release );
TYPELIB_DANGER_RELEASE( pTempParamTypeDescr[nTempIndexes] );
}
- // return type
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
- }
- // end here
- return;
+ // Return type
+ if ( pReturnTD )
+ TYPELIB_DANGER_RELEASE( pReturnTD );
+
+ // End here
+ return true;
}
- // NO exception occurred
- *ppUnoExc = 0;
+ // No exception occurred
+ *ppUnoExc = NULL;
// Reconvert temporary params
- while (nTempIndexes--)
+ while ( nTempIndexes-- )
{
int nCppIndex = pTempCppIndexes[nTempIndexes];
int nIndex = pTempIndexes[nTempIndexes];
- typelib_TypeDescription * pParamTypeDescr =
+ typelib_TypeDescription * pParamTD =
pTempParamTypeDescr[nTempIndexes];
- if (pParams[nIndex].bIn)
+ if ( pParams[nIndex].bIn )
{
- if (pParams[nIndex].bOut) // inout
+ if ( pParams[nIndex].bOut ) // Inout
{
::uno_destructData(
- pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
+ pUnoArgs[nIndex], pParamTD, 0 ); // Destroy UNO value
::uno_copyAndConvertData(
- pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTypeDescr,
+ pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
}
- else // pure out
+ else // Pure out
{
::uno_copyAndConvertData(
- pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTypeDescr,
+ pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTD,
pThis->getBridge()->getCpp2Uno() );
}
- // destroy temp cpp param => cpp: every param was constructed
+
+ // Destroy temp C++ param => C++: every param was constructed
::uno_destructData(
- aCppParams[nCppIndex].p, pParamTypeDescr, cpp_release );
+ aCppParams[nCppIndex].p, pParamTD, cpp_release );
- TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+ TYPELIB_DANGER_RELEASE( pParamTD );
}
- // return value
- if (!bSimpleReturn)
+
+ // Return value
+ if ( !bSimpleReturn )
{
::uno_copyAndConvertData(
- pUnoReturn, uRetVal.p, pReturnTypeDescr,
+ pUnoReturn, uRetVal.p, pReturnTD,
pThis->getBridge()->getCpp2Uno() );
::uno_destructData(
- aCppParams[0].p, pReturnTypeDescr, cpp_release );
- }
- // return type
- if (pReturnTypeDescr)
- {
- TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+ aCppParams[1].p, pReturnTD, cpp_release );
}
+ else if ( pUnoReturn )
+ *(sal_Int64*)pUnoReturn = uRetVal.i;
+
+ if ( pReturnTD )
+ TYPELIB_DANGER_RELEASE( pReturnTD );
+
+ return true;
}
}
@@ -330,46 +301,56 @@ static void cpp_call(
namespace bridges { namespace cpp_uno { namespace shared {
void unoInterfaceProxyDispatch(
- uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
- void * pReturn, void * pArgs[], uno_Any ** ppException )
+ uno_Interface * pUnoI,
+ const typelib_TypeDescription * pMemberTD,
+ void * pReturn,
+ void * pArgs[],
+ uno_Any ** ppException )
{
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
+#if OSL_DEBUG_LEVEL > 0
+ typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
+#endif
- switch (pMemberDescr->eTypeClass)
+ switch (pMemberTD->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
+#if OSL_DEBUG_LEVEL > 0
+ // determine vtable call index
+ sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition;
+ OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
+#endif
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceAttributeTypeDescription const * >(
- pMemberDescr)));
- if (pReturn)
+ pMemberTD)));
+ if ( pReturn )
{
- // dependent dispatch
+ // Is GET
cpp_call(
pThis, aVtableSlot,
- ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
- 0, 0, // no params
+ ((typelib_InterfaceAttributeTypeDescription *)pMemberTD)->pAttributeTypeRef,
+ 0, NULL, // no params
pReturn, pArgs, ppException );
}
else
{
- // is SET
+ // Is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
- ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
+ ((typelib_InterfaceAttributeTypeDescription *)pMemberTD)->pAttributeTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
- typelib_TypeDescriptionReference * pReturnTypeRef = 0;
+ typelib_TypeDescriptionReference * pReturnTypeRef = NULL;
OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
- // dependent dispatch
aVtableSlot.index += 1; // get, then set method
cpp_call(
pThis, aVtableSlot,
@@ -384,65 +365,81 @@ void unoInterfaceProxyDispatch(
}
case typelib_TypeClass_INTERFACE_METHOD:
{
+#if OSL_DEBUG_LEVEL > 0
+ // determine vtable call index
+ sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition;
+ OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
+#endif
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription const * >(
- pMemberDescr)));
+ pMemberTD)));
+
switch (aVtableSlot.index)
{
- // standard calls
- case 1: // acquire uno interface
+ // Standard calls
+ case 1: // Acquire UNO interface
(*pUnoI->acquire)( pUnoI );
*ppException = 0;
break;
- case 2: // release uno interface
+ case 2: // Release UNO interface
(*pUnoI->release)( pUnoI );
*ppException = 0;
break;
case 0: // queryInterface() opt
{
- typelib_TypeDescription * pTD = 0;
+ typelib_TypeDescription * pTD = NULL;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
- if (pTD)
+
+ if ( pTD )
{
- uno_Interface * pInterface = 0;
- (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
- pThis->pBridge->getUnoEnv(),
+ uno_Interface * pInterface = NULL;
+ (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
+ pThis->getBridge()->getUnoEnv(),
(void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
- if (pInterface)
+ if ( pInterface )
{
::uno_any_construct(
reinterpret_cast< uno_Any * >( pReturn ),
&pInterface, pTD, 0 );
(*pInterface->release)( pInterface );
+
TYPELIB_DANGER_RELEASE( pTD );
+
*ppException = 0;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
- } // else perform queryInterface()
+ } // Else perform queryInterface()
default:
- // dependent dispatch
- cpp_call(
- pThis, aVtableSlot,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
- ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
- pReturn, pArgs, ppException );
+ if ( ! cpp_call(
+ pThis, aVtableSlot,
+ ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->pReturnTypeRef,
+ ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->nParams,
+ ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->pParams,
+ pReturn, pArgs, ppException ) )
+ {
+ RuntimeException aExc(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Too many parameters!") ),
+ Reference< XInterface >() );
+
+ Type const & rExcType = ::getCppuType( &aExc );
+ ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
+ }
}
break;
}
default:
{
- ::com::sun::star::uno::RuntimeException aExc(
- OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ),
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
+ RuntimeException aExc(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Illegal member type description!") ),
+ Reference< XInterface >() );
Type const & rExcType = ::getCppuType( &aExc );
- // binary identical null reference
+ // Binary identical null reference (whatever that comment means...)
::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
}
}
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 4b819632c863..11cc6878e474 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -50,7 +50,7 @@
#include "sal/types.h"
#include "typelib/typedescription.hxx"
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <new>
#include <vector>
@@ -83,7 +83,7 @@ namespace {
extern "C" void * SAL_CALL allocExec(rtl_arena_type *, sal_Size * size) {
sal_Size pagesize;
#if defined SAL_UNX
-#if defined FREEBSD || defined NETBSD || defined OPENBSD
+#if defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY
pagesize = getpagesize();
#else
pagesize = sysconf(_SC_PAGESIZE);
@@ -176,7 +176,7 @@ private:
sal_Int32 calculate(
typelib_InterfaceTypeDescription * type, sal_Int32 offset);
- typedef std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash > Map;
+ typedef boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash > Map;
Map m_map;
};