LibreOffice Module bridges (master) 1
gcc3_linux_s390/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 <string.h>
34
35using namespace ::com::sun::star::uno;
36
37namespace
38{
39
40static typelib_TypeClass cpp2uno_call(
42 const typelib_TypeDescription * pMemberTypeDescr,
43 typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
44 sal_Int32 nParams, typelib_MethodParameter * pParams,
45 void ** gpreg, void ** fpreg, void ** ovrflw,
46 sal_Int64 * pRegisterReturn /* space for register return */ )
47{
48 int ng = 0; //number of gpr registers used
49 int nf = 0; //number of fpr registers used
50 void ** pCppStack; //temporary stack pointer
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_Int32), "### 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
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 (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
104 {
105
106 switch (pParamTypeDescr->eTypeClass)
107 {
108
109 case typelib_TypeClass_DOUBLE:
110 if (nf < 2) {
111 pCppArgs[nPos] = fpreg;
112 pUnoArgs[nPos] = fpreg;
113 nf++;
114 fpreg += 2;
115 } else {
116 pCppArgs[nPos] = ovrflw;
117 pUnoArgs[nPos] = ovrflw;
118 ovrflw += 2;
119 }
120 break;
121
122 case typelib_TypeClass_FLOAT:
123 // fpreg are all double values so need to
124 // modify fpreg to be a single word float value
125 if (nf < 2) {
126// float tmp = (float) (*((double *)fpreg));
127// (*((float *) fpreg)) = tmp;
128 pCppArgs[nPos] = fpreg;
129 pUnoArgs[nPos] = fpreg;
130 nf++;
131 fpreg += 2;
132 } else {
133 pCppArgs[nPos] = ovrflw;
134 pUnoArgs[nPos] = ovrflw;
135 ovrflw += 1;
136 }
137 break;
138
139 case typelib_TypeClass_HYPER:
140 case typelib_TypeClass_UNSIGNED_HYPER:
141 if (ng < 4) {
142 pCppArgs[nPos] = gpreg;
143 pUnoArgs[nPos] = gpreg;
144 ng += 2;
145 gpreg += 2;
146 } else {
147 pCppArgs[nPos] = ovrflw;
148 pUnoArgs[nPos] = ovrflw;
149 ovrflw += 2;
150 }
151 break;
152
153 case typelib_TypeClass_BYTE:
154 case typelib_TypeClass_BOOLEAN:
155 if (ng < 5) {
156 pCppArgs[nPos] = (((char *)gpreg) + 3);
157 pUnoArgs[nPos] = (((char *)gpreg) + 3);
158 ng++;
159 gpreg++;
160 } else {
161 pCppArgs[nPos] = (((char *)ovrflw) + 3);
162 pUnoArgs[nPos] = (((char *)ovrflw) + 3);
163 ovrflw++;
164 }
165 break;
166
167
168 case typelib_TypeClass_CHAR:
169 case typelib_TypeClass_SHORT:
170 case typelib_TypeClass_UNSIGNED_SHORT:
171 if (ng < 5) {
172 pCppArgs[nPos] = (((char *)gpreg)+ 2);
173 pUnoArgs[nPos] = (((char *)gpreg)+ 2);
174 ng++;
175 gpreg++;
176 } else {
177 pCppArgs[nPos] = (((char *)ovrflw) + 2);
178 pUnoArgs[nPos] = (((char *)ovrflw) + 2);
179 ovrflw++;
180 }
181 break;
182
183
184 default:
185 if (ng < 5) {
186 pCppArgs[nPos] = gpreg;
187 pUnoArgs[nPos] = gpreg;
188 ng++;
189 gpreg++;
190 } else {
191 pCppArgs[nPos] = ovrflw;
192 pUnoArgs[nPos] = ovrflw;
193 ovrflw++;
194 }
195 break;
196
197 }
198 // no longer needed
199 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
200 }
201 else // ptr to complex value | ref
202 {
203
204 if (ng < 5) {
205 pCppArgs[nPos] = *(void **)gpreg;
206 pCppStack = gpreg;
207 ng++;
208 gpreg++;
209 } else {
210 pCppArgs[nPos] = *(void **)ovrflw;
211 pCppStack = ovrflw;
212 ovrflw++;
213 }
214
215 if (! rParam.bIn) // is pure out
216 {
217 // uno out is unconstructed mem!
218 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
219 pTempIndices[nTempIndices] = nPos;
220 // will be released at reconversion
221 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
222 }
223 // is in/inout
224 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
225 {
226 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
227 *(void **)pCppStack, pParamTypeDescr,
228 pThis->getBridge()->getCpp2Uno() );
229 pTempIndices[nTempIndices] = nPos; // has to be reconverted
230 // will be released at reconversion
231 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
232 }
233 else // direct way
234 {
235 pUnoArgs[nPos] = *(void **)pCppStack;
236 // no longer needed
237 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
238 }
239 }
240 }
241
242 // ExceptionHolder
243 uno_Any aUnoExc; // Any will be constructed by callee
244 uno_Any * pUnoExc = &aUnoExc;
245
246 // invoke uno dispatch call
247 (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
248
249 // in case an exception occurred...
250 if (pUnoExc)
251 {
252 // destruct temporary in/inout params
253 for ( ; nTempIndices--; )
254 {
255 sal_Int32 nIndex = pTempIndices[nTempIndices];
256
257 if (pParams[nIndex].bIn) // is in/inout => was constructed
258 uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
259 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
260 }
261 if (pReturnTypeDescr)
262 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
263
264 CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any
265 // is here for dummy
266 return typelib_TypeClass_VOID;
267 }
268 else // else no exception occurred...
269 {
270 // temporary params
271 for ( ; nTempIndices--; )
272 {
273 sal_Int32 nIndex = pTempIndices[nTempIndices];
274 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
275
276 if (pParams[nIndex].bOut) // inout/out
277 {
278 // convert and assign
279 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
280 uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
281 pThis->getBridge()->getUno2Cpp() );
282 }
283 // destroy temp uno param
284 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
285
286 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
287 }
288 // return
289 if (pCppReturn) // has complex return
290 {
291 if (pUnoReturn != pCppReturn) // needs reconversion
292 {
293 uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
294 pThis->getBridge()->getUno2Cpp() );
295 // destroy temp uno return
296 uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
297 }
298 // complex return ptr is set to return reg
299 *(void **)pRegisterReturn = pCppReturn;
300 }
301 if (pReturnTypeDescr)
302 {
303 typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
304 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
305 return eRet;
306 }
307 else
308 return typelib_TypeClass_VOID;
309 }
310}
311
312
313static typelib_TypeClass cpp_mediate(
314 sal_uInt32 nOffsetAndIndex,
315 void ** gpreg, void ** fpreg, void ** ovrflw,
316 sal_Int64 * pRegisterReturn /* space for register return */ )
317{
318 static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!");
319
320 sal_Int16 nVtableOffset = (nOffsetAndIndex >> 16);
321 sal_Int16 nFunctionIndex = (nOffsetAndIndex & 0xFFFF);
322
323 // gpreg: [ret *], this, [other gpr params]
324 // fpreg: [fpr params]
325 // ovrflw: [gpr or fpr params (properly aligned)]
326
327 // _this_ ptr is patched cppu_XInterfaceProxy object
328 void * pThis;
329 if( nFunctionIndex & 0x8000 )
330 {
331 nFunctionIndex &= 0x7fff;
332 pThis = gpreg[1];
333 }
334 else
335 {
336 pThis = gpreg[0];
337 }
338
339 pThis = static_cast< char * >(pThis) - nVtableOffset;
340
343 pThis);
344
345 typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
346
347
348 if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
349 {
350 SAL_WARN(
351 "bridges",
352 "illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
353 << " vtable index " << nFunctionIndex << "/"
354 << pTypeDescr->nMapFunctionIndexToMemberIndex);
355 throw RuntimeException(
356 ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
357 + " vtable index " + OUString::number(nFunctionIndex) + "/"
358 + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
359 (XInterface *)pCppI);
360 }
361
362 // determine called method
363 sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
364 assert(nMemberPos < pTypeDescr->nAllMembers);
365
366 TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
367
368 typelib_TypeClass eRet;
369 switch (aMemberDescr.get()->eTypeClass)
370 {
371 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
372 {
373 if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
374 {
375 // is GET method
376 eRet = cpp2uno_call(
377 pCppI, aMemberDescr.get(),
378 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
379 0, 0, // no params
380 gpreg, fpreg, ovrflw, pRegisterReturn );
381 }
382 else
383 {
384 // is SET method
385 typelib_MethodParameter aParam;
386 aParam.pTypeRef =
387 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
388 aParam.bIn = sal_True;
389 aParam.bOut = sal_False;
390
391 eRet = cpp2uno_call(
392 pCppI, aMemberDescr.get(),
393 0, // indicates void return
394 1, &aParam,
395 gpreg, fpreg, ovrflw, pRegisterReturn );
396 }
397 break;
398 }
399 case typelib_TypeClass_INTERFACE_METHOD:
400 {
401 // is METHOD
402 switch (nFunctionIndex)
403 {
404 case 1: // acquire()
405 pCppI->acquireProxy(); // non virtual call!
406 eRet = typelib_TypeClass_VOID;
407 break;
408 case 2: // release()
409 pCppI->releaseProxy(); // non virtual call!
410 eRet = typelib_TypeClass_VOID;
411 break;
412 case 0: // queryInterface() opt
413 {
414 typelib_TypeDescription * pTD = 0;
415 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
416 if (pTD)
417 {
418 XInterface * pInterface = 0;
419 (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
420 pCppI->getBridge()->getCppEnv(),
421 (void **)&pInterface, pCppI->getOid().pData,
422 (typelib_InterfaceTypeDescription *)pTD );
423
424 if (pInterface)
425 {
426 ::uno_any_construct(
427 reinterpret_cast< uno_Any * >( gpreg[0] ),
428 &pInterface, pTD, cpp_acquire );
429 pInterface->release();
430 TYPELIB_DANGER_RELEASE( pTD );
431 *(void **)pRegisterReturn = gpreg[0];
432 eRet = typelib_TypeClass_ANY;
433 break;
434 }
435 TYPELIB_DANGER_RELEASE( pTD );
436 }
437 } // else perform queryInterface()
438 default:
439 eRet = cpp2uno_call(
440 pCppI, aMemberDescr.get(),
441 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
442 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
443 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
444 gpreg, fpreg, ovrflw, pRegisterReturn );
445 }
446 break;
447 }
448 default:
449 {
450 throw RuntimeException( "no member description found!", (XInterface *)pCppI );
451 }
452 }
453
454 return eRet;
455}
456
461static void privateSnippetExecutor( sal_uInt32 nOffsetAndIndex, void** gpregptr, void** fpregptr, void** ovrflw)
462{
463#if OSL_DEBUG_LEVEL > 2
464 fprintf(stderr, "privateSnippetExecutor\n");
465#endif
466
467
468 sal_Int32 gpreg[8];
469 double fpreg[8];
470
471 memcpy( gpreg, gpregptr, 32);
472 memcpy( fpreg, fpregptr, 64);
473
474 volatile long nRegReturn[2];
475
476 typelib_TypeClass aType =
477 cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, ovrflw,
478 (sal_Int64*)nRegReturn );
479
480 switch( aType )
481 {
482
483 // move return value into register space
484 // (will be loaded by machine code snippet)
485
486 case typelib_TypeClass_BOOLEAN:
487 {
488 unsigned long tmp = (unsigned long)(*(unsigned char *)nRegReturn);
489 __asm__ volatile ( "l 2,%0\n\t" : :
490 "m"(tmp) : "2" );
491 break;
492 }
493 case typelib_TypeClass_BYTE:
494 {
495 long tmp = (long)(*(signed char *)nRegReturn);
496 __asm__ volatile ( "l 2,%0\n\t" : :
497 "m"(tmp) : "2" );
498 break;
499 }
500 case typelib_TypeClass_CHAR:
501 case typelib_TypeClass_UNSIGNED_SHORT:
502 {
503 unsigned long tmp = (unsigned long)(*(unsigned short *)nRegReturn);
504 __asm__ volatile ( "l 2,%0\n\t" : :
505 "m"(tmp) : "2" );
506 break;
507 }
508 case typelib_TypeClass_SHORT:
509 {
510 long tmp = (long)(*(short *)nRegReturn);
511 __asm__ volatile ( "l 2,%0\n\t" : :
512 "m"(tmp) : "2" );
513 break;
514 }
515 case typelib_TypeClass_FLOAT:
516 __asm__ volatile ( "le 0,%0\n\t" : :
517 "m" (*((float*)nRegReturn)) : "16" );
518 break;
519
520 case typelib_TypeClass_DOUBLE:
521 __asm__ volatile ( "ld 0,%0\n\t" : :
522 "m" (*((double*)nRegReturn)) : "16" );
523 break;
524
525 case typelib_TypeClass_HYPER:
526 case typelib_TypeClass_UNSIGNED_HYPER:
527 __asm__ volatile ( "lm 2,3,%0\n\t" : :
528 "m"(nRegReturn[0]) : "2", "3" );
529 break;
530
531 default:
532 __asm__ volatile ( "l 2,%0\n\t" : :
533 "m"(nRegReturn[0]) : "2" );
534 break;
535 }
536}
537
538const int codeSnippetSize = 50;
539
540unsigned char* codeSnippet( unsigned char * code, sal_Int16 nFunctionIndex, sal_Int16 nVtableOffset, bool simple_ret_type )
541{
542 sal_uInt32 nOffsetAndIndex = ( ( nVtableOffset ) << 16 ) | ( nFunctionIndex );
543
544 if (! simple_ret_type)
545 nOffsetAndIndex |= 0x8000;
546
547 static_assert(sizeof (long) == 4, "boo");
548
549 /* generate this code */
550 // lr %r0,%r13
551 // bras %r13,0x6
552 // .long privateSnippetExecutor
553 // .long nOffsetAndIndex
554 // stm %r2,%r6,8(%r15)
555 // std %f0,64(%r15)
556 // std %f2,72(%r15)
557
558 // l %r2,4(%r13)
559 // la %r3,8(%r15)
560 // la %r4,64(%r15)
561 // la %r5,96(%r15)
562 // l %r1,0(%r13)
563 // lr %r13,%r0
564 // br %r1
565
566 unsigned char * p = code;
567 *reinterpret_cast< sal_Int16 * >(p) = 0x180d;
568 p += sizeof(sal_Int16);
569 *reinterpret_cast< sal_Int32 * >(p) = 0xa7d50006;
570 p += sizeof(sal_Int32);
571 *reinterpret_cast< sal_Int32 * >(p) =
572 reinterpret_cast< sal_Int32 >(privateSnippetExecutor);
573 p += sizeof(sal_Int32);
574 *reinterpret_cast< sal_Int32 * >(p) = nOffsetAndIndex;
575 p += sizeof(sal_Int32);
576 *reinterpret_cast< sal_Int32 * >(p) = 0x9026f008;
577 p += sizeof(sal_Int32);
578 *reinterpret_cast< sal_Int32 * >(p) = 0x6000f040;
579 p += sizeof(sal_Int32);
580 *reinterpret_cast< sal_Int32 * >(p) = 0x6020f048;
581 p += sizeof(sal_Int32);
582 *reinterpret_cast< sal_Int32 * >(p) = 0x5820d004;
583 p += sizeof(sal_Int32);
584 *reinterpret_cast< sal_Int32 * >(p) = 0x4130f008;
585 p += sizeof(sal_Int32);
586 *reinterpret_cast< sal_Int32 * >(p) = 0x4140f040;
587 p += sizeof(sal_Int32);
588 *reinterpret_cast< sal_Int32 * >(p) = 0x4150f060;
589 p += sizeof(sal_Int32);
590 *reinterpret_cast< sal_Int32 * >(p) = 0x5810d000;
591 p += sizeof(sal_Int32);
592 *reinterpret_cast< sal_Int16 * >(p) = 0x18d0;
593 p += sizeof(sal_Int16);
594 *reinterpret_cast< sal_Int16 * >(p) = 0x07f1;
595 p += sizeof(sal_Int16);
596
597 return (code + codeSnippetSize);
598}
599}
600
601void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *)
602{
603}
604
606
609{
610 return static_cast< Slot * >(block) + 2;
611}
612
614 sal_Int32 slotCount)
615{
616 return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
617}
618
621 void * block, sal_Int32 slotCount, sal_Int32,
622 typelib_InterfaceTypeDescription *)
623{
624 Slot * slots = mapBlockToVtable(block);
625 slots[-2].fn = 0;
626 slots[-1].fn = 0;
627 return slots + slotCount;
628}
629
631 Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
632 typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
633 sal_Int32 functionCount, sal_Int32 vtableOffset)
634{
635 (*slots) -= functionCount;
636 Slot * s = *slots;
637#if OSL_DEBUG_LEVEL > 2
638 fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
639 fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
640#endif
641
642 for (sal_Int32 i = 0; i < type->nMembers; ++i) {
643 typelib_TypeDescription * member = 0;
644 TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
645 assert(member != 0);
646 switch (member->eTypeClass) {
647 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
648 // Getter:
649 (s++)->fn = code + writetoexecdiff;
651 code, functionOffset++, vtableOffset,
653 reinterpret_cast<
654 typelib_InterfaceAttributeTypeDescription * >(
655 member)->pAttributeTypeRef));
656
657 // Setter:
658 if (!reinterpret_cast<
659 typelib_InterfaceAttributeTypeDescription * >(
660 member)->bReadOnly)
661 {
662 (s++)->fn = code + writetoexecdiff;
663 code = codeSnippet(code, functionOffset++, vtableOffset, true);
664 }
665 break;
666
667 case typelib_TypeClass_INTERFACE_METHOD:
668 (s++)->fn = code + writetoexecdiff;
670 code, functionOffset++, vtableOffset,
672 reinterpret_cast<
673 typelib_InterfaceMethodTypeDescription * >(
674 member)->pReturnTypeRef));
675 break;
676
677 default:
678 assert(false);
679 break;
680 }
681 TYPELIB_DANGER_RELEASE(member);
682 }
683 return code;
684}
685
686/* 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