23#include <rtl/ustring.hxx>
25#include <typelib/typedescription.hxx>
29#include <unordered_map>
32#if defined(LINUX) || defined(OPENBSD) || defined(FREEBSD) \
33 || defined(NETBSD) || defined(DRAGONFLY) || defined (ANDROID) \
35#define USE_DOUBLE_MMAP
110 const Vtables&
getVtables(typelib_InterfaceTypeDescription * type);
133 typelib_InterfaceTypeDescription * type, sal_Int32 vtableNumber,
134 typelib_InterfaceTypeDescription * mostDerived,
bool includePrimary)
162 void * block, sal_Int32 slotCount, sal_Int32 vtableNumber,
163 typelib_InterfaceTypeDescription * type);
193 Slot ** slots,
unsigned char * code,
195 sal_PtrDiff writetoexecdiff,
197 typelib_InterfaceTypeDescription
const * type, sal_Int32 functionOffset,
198 sal_Int32 functionCount, sal_Int32 vtableOffset);
209 unsigned char const * begin,
unsigned char const * end);
211 typedef std::unordered_map< OUString, Vtables >
Map;
Hand out vtable structures for interface type descriptions.
std::unordered_map< OUString, Vtables > Map
bool createBlock(Block &block, sal_Int32 slotCount) const
const Vtables & getVtables(typelib_InterfaceTypeDescription *type)
Given an interface type description, return its corresponding vtable structure.
static Slot * mapBlockToVtable(void *block)
Given a pointer to a block, turn it into a vtable pointer.
VtableFactory & operator=(const VtableFactory &)=delete
sal_Int32 createVtables(GuardedBlocks &blocks, BaseOffset const &baseOffset, typelib_InterfaceTypeDescription *type, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription *mostDerived, bool includePrimary) const
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...
friend class GuardedBlocks
VtableFactory(VtableFactory const &)=delete
void freeBlock(Block const &block) const
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.
sal_Size size
The size of the raw vtable block, in bytes.
void * exec
When separately mmapping the block for writing and executing exec points to the same memory as start,...
int fd
File handle for the underlying anonymous file.
void * start
The start of the raw vtable block.
The vtable structure corresponding to an interface type.
std::unique_ptr< Block[]> blocks
An array of blocks, representing the multiple vtables of a (multiple-inheritance) type.
sal_Int32 count
The number of blocks/vtables.