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