Commit Graph

67 Commits

Author SHA1 Message Date
Mishal Shah
c769e491e2 Revert "ModuleInterface: lock .swiftinterface while generating module cache" 2020-01-09 22:54:41 -08:00
Xi Ge
a8baeb3670 Merge pull request #29101 from nkcsgexi/lock-interface-gen-module
ModuleInterface: lock .swiftinterface while generating module cache
2020-01-09 17:41:20 -08:00
Xi Ge
8dda0193a6 ModuleInterface: lock .swiftinterface while generating module cache
This ensures only one process is generating module cache from an interface
file so that we don't blow up memory usage when multiple processes are
doing the same. The locking mechanism is similar to that of Clang's.

A better approach is that the build system takes care of the module building
step as a formal dependency.

rdar://52839445
2020-01-09 15:45:48 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
Varun Gandhi
68a68cb564 Merge pull request #27635 from varungandhi-apple/vg-robustify-module-trace-emission
Make module trace emission more robust.
2019-10-15 20:45:04 -07:00
Varun Gandhi
903add2c3f [Frontend] Make the module trace emission more robust.
✔ More informative error messages in case of crashes.
✔ Handling and documenting different cases.
✔ Test cases for different cases.
✔ Make SDKDependencies.swift pass again.
2019-10-15 15:44:26 -07:00
swift-ci
e85a715a62 Merge pull request #27634 from varungandhi-apple/vg-add-module-loader-ordering-doc 2019-10-14 17:06:04 -07:00
Varun Gandhi
d68866ca98 [NFC] Explain the order for adding module loaders. 2019-10-14 15:40:10 -07:00
Xi Ge
014f863546 SerializeLoc: address more comments from Jordan. NFC 2019-10-09 15:29:52 -07:00
Xi Ge
212fe43d79 SerializeLoc: ensure we can load serialized source locations when we are importing a module from a Swift interface file 2019-10-09 15:29:52 -07:00
Xi Ge
e9dfdea6fd SerializeLoc: serialize basic decl source location information to .swiftsourceinfo file
After setting up the .swiftsourceinfo file, this patch starts to actually serialize
and de-serialize source locations for declaration. The binary format of .swiftsourceinfo
currently contains these three records:

BasicDeclLocs: a hash table mapping from a USR ID to a list of basic source locations. The USR id
could be retrieved from the following DeclUSRs record using an actual decl USR. The basic source locations
include a file ID and the results from Decl::getLoc(), ValueDecl::getNameLoc(), Decl::getStartLoc() and Decl::getEndLoc().
The file ID could be used to retrieve the actual file name from the following SourceFilePaths record.
Each location is encoded as a line:column pair.

DeclUSRS: a hash table mapping from USR to a USR ID used by location records.

SourceFilePaths: a hash table mapping from a file ID to actual file name.

BasicDeclLocs should be sufficient for most diagnostic cases. If additional source locations
are needed, we could always add new source location records without breaking the backward compatibility.
When de-serializing the source location from a module-imported decl, we calculate its USR, retrieve the USR ID
from the DeclUSRS record, and use the USR ID to look up the basic location list in the BasicDeclLocs record.

For more details about .swiftsourceinfo file: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation
2019-10-09 15:29:51 -07:00
Jordan Rose
b32e82c720 More idiomatic use of llvm::hash_combine in many places (#27497)
- No need to hash input values first
- Pass many values to a single hash_combine to save on intermediates
- Use hash_combine_range instead of a loop of hash_combines

No functionality change.
2019-10-04 13:08:24 -07:00
Harlan Haskins
c0908160a6 [ModuleInterfaces] Combine the normalized target triple into the cache hash
Previously, we'd combine just the target architecture, and rely on the
fact that the .swiftinterface is in a reasonably-target-specific
subdirectory to include enough entropy to avoid hash collisions. But in
the presence of a VFS or if two targets are sharing the same
.swiftinterface file (which can sometimes happen in tests), they will
collide since the hash only includes architecture.

Instead, use the same normalization that the serialized module loader
uses, and serialize the normalized target triple instead.

Fixes rdar://55881335
2019-10-02 11:43:55 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
Harlan Haskins
dcbfe443ca [ModuleInterfaces] ParseableInterfaceBuilder -> ModuleInterfaceBuilder
Rename ParseableInterfaceBuilder to accompany ModuleInterfaceLoader
2019-09-13 13:52:16 -07:00
Harlan Haskins
fafc5832fe [ModuleInterfaces] ParseableInterfaceModuleLoader -> ModuleInterfaceLoader
Rename this class to better fit the user-facing name.
2019-09-13 13:40:01 -07:00