7#if ALIB_MONOMEM && ALIB_CONTAINERS
9 CustomFunctionKey, CustomFunctionMapped,
13std::unordered_map< CustomFunctionKey, CustomFunctionMapped,
15 CustomFunctionEqualTo > customFunctionMap;
20#if ALIB_MONOMEM && ALIB_CONTAINERS
25 std::unordered_set< lang::TypeFunctors::Key , lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownCustomFunctions;
26 std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTables;
27 std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTablesArray;
31void DbgLockMaps(
bool doLock ) {
32 #if ALIB_SINGLE_THREADED
37 ALIB_DBG(dbgLock.Dbg.Name=
"DbgBoxing";)
55#if (ALIB_MONOMEM && ALIB_CONTAINERS && ALIB_DEBUG)
57 #if ALIB_MONOMEM && ALIB_DEBUG_BOXING
58 debug::DbgKnownCustomFunctions.Reset();
59 debug::DbgKnownVTables .Reset();
60 debug::DbgKnownVTablesArray .Reset();
62 customFunctionMap .Reset();
68#if ALIB_MONOMEM && ALIB_CONTAINERS
69 auto it= customFunctionMap.Find( CustomFunctionKey(
this, rtti) );
71 auto it= customFunctionMap.find( CustomFunctionKey(
this, rtti) );
73 if ( it != customFunctionMap.end() ) {
75 ++it->second.DbgCntInvocations; )
76 return it->second.Implementation;
83 debug::DbgLockMaps(
true);
85 debug::DbgKnownCustomFunctions.InsertIfNotExistent( &rtti );
87 debug::DbgKnownCustomFunctions.emplace( &rtti );
89 debug::DbgLockMaps(
false);
93 #if ALIB_MONOMEM && ALIB_CONTAINERS
94 customFunctionMap.InsertOrAssign( CustomFunctionKey(
this, rtti), CustomFunctionMapped(impl) );
96 if( customFunctionMap.size() == 0 )
97 customFunctionMap.reserve( 50 );
98 customFunctionMap.insert_or_assign( CustomFunctionKey(
this, rtti), CustomFunctionMapped(impl) );
115 std::vector<detail::VTable*> result;
117 result.reserve(
size_t(
118 DbgKnownVTables .Size()
119 + DbgKnownVTablesArray.Size() ) );
121 result.reserve( DbgKnownVTables .size()
122 + DbgKnownVTablesArray.size() );
125 for(
int type= 0 ; type < 2 ; ++type ) {
126 auto& map= type == 0 ? DbgKnownVTables
127 : DbgKnownVTablesArray;
128 for(
auto it= map.begin() ; it!= map.end() ; ++it )
129 result.emplace_back( it->second );
137 std::vector<std::pair<const std::type_info*,uinteger>> result;
146 debug::DbgLockMaps(
true);
148 for (
auto* typeIt : debug::DbgKnownCustomFunctions ) {
150 auto usage= (std::numeric_limits<uinteger>::max)();
157 if( implIt != customFunctionMap.end() )
158 usage= implIt->second.DbgCntInvocations;
160 result.emplace_back( typeIt, usage );
162 debug::DbgLockMaps(
false);
168 std::vector<std::pair<const std::type_info*,uinteger>>& output ) {
180 for(
auto funcIt= customFunctionMap.begin() ; funcIt != customFunctionMap.end() ; ++funcIt )
181 if( funcIt->first.Parent == &functionTable )
182 output.emplace_back( &funcIt->first.Type , funcIt->second.DbgCntInvocations );
#define IF_ALIB_THREADS(...)
#define IF_ALIB_MONOMEM(...)
#define ALIB_CALLER_PRUNED
std::vector< std::pair< const std::type_info *, uinteger > > GetKnownFunctionTypes()
std::vector< detail::VTable * > GetKnownVTables()
void getFunctionTypes(const detail::FunctionTable &input, std::vector< std::pair< const std::type_info *, uinteger > > &output)
This namespace implements internals of namespace #"alib::boxing;2".
FunctionTable DEFAULT_FUNCTIONS
The default box-functions set.
TMonoAllocator< lang::HeapAllocator > GLOBAL_ALLOCATOR
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
containers::HashSet< TAllocator, T, THash, TEqual, THashCaching, TRecycling > HashSet
Type alias in namespace #"%alib". See type definition #"alib::containers::HashSet".
containers::HashMap< TAllocator, TKey, TMapped, THash, TEqual, THashCaching, TRecycling > HashMap
Type alias in namespace #"%alib".
threads::RecursiveLock RecursiveLock
Type alias in namespace #"%alib".
void setCustom(const std::type_info &rtti, void *implementation)
uinteger DbgCntInvocationsFHashcode
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFIsTrue
Debug-compilation counter for the number of invocations.
FIsNotNull::Signature fIsNotNull
Entry for built-in function #"FIsNotNull".
uinteger DbgCntInvocationsFIsLess
Debug-compilation counter for the number of invocations.
FIsTrue::Signature fIsTrue
Entry for built-in function #"FIsTrue".
FIsLess::Signature fIsLess
Entry for built-in function #"FIsLess".
void * getCustom(const std::type_info &rtti, bool isInvocation) const
FEquals::Signature fEquals
Entry for built-in function #"FEquals".
uinteger DbgCntInvocationsFIsNotNull
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFEquals
Debug-compilation counter for the number of invocations.
FClone::Signature fClone
Entry for built-in function #"FClone".
uinteger DbgCntInvocationsFClone
Debug-compilation counter for the number of invocations.
FHashcode::Signature fHashcode
Entry for built-in function #"FHashcode".
static void Shutdown()
Needs to be called only in debug versions to shut down internal hashtables cleanly.