LibreOffice Module bridges (master) 1
|
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 Vtables & | getVtables (typelib_InterfaceTypeDescription *type) |
Given an interface type description, return its corresponding vtable structure. More... | |
Static Public Member Functions | |
static Slot * | mapBlockToVtable (void *block) |
Given a pointer to a block, turn it into a vtable pointer. More... | |
Private Types | |
typedef std::unordered_map< OUString, Vtables > | Map |
Private Member Functions | |
VtableFactory (VtableFactory const &)=delete | |
VtableFactory & | operator= (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 Slot * | initializeBlock (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 | |
std::mutex | m_mutex |
Map | m_map |
rtl_arena_type * | m_arena |
Friends | |
class | GuardedBlocks |
Hand out vtable structures for interface type descriptions.
Definition at line 42 of file vtablefactory.hxx.
|
private |
Definition at line 211 of file vtablefactory.hxx.
VtableFactory::VtableFactory | ( | ) |
Definition at line 203 of file vtablefactory.cxx.
References m_arena.
VtableFactory::~VtableFactory | ( | ) |
Definition at line 214 of file vtablefactory.cxx.
References freeBlock(), m_arena, m_map, and m_mutex.
|
privatedelete |
|
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).
slots | on 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 |
code | points to the start of the area where code snippets can be generated |
writetoexecdiff | when 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 |
type | the interface type description for which to generate vtable slots |
functionOffset | the function offset of the first vtable slot (typically coded into the code snippet for that vtable slot) |
functionCount | the 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) |
vtableOffset | the offset of this vtable (needed to adjust the this pointer, typically coded into the code snippets for all the filled vtable slots) |
Definition at line 496 of file gcc3_ios/cpp2uno.cxx.
References code, codeSnippet(), i, and type.
Referenced by createVtables().
|
private |
Definition at line 334 of file vtablefactory.cxx.
References getBlockSize(), m_arena, bridges::cpp_uno::shared::VtableFactory::Block::size, and bridges::cpp_uno::shared::VtableFactory::Block::start.
Referenced by createVtables().
|
private |
Definition at line 346 of file vtablefactory.cxx.
References addLocalFunctions(), code, createBlock(), createVtables(), bridges::cpp_uno::shared::VtableFactory::Block::exec, flushCode(), freeBlock(), bridges::cpp_uno::shared::VtableFactory::BaseOffset::getFunctionOffset(), bridges::cpp_uno::shared::getLocalFunctions(), bridges::cpp_uno::shared::getPrimaryFunctions(), i, initializeBlock(), bridges::cpp_uno::shared::VtableFactory::Block::start, type, and USE_DOUBLE_MMAP.
Referenced by createVtables(), and getVtables().
|
staticprivate |
Flush all the generated code snippets of a vtable, on platforms that require it.
begin | points to the start of the code snippet area |
end | points behind the end of the code snippet area |
Definition at line 544 of file gcc3_ios/cpp2uno.cxx.
Referenced by createVtables().
|
private |
Definition at line 341 of file vtablefactory.cxx.
References m_arena, bridges::cpp_uno::shared::VtableFactory::Block::size, and bridges::cpp_uno::shared::VtableFactory::Block::start.
Referenced by createVtables(), bridges::cpp_uno::shared::VtableFactory::GuardedBlocks::~GuardedBlocks(), and ~VtableFactory().
|
staticprivate |
Calculate the size of a raw vtable block.
slotCount | the 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) |
Definition at line 473 of file gcc3_ios/cpp2uno.cxx.
Referenced by createBlock().
const VtableFactory::Vtables & VtableFactory::getVtables | ( | typelib_InterfaceTypeDescription * | type | ) |
Given an interface type description, return its corresponding vtable structure.
Definition at line 226 of file vtablefactory.cxx.
References bridges::cpp_uno::shared::VtableFactory::Vtables::blocks, bridges::cpp_uno::shared::VtableFactory::Vtables::count, createVtables(), first, i, m_map, m_mutex, name, SAL_MAX_INT32, type, and bridges::cpp_uno::shared::VtableFactory::GuardedBlocks::unguard().
Referenced by bridges::cpp_uno::shared::CppInterfaceProxy::create().
|
staticprivate |
Initialize a raw vtable block.
block | the start address of the raw vtable block |
slotCount | the number of slots |
vtableNumber | zero-based count across all the most derived type's vtables (for vtable's "offset to top" slot) |
type | non-null most derived type (for vtable's "typeinfo pointer" slot) |
Definition at line 486 of file gcc3_ios/cpp2uno.cxx.
References bridges::cpp_uno::shared::VtableFactory::Slot::fn.
Referenced by createVtables().
|
static |
Given a pointer to a block, turn it into a vtable pointer.
Definition at line 468 of file gcc3_ios/cpp2uno.cxx.
Referenced by bridges::cpp_uno::shared::CppInterfaceProxy::create().
|
privatedelete |
|
friend |
Definition at line 120 of file vtablefactory.hxx.
|
private |
Definition at line 216 of file vtablefactory.hxx.
Referenced by createBlock(), freeBlock(), VtableFactory(), and ~VtableFactory().
|
private |
Definition at line 214 of file vtablefactory.hxx.
Referenced by getVtables(), and ~VtableFactory().
|
private |
Definition at line 213 of file vtablefactory.hxx.
Referenced by getVtables(), and ~VtableFactory().