mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Load swiftmodule files as volatile to avoid mmap
Avoid mmaping swiftmodule files to hopefully fix issues seen when building many Swift projects in parallel on NFS. This only affects loading ModuleFile, it doesn't affect scanning swiftmodule for dependecies which are still handled as non-volatile. rdar://63755989
This commit is contained in:
@@ -347,8 +347,15 @@ std::error_code SerializedModuleLoaderBase::openModuleFile(
|
||||
}
|
||||
|
||||
// Actually load the file and error out if necessary.
|
||||
//
|
||||
// Use the default arguments except for IsVolatile. Force avoiding the use of
|
||||
// mmap to workaround issues on NFS when the swiftmodule file loaded changes
|
||||
// on disk while it's in use.
|
||||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ModuleOrErr =
|
||||
FS.getBufferForFile(ModulePath);
|
||||
FS.getBufferForFile(ModulePath,
|
||||
/*FileSize=*/-1,
|
||||
/*RequiresNullTerminator=*/true,
|
||||
/*IsVolatile=*/true);
|
||||
if (!ModuleOrErr)
|
||||
return ModuleOrErr.getError();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user