13#ifndef LLVM_EXECUTIONENGINE_ORC_SYMBOLSTRINGPOOL_H
14#define LLVM_EXECUTIONENGINE_ORC_SYMBOLSTRINGPOOL_H
27class SymbolStringPtrBase;
29class NonOwningSymbolStringPtr;
56 using RefCountType = std::atomic<size_t>;
59 mutable std::mutex PoolMutex;
79 explicit operator bool()
const {
return S; }
112 std::numeric_limits<uintptr_t>::max()
116 (std::numeric_limits<uintptr_t>::max() - 1)
120 (std::numeric_limits<uintptr_t>::max() - 3)
179 assert(
S->
getValue() &&
"Releasing SymbolStringPtr with zero ref count");
254 using SymbolStringPtrBase::operator=;
273 "SymbolStringPtr constructed from invalid non-owning pointer.");
282 assert(Pool.
empty() &&
"Dangling references at pool destruction time");
287 std::lock_guard<std::mutex> Lock(PoolMutex);
295 std::lock_guard<std::mutex> Lock(PoolMutex);
298 if (Tmp->second == 0)
304 std::lock_guard<std::mutex> Lock(PoolMutex);
319 return orc::SymbolStringPtr::getEmptyVal();
323 return orc::SymbolStringPtr::getTombstoneVal();
339 return orc::NonOwningSymbolStringPtr::getEmptyVal();
343 return orc::NonOwningSymbolStringPtr::getTombstoneVal();
This file defines the StringMap class.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const ValueTy & getValue() const
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&...Args)
Emplace a new element for the specified key into the map if the key isn't already in the map.
StringRef - Represent a constant reference to a string, i.e.
Non-owning SymbolStringPool entry pointer.
NonOwningSymbolStringPtr()=default
Provides unsafe access to ownership operations on SymbolStringPtr.
static SymbolStringPoolEntryUnsafe from(const SymbolStringPtr &S)
Create an unsafe pool entry ref without changing the ref-count.
SymbolStringPtr copyToSymbolStringPtr()
Creates a SymbolStringPtr for this entry, with the SymbolStringPtr retaining the entry as usual.
SymbolStringPoolEntryUnsafe(PoolEntry *E)
static SymbolStringPoolEntryUnsafe take(SymbolStringPtr &&S)
Consumes the given SymbolStringPtr without releasing the pool entry.
SymbolStringPtr moveToSymbolStringPtr()
Creates a SymbolStringPtr for this entry without performing a retain operation during construction.
String pool for symbol names used by the JIT.
friend raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPool &SSP)
Dump a SymbolStringPool. Useful for debugging dangling-pointer crashes.
SymbolStringPtr intern(StringRef S)
Create a symbol string pointer from the given string.
bool empty() const
Returns true if the pool is empty.
friend class SymbolStringPoolTest
~SymbolStringPool()
Destroy a SymbolStringPool.
void clearDeadEntries()
Remove from the pool any entries that are no longer referenced.
Base class for both owning and non-owning symbol-string ptrs.
static bool isRealPoolEntry(PoolEntryPtr P)
friend bool operator!=(SymbolStringPtrBase LHS, SymbolStringPtrBase RHS)
bool poolEntryIsAlive() const
SymbolStringPtrBase()=default
friend bool operator<(SymbolStringPtrBase LHS, SymbolStringPtrBase RHS)
friend bool operator==(SymbolStringPtrBase LHS, SymbolStringPtrBase RHS)
static constexpr uintptr_t InvalidPtrMask
size_t getRefCount() const
StringRef operator*() const
static constexpr uintptr_t EmptyBitPattern
static constexpr uintptr_t TombstoneBitPattern
SymbolStringPtrBase(PoolEntryPtr S)
SymbolStringPtrBase(std::nullptr_t)
Pointer to a pooled string representing a symbol name.
SymbolStringPtr()=default
SymbolStringPtr(const SymbolStringPtr &Other)
SymbolStringPtr(std::nullptr_t)
SymbolStringPtr & operator=(SymbolStringPtr &&Other)
SymbolStringPtr & operator=(const SymbolStringPtr &Other)
SymbolStringPtr(SymbolStringPtr &&Other)
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static orc::NonOwningSymbolStringPtr getEmptyKey()
static bool isEqual(const orc::SymbolStringPtrBase &LHS, const orc::SymbolStringPtrBase &RHS)
static unsigned getHashValue(const orc::SymbolStringPtrBase &V)
static orc::NonOwningSymbolStringPtr getTombstoneKey()
static orc::SymbolStringPtr getEmptyKey()
static bool isEqual(const orc::SymbolStringPtrBase &LHS, const orc::SymbolStringPtrBase &RHS)
static unsigned getHashValue(const orc::SymbolStringPtrBase &V)
static orc::SymbolStringPtr getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...