LibreOffice Module bridges (master)  1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
bridges::cpp_uno::shared::VtableFactory Class Reference

Hand out vtable structures for interface type descriptions. More...

#include <vtablefactory.hxx>

Classes

class  BaseOffset
 
struct  Block
 A raw vtable block. More...
 
class  GuardedBlocks
 
struct  Slot
 
struct  Vtables
 The vtable structure corresponding to an interface type. More...
 

Public Member Functions

 VtableFactory ()
 
 ~VtableFactory ()
 
const VtablesgetVtables (typelib_InterfaceTypeDescription *type)
 Given an interface type description, return its corresponding vtable structure. More...
 

Static Public Member Functions

static SlotmapBlockToVtable (void *block)
 Given a pointer to a block, turn it into a vtable pointer. More...
 

Private Types

typedef std::unordered_map< OUString, VtablesMap
 

Private Member Functions

 VtableFactory (VtableFactory const &)=delete
 
VtableFactoryoperator= (const VtableFactory &)=delete
 
bool createBlock (Block &block, sal_Int32 slotCount) const
 
void freeBlock (Block const &block) const
 
sal_Int32 createVtables (GuardedBlocks &blocks, BaseOffset const &baseOffset, typelib_InterfaceTypeDescription *type, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription *mostDerived, bool includePrimary) const
 

Static Private Member Functions

static std::size_t getBlockSize (sal_Int32 slotCount)
 Calculate the size of a raw vtable block. More...
 
static SlotinitializeBlock (void *block, sal_Int32 slotCount, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription *type)
 Initialize a raw vtable block. More...
 
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 type (and generate any necessary code snippets for them). More...
 
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. More...
 

Private Attributes

osl::Mutex m_mutex
 
Map m_map
 
rtl_arena_type * m_arena
 

Friends

class GuardedBlocks
 

Detailed Description

Hand out vtable structures for interface type descriptions.

Definition at line 42 of file vtablefactory.hxx.

Member Typedef Documentation

typedef std::unordered_map< OUString, Vtables > bridges::cpp_uno::shared::VtableFactory::Map
private

Definition at line 211 of file vtablefactory.hxx.

Constructor & Destructor Documentation

VtableFactory::VtableFactory ( )

Definition at line 181 of file vtablefactory.cxx.

References m_arena, and void().

VtableFactory::~VtableFactory ( )

Definition at line 192 of file vtablefactory.cxx.

References freeBlock(), m_arena, m_map, and m_mutex.

bridges::cpp_uno::shared::VtableFactory::VtableFactory ( VtableFactory const &  )
privatedelete

Member Function Documentation

unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions ( Slot **  slots,
unsigned char *  code,
sal_PtrDiff  writetoexecdiff,
typelib_InterfaceTypeDescription const *  type,
sal_Int32  functionOffset,
sal_Int32  functionCount,
sal_Int32  vtableOffset 
)
staticprivate

Fill the vtable slots corresponding to all local (i.e., not inherited) functions of a given interface type (and generate any necessary code snippets for them).

Parameters
slotson input, points past the vtable slot to be filled with the last virtual function local to the given type; on output, points to the vtable slot filled with the first virtual function local to the given type
codepoints to the start of the area where code snippets can be generated
writetoexecdiffwhen the same code area is mapped twice, once for writing for code-generation, and once for code-execution, then this records the offset from a writable address to its executable address
typethe interface type description for which to generate vtable slots
functionOffsetthe function offset of the first vtable slot (typically coded into the code snippet for that vtable slot)
functionCountthe number of vtable slots to fill (the number of local functions of the given type, passed in so that it doesn't need to be recomputed)
vtableOffsetthe offset of this vtable (needed to adjust the this pointer, typically coded into the code snippets for all the filled vtable slots)
Returns
a pointer to the remaining code snippet area

Definition at line 599 of file gcc3_aix_powerpc/cpp2uno.cxx.

References assert(), bReadOnly, codeSnippet(), i, and bridges::cpp_uno::shared::isSimpleType().

Referenced by createVtables().

bool VtableFactory::createBlock ( Block block,
sal_Int32  slotCount 
) const
private
sal_Int32 VtableFactory::createVtables ( GuardedBlocks blocks,
BaseOffset const &  baseOffset,
typelib_InterfaceTypeDescription *  type,
sal_Int32  vtableNumber,
typelib_InterfaceTypeDescription *  mostDerived,
bool  includePrimary 
) const
private
void bridges::cpp_uno::shared::VtableFactory::flushCode ( unsigned char const *  begin,
unsigned char const *  end 
)
staticprivate

Flush all the generated code snippets of a vtable, on platforms that require it.

Parameters
beginpoints to the start of the code snippet area
endpoints behind the end of the code snippet area

Definition at line 561 of file gcc3_aix_powerpc/cpp2uno.cxx.

References __asm__(), and p.

Referenced by createVtables().

void VtableFactory::freeBlock ( Block const &  block) const
private
std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize ( sal_Int32  slotCount)
staticprivate

Calculate the size of a raw vtable block.

Parameters
slotCountthe number of virtual function slots the returned vtable block shall support (if there are any platform-specific slots, like an RTTI pointer, or a pointer to a destructor, they are not covered by slotCount)
Returns
the size of the raw vtable block, in bytes

Definition at line 582 of file gcc3_aix_powerpc/cpp2uno.cxx.

Referenced by createBlock().

const VtableFactory::Vtables & VtableFactory::getVtables ( typelib_InterfaceTypeDescription *  type)
bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock ( void block,
sal_Int32  slotCount,
sal_Int32  vtableNumber,
typelib_InterfaceTypeDescription *  type 
)
staticprivate

Initialize a raw vtable block.

Parameters
blockthe start address of the raw vtable block
slotCountthe number of slots
vtableNumberzero-based count across all the most derived type's vtables (for vtable's "offset to top" slot)
typenon-null most derived type (for vtable's "typeinfo pointer" slot)
Returns
a pointer past the last vtable slot

Definition at line 589 of file gcc3_aix_powerpc/cpp2uno.cxx.

References bridges::cpp_uno::shared::VtableFactory::Slot::fn.

Referenced by createVtables().

bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable ( void block)
static

Given a pointer to a block, turn it into a vtable pointer.

Definition at line 577 of file gcc3_aix_powerpc/cpp2uno.cxx.

Referenced by bridges::cpp_uno::shared::CppInterfaceProxy::create().

VtableFactory& bridges::cpp_uno::shared::VtableFactory::operator= ( const VtableFactory )
privatedelete

Friends And Related Function Documentation

friend class GuardedBlocks
friend

Definition at line 119 of file vtablefactory.hxx.

Member Data Documentation

rtl_arena_type* bridges::cpp_uno::shared::VtableFactory::m_arena
private

Definition at line 216 of file vtablefactory.hxx.

Referenced by createBlock(), freeBlock(), VtableFactory(), and ~VtableFactory().

Map bridges::cpp_uno::shared::VtableFactory::m_map
private

Definition at line 214 of file vtablefactory.hxx.

Referenced by getVtables(), and ~VtableFactory().

osl::Mutex bridges::cpp_uno::shared::VtableFactory::m_mutex
private

Definition at line 213 of file vtablefactory.hxx.

Referenced by getVtables(), and ~VtableFactory().


The documentation for this class was generated from the following files: