14 Commits

Author SHA1 Message Date
Simon Pilgrim
2eb811239c
[CAS] getInternalFileBackedObjectData - fix MSVC not all control paths return a value warning. NFC. (#180499) 2026-02-09 10:52:31 +00:00
Argyrios Kyrtzidis
60ecb37896
[llvm/CAS] Add file-based APIs to OnDiskGraphDB (#179782)
These allow performing optimizations that reduce I/O and disk space
consumption. For example, when applicable, a file can be cloned directly
into the database directory, instead of needing to load it in memory and
then copy its contents into a new file.

These APIs are then used to optimize importing data from an upstream DB
by using file cloning where applicable.
2026-02-06 13:27:24 -08:00
Argyrios Kyrtzidis
29fd868691
[llvm/CAS] Improve layering and decouple UnifiedOnDiskCache from the builtin hash implementation (#177280) 2026-01-26 09:48:32 -08:00
Steven Wu
f7d32078e5
[CAS] Add OnDiskCASLogger to help logging/debugging CAS (#174462)
Adds a CAS logging interface to track mutations of the CAS and action
cache database files. This is designed to aid in the debugging of
data corruption and other issues with the low-level on-disk
representation.

To enable logging, set the environment variable LLVM_CAS_LOG to 1 or 2.
Level 2 includes logging of all allocations inside the index, action
cache, and datapool, which increases the overhead. The log file is
placed inside the top-level directory of the unified cache. For now it
is a human-readable textual format with one line per entry.
2026-01-16 09:48:41 -08:00
Argyrios Kyrtzidis
1a1791b65d
[llvm/CAS] Introduce validateObjectID() and use it in UnifiedOnDiskActionCache::validate() (#176069)
This allows object IDs to be valid even if they do not point to actual
data yet, like in lazy materialization schemes.
2026-01-15 14:06:36 -08:00
Victor Chernyakin
c438773432
[LLVM][ADT] Migrate users of make_scope_exit to CTAD (#174030)
This is a followup to #173131, which introduced the CTAD functionality.
2026-01-02 20:42:56 -08:00
Jan Svoboda
01a09e04d7
[llvm][cas] Bypass sandbox in on-disk CAS (#172763)
This PR bypasses sandbox in the on-disk CAS implementation to match the
downstream patch: https://github.com/swiftlang/llvm-project/pull/12022
This isn't strictly necessary right now, since Clang doesn't integrate
with CAS upstream, but it'll make the future integration easier.
2025-12-18 09:25:25 -08:00
Ben Langmuir
a451ff04d2
[llvm][cas] Improve UnifiedOnDiskActionCache validation to check cas refs (#171732)
Check that action cache references point to valid CAS objects by
ensuring they are contained within the corresponding CAS and also that
the offsets match. This prevents accidentally referencing "dead" index
records that were not properly flushed to disk, which can lead to the
action cache pointing to the wrong data or to garbage data.

rdar://126642956
2025-12-11 09:38:22 -08:00
David Spickett
f21857313d
[llvm][CAS] Remove unused functions (#168856)
Building with GCC I got:
```
<...>/OnDiskGraphDB.cpp:624:18: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::construct(char*, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  624 | DataRecordHandle DataRecordHandle::construct(char *Mem, const Input &I) {
      |                  ^~~~~~~~~~~~~~~~
<...>/OnDiskGraphDB.cpp:456:1: warning: ‘static {anonymous}::DataRecordHandle {anonymous}::DataRecordHandle::create(llvm::function_ref<char*(long unsigned int)>, const {anonymous}::DataRecordHandle::Input&)’ defined but not used [-Wunused-function]
  456 | DataRecordHandle::create(function_ref<char *(size_t Size)> Alloc,
      | ^~~~~~~~~~~~~~~~
```

These implement parts of a class that is defined in an anonymous
namespace. All llvm tests passed with them removed.
2025-11-24 09:09:30 +00:00
Kazu Hirata
19129ea343
[llvm] Use llvm::size (NFC) (#168675)
Note that llvm::size only works on types that allow std::distance in
O(1).
2025-11-19 07:29:57 -08:00
Kazu Hirata
7262c592c1
[CAS] Remove a redundant cast (NFC) (#168240)
D.Offset.get() already returns uint64_t.

Identified with readability-redundant-casting.
2025-11-16 08:08:59 -08:00
Steven Wu
6747ea050d
[CAS] Add UnifiedOnDiskCache and OnDiskCAS (#114103)
Add a new abstraction layer UnifiedOnDiskCache that adds new functions
of disk space management and data validation that builds on top of
OnDiskGraphDB and OnDiskKeyValueDB.

Build upon UnifiedOnDiskCache, it is OnDiskCAS that implements
ObjectStore and ActionCache interface for LLVM tools to interact with
CAS storage.
2025-11-03 09:50:28 -08:00
Simon Pilgrim
1bf7ed27c1
[CAS] OnDiskGraphDB - fix MSVC "not all control paths return a value" warnings. NFC. (#164369) 2025-10-21 08:02:13 +00:00
Steven Wu
be9c083cf7
[CAS] Add OnDiskGraphDB and OnDiskKeyValueDB (#114102)
Add OnDiskGraphDB and OnDiskKeyValueDB that can be used to implement
ObjectStore and ActionCache respectively. Those are on-disk persistent
storage that build upon OnDiskTrieHashMap and implements key functions
that are required by LLVMCAS interfaces.

This abstraction layer defines how the objects are hashed and stored on
disk. OnDiskKeyValueDB is a basic OnDiskTrieHashMap while OnDiskGraphDB
also defines:
* How objects of various size are store on disk and are referenced by
  the trie nodes.
* How to store the references from one stored object to another object
  that is referenced.

In addition to basic APIs for ObjectStore and ActionCache, other
advances database configuration features can be implemented in this
layer without exposing to the users of the LLVMCAS interface. For
example, OnDiskGraphDB has a faulty in function to fetch data from an
upstream OnDiskGraphDB if the data is missing.
2025-10-20 13:16:09 -07:00