1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_bridges.hxx"
30 
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <rtl/alloc.h>
35 
36 #include <com/sun/star/uno/genfunc.hxx>
37 #include "com/sun/star/uno/RuntimeException.hpp"
38 #include <uno/data.h>
39 
40 #include <bridges/cpp_uno/shared/bridge.hxx>
41 #include <bridges/cpp_uno/shared/types.hxx>
42 #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
43 #include "bridges/cpp_uno/shared/vtables.hxx"
44 
45 #include "abi.hxx"
46 #include "share.hxx"
47 
48 using namespace ::rtl;
49 using namespace ::com::sun::star::uno;
50 
51 //==================================================================================================
52 static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
53                               void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
54                               sal_uInt64 *pStack, sal_uInt32 nStack,
55                               sal_uInt64 *pGPR, sal_uInt32 nGPR,
56                               double *pFPR, sal_uInt32 nFPR) __attribute__((noinline));
57 
58 static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
59                               void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
60                               sal_uInt64 *pStack, sal_uInt32 nStack,
61                               sal_uInt64 *pGPR, sal_uInt32 nGPR,
62                               double *pFPR, sal_uInt32 nFPR)
63 {
64 #if OSL_DEBUG_LEVEL > 1
65     // Let's figure out what is really going on here
66     {
67         fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
68         for ( int i = 0; i < nGPR; ++i )
69             fprintf( stderr, "0x%lx, ", pGPR[i] );
70         fprintf( stderr, "\nFPR's (%d): ", nFPR );
71         for ( int i = 0; i < nFPR; ++i )
72             fprintf( stderr, "%f, ", pFPR[i] );
73         fprintf( stderr, "\nStack (%d): ", nStack );
74         for ( int i = 0; i < nStack; ++i )
75             fprintf( stderr, "0x%lx, ", pStack[i] );
76         fprintf( stderr, "\n" );
77     }
78 #endif
79 
80     // The call instruction within the asm section of callVirtualMethod may throw
81     // exceptions.  So that the compiler handles this correctly, it is important
82     // that (a) callVirtualMethod might call dummy_can_throw_anything (although this
83     // never happens at runtime), which in turn can throw exceptions, and (b)
84     // callVirtualMethod is not inlined at its call site (so that any exceptions are
85     // caught which are thrown from the instruction calling callVirtualMethod):
86     if ( !pThis )
87         CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything( "xxx" ); // address something
88 
89     // Should not happen, but...
90     if ( nFPR > x86_64::MAX_SSE_REGS )
91         nFPR = x86_64::MAX_SSE_REGS;
92     if ( nGPR > x86_64::MAX_GPR_REGS )
93         nGPR = x86_64::MAX_GPR_REGS;
94 
95     // Get pointer to method
96     sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
97     pMethod += 8 * nVtableIndex;
98     pMethod = *((sal_uInt64 *)pMethod);
99 
100     // Load parameters to stack, if necessary
101     if ( nStack )
102     {
103         // 16-bytes aligned
104         sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
105         sal_uInt64 *pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
106         memcpy( pCallStack, pStack, nStackBytes );
107     }
108 
109     // Return values
110     sal_uInt64 rax;
111     sal_uInt64 rdx;
112     double xmm0;
113 
114     asm volatile (
115 
116         // Fill the xmm registers
117         "movq %2, %%rax\n\t"
118 
119         "movsd   (%%rax), %%xmm0\n\t"
120         "movsd  8(%%rax), %%xmm1\n\t"
121         "movsd 16(%%rax), %%xmm2\n\t"
122         "movsd 24(%%rax), %%xmm3\n\t"
123         "movsd 32(%%rax), %%xmm4\n\t"
124         "movsd 40(%%rax), %%xmm5\n\t"
125         "movsd 48(%%rax), %%xmm6\n\t"
126         "movsd 56(%%rax), %%xmm7\n\t"
127 
128         // Fill the general purpose registers
129         "movq %1, %%rax\n\t"
130 
131         "movq    (%%rax), %%rdi\n\t"
132         "movq   8(%%rax), %%rsi\n\t"
133         "movq  16(%%rax), %%rdx\n\t"
134         "movq  24(%%rax), %%rcx\n\t"
135         "movq  32(%%rax), %%r8\n\t"
136         "movq  40(%%rax), %%r9\n\t"
137 
138         // Perform the call
139         "movq %0, %%r11\n\t"
140         "movq %3, %%rax\n\t"
141         "call *%%r11\n\t"
142 
143         // Fill the return values
144         "movq   %%rax, %4\n\t"
145         "movq   %%rdx, %5\n\t"
146         "movsd %%xmm0, %6\n\t"
147         :
148         : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
149           "m" ( rax ), "m" ( rdx ), "m" ( xmm0 )
150         : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11"
151     );
152 
153     switch (pReturnTypeDescr->eTypeClass)
154     {
155     case typelib_TypeClass_HYPER:
156     case typelib_TypeClass_UNSIGNED_HYPER:
157         *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = rax;
158         break;
159     case typelib_TypeClass_LONG:
160     case typelib_TypeClass_UNSIGNED_LONG:
161     case typelib_TypeClass_ENUM:
162         *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &rax );
163         break;
164     case typelib_TypeClass_CHAR:
165     case typelib_TypeClass_SHORT:
166     case typelib_TypeClass_UNSIGNED_SHORT:
167         *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &rax );
168         break;
169     case typelib_TypeClass_BOOLEAN:
170     case typelib_TypeClass_BYTE:
171         *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &rax );
172         break;
173     case typelib_TypeClass_FLOAT:
174     case typelib_TypeClass_DOUBLE:
175         *reinterpret_cast<double *>( pRegisterReturn ) = xmm0;
176         break;
177     default:
178         {
179             sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
180             if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
181             {
182                 if (nRetSize > 8)
183                     static_cast<sal_uInt64 *>(pRegisterReturn)[1] = rdx;
184                 static_cast<sal_uInt64 *>(pRegisterReturn)[0] = rax;
185             }
186             break;
187         }
188     }
189 }
190 
191 //==================================================================================================
192 
193 // Macros for easier insertion of values to registers or stack
194 // pSV - pointer to the source
195 // nr - order of the value [will be increased if stored to register]
196 // pFPR, pGPR - pointer to the registers
197 // pDS - pointer to the stack [will be increased if stored here]
198 
199 // The value in %xmm register is already prepared to be retrieved as a float,
200 // thus we treat float and double the same
201 #define INSERT_FLOAT_DOUBLE( pSV, nr, pFPR, pDS ) \
202 	if ( nr < x86_64::MAX_SSE_REGS ) \
203 		pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
204 	else \
205 		*pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
206 
207 #define INSERT_INT64( pSV, nr, pGPR, pDS ) \
208 	if ( nr < x86_64::MAX_GPR_REGS ) \
209 		pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
210 	else \
211 		*pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
212 
213 #define INSERT_INT32( pSV, nr, pGPR, pDS ) \
214 	if ( nr < x86_64::MAX_GPR_REGS ) \
215 		pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
216 	else \
217 		*pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
218 
219 #define INSERT_INT16( pSV, nr, pGPR, pDS ) \
220 	if ( nr < x86_64::MAX_GPR_REGS ) \
221 		pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
222 	else \
223 		*pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
224 
225 #define INSERT_INT8( pSV, nr, pGPR, pDS ) \
226 	if ( nr < x86_64::MAX_GPR_REGS ) \
227 		pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
228 	else \
229 		*pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
230 
231 //==================================================================================================
232 
233 static void cpp_call(
234 	bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
235 	bridges::cpp_uno::shared::VtableSlot aVtableSlot,
236 	typelib_TypeDescriptionReference * pReturnTypeRef,
237 	sal_Int32 nParams, typelib_MethodParameter * pParams,
238 	void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
239 {
240 	// Maxium space for [complex ret ptr], values | ptr ...
241 	// (but will be used less - some of the values will be in pGPR and pFPR)
242   	sal_uInt64 *pStack = (sal_uInt64 *)__builtin_alloca( (nParams + 3) * sizeof(sal_uInt64) );
243   	sal_uInt64 *pStackStart = pStack;
244 
245 	sal_uInt64 pGPR[x86_64::MAX_GPR_REGS];
246 	sal_uInt32 nGPR = 0;
247 
248 	double pFPR[x86_64::MAX_SSE_REGS];
249 	sal_uInt32 nFPR = 0;
250 
251 	// Return
252 	typelib_TypeDescription * pReturnTypeDescr = 0;
253 	TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
254 	OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
255 
256 	void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below)
257 
258 	bool bSimpleReturn = true;
259 	if ( pReturnTypeDescr )
260 	{
261 		if ( x86_64::return_in_hidden_param( pReturnTypeRef ) )
262 			bSimpleReturn = false;
263 
264 		if ( bSimpleReturn )
265 			pCppReturn = pUnoReturn; // direct way for simple types
266 		else
267 		{
268 			// complex return via ptr
269 			pCppReturn = bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )?
270 						 __builtin_alloca( pReturnTypeDescr->nSize ) : pUnoReturn;
271 			INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack );
272 		}
273 	}
274 
275 	// Push "this" pointer
276 	void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset;
277 	INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack );
278 
279 	// Args
280 	void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
281 	// Indizes of values this have to be converted (interface conversion cpp<=>uno)
282 	sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams);
283 	// Type descriptions for reconversions
284 	typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
285 
286 	sal_Int32 nTempIndizes = 0;
287 
288 	for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
289 	{
290 		const typelib_MethodParameter & rParam = pParams[nPos];
291 		typelib_TypeDescription * pParamTypeDescr = 0;
292 		TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
293 
294 		if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
295 		{
296 			uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
297 									pThis->getBridge()->getUno2Cpp() );
298 
299 			switch (pParamTypeDescr->eTypeClass)
300 			{
301 			case typelib_TypeClass_HYPER:
302 			case typelib_TypeClass_UNSIGNED_HYPER:
303 				INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack );
304 				break;
305 			case typelib_TypeClass_LONG:
306 			case typelib_TypeClass_UNSIGNED_LONG:
307 			case typelib_TypeClass_ENUM:
308 				INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack );
309 				break;
310 			case typelib_TypeClass_SHORT:
311 			case typelib_TypeClass_CHAR:
312 			case typelib_TypeClass_UNSIGNED_SHORT:
313 				INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack );
314 				break;
315 			case typelib_TypeClass_BOOLEAN:
316 			case typelib_TypeClass_BYTE:
317 				INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack );
318 				break;
319 			case typelib_TypeClass_FLOAT:
320 			case typelib_TypeClass_DOUBLE:
321 				INSERT_FLOAT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack );
322 				break;
323 			}
324 
325 			// no longer needed
326 			TYPELIB_DANGER_RELEASE( pParamTypeDescr );
327 		}
328 		else // ptr to complex value | ref
329 		{
330 			if (! rParam.bIn) // is pure out
331 			{
332 				// cpp out is constructed mem, uno out is not!
333 				uno_constructData(
334 					pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
335 					pParamTypeDescr );
336 				pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call
337 				// will be released at reconversion
338 				ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
339 			}
340 			// is in/inout
341 			else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
342 			{
343 				uno_copyAndConvertData(
344 					pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
345 					pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
346 
347 				pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
348 				// will be released at reconversion
349 				ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
350 			}
351 			else // direct way
352 			{
353 				pCppArgs[nPos] = pUnoArgs[nPos];
354 				// no longer needed
355 				TYPELIB_DANGER_RELEASE( pParamTypeDescr );
356 			}
357 			INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
358 		}
359 	}
360 
361 	try
362 	{
363 		callVirtualMethod(
364 			pAdjustedThisPtr, aVtableSlot.index,
365 			pCppReturn, pReturnTypeDescr, bSimpleReturn,
366 			pStackStart, ( pStack - pStackStart ),
367 			pGPR, nGPR,
368 			pFPR, nFPR );
369 		// NO exception occured...
370 		*ppUnoExc = 0;
371 
372 		// reconvert temporary params
373 		for ( ; nTempIndizes--; )
374 		{
375 			sal_Int32 nIndex = pTempIndizes[nTempIndizes];
376 			typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
377 
378 			if (pParams[nIndex].bIn)
379 			{
380 				if (pParams[nIndex].bOut) // inout
381 				{
382 					uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
383 					uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
384 											pThis->getBridge()->getCpp2Uno() );
385 				}
386 			}
387 			else // pure out
388 			{
389 				uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
390 										pThis->getBridge()->getCpp2Uno() );
391 			}
392 			// destroy temp cpp param => cpp: every param was constructed
393 			uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
394 
395 			TYPELIB_DANGER_RELEASE( pParamTypeDescr );
396 		}
397 		// return value
398 		if (pCppReturn && pUnoReturn != pCppReturn)
399 		{
400 			uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
401 									pThis->getBridge()->getCpp2Uno() );
402 			uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
403 		}
404 	}
405  	catch (...)
406  	{
407   		// fill uno exception
408 		fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
409 
410 		// temporary params
411 		for ( ; nTempIndizes--; )
412 		{
413 			sal_Int32 nIndex = pTempIndizes[nTempIndizes];
414 			// destroy temp cpp param => cpp: every param was constructed
415 			uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release );
416 			TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
417 		}
418 		// return type
419 		if (pReturnTypeDescr)
420 			TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
421 	}
422 }
423 
424 //==================================================================================================
425 
426 namespace bridges { namespace cpp_uno { namespace shared {
427 
428 void unoInterfaceProxyDispatch(
429 	uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
430 	void * pReturn, void * pArgs[], uno_Any ** ppException )
431 {
432 	// is my surrogate
433 	bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
434 		= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
435 	typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
436 
437 	switch (pMemberDescr->eTypeClass)
438 	{
439 	case typelib_TypeClass_INTERFACE_ATTRIBUTE:
440 	{
441 		// determine vtable call index
442 		sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
443 		OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
444 
445 		VtableSlot aVtableSlot(
446 				getVtableSlot(
447 					reinterpret_cast<
448 					typelib_InterfaceAttributeTypeDescription const * >(
449 						pMemberDescr)));
450 
451 		if (pReturn)
452 		{
453 			// dependent dispatch
454 			cpp_call(
455 				pThis, aVtableSlot,
456 				((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
457 				0, 0, // no params
458 				pReturn, pArgs, ppException );
459 		}
460 		else
461 		{
462 			// is SET
463 			typelib_MethodParameter aParam;
464 			aParam.pTypeRef =
465 				((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
466 			aParam.bIn		= sal_True;
467 			aParam.bOut		= sal_False;
468 
469 			typelib_TypeDescriptionReference * pReturnTypeRef = 0;
470 			OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
471 			typelib_typedescriptionreference_new(
472 				&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
473 
474 			// dependent dispatch
475 			aVtableSlot.index += 1; // get, then set method
476 			cpp_call(
477 				pThis, aVtableSlot, // get, then set method
478 				pReturnTypeRef,
479 				1, &aParam,
480 				pReturn, pArgs, ppException );
481 
482 			typelib_typedescriptionreference_release( pReturnTypeRef );
483 		}
484 
485 		break;
486 	}
487 	case typelib_TypeClass_INTERFACE_METHOD:
488 	{
489 		// determine vtable call index
490 		sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
491 		OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
492 
493 		VtableSlot aVtableSlot(
494 				getVtableSlot(
495 					reinterpret_cast<
496 					typelib_InterfaceMethodTypeDescription const * >(
497 						pMemberDescr)));
498 
499 		switch (aVtableSlot.index)
500 		{
501 			// standard calls
502 		case 1: // acquire uno interface
503 			(*pUnoI->acquire)( pUnoI );
504 			*ppException = 0;
505 			break;
506 		case 2: // release uno interface
507 			(*pUnoI->release)( pUnoI );
508 			*ppException = 0;
509 			break;
510 		case 0: // queryInterface() opt
511 		{
512 			typelib_TypeDescription * pTD = 0;
513 			TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
514 			if (pTD)
515 			{
516                 uno_Interface * pInterface = 0;
517                 (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
518                     pThis->getBridge()->getUnoEnv(),
519                     (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
520 
521                 if (pInterface)
522                 {
523                     ::uno_any_construct(
524                         reinterpret_cast< uno_Any * >( pReturn ),
525                         &pInterface, pTD, 0 );
526                     (*pInterface->release)( pInterface );
527                     TYPELIB_DANGER_RELEASE( pTD );
528                     *ppException = 0;
529                     break;
530                 }
531                 TYPELIB_DANGER_RELEASE( pTD );
532             }
533 		} // else perform queryInterface()
534 		default:
535 			// dependent dispatch
536 			cpp_call(
537 				pThis, aVtableSlot,
538 				((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
539 				((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
540 				((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
541 				pReturn, pArgs, ppException );
542 		}
543 		break;
544 	}
545 	default:
546 	{
547 		::com::sun::star::uno::RuntimeException aExc(
548 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ),
549 			::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
550 
551 		Type const & rExcType = ::getCppuType( &aExc );
552 		// binary identical null reference
553 		::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
554 	}
555 	}
556 }
557 
558 } } }
559