Oleg Sidorkin [Wed, 4 Jan 2023 13:53:21 +0000 (16:53 +0300)]
fix: Use spinlocks for inode cache memory synchronization (#1229)
Changed the inode cache implementation to use spinlocks instead of pthread
mutexes. This makes the inode cache work on FreeBSD and other systems where the
pthread mutexes are destroyed when the last memory mapping containing the
mutexes is unmapped.
Also added tmpfs, ufs and zfs to the list of supported filesystems on macOS and
BSDs.
Joel Rosdahl [Wed, 21 Dec 2022 12:16:12 +0000 (13:16 +0100)]
fix: Fix matching of base directory for MSVC
The base directory will now match case-insensitively with absolute paths
in preprocessed output, or from /showIncludes in the depend mode case,
when compiling with MSVC.
Joel Rosdahl [Mon, 5 Dec 2022 19:50:58 +0000 (20:50 +0100)]
enhance: Extract lock keep-alive thread to a manager class
Instead of running one keep-alive thread per lock, a long-lived LockFile
now lets a separate LongLivedLockFileManager object handle keep-alive
for several locks in a single thread.
Joel Rosdahl [Wed, 23 Nov 2022 19:11:12 +0000 (20:11 +0100)]
fix: Don't use copy of mutex/condition in long-lived lock thread
This was kind of due to a typo in 0babd33e84147e923a729ee07a3b85097ec8baa8. Since the LongLivedLockFile
class is not used yet, the bug does not affect any released code.
Joel Rosdahl [Thu, 10 Nov 2022 09:15:12 +0000 (10:15 +0100)]
enhance: Only keep atime if needed
- For the --recompress case, only reset timestamps if mtime has changed
since local cache LRU cleanup always uses mtime.
- For the --trim-dir/--trim-recompress case, always reset timestamps
since atime may be used for LRU cleanup.
Erik Flodin [Sun, 27 Nov 2022 20:32:36 +0000 (21:32 +0100)]
fix: Fix edge case where a non-temporal identifier is misidentified (#1227)
If a non-temporal identifier, that ends with a temporal macro, happens
to be at the end of the buffer with the temporal suffix starting on the
avx boundary, then it would be incorrectly classified as a temporal
macro. This since the helper function lacks the context to see that the
data before the match is something that invalidates the match.
Joel Rosdahl [Thu, 17 Nov 2022 20:31:58 +0000 (21:31 +0100)]
fix: Avoid race condition in inode cache for quick updates
The inode cache has a race condition that consists of these events:
1. A file is written with content C1, size S and timestamp (ctime/mtime)
T.
2. Ccache hashes the file content and asks the inode cache to store the
digest with a hash of S and T (and some other data) as the key.
3. The file is quickly thereafter written with content C2 without
changing size S and timestamp T. The timestamp is not updated since
the file writes are made within a time interval smaller than the
granularity of the clock used for file system timestamps. At the time
of writing, a common granularity on a Linux system is 0.004 s (250
Hz).
4. The inode cache is asked for the file digest and the inode cache
delivers a digest of C1 even though the file's content is C2.
To avoid the race condition, the inode cache now only caches inodes
whose timestamp was updated more than two seconds ago. This conservative
value is chosen since not all file systems have subsecond resolution.
Joel Rosdahl [Sat, 5 Nov 2022 12:03:22 +0000 (13:03 +0100)]
feat: Include I_MPI_CC/I_MPI_CXX in the input hash
The I_MPI_CC and I_MPI_CXX variables affect which underlying compiler
ICC uses. Reference:
<https://www.intel.com/content/www/us/en/develop/documentation/
mpi-developer-reference-windows/top/environment-variable-reference/
compilation-environment-variables.html>.
rblx-kbuck [Fri, 28 Oct 2022 18:41:28 +0000 (11:41 -0700)]
fix: Process the argument following a -Xarch argument (#1199)
Since there are already checks enforcing that all -Xarch arguments match
each other and -arch, we can assume that the compiler would also
interpret the following argument, so ccache should interpret it too.
Joel Rosdahl [Sat, 15 Oct 2022 18:26:18 +0000 (20:26 +0200)]
refactor: Rename ShowIncludesParser to MsvcShowIncludesOutput
I think that this is more in line with what the namespace represents. I
also renamed ShowIncludesParser::tokenize to
MsvcShowIncludesOutput::get_includes since it's not returning generic
tokens but specifically includes files.