introspection major optimization
This commit is contained in:
@@ -20,27 +20,48 @@
|
||||
#ifndef PIINTROSPECTION_CONTAINERS_H
|
||||
#define PIINTROSPECTION_CONTAINERS_H
|
||||
|
||||
#include "pibase.h"
|
||||
|
||||
struct PIP_EXPORT PIIntrospectionContainersType {
|
||||
~PIIntrospectionContainersType();
|
||||
void finish();
|
||||
uint id = 0;
|
||||
const char * name = nullptr;
|
||||
const char * demangled = "?";
|
||||
bool inited = false;
|
||||
bool has_demangled = false;
|
||||
};
|
||||
|
||||
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
|
||||
|
||||
#include "piintrospection_base.h"
|
||||
|
||||
class PIIntrospectionContainers;
|
||||
|
||||
#define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())//(PIIntrospectionContainersInterface::instance())
|
||||
template<typename T>
|
||||
class PIIntrospectionContainersTypeInfo {
|
||||
public:
|
||||
static const PIIntrospectionContainersType & get() {
|
||||
static PIIntrospectionContainersType ret = create();
|
||||
return ret;
|
||||
}
|
||||
private:
|
||||
static PIIntrospectionContainersType create() {
|
||||
PIIntrospectionContainersType ret;
|
||||
ret.name = __PIP_TYPENAME__(T);
|
||||
ret.finish();
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CC_GCC
|
||||
# include <typeinfo>
|
||||
# define _PIIS_TYPENAME_(t) typeid(t).name()
|
||||
#else
|
||||
# define _PIIS_TYPENAME_(t) ""
|
||||
#endif
|
||||
#define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())
|
||||
|
||||
# define PIINTROSPECTION_CONTAINER_NEW(t, isz) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t), isz);
|
||||
# define PIINTROSPECTION_CONTAINER_DELETE(t) PIINTROSPECTION_CONTAINERS->containerDelete(_PIIS_TYPENAME_(t));
|
||||
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) PIINTROSPECTION_CONTAINERS->containerAlloc (_PIIS_TYPENAME_(t), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (_PIIS_TYPENAME_(t), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_USED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUsed (_PIIS_TYPENAME_(t), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUnused(_PIIS_TYPENAME_(t), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_NEW(t, isz) PIINTROSPECTION_CONTAINERS->containerNew (PIIntrospectionContainersTypeInfo<t>::get(), isz);
|
||||
# define PIINTROSPECTION_CONTAINER_DELETE(t) PIINTROSPECTION_CONTAINERS->containerDelete(PIIntrospectionContainersTypeInfo<t>::get());
|
||||
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) PIINTROSPECTION_CONTAINERS->containerAlloc (PIIntrospectionContainersTypeInfo<t>::get(), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (PIIntrospectionContainersTypeInfo<t>::get(), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_USED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUsed (PIIntrospectionContainersTypeInfo<t>::get(), cnt);
|
||||
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUnused(PIIntrospectionContainersTypeInfo<t>::get(), cnt);
|
||||
|
||||
|
||||
class PIP_EXPORT PIIntrospectionContainersInterface {
|
||||
@@ -49,12 +70,12 @@ class PIP_EXPORT PIIntrospectionContainersInterface {
|
||||
public:
|
||||
__PIINTROSPECTION_SINGLETON_H__(Containers)
|
||||
|
||||
void containerNew (const char * tn, uint isz);
|
||||
void containerDelete(const char * tn);
|
||||
void containerAlloc (const char * tn, ullong cnt);
|
||||
void containerFree (const char * tn, ullong cnt);
|
||||
void containerUsed (const char * tn, ullong cnt);
|
||||
void containerUnused(const char * tn, ullong cnt);
|
||||
void containerNew (const PIIntrospectionContainersType & ti, uint isz);
|
||||
void containerDelete(const PIIntrospectionContainersType & ti);
|
||||
void containerAlloc (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
void containerFree (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
void containerUsed (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
void containerUnused(const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
|
||||
PIIntrospectionContainers * p;
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user