LibreOffice Module bridges (master) 1
gcc3_linux_s390x/cpp2uno.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include <com/sun/star/uno/genfunc.hxx>
22#include <sal/log.hxx>
23#include <uno/data.h>
24#include <typelib/typedescription.hxx>
25
26#include "bridge.hxx"
27#include "cppinterfaceproxy.hxx"
28#include "types.hxx"
29#include "vtablefactory.hxx"
30
31#include "share.hxx"
32#include <stdio.h>
33
34using namespace ::com::sun::star::uno;
35
36namespace
37{
38static typelib_TypeClass cpp2uno_call(
40 const typelib_TypeDescription * pMemberTypeDescr,
41 typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
42 sal_Int32 nParams, typelib_MethodParameter * pParams,
43 void ** gpreg, void ** fpreg, void ** ovrflw,
44 sal_Int64 * pRegisterReturn /* space for register return */ )
45{
46#if OSL_DEBUG_LEVEL > 2
47 fprintf(stderr, "as far as cpp2uno_call\n");
48#endif
49 int ng = 0; //number of gpr registers used
50 int nf = 0; //number of fpr registers used
51
52 // gpreg: [ret *], this, [gpr params]
53 // fpreg: [fpr params]
54 // ovrflw: [gpr or fpr params (properly aligned)]
55
56 // return
57 typelib_TypeDescription * pReturnTypeDescr = 0;
58 if (pReturnTypeRef)
59 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
60
61 void * pUnoReturn = 0;
62 void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
63
64 if (pReturnTypeDescr)
65 {
66 if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
67 {
68 pUnoReturn = pRegisterReturn; // direct way for simple types
69 }
70 else // complex return via ptr (pCppReturn)
71 {
72 pCppReturn = *(void **)gpreg;
73 gpreg++;
74 ng++;
75
76 pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
77 ? alloca( pReturnTypeDescr->nSize )
78 : pCppReturn); // direct way
79 }
80 }
81 // pop this
82 gpreg++;
83 ng++;
84
85 // stack space
86 static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!");
87 // parameters
88 void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
89 void ** pCppArgs = pUnoArgs + nParams;
90 // indices of values this have to be converted (interface conversion cpp<=>uno)
91 sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
92 // type descriptions for reconversions
93 typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
94
95 sal_Int32 nTempIndices = 0;
96 for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
97 {
98 const typelib_MethodParameter & rParam = pParams[nPos];
99 typelib_TypeDescription * pParamTypeDescr = 0;
100 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
101
102#if OSL_DEBUG_LEVEL > 2
103 fprintf(stderr, "arg %d of %d\n", nPos, nParams);
104#endif
105
106 if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
107 {
108#if OSL_DEBUG_LEVEL > 2
109 fprintf(stderr, "simple\n");
110#endif
111
112 switch (pParamTypeDescr->eTypeClass)
113 {
114 case typelib_TypeClass_FLOAT:
115 case typelib_TypeClass_DOUBLE:
116 if (nf < s390x::MAX_SSE_REGS)
117 {
118 if (pParamTypeDescr->eTypeClass == typelib_TypeClass_FLOAT)
119 {
120 float tmp = (float) (*((double *)fpreg));
121 (*((float *) fpreg)) = tmp;
122 }
123
124 pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
125 nf++;
126 }
127 else
128 {
129 pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
130 ovrflw++;
131 }
132 break;
133 case typelib_TypeClass_BYTE:
134 case typelib_TypeClass_BOOLEAN:
135 if (ng < s390x::MAX_GPR_REGS)
136 {
137 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-1));
138 ng++;
139 gpreg++;
140 }
141 else
142 {
143 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-1));
144 ovrflw++;
145 }
146 break;
147 case typelib_TypeClass_CHAR:
148 case typelib_TypeClass_SHORT:
149 case typelib_TypeClass_UNSIGNED_SHORT:
150 if (ng < s390x::MAX_GPR_REGS)
151 {
152 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-2));
153 ng++;
154 gpreg++;
155 }
156 else
157 {
158 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-2));
159 ovrflw++;
160 }
161 break;
162 case typelib_TypeClass_ENUM:
163 case typelib_TypeClass_LONG:
164 case typelib_TypeClass_UNSIGNED_LONG:
165 if (ng < s390x::MAX_GPR_REGS)
166 {
167 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-4));
168 ng++;
169 gpreg++;
170 }
171 else
172 {
173 pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-4));
174 ovrflw++;
175 }
176 break;
177 default:
178 if (ng < s390x::MAX_GPR_REGS)
179 {
180 pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++;
181 ng++;
182 }
183 else
184 {
185 pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
186 ovrflw++;
187 }
188 break;
189 }
190
191 // no longer needed
192 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
193 }
194 else // ptr to complex value | ref
195 {
196#if OSL_DEBUG_LEVEL > 2
197 fprintf(stderr, "complex, ng is %d\n", ng);
198#endif
199
200 void *pCppStack; //temporary stack pointer
201
202 if (ng < s390x::MAX_GPR_REGS)
203 {
204 pCppArgs[nPos] = pCppStack = *gpreg++;
205 ng++;
206 }
207 else
208 {
209 pCppArgs[nPos] = pCppStack = *ovrflw;
210 ovrflw++;
211 }
212
213 if (! rParam.bIn) // is pure out
214 {
215 // uno out is unconstructed mem!
216 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
217 pTempIndices[nTempIndices] = nPos;
218 // will be released at reconversion
219 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
220 }
221 // is in/inout
222 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
223 {
224 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
225 pCppStack, pParamTypeDescr,
226 pThis->getBridge()->getCpp2Uno() );
227 pTempIndices[nTempIndices] = nPos; // has to be reconverted
228 // will be released at reconversion
229 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
230 }
231 else // direct way
232 {
233 pUnoArgs[nPos] = pCppStack;
234 // no longer needed
235 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
236 }
237 }
238 }
239
240#if OSL_DEBUG_LEVEL > 2
241 fprintf(stderr, "end of params\n");
242#endif
243
244 // ExceptionHolder
245 uno_Any aUnoExc; // Any will be constructed by callee
246 uno_Any * pUnoExc = &aUnoExc;
247
248 // invoke uno dispatch call
249 (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
250
251 // in case an exception occurred...
252 if (pUnoExc)
253 {
254 // destruct temporary in/inout params
255 for ( ; nTempIndices--; )
256 {
257 sal_Int32 nIndex = pTempIndices[nTempIndices];
258
259 if (pParams[nIndex].bIn) // is in/inout => was constructed
260 uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
261 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
262 }
263 if (pReturnTypeDescr)
264 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
265
266 CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any
267 // is here for dummy
268 return typelib_TypeClass_VOID;
269 }
270 else // else no exception occurred...
271 {
272 // temporary params
273 for ( ; nTempIndices--; )
274 {
275 sal_Int32 nIndex = pTempIndices[nTempIndices];
276 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
277
278 if (pParams[nIndex].bOut) // inout/out
279 {
280 // convert and assign
281 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
282 uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
283 pThis->getBridge()->getUno2Cpp() );
284 }
285 // destroy temp uno param
286 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
287
288 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
289 }
290 // return
291 if (pCppReturn) // has complex return
292 {
293 if (pUnoReturn != pCppReturn) // needs reconversion
294 {
295 uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
296 pThis->getBridge()->getUno2Cpp() );
297 // destroy temp uno return
298 uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
299 }
300 // complex return ptr is set to return reg
301 *(void **)pRegisterReturn = pCppReturn;
302 }
303 if (pReturnTypeDescr)
304 {
305 typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
306 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
307 return eRet;
308 }
309 else
310 return typelib_TypeClass_VOID;
311 }
312}
313
314
315static typelib_TypeClass cpp_mediate(
316 sal_uInt64 nOffsetAndIndex,
317 void ** gpreg, void ** fpreg, void ** ovrflw,
318 sal_Int64 * pRegisterReturn /* space for register return */ )
319{
320 static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!");
321
322 sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
323 sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
324
325#if OSL_DEBUG_LEVEL > 2
326 fprintf(stderr, "nVTableOffset, nFunctionIndex are %x %x\n", nVtableOffset, nFunctionIndex);
327#endif
328
329#if OSL_DEBUG_LEVEL > 2
330 // Let's figure out what is really going on here
331 {
332 fprintf( stderr, "= cpp_mediate () =\nGPR's (%d): ", 5 );
333 for ( unsigned int i = 0; i < 5; ++i )
334 fprintf( stderr, "0x%lx, ", gpreg[i] );
335 fprintf( stderr, "\n");
336 fprintf( stderr, "\nFPR's (%d): ", 4 );
337 for ( unsigned int i = 0; i < 4; ++i )
338 fprintf( stderr, "0x%lx (%f), ", fpreg[i], fpreg[i] );
339 fprintf( stderr, "\n");
340 }
341#endif
342
343
344 // gpreg: [ret *], this, [other gpr params]
345 // fpreg: [fpr params]
346 // ovrflw: [gpr or fpr params (properly aligned)]
347
348 // _this_ ptr is patched cppu_XInterfaceProxy object
349 void * pThis;
350 if( nFunctionIndex & 0x80000000 )
351 {
352 nFunctionIndex &= 0x7fffffff;
353 pThis = gpreg[1];
354 }
355 else
356 {
357 pThis = gpreg[0];
358 }
359
360 pThis = static_cast< char * >(pThis) - nVtableOffset;
361
364 pThis);
365
366 typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
367
368
369 if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
370 {
371 SAL_WARN(
372 "bridges",
373 "illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
374 << " vtable index " << nFunctionIndex << "/"
375 << pTypeDescr->nMapFunctionIndexToMemberIndex);
376 throw RuntimeException(
377 ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
378 + " vtable index " + OUString::number(nFunctionIndex) + "/"
379 + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
380 (XInterface *)pCppI);
381 }
382
383 // determine called method
384 sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
385 assert(nMemberPos < pTypeDescr->nAllMembers);
386
387 TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
388
389 typelib_TypeClass eRet;
390 switch (aMemberDescr.get()->eTypeClass)
391 {
392 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
393 {
394 if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
395 {
396 // is GET method
397 eRet = cpp2uno_call(
398 pCppI, aMemberDescr.get(),
399 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
400 0, 0, // no params
401 gpreg, fpreg, ovrflw, pRegisterReturn );
402 }
403 else
404 {
405 // is SET method
406 typelib_MethodParameter aParam;
407 aParam.pTypeRef =
408 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
409 aParam.bIn = sal_True;
410 aParam.bOut = sal_False;
411
412 eRet = cpp2uno_call(
413 pCppI, aMemberDescr.get(),
414 0, // indicates void return
415 1, &aParam,
416 gpreg, fpreg, ovrflw, pRegisterReturn );
417 }
418 break;
419 }
420 case typelib_TypeClass_INTERFACE_METHOD:
421 {
422 // is METHOD
423 switch (nFunctionIndex)
424 {
425 case 1: // acquire()
426 pCppI->acquireProxy(); // non virtual call!
427 eRet = typelib_TypeClass_VOID;
428 break;
429 case 2: // release()
430 pCppI->releaseProxy(); // non virtual call!
431 eRet = typelib_TypeClass_VOID;
432 break;
433 case 0: // queryInterface() opt
434 {
435 typelib_TypeDescription * pTD = 0;
436 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
437 if (pTD)
438 {
439 XInterface * pInterface = 0;
440 (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
441 pCppI->getBridge()->getCppEnv(),
442 (void **)&pInterface, pCppI->getOid().pData,
443 (typelib_InterfaceTypeDescription *)pTD );
444
445 if (pInterface)
446 {
447 ::uno_any_construct(
448 reinterpret_cast< uno_Any * >( gpreg[0] ),
449 &pInterface, pTD, cpp_acquire );
450 pInterface->release();
451 TYPELIB_DANGER_RELEASE( pTD );
452 *(void **)pRegisterReturn = gpreg[0];
453 eRet = typelib_TypeClass_ANY;
454 break;
455 }
456 TYPELIB_DANGER_RELEASE( pTD );
457 }
458 } // else perform queryInterface()
459 default:
460 eRet = cpp2uno_call(
461 pCppI, aMemberDescr.get(),
462 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
463 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
464 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
465 gpreg, fpreg, ovrflw, pRegisterReturn );
466 }
467 break;
468 }
469 default:
470 {
471 throw RuntimeException( "no member description found!", (XInterface *)pCppI );
472 }
473 }
474
475 return eRet;
476}
477
478long privateSnippetExecutor(long r2, long r3, long r4, long r5, long r6, long firstonstack)
479{
480 register long r0 asm("r0");
481 sal_uInt64 nOffsetAndIndex = r0;
482
483 long sp = (long)&firstonstack;
484
485 sal_uInt64 gpreg[s390x::MAX_GPR_REGS];
486 gpreg[0] = r2;
487 gpreg[1] = r3;
488 gpreg[2] = r4;
489 gpreg[3] = r5;
490 gpreg[4] = r6;
491
492 double fpreg[s390x::MAX_SSE_REGS];
493 register double f0 asm("f0"); fpreg[0] = f0;
494 register double f2 asm("f2"); fpreg[1] = f2;
495 register double f4 asm("f4"); fpreg[2] = f4;
496 register double f6 asm("f6"); fpreg[3] = f6;
497
498 volatile long nRegReturn[1];
499#if OSL_DEBUG_LEVEL > 2
500 fprintf(stderr, "before mediate with %lx\n",nOffsetAndIndex);
501 fprintf(stderr, "doubles are %f %f %f %f\n", fpreg[0], fpreg[1], fpreg[2], fpreg[3]);
502#endif
503 typelib_TypeClass aType =
504 cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, (void**)sp,
505 (sal_Int64*)nRegReturn );
506#if OSL_DEBUG_LEVEL > 2
507 fprintf(stderr, "after mediate ret is %lx %ld\n", nRegReturn[0], nRegReturn[0]);
508#endif
509
510 switch( aType )
511 {
512 case typelib_TypeClass_BOOLEAN:
513 case typelib_TypeClass_BYTE:
514 nRegReturn[0] = (unsigned long)(*(unsigned char *)nRegReturn);
515 break;
516 case typelib_TypeClass_CHAR:
517 case typelib_TypeClass_UNSIGNED_SHORT:
518 case typelib_TypeClass_SHORT:
519 nRegReturn[0] = (unsigned long)(*(unsigned short *)nRegReturn);
520 break;
521 case typelib_TypeClass_ENUM:
522 case typelib_TypeClass_UNSIGNED_LONG:
523 case typelib_TypeClass_LONG:
524 nRegReturn[0] = (unsigned long)(*(unsigned int *)nRegReturn);
525 break;
526 case typelib_TypeClass_VOID:
527 default:
528 break;
529 case typelib_TypeClass_FLOAT:
530 {
531 double tmp = (double) (*((float *)nRegReturn));
532 (*((double *) nRegReturn)) = tmp;
533 }
534 //deliberate fall through
535 case typelib_TypeClass_DOUBLE:
536 __asm__ ( "ld 0,%0\n\t"
537 : : "m" (*((double*)nRegReturn)) );
538 break;
539 }
540 return nRegReturn[0];
541}
542
543const int codeSnippetSize = 32;
544
545unsigned char *codeSnippet( unsigned char * code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, bool simple_ret_type )
546{
547 sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_Int64) nFunctionIndex );
548
549 if (! simple_ret_type)
550 nOffsetAndIndex |= 0x80000000;
551
552 unsigned char * p = code;
553 *(short *)&p[0] = 0x0d10; /* basr %r1,0 */
554 *(short *)&p[2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */
555 *(short *)&p[4] = 0x100e;
556 *(short *)&p[6] = 0x0004;
557 *(short *)&p[8] = 0x07f1; /* br %r1 */
558 *(long *)&p[16] = (long)nOffsetAndIndex;
559 *(long *)&p[24] = (long)&privateSnippetExecutor;
560 return (code + codeSnippetSize);
561}
562}
563
564void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *)
565{
566}
567
569
572{
573 return static_cast< Slot * >(block) + 2;
574}
575
577 sal_Int32 slotCount)
578{
579 return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
580}
581
584 void * block, sal_Int32 slotCount, sal_Int32,
585 typelib_InterfaceTypeDescription *)
586{
587 Slot * slots = mapBlockToVtable(block);
588 slots[-2].fn = 0;
589 slots[-1].fn = 0;
590 return slots + slotCount;
591}
592
594 Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
595 typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
596 sal_Int32 functionCount, sal_Int32 vtableOffset)
597{
598 (*slots) -= functionCount;
599 Slot * s = *slots;
600#if OSL_DEBUG_LEVEL > 2
601 fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
602 fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
603#endif
604
605 for (sal_Int32 i = 0; i < type->nMembers; ++i) {
606 typelib_TypeDescription * member = 0;
607 TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
608 assert(member != 0);
609 switch (member->eTypeClass) {
610 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
611 // Getter:
612 (s++)->fn = code + writetoexecdiff;
614 code, functionOffset++, vtableOffset,
616 reinterpret_cast<
617 typelib_InterfaceAttributeTypeDescription * >(
618 member)->pAttributeTypeRef));
619
620 // Setter:
621 if (!reinterpret_cast<
622 typelib_InterfaceAttributeTypeDescription * >(
623 member)->bReadOnly)
624 {
625 (s++)->fn = code + writetoexecdiff;
626 code = codeSnippet(code, functionOffset++, vtableOffset, true);
627 }
628 break;
629
630 case typelib_TypeClass_INTERFACE_METHOD:
631 (s++)->fn = code + writetoexecdiff;
633 code, functionOffset++, vtableOffset,
635 reinterpret_cast<
636 typelib_InterfaceMethodTypeDescription * >(
637 member)->pReturnTypeRef));
638 break;
639
640 default:
641 assert(false);
642 break;
643 }
644 TYPELIB_DANGER_RELEASE(member);
645 }
646 return code;
647}
648
649/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
uno_Mapping * getUno2Cpp()
Definition: bridge.hxx:73
uno_ExtEnvironment * getCppEnv()
Definition: bridge.hxx:69
uno_Mapping * getCpp2Uno()
Definition: bridge.hxx:72
A cpp proxy wrapping a uno interface.
static CppInterfaceProxy * castInterfaceToProxy(void *pInterface)
typelib_InterfaceTypeDescription * getTypeDescr()
static Slot * mapBlockToVtable(void *block)
Given a pointer to a block, turn it into a vtable pointer.
static void flushCode(unsigned char const *begin, unsigned char const *end)
Flush all the generated code snippets of a vtable, on platforms that require it.
static unsigned char * addLocalFunctions(Slot **slots, unsigned char *code, sal_PtrDiff writetoexecdiff, typelib_InterfaceTypeDescription const *type, sal_Int32 functionOffset, sal_Int32 functionCount, sal_Int32 vtableOffset)
Fill the vtable slots corresponding to all local (i.e., not inherited) functions of a given interface...
static Slot * initializeBlock(void *block, sal_Int32 slotCount, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription *type)
Initialize a raw vtable block.
static std::size_t getBlockSize(sal_Int32 slotCount)
Calculate the size of a raw vtable block.
void SAL_CALL uno_destructData(void *pValue, typelib_TypeDescription *pTypeDescr, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
void SAL_CALL uno_copyAndConvertData(void *pDest, void *pSource, typelib_TypeDescription *pTypeDescr, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
register sal_uInt32 r28 __asm__("%r28")
void(* privateSnippetExecutor)()
const int codeSnippetSize
static unsigned char * codeSnippet(unsigned char *code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, bool bHasHiddenParam)
static int cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy *pThis, const typelib_TypeDescription *pMemberTypeDescr, typelib_TypeDescriptionReference *pReturnTypeRef, sal_Int32 nParams, typelib_MethodParameter *pParams, void **gpreg, void **fpreg, void **ovrflw, sal_uInt64 *pRegisterReturn)
sal_Int32 nIndex
void * p
sal_uInt16 nPos
#define SAL_WARN(area, stream)
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:52
struct _uno_Any uno_Any
Definition: msvc/except.hxx:31
typelib_TypeClass __cdecl cpp_mediate(void **pCallStack, const sal_Int32 nFunctionIndex, const sal_Int32 nVtableOffset, sal_Int64 *const pRegisterReturn)
void raiseException(uno_Any *pUnoExc, uno_Mapping *pUno2Cpp)
bool isSimpleType(typelib_TypeClass typeClass)
Determines whether a type is a "simple" type (VOID, BOOLEAN, BYTE, SHORT, UNSIGNED SHORT,...
Definition: types.cxx:28
bool relatesToInterfaceType(typelib_TypeDescription const *type)
Determines whether a type relates to an interface type (is itself an interface type,...
Definition: types.cxx:41
Type
int i
sal_Unicode code
#define sal_True
#define sal_False
ResultType type