16#ifndef LLVM_CAS_ONDISKTRIERAWHASHMAP_H
17#define LLVM_CAS_ONDISKTRIERAWHASHMAP_H
94 return Offset.get() < (1LL << 48);
147 using ConstOnDiskPtr::PointerImpl::PointerImpl;
160 using OnDiskPtr::PointerImpl::PointerImpl;
200 assert(Allocated.Hash == Value.Hash);
201 assert(Allocated.Data.size() == Value.Data.size());
202 llvm::copy(Value.Data, Allocated.Data.begin());
224 std::optional<uint64_t> NewFileInitialSize,
225 std::shared_ptr<ondisk::OnDiskCASLogger>
Logger =
nullptr,
226 std::optional<size_t> NewTableNumRootBits = std::nullopt,
227 std::optional<size_t> NewTableNumSubtrieBits = std::nullopt);
236 std::unique_ptr<ImplType> Impl;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file declares interface for FileOffset that represent stored data at an offset from the beginnin...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Logging utility - given an ordered specification of features, and assuming a scalar reward,...
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
FileOffset is a wrapper around uint64_t to represent the offset of data from the beginning of the fil...
friend class OnDiskTrieRawHashMap
friend class OnDiskTrieRawHashMap
const ProxyT * operator->() const
FileOffset getOffset() const
const ProxyT & operator*() const
PointerImpl(ProxyT Value, FileOffset Offset, bool IsValue=true)
LLVM_DUMP_METHOD LLVM_ABI void dump() const
Expected< OnDiskPtr > insert(const ConstValueProxy &Value)
LLVM_ABI OnDiskTrieRawHashMap(OnDiskTrieRawHashMap &&RHS)
function_ref< void(FileOffset TentativeOffset, ValueProxy TentativeValue)> LazyInsertOnConstructCB
LLVM_ABI Error validate(function_ref< Error(FileOffset, ConstValueProxy)> RecordVerifier) const
Validate the trie data structure.
LLVM_ABI ConstOnDiskPtr find(ArrayRef< uint8_t > Hash) const
Find the value from hash.
static LLVM_ABI Expected< OnDiskTrieRawHashMap > create(const Twine &Path, const Twine &TrieName, size_t NumHashBits, uint64_t DataSize, uint64_t MaxFileSize, std::optional< uint64_t > NewFileInitialSize, std::shared_ptr< ondisk::OnDiskCASLogger > Logger=nullptr, std::optional< size_t > NewTableNumRootBits=std::nullopt, std::optional< size_t > NewTableNumSubtrieBits=std::nullopt)
Gets or creates a file at Path with a hash-mapped trie named TrieName.
LLVM_ABI size_t size() const
static bool validOffset(FileOffset Offset)
Check the valid range of file offset for OnDiskTrieRawHashMap.
LLVM_ABI Expected< OnDiskPtr > insertLazy(ArrayRef< uint8_t > Hash, LazyInsertOnConstructCB OnConstruct=nullptr, LazyInsertOnLeakCB OnLeak=nullptr)
Insert lazily.
LLVM_ABI size_t capacity() const
LLVM_ABI Expected< ConstOnDiskPtr > recoverFromFileOffset(FileOffset Offset) const
Helper function to recover a pointer into the trie from file offset.
LLVM_ABI OnDiskTrieRawHashMap & operator=(OnDiskTrieRawHashMap &&RHS)
LLVM_ABI void print(raw_ostream &OS, function_ref< void(ArrayRef< char >)> PrintRecordData=nullptr) const
function_ref< void(FileOffset TentativeOffset, ValueProxy TentativeValue, FileOffset FinalOffset, ValueProxy FinalValue)> LazyInsertOnLeakCB
LLVM_ABI ~OnDiskTrieRawHashMap()
Interface for logging low-level on-disk cas operations.
An efficient, type-erasing, non-owning reference to a callable.
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.
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Const value proxy to access the records stored in TrieRawHashMap.
ConstValueProxy(ArrayRef< uint8_t > Hash, StringRef Data)
ConstValueProxy(ArrayRef< uint8_t > Hash, ArrayRef< char > Data)
ConstValueProxy()=default
Value proxy to access the records stored in TrieRawHashMap.
ValueProxy(ArrayRef< uint8_t > Hash, MutableArrayRef< char > Data)
MutableArrayRef< char > Data