Commit Graph

8 Commits

Author SHA1 Message Date
Alex Hoppen
fe7878ecce [Serialization] Improve module loading performance
When looking for a Swift module on disk, we were scanning all module search paths if they contain the module we are searching for. In a setup where each module is contained in its own framework search path, this scaled quadratically with the number of modules being imported. E.g. a setup with 100 modules being imported form 100 module search paths could cause on the order of 10,000 checks of `FileSystem::exists`. While these checks are fairly fast (~10µs), they add up to ~100ms.

To improve this, perform a first scan of all module search paths and list the files they contain. From this, create a lookup map that maps filenames to the search paths they can be found in. E.g. for
```
searchPath1/
  Module1.framework

searchPath2/
  Module1.framework
  Module2.swiftmodule
```
we create the following lookup table
```
Module1.framework -> [searchPath1, searchPath2]
Module2.swiftmodule -> [searchPath2]
```
2021-12-14 12:44:13 +01:00
Xi Ge
6377c3a742 Revert "Revert "serialization: obfuscate the serialized search paths"" 2021-12-02 13:21:04 -08:00
Saleem Abdulrasool
11d5d6d4ca Revert "serialization: obfuscate the serialized search paths" 2021-12-02 08:18:23 -08:00
Xi Ge
0047d81f9a serialization: obfuscate the serialized search paths
We noticed some Swift clients rely on the serialized search paths in the module to
find dependencies and droping these paths altogether can lead to build failures like
rdar://85840921.

This change teaches the serialization to obfuscate the search paths and the deserialization
to recover them. This allows clients to keep accessing these paths without exposing
them when shipping the module to other users.
2021-12-01 11:47:41 -08:00
Ben Langmuir
a46b35b5ca More explicit StringRef -> std::string conversions
On the older compiler/stdlib used by our Ubuntu 16.04 bots, the
construction

        std::pair<std::string, X>(StringRef, X)

fails unless you call `.str()`. Newer compilers/stdlib treat this as an
explicit construction, which is what is now needed on master-next, so it
only fails on Ubuntu 16.04.

rdar://60514063
2020-03-18 09:50:56 -07:00
Tony Allevato
aade5fb1e4 Remove redundant "private" 2018-07-24 12:48:48 -07:00
Tony Allevato
346e1c3317 Apply review feedback. 2018-07-06 21:00:06 -07:00
Tony Allevato
78edd30ddf Implement -debug-prefix-map flag.
This flag is based on Clang's -fdebug-prefix-map, which lets the user remap absolute paths in debug info. This is necessary for reproducible builds and allows debugging to work on a different machine than the one that built the code when paths to the source may be different.
2018-07-01 18:22:15 -07:00