40 "expected value size of " +
itostr(ValueSize) +
43 auto ActionP = Cache.insertLazy(
50 return ActionP.takeError();
51 return (*ActionP)->Data;
62 if (!UnifiedCache || !UnifiedCache->UpstreamKVDB)
66 return UnifiedCache->faultInFromUpstreamKV(
Key);
73 std::shared_ptr<OnDiskCASLogger>
Logger) {
79 constexpr uint64_t MB = 1024ull * 1024ull;
80 constexpr uint64_t GB = 1024ull * 1024ull * 1024ull;
85 return CustomSize.takeError();
87 MaxFileSize = **CustomSize;
92 "llvm.actioncache[" + HashName +
"->" +
ValueName +
"]",
94 ValueSize, MaxFileSize, MB,
99 return std::unique_ptr<OnDiskKeyValueDB>(
100 new OnDiskKeyValueDB(ValueSize, std::move(*
ActionCache), Cache));
105 return Cache.validate(
108 auto formatError = [&](
Twine Msg) {
111 "bad cache value at 0x" +
116 if (
Record.Data.size() != ValueSize)
117 return formatError(
"wrong cache value size");
119 return formatError(
"wrong cache value alignment");
131 if (UnifiedCache && UnifiedCache->UpstreamKVDB) {
132 assert(UnifiedCache->UpstreamGraphDB &&
133 "upstream cache and cas must be paired");
135 UnifiedCache->UpstreamKVDB->ValueSize,
136 UnifiedCache->UpstreamGraphDB.get()))
141 UnifiedCache ? UnifiedCache->PrimaryGraphDB.get() :
nullptr);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_UNLIKELY(EXPR)
static constexpr StringLiteral ActionCacheFile
static Error validateOnDiskKeyValueDB(const OnDiskTrieRawHashMap &Cache, size_t ValueSize, OnDiskGraphDB *CAS)
This declares OnDiskKeyValueDB, a key value storage database of fixed size key and value.
This file declares interface for OnDiskTrieRawHashMap, a thread-safe and (mostly) lock-free hash map ...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Logging utility - given an ordered specification of features, and assuming a scalar reward,...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - 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.
A cache from a key (that describes an action) to the result of performing that action.
FileOffset is a wrapper around uint64_t to represent the offset of data from the beginning of the fil...
OnDiskTrieRawHashMap is a persistent trie data structure used as hash maps.
static LLVM_ABI_FOR_TEST 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.
On-disk CAS nodes database, independent of a particular hashing algorithm.
LLVM_ABI_FOR_TEST Error validateObjectID(ObjectID ID) const
Checks that ID exists in the index.
static LLVM_ABI_FOR_TEST Expected< std::unique_ptr< OnDiskKeyValueDB > > open(StringRef Path, StringRef HashName, unsigned KeySize, StringRef ValueName, size_t ValueSize, UnifiedOnDiskCache *UnifiedCache=nullptr, std::shared_ptr< OnDiskCASLogger > Logger=nullptr)
Open the on-disk store from a directory.
LLVM_ABI_FOR_TEST Expected< ArrayRef< char > > put(ArrayRef< uint8_t > Key, ArrayRef< char > Value)
Associate a value with a key.
LLVM_ABI_FOR_TEST Expected< std::optional< ArrayRef< char > > > get(ArrayRef< uint8_t > Key)
LLVM_ABI_FOR_TEST Error validate() const
Validate the storage.
A unified CAS nodes and key-value database, using on-disk storage for both.
static LLVM_ABI_FOR_TEST ObjectID getObjectIDFromValue(ArrayRef< char > Value)
Helper function to convert the value stored in KeyValueDB and ObjectID.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
constexpr StringLiteral CASFormatVersion
The version for all the ondisk database files.
Expected< std::optional< uint64_t > > getOverriddenMaxMappingSize()
Retrieves an overridden maximum mapping size for CAS files, if any, speicified by LLVM_CAS_MAX_MAPPIN...
LLVM_ABI std::error_code create_directories(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
StringMapEntry< Value * > ValueName
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
OutputIt copy(R &&Range, OutputIt Out)
std::string itostr(int64_t X)
bool isAddrAligned(Align Lhs, const void *Addr)
Checks that Addr is a multiple of the alignment.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Const value proxy to access the records stored in TrieRawHashMap.
Value proxy to access the records stored in TrieRawHashMap.
MutableArrayRef< char > Data