[Serialization] Reduce file size by splitting dep dirnames from basenames

Dependency tracking for cached compiled modules (compiled from
swiftinterfaces) can lead to a high percentage of the module being
SDK-relative paths when -track-system-dependencies is on. Cut down on
this by storing directory names in a separate record that gets
referenced from each file dependency. (Since a lot of per-file
dependencies are header files in a common directory, this is a win.)

We can do something more clever in the future, but this is a
reasonable start for, say, the overlays.

rdar://problem/50449802
This commit is contained in:
Jordan Rose
2019-05-04 10:42:44 -07:00
parent 9ba1d8a1c6
commit b3c5a68acf
4 changed files with 48 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 488; // assign_by_delegate
const uint16_t SWIFTMODULE_VERSION_MINOR = 489; // dependency directories
using DeclIDField = BCFixed<31>;
@@ -644,6 +644,7 @@ namespace input_block {
MODULE_FLAGS, // [unused]
SEARCH_PATH,
FILE_DEPENDENCY,
DEPENDENCY_DIRECTORY,
PARSEABLE_INTERFACE_PATH
};
@@ -689,9 +690,15 @@ namespace input_block {
FileModTimeOrContentHashField, // mtime or content hash (for validation)
BCFixed<1>, // are we reading mtime (0) or hash (1)?
BCFixed<1>, // SDK-relative?
BCVBR<8>, // subpath-relative index (0=none)
BCBlob // path
>;
using DependencyDirectoryLayout = BCRecordLayout<
DEPENDENCY_DIRECTORY,
BCBlob
>;
using ParseableInterfaceLayout = BCRecordLayout<
PARSEABLE_INTERFACE_PATH,
BCBlob // file path