clang-tools 24.0.0git
clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels > Class Template Reference

A thread-safe string pool that deduplicates strings into a PerThreadBumpPtrAllocator. More...

#include <ConcurrentStringPool.h>

Public Member Functions

 ConcurrentStringPoolImpl ()=default
 ~ConcurrentStringPoolImpl ()=default
 ConcurrentStringPoolImpl (const ConcurrentStringPoolImpl &)=delete
ConcurrentStringPoolImpl & operator= (const ConcurrentStringPoolImpl &)=delete
llvm::StringRef save (const char *S)
 Save string S in the arena.
llvm::StringRef save (const std::string &S)
llvm::StringRef save (const llvm::Twine &S)
llvm::StringRef save (llvm::StringRef S)

Detailed Description

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
class clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >

A thread-safe string pool that deduplicates strings into a PerThreadBumpPtrAllocator.

Keys are sharded by the upper bits of their hash. Each shard holds an array with a power-of-two number of slabs which are allocated on demand via LazyAtomicPointer. Lookups probe a small window in each slab and move to the next level when the window is full, avoiding locks and table rehashing.

Template Parameters
ShardBitsNumber of upper hash bits used to select a shard (1..31).
InitialSlabCapacityPower-of-two capacity of level 0.
ProbeWindowLinear probe window per level (1..InitialSlabCapacity).
NumLevelsNumber of doubling slab levels per shard; the largest slab (InitialSlabCapacity << (NumLevels - 1)) must not exceed 2^(32 - ShardBits), the bits of ProbeHash not consumed by ShardBits.

Definition at line 55 of file ConcurrentStringPool.h.

Constructor & Destructor Documentation

◆ ConcurrentStringPoolImpl() [1/2]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::ConcurrentStringPoolImpl ( )
default

◆ ~ConcurrentStringPoolImpl()

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::~ConcurrentStringPoolImpl ( )
default

◆ ConcurrentStringPoolImpl() [2/2]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::ConcurrentStringPoolImpl ( const ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels > & )
delete

Member Function Documentation

◆ operator=()

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
ConcurrentStringPoolImpl & clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::operator= ( const ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels > & )
delete

◆ save() [1/4]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
llvm::StringRef clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::save ( const char * S)
inline

Save string S in the arena.

Returns
a reference to the interned string.

Definition at line 105 of file ConcurrentStringPool.h.

References save().

Referenced by clang::doc::internString(), save(), save(), and save().

◆ save() [2/4]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
llvm::StringRef clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::save ( const llvm::Twine & S)
inline

Definition at line 111 of file ConcurrentStringPool.h.

References save().

◆ save() [3/4]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
llvm::StringRef clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::save ( const std::string & S)
inline

Definition at line 107 of file ConcurrentStringPool.h.

References save().

◆ save() [4/4]

template<size_t ShardBits = 10, uint32_t InitialSlabCapacity = 256, uint32_t ProbeWindow = 8, size_t NumLevels = 15>
llvm::StringRef clang::doc::ConcurrentStringPoolImpl< ShardBits, InitialSlabCapacity, ProbeWindow, NumLevels >::save ( llvm::StringRef S)
inline

Definition at line 119 of file ConcurrentStringPool.h.


The documentation for this class was generated from the following file: