LibreOffice Module bridges (master)  1
gcc3_aix_powerpc/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 #include <com/sun/star/uno/genfunc.hxx>
21 #include <sal/log.hxx>
22 #include <uno/data.h>
23 #include <typelib/typedescription.hxx>
24 
25 #include "bridge.hxx"
26 #include "cppinterfaceproxy.hxx"
27 #include "types.hxx"
28 #include "vtablefactory.hxx"
29 
30 #include "share.hxx"
31 
32 #include <string.h>
33 
34 using namespace ::com::sun::star::uno;
35 
36 namespace
37 {
38 
39 
40 static 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, double * fpreg, void ** ovrflw,
46  sal_uInt64 * pRegisterReturn /* space for register return */ )
47 {
48  // gpreg: [ret *], this, [gpr params]
49  // fpreg: [fpr params]
50  // ovrflw: [remainder of params]
51 
52  // return
53  typelib_TypeDescription * pReturnTypeDescr = 0;
54  if (pReturnTypeRef)
55  TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
56 
57  void * pUnoReturn = 0;
58  void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
59 
60  sal_Int32 ng = 0;
61  sal_Int32 nf = 0;
62 
63  ovrflw -= ppc::MAX_GPR_REGS;
64 
65  if (pReturnTypeDescr)
66  {
67  if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
68  pUnoReturn = pRegisterReturn; // direct way for simple types
69  else // complex return via ptr (pCppReturn)
70  {
71  pCppReturn = *gpreg;
72  ++gpreg;
73  ++ng;
74  ++ovrflw;
75 
76  pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
77  ? __builtin_alloca( pReturnTypeDescr->nSize )
78  : pCppReturn); // direct way
79  }
80  }
81  // pop this
82  ++gpreg;
83  ++ng;
84  ++ovrflw;
85 
86  // stack space
87  static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
88  // parameters
89  void ** pUnoArgs = (void **)__builtin_alloca( 4 * sizeof(void *) * nParams );
90  void ** pCppArgs = pUnoArgs + nParams;
91 
92  // indices of values this have to be converted (interface conversion cpp<=>uno)
93  sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
94 
95  // type descriptions for reconversions
96  typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
97 
98  sal_Int32 nTempIndices = 0;
99 
100  for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
101  {
102  const typelib_MethodParameter & rParam = pParams[nPos];
103  typelib_TypeDescription * pParamTypeDescr = 0;
104  TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
105 
106  if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
107  // value
108  {
109  switch (pParamTypeDescr->eTypeClass)
110  {
111  case typelib_TypeClass_BOOLEAN:
112  case typelib_TypeClass_BYTE:
113  if (ng < ppc::MAX_GPR_REGS)
114  {
115  *ovrflw = *gpreg++;
116  ++ng;
117  }
118  pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-1));
119  ++ovrflw;
120  break;
121  case typelib_TypeClass_CHAR:
122  case typelib_TypeClass_SHORT:
123  case typelib_TypeClass_UNSIGNED_SHORT:
124  if (ng < ppc::MAX_GPR_REGS)
125  {
126  *ovrflw = *gpreg++;
127  ++ng;
128  }
129  pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-2));
130  ++ovrflw;
131  break;
132  case typelib_TypeClass_HYPER:
133  case typelib_TypeClass_UNSIGNED_HYPER:
134  pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
135  for (int i = 0; i < 2; ++i)
136  {
137  if (ng < ppc::MAX_GPR_REGS)
138  {
139  *ovrflw = *gpreg++;
140  ++ng;
141  }
142  ++ovrflw;
143  }
144  break;
145  case typelib_TypeClass_DOUBLE:
146  if (nf < ppc::MAX_SSE_REGS)
147  {
148  pCppArgs[nPos] = pUnoArgs[nPos] = fpreg;
149  ++fpreg;
150  ++nf;
151  }
152  else
153  {
154  pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
155  }
156  if (ng < ppc::MAX_GPR_REGS)
157  {
158  ng+=2;
159  gpreg+=2;
160  }
161  ovrflw+=2;
162  break;
163  case typelib_TypeClass_FLOAT:
164  if (nf < ppc::MAX_SSE_REGS)
165  {
166  pCppArgs[nPos] = pUnoArgs[nPos] = fpreg;
167  ++fpreg;
168  ++nf;
169  }
170  else
171  {
172  pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
173  }
174  if (ng < ppc::MAX_GPR_REGS)
175  {
176  ++gpreg;
177  ++ng;
178  }
179  ++ovrflw;
180  break;
181  default:
182  if (ng < ppc::MAX_GPR_REGS)
183  {
184  *ovrflw = *gpreg++;
185  ++ng;
186  }
187  pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
188  ++ovrflw;
189  break;
190  }
191 
192  // no longer needed
193  TYPELIB_DANGER_RELEASE( pParamTypeDescr );
194  }
195  else // ptr to complex value | ref
196  {
197  void *pCppStack; //temporary stack pointer
198 
199  if (ng < ppc::MAX_GPR_REGS)
200  {
201  *ovrflw = *gpreg++;
202  ++ng;
203  }
204  pCppArgs[nPos] = pCppStack = *ovrflw++;
205 
206  if (! rParam.bIn) // is pure out
207  {
208  // uno out is unconstructed mem!
209  pUnoArgs[nPos] = __builtin_alloca( pParamTypeDescr->nSize );
210  pTempIndices[nTempIndices] = nPos;
211  // will be released at reconversion
212  ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
213  }
214  // is in/inout
215  else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
216  {
217  uno_copyAndConvertData( pUnoArgs[nPos] = __builtin_alloca( pParamTypeDescr->nSize ),
218  pCppStack, pParamTypeDescr,
219  pThis->getBridge()->getCpp2Uno() );
220  pTempIndices[nTempIndices] = nPos; // has to be reconverted
221  // will be released at reconversion
222  ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
223  }
224  else // direct way
225  {
226  pUnoArgs[nPos] = pCppStack;
227  // no longer needed
228  TYPELIB_DANGER_RELEASE( pParamTypeDescr );
229  }
230  }
231  }
232 
233  // ExceptionHolder
234  uno_Any aUnoExc; // Any will be constructed by callee
235  uno_Any * pUnoExc = &aUnoExc;
236 
237  // invoke uno dispatch call
238  (*pThis->getUnoI()->pDispatcher)(
239  pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
240 
241  // in case an exception occurred...
242  if (pUnoExc)
243  {
244  // destruct temporary in/inout params
245  for ( ; nTempIndices--; )
246  {
247  sal_Int32 nIndex = pTempIndices[nTempIndices];
248 
249  if (pParams[nIndex].bIn) // is in/inout => was constructed
250  uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
251  TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
252  }
253  if (pReturnTypeDescr)
254  TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
255 
257  &aUnoExc, pThis->getBridge()->getUno2Cpp() );
258  // has to destruct the any
259  // is here for dummy
260  return typelib_TypeClass_VOID;
261  }
262  else // else no exception occurred...
263  {
264  // temporary params
265  for ( ; nTempIndices--; )
266  {
267  sal_Int32 nIndex = pTempIndices[nTempIndices];
268  typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
269 
270  if (pParams[nIndex].bOut) // inout/out
271  {
272  // convert and assign
273  uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
274  uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
275  pThis->getBridge()->getUno2Cpp() );
276  }
277  // destroy temp uno param
278  uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
279 
280  TYPELIB_DANGER_RELEASE( pParamTypeDescr );
281  }
282  // return
283  if (pCppReturn) // has complex return
284  {
285  if (pUnoReturn != pCppReturn) // needs reconversion
286  {
287  uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
288  pThis->getBridge()->getUno2Cpp() );
289  // destroy temp uno return
290  uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
291  }
292  // complex return ptr is set to return reg
293  *(void **)pRegisterReturn = pCppReturn;
294  }
295  if (pReturnTypeDescr)
296  {
297  typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
298  TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
299  return eRet;
300  }
301  else
302  return typelib_TypeClass_VOID;
303  }
304 }
305 
306 
307 static typelib_TypeClass cpp_mediate(
308  sal_Int32 nFunctionIndex,
309  sal_Int32 nVtableOffset,
310  void ** gpreg, double * fpreg, void ** ovrflw,
311  sal_uInt64 * pRegisterReturn /* space for register return */ )
312 {
313  static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!");
314 
315  // gpreg: [ret *], this, [other gpr params]
316  // fpreg: [fpr params]
317  // ovrflw: [gpr or fpr params (in space allocated for all params properly aligned)]
318 
319  void * pThis;
320  if( nFunctionIndex & 0x8000 )
321  {
322  nFunctionIndex &= 0x7fff;
323  pThis = gpreg[1];
324  }
325  else
326  {
327  pThis = gpreg[0];
328  }
329 
330  pThis = static_cast< char * >(pThis) - nVtableOffset;
331 
334 
335  typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
336 
337  if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
338  {
339  SAL_WARN(
340  "bridges",
341  "illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
342  << " vtable index " << nFunctionIndex << "/"
343  << pTypeDescr->nMapFunctionIndexToMemberIndex);
344  throw RuntimeException(
345  ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
346  + " vtable index " + OUString::number(nFunctionIndex) + "/"
347  + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
348  (XInterface *)pThis);
349  }
350 
351  // determine called method
352  sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
353  assert(nMemberPos < pTypeDescr->nAllMembers);
354 
355  TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
356 
357  typelib_TypeClass eRet;
358  switch (aMemberDescr.get()->eTypeClass)
359  {
360  case typelib_TypeClass_INTERFACE_ATTRIBUTE:
361  {
362  if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
363  {
364  // is GET method
365  eRet = cpp2uno_call(
366  pCppI, aMemberDescr.get(),
367  ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
368  0, 0, // no params
369  gpreg, fpreg, ovrflw, pRegisterReturn );
370  }
371  else
372  {
373  // is SET method
374  typelib_MethodParameter aParam;
375  aParam.pTypeRef =
376  ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
377  aParam.bIn = sal_True;
378  aParam.bOut = sal_False;
379 
380  eRet = cpp2uno_call(
381  pCppI, aMemberDescr.get(),
382  0, // indicates void return
383  1, &aParam,
384  gpreg, fpreg, ovrflw, pRegisterReturn );
385  }
386  break;
387  }
388  case typelib_TypeClass_INTERFACE_METHOD:
389  {
390  // is METHOD
391  switch (nFunctionIndex)
392  {
393  case 1: // acquire()
394  pCppI->acquireProxy(); // non virtual call!
395  eRet = typelib_TypeClass_VOID;
396  break;
397  case 2: // release()
398  pCppI->releaseProxy(); // non virtual call!
399  eRet = typelib_TypeClass_VOID;
400  break;
401  case 0: // queryInterface() opt
402  {
403  typelib_TypeDescription * pTD = 0;
404  TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
405  if (pTD)
406  {
407  XInterface * pInterface = 0;
408  (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
409  pCppI->getBridge()->getCppEnv(),
410  (void **)&pInterface, pCppI->getOid().pData, (typelib_InterfaceTypeDescription *)pTD );
411 
412  if (pInterface)
413  {
414  ::uno_any_construct(
415  reinterpret_cast< uno_Any * >( gpreg[0] ),
416  &pInterface, pTD, cpp_acquire );
417  pInterface->release();
418  TYPELIB_DANGER_RELEASE( pTD );
419  *(void **)pRegisterReturn = gpreg[0];
420  eRet = typelib_TypeClass_ANY;
421  break;
422  }
423  TYPELIB_DANGER_RELEASE( pTD );
424  }
425  } // else perform queryInterface()
426  default:
427  eRet = cpp2uno_call(
428  pCppI, aMemberDescr.get(),
429  ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
430  ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
431  ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
432  gpreg, fpreg, ovrflw, pRegisterReturn );
433  }
434  break;
435  }
436  default:
437  {
438  throw RuntimeException( "no member description found!", (XInterface *)pThis );
439  }
440  }
441 
442  return eRet;
443 }
444 
445 
450 static sal_uInt64 cpp_vtable_call(sal_Int32 r3, sal_Int32 r4, sal_Int32 r5,
451  sal_Int32 r6, sal_Int32 r7, sal_Int32 r8, sal_Int32 r9,
452  sal_Int32 r10, sal_Int32 firstonstack)
453 {
454  volatile unsigned long nOffsetAndIndex;
455 
456  __asm__ __volatile__(
457  "mr %0, 11\n\t"
458  : "=r" (nOffsetAndIndex) : );
459 
460  sal_Int32 nVtableOffset = (nOffsetAndIndex >> 16);
461  sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFF);
462 
463  void ** ovrflw = (void**)&firstonstack;
464 
465  sal_Int32 gpreg[ppc::MAX_GPR_REGS];
466  gpreg[0] = r3;
467  gpreg[1] = r4;
468  gpreg[2] = r5;
469  gpreg[3] = r6;
470  gpreg[4] = r7;
471  gpreg[5] = r8;
472  gpreg[6] = r9;
473  gpreg[7] = r10;
474 
475  double fpreg[ppc::MAX_SSE_REGS];
476  register double d0 asm("fr1"); fpreg[0] = d0;
477  register double d1 asm("fr2"); fpreg[1] = d1;
478  register double d2 asm("fr3"); fpreg[2] = d2;
479  register double d3 asm("fr4"); fpreg[3] = d3;
480  register double d4 asm("fr5"); fpreg[4] = d4;
481  register double d5 asm("fr6"); fpreg[5] = d5;
482  register double d6 asm("fr7"); fpreg[6] = d6;
483  register double d7 asm("fr8"); fpreg[7] = d7;
484  register double d8 asm("fr9"); fpreg[8] = d8;
485  register double d9 asm("fr10"); fpreg[9] = d9;
486  register double d10 asm("fr11"); fpreg[10] = d10;
487  register double d11 asm("fr12"); fpreg[11] = d11;
488  register double d12 asm("fr13"); fpreg[12] = d12;
489 
490 #if OSL_DEBUG_LEVEL > 2
491  for(int i = 0; i < 8; ++i)
492  {
493  fprintf(stderr, "general reg %d is %x\n", i, gpreg[i]);
494  }
495  for(int i = 0; i < 13; ++i)
496  {
497  fprintf(stderr, "sse reg %d is %f\n", i, fpreg[i]);
498  fprintf(stderr, "sse reg %d is %llx\n", i, fpreg[i]);
499  }
500  for(int i = -8; i < 8; ++i)
501  {
502  fprintf(stderr, "overflow arg %d is %x\n", i, ovrflw[i]);
503  }
504 #endif
505  sal_uInt64 nRegReturn=0;
506 
507  typelib_TypeClass aType =
508  cpp_mediate( nFunctionIndex, nVtableOffset, (void**)gpreg, fpreg, ovrflw, &nRegReturn );
509 
510  sal_uInt32 *pRegReturn = (sal_uInt32*)&nRegReturn;
511  switch( aType )
512  {
513  case typelib_TypeClass_BOOLEAN:
514  pRegReturn[0] = (sal_uInt32)(*(char *)pRegReturn);
515  break;
516  case typelib_TypeClass_BYTE:
517  pRegReturn[0] = (sal_Int32)(*(unsigned char *)pRegReturn);
518  break;
519  case typelib_TypeClass_SHORT:
520  pRegReturn[0] = (sal_Int32)(*(short *)pRegReturn);
521  break;
522  case typelib_TypeClass_CHAR:
523  case typelib_TypeClass_UNSIGNED_SHORT:
524  pRegReturn[0] = (sal_uInt32)(*(unsigned short *)pRegReturn);
525  break;
526  case typelib_TypeClass_FLOAT:
527  __asm__("lfs 1,%0\n\t" : : "m"(*((float*)&nRegReturn)));
528  break;
529  case typelib_TypeClass_DOUBLE:
530  __asm__("lfd 1,%0\n\t" : : "m"(*((double*)&nRegReturn)));
531  break;
532  case typelib_TypeClass_HYPER:
533  case typelib_TypeClass_UNSIGNED_HYPER:
534  break;
535  default:
536  pRegReturn[0] = (sal_uInt32)(*(unsigned int*)pRegReturn);
537  break;
538  }
539  return nRegReturn;
540 }
541 
542 
543 int const codeSnippetSize = 3 * sizeof(void*);
544 
545 unsigned char * codeSnippet( unsigned char * code, sal_Int16 functionIndex,
546  sal_Int16 vtableOffset, bool simpleRetType )
547 {
548  sal_uInt32 nOffsetAndIndex = ( ( vtableOffset ) << 16 ) | (functionIndex );
549  if (! simpleRetType )
550  nOffsetAndIndex |= 0x8000;
551 
552  void **raw = (void**)&code[0];
553  memcpy(raw, (char*)cpp_vtable_call, 2 * sizeof(void*));
554  raw[2] = (void*)nOffsetAndIndex;
555 
556  return (code + codeSnippetSize);
557 }
558 
559 }
560 
561 void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const * bptr, unsigned char const * eptr)
562 {
563  int const lineSize = 32;
564  for (unsigned char const * p = bptr; p < eptr + lineSize; p += lineSize) {
565  __asm__ volatile ("dcbst 0, %0" : : "r"(p) : "memory");
566  }
567  __asm__ volatile ("sync" : : : "memory");
568  for (unsigned char const * p = bptr; p < eptr + lineSize; p += lineSize) {
569  __asm__ volatile ("icbi 0, %0" : : "r"(p) : "memory");
570  }
571  __asm__ volatile ("isync" : : : "memory");
572 }
573 
575 
578 {
579  return static_cast< Slot * >(block) + 2;
580 }
581 
583  sal_Int32 slotCount)
584 {
585  return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
586 }
587 
590  void * block, sal_Int32 slotCount, sal_Int32,
591  typelib_InterfaceTypeDescription *)
592 {
593  Slot * slots = mapBlockToVtable(block);
594  slots[-2].fn = 0;
595  slots[-1].fn = 0;
596  return slots + slotCount;
597 }
598 
600  Slot ** slots, unsigned char * code,
601  typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
602  sal_Int32 functionCount, sal_Int32 vtableOffset)
603 {
604  (*slots) -= functionCount;
605  Slot * s = *slots;
606 
607  for (sal_Int32 i = 0; i < type->nMembers; ++i) {
608  typelib_TypeDescription * member = 0;
609  TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
610  assert(member != 0);
611  switch (member->eTypeClass) {
612  case typelib_TypeClass_INTERFACE_ATTRIBUTE:
613  // Getter:
614  (s++)->fn = code;
615  code = codeSnippet(
616  code, functionOffset++, vtableOffset,
618  reinterpret_cast<
619  typelib_InterfaceAttributeTypeDescription * >(
620  member)->pAttributeTypeRef));
621 
622  // Setter:
623  if (!reinterpret_cast<
624  typelib_InterfaceAttributeTypeDescription * >(
625  member)->bReadOnly)
626  {
627  (s++)->fn = code;
628  code = codeSnippet(code, functionOffset++, vtableOffset, true);
629  }
630  break;
631 
632  case typelib_TypeClass_INTERFACE_METHOD:
633  (s++)->fn = code;
634  code = codeSnippet(
635  code, functionOffset++, vtableOffset,
637  reinterpret_cast<
638  typelib_InterfaceMethodTypeDescription * >(
639  member)->pReturnTypeRef));
640  break;
641 
642  default:
643  assert(false);
644  break;
645  }
646  TYPELIB_DANGER_RELEASE(member);
647  }
648  return code;
649 }
650 
651 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static typelib_TypeClass 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 SAL_CALL uno_destructData(void *pValue, typelib_TypeDescription *pTypeDescr, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
bool isSimpleType(typelib_TypeClass typeClass)
Determines whether a type is a "simple" type (VOID, BOOLEAN, BYTE, SHORT, UNSIGNED SHORT...
Definition: types.cxx:28
static std::size_t getBlockSize(sal_Int32 slotCount)
Calculate the size of a raw vtable block.
bool bReadOnly
const int codeSnippetSize
bool relatesToInterfaceType(typelib_TypeDescription const *type)
Determines whether a type relates to an interface type (is itself an interface type, or might contain entities of interface type).
Definition: types.cxx:41
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static Slot * initializeBlock(void *block, sal_Int32 slotCount, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription *type)
Initialize a raw vtable block.
typelib_TypeClass __cdecl cpp_mediate(void **pCallStack, const sal_Int32 nFunctionIndex, const sal_Int32 nVtableOffset, sal_Int64 *const pRegisterReturn)
static Slot * mapBlockToVtable(void *block)
Given a pointer to a block, turn it into a vtable pointer.
struct _uno_Any uno_Any
Definition: msvc/except.hxx:31
uno_Mapping * getUno2Cpp()
Definition: bridge.hxx:73
uno_ExtEnvironment * getCppEnv()
Definition: bridge.hxx:69
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...
typelib_InterfaceTypeDescription * getTypeDescr()
A cpp proxy wrapping a uno interface.
int i
#define sal_True
void SAL_CALL uno_copyAndConvertData(void *pDest, void *pSource, typelib_TypeDescription *pTypeDescr, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:52
uno_Mapping * getCpp2Uno()
Definition: bridge.hxx:72
register sal_uInt32 r28 __asm__("%r28")
void raiseException(uno_Any *pUnoExc, uno_Mapping *pUno2Cpp)
static unsigned char * codeSnippet(unsigned char *code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, bool bHasHiddenParam)
void cpp_vtable_call(sal_Int32 func, sal_Int32 offset, void **pStack)
is called on incoming vtable calls (called by asm snippets)
#define sal_False
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.
void * p
#define SAL_WARN(area, stream)
static CppInterfaceProxy * castInterfaceToProxy(void *pInterface)
sal_uInt16 nPos