mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If a module was first read using the adjacent swiftmodule and then reloaded using the swiftinterface, we would do an up to date check on the adjacent module but write out the unit using the swiftinterface. This would cause the same modules to be indexed repeatedly for the first invocation using a new SDK. On the next run we would instead raad the swiftmodule from the cache and thus the out of date check would match up. The impact of this varies depending on the size of the module graph in the initial compilation and the number of jobs started at the same time. Each SDK dependency is re-indexed *and* reloaded, which is a drain on both CPU and memory. Thus, if many jobs are initially started and they're all going down this path, it can cause the system to run out of memory very quickly. Resolves rdar://103119964.
58 lines
2.3 KiB
Swift
58 lines
2.3 KiB
Swift
/// Test the -Rmodule-loading flag.
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t/cache)
|
|
// RUN: split-file %s %t
|
|
|
|
/// Create Swift modules to import.
|
|
// RUN: %target-swift-emit-module-interface(%t/SwiftDependency.swiftinterface) \
|
|
// RUN: %t/SwiftDependency.swift
|
|
// RUN: %target-swift-frontend -emit-module -o %t/SwiftNonResilientDependency.swiftmodule \
|
|
// RUN: -module-name SwiftNonResilientDependency %t/SwiftDependency.swift
|
|
// RUN: %target-swift-emit-module-interface(%t/IndirectMixedDependency.swiftinterface) \
|
|
// RUN: %t/IndirectMixedDependency.swift -I %t
|
|
|
|
/// Use -Rmodule-loading in a client and look for the diagnostics output.
|
|
// RUN: %target-swift-frontend -typecheck %t/Client.swift -Rmodule-loading \
|
|
// RUN: -I %t -module-cache-path %t/cache 2>&1 | %FileCheck %s
|
|
|
|
//--- module.modulemap
|
|
module IndirectMixedDependency {
|
|
header "IndirectMixedDependency.h"
|
|
}
|
|
|
|
module DirectMixedDependency {
|
|
header "DirectMixedDependency.h"
|
|
export *
|
|
}
|
|
|
|
//--- IndirectMixedDependency.h
|
|
|
|
//--- IndirectMixedDependency.swift
|
|
|
|
@_exported import IndirectMixedDependency
|
|
|
|
//--- DirectMixedDependency.h
|
|
|
|
#include "IndirectMixedDependency.h"
|
|
|
|
//--- DirectMixedDependency.swift
|
|
|
|
@_exported import DirectMixedDependency
|
|
|
|
//--- SwiftDependency.swift
|
|
|
|
public func publicFunction() {}
|
|
|
|
//--- Client.swift
|
|
|
|
import SwiftDependency
|
|
import SwiftNonResilientDependency
|
|
import DirectMixedDependency
|
|
|
|
// CHECK: remark: loaded module 'SwiftShims'; source: '{{.*}}module.modulemap', loaded: '{{.*}}SwiftShims-{{.*}}.pcm'
|
|
// CHECK: remark: loaded module 'Swift'; source: '{{.*}}Swift.swiftmodule{{.*}}.swiftinterface', loaded: '{{.*}}Swift.swiftmodule{{.*}}.swiftmodule'
|
|
// CHECK: remark: loaded module 'SwiftDependency'; source: '{{.*}}SwiftDependency.swiftinterface', loaded: '{{.*}}SwiftDependency-{{.*}}.swiftmodule'
|
|
// CHECK: remark: loaded module 'SwiftNonResilientDependency'; source: '{{.*}}SwiftNonResilientDependency.swiftmodule', loaded: '{{.*}}SwiftNonResilientDependency.swiftmodule'
|
|
// CHECK: remark: loaded module 'IndirectMixedDependency' (overlay for a clang dependency); source: '{{.*}}IndirectMixedDependency.swiftinterface', loaded: '{{.*}}IndirectMixedDependency-{{.*}}.swiftmodule'
|
|
// CHECK: remark: loaded module 'DirectMixedDependency'; source: '{{.*}}module.modulemap', loaded: '{{.*}}DirectMixedDependency-{{.*}}.pcm'
|