LLDB mainline
|
Classes | |
struct | PoolEntry |
Public Types | |
typedef llvm::BumpPtrAllocatorImpl< llvm::MallocAllocator, AllocatorSlabSize, SizeThreshold, AllocatorGrowthDelay > | Allocator |
typedef const char * | StringPoolValueType |
typedef llvm::StringMap< StringPoolValueType, Allocator > | StringPool |
typedef llvm::StringMapEntry< StringPoolValueType > | StringPoolEntryType |
Public Member Functions | |
StringPoolValueType | GetMangledCounterpart (const char *ccstr) |
const char * | GetConstCString (const char *cstr) |
const char * | GetConstCStringWithLength (const char *cstr, size_t cstr_len) |
const char * | GetConstCStringWithStringRef (llvm::StringRef string_ref) |
const char * | GetConstCStringAndSetMangledCounterPart (llvm::StringRef demangled, const char *mangled_ccstr) |
const char * | GetConstTrimmedCStringWithLength (const char *cstr, size_t cstr_len) |
ConstString::MemoryStats | GetMemoryStats () const |
Static Public Member Functions | |
static StringPoolEntryType & | GetStringMapEntryFromKeyData (const char *keyData) |
static size_t | GetConstCStringLength (const char *ccstr) |
Static Public Attributes | |
static const size_t | AllocatorSlabSize = 4096 |
The default BumpPtrAllocatorImpl slab size. | |
static const size_t | SizeThreshold = AllocatorSlabSize |
static const size_t | AllocatorGrowthDelay = 1 |
Every Pool has its own allocator which receives an equal share of the ConstString allocations. | |
Protected Member Functions | |
PoolEntry & | selectPool (const llvm::StringRef &s) |
PoolEntry & | selectPool (uint32_t h) |
Protected Attributes | |
std::array< PoolEntry, 256 > | m_string_pools |
Definition at line 30 of file ConstString.cpp.
typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, AllocatorSlabSize, SizeThreshold, AllocatorGrowthDelay> Pool::Allocator |
Definition at line 60 of file ConstString.cpp.
typedef llvm::StringMap<StringPoolValueType, Allocator> Pool::StringPool |
Definition at line 62 of file ConstString.cpp.
typedef llvm::StringMapEntry<StringPoolValueType> Pool::StringPoolEntryType |
Definition at line 63 of file ConstString.cpp.
typedef const char* Pool::StringPoolValueType |
Definition at line 61 of file ConstString.cpp.
|
inline |
Definition at line 89 of file ConstString.cpp.
References GetConstCStringWithLength().
Referenced by lldb_private::ConstString::SetCString().
|
inline |
Definition at line 124 of file ConstString.cpp.
References GetStringMapEntryFromKeyData(), Pool::PoolEntry::m_mutex, Pool::PoolEntry::m_string_map, and selectPool().
Referenced by lldb_private::ConstString::SetStringWithMangledCounterpart().
|
inlinestatic |
Definition at line 70 of file ConstString.cpp.
References GetStringMapEntryFromKeyData().
Referenced by lldb_private::ConstString::GetLength().
|
inline |
Definition at line 95 of file ConstString.cpp.
References GetConstCStringWithStringRef().
Referenced by GetConstCString(), GetConstTrimmedCStringWithLength(), and lldb_private::ConstString::SetCStringWithLength().
|
inline |
Definition at line 101 of file ConstString.cpp.
References Pool::PoolEntry::m_mutex, Pool::PoolEntry::m_string_map, and selectPool().
Referenced by GetConstCStringWithLength(), and lldb_private::ConstString::SetString().
|
inline |
Definition at line 156 of file ConstString.cpp.
References GetConstCStringWithLength().
Referenced by lldb_private::ConstString::SetTrimmedCStringWithLength().
|
inline |
Definition at line 80 of file ConstString.cpp.
References GetStringMapEntryFromKeyData(), Pool::PoolEntry::m_mutex, and selectPool().
Referenced by lldb_private::ConstString::GetMangledCounterpart().
|
inline |
Definition at line 165 of file ConstString.cpp.
References lldb_private::ConstString::MemoryStats::bytes_total, lldb_private::ConstString::MemoryStats::bytes_used, and m_string_pools.
Referenced by lldb_private::ConstString::GetMemoryStats().
|
inlinestatic |
Definition at line 66 of file ConstString.cpp.
Referenced by GetConstCStringAndSetMangledCounterPart(), GetConstCStringLength(), and GetMangledCounterpart().
|
inlineprotected |
Definition at line 184 of file ConstString.cpp.
References selectPool().
Referenced by GetConstCStringAndSetMangledCounterPart(), GetConstCStringWithStringRef(), GetMangledCounterpart(), and selectPool().
|
inlineprotected |
Definition at line 188 of file ConstString.cpp.
References m_string_pools.
|
static |
Every Pool has its own allocator which receives an equal share of the ConstString allocations.
This means that when allocating many ConstStrings, every allocator sees only its small share of allocations and assumes LLDB only allocated a small amount of memory so far. In reality LLDB allocated a total memory that is N times as large as what the allocator sees (where N is the number of string pools). This causes that the BumpPtrAllocator continues a long time to allocate memory in small chunks which only makes sense when allocating a small amount of memory (which is true from the perspective of a single allocator). On some systems doing all these small memory allocations causes LLDB to spend a lot of time in malloc, so we need to force all these allocators to behave like one allocator in terms of scaling their memory allocations with increased demand. To do this we set the growth delay for each single allocator to a rate so that our pool of allocators scales their memory allocations similar to a single BumpPtrAllocatorImpl.
Currently we have 256 string pools and the normal growth delay of the BumpPtrAllocatorImpl is 128 (i.e., the memory allocation size increases every 128 full chunks), so by changing the delay to 1 we get a total growth delay in our allocator collection of 256/1 = 256. This is still only half as fast as a normal allocator but we can't go any faster without decreasing the number of string pools.
Definition at line 57 of file ConstString.cpp.
|
static |
The default BumpPtrAllocatorImpl slab size.
Definition at line 33 of file ConstString.cpp.
|
protected |
Definition at line 182 of file ConstString.cpp.
Referenced by GetMemoryStats(), and selectPool().
|
static |
Definition at line 34 of file ConstString.cpp.