Skip to content

Commit 2cd92f2

Browse files
authored
---
yaml --- r: 293055 b: refs/heads/tensorflow c: 7488798 h: refs/heads/master i: 293053: 50eb62f 293051: 8cefce2 293047: adb91f4 293039: bfb84ff 293023: 654eb0d 292991: 9831f71
1 parent 18e6e69 commit 2cd92f2

31 files changed

+753
-263
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 68c00792dfbc09217074ef29d6803c116ae71c52
819+
refs/heads/tensorflow: 7488798e51dfb69b2ccea6953c68d95fac01b1ec
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/docs/Windows.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
# Getting Started with Swift on Windows
22

3-
One can build and run Swift natively, or through the Windows Subsystem for
4-
Linux.
3+
One can build and run Swift natively or through the Windows Subsystem for Linux.
54

65
## Native Windows
76

8-
Currently there are three supported ways to build Swift for Windows.
7+
Currently there are two supported ways to build Swift for Windows.
98

10-
1. To cross-compile Swift for Windows from another host operating system (using
11-
`clang`), see [Cross Compiling for Windows](./WindowsCrossCompile.md)
9+
1. To cross-compile Swift for Windows from another host operating system (using `clang`), see [Cross Compiling for Windows](./WindowsCrossCompile.md)
1210

13-
1. To build on Windows using `clang-cl`, see [Building on
14-
Windows](./WindowsBuild.md#clang-cl)
15-
16-
1. To build on Windows using Microsoft Visual C++ (MSVC), see [Building on
17-
Windows](./WindowsBuild.md#MSVC)
18-
19-
`clang-cl` is recommended over MSVC for building Swift on Windows.
20-
Although it is possible to build the compiler and the standard library with
21-
MSVC to use those built products to compile a Swift program, it won't be
22-
possible to run the binary without separately obtaining the Swift runtime. On
23-
the other hand, `clang-cl` is able to build the runtime, which makes it
24-
possible to build and run all the components required for Swift natively on
25-
Windows.
11+
1. To build on Windows using Microsoft Visual C++ (MSVC), see [Building on Windows](./WindowsBuild.md#MSVC)
2612

2713
## Windows Subsystem for Linux
2814

29-
On the [Windows Subsystem for
30-
Linux](https://docs.microsoft.com/en-us/windows/wsl/about), it's possible to
31-
build and run Swift in a Linux-like environment, on Windows. See [Swift on
32-
the Windows Subsystem for Linux](./WindowsSubsystemForLinux.md) for details.
15+
[Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about) is an Ubuntu environment. Follow the instructions for building on [Linux](../README.md#linux)

branches/tensorflow/docs/WindowsBuild.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ popd
248248

249249
```cmd
250250
pushd "S:\libxml2\win32"
251-
cscript configure.js iconv=no
251+
cscript //E:jscript configure.js iconv=no
252252
nmake /f Makefile.msvc
253253
popd
254254
```
@@ -345,7 +345,7 @@ ninja -C S:\b\foundation test
345345
```cmd
346346
md S:\b\sqlite
347347
cd S:\b\sqlite
348-
cl /MD /Ox /Zi /LD /DSQLITE_API=__declspec(dllexport) S:\sqlite-amalgamation-3270200\sqlite.c
348+
cl /MD /Ox /Zi /LD /DSQLITE_API=__declspec(dllexport) S:\sqlite-amalgamation-3270200\sqlite3.c
349349
```
350350

351351
- Add SQLite3 to your path:
@@ -363,8 +363,12 @@ cmake -G Ninja^
363363
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
364364
-DCMAKE_C_COMPILER=cl^
365365
-DCMAKE_CXX_COMPILER=cl^
366+
-DFOUNDATION_BUILD_DIR=S:\b\foundation^
367+
-DLIBDISPATCH_BUILD_DIR=S:\b\libdispatch^
368+
-DLIBDISPATCH_SOURCE_DIR=S:\swift-corelibs-libdispatch^
366369
-DLLBUILD_PATH_TO_SQLITE_SOURCE=S:\sqlite-amalgamation-3270200^
367370
-DLLBUILD_PATH_TO_SQLITE_BUILD=S:\b\sqlite^
371+
-DLLBUILD_SUPPORT_BINDINGS=Swift^
368372
S:\llbuild
369373
ninja
370374
```

branches/tensorflow/include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ ERROR(expr_keypath_subscript_index_not_hashable, none,
506506
ERROR(expr_smart_keypath_application_type_mismatch,none,
507507
"key path of type %0 cannot be applied to a base of type %1",
508508
(Type, Type))
509+
ERROR(expr_swift_keypath_anyobject_root,none,
510+
"the root type of a Swift key path cannot be 'AnyObject'", ())
509511
WARNING(expr_deprecated_writable_keypath,none,
510512
"forming a writable keypath to property %0 that is read-only in this context "
511513
"is deprecated and will be removed in a future release",(DeclName))

branches/tensorflow/include/swift/AST/SILOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class SILOptions {
133133
bool EnableLargeLoadableTypes = true;
134134

135135
/// Should the default pass pipelines strip ownership during the diagnostic
136-
/// pipeline.
137-
bool StripOwnershipDuringDiagnosticsPipeline = true;
136+
/// pipeline or after serialization.
137+
bool StripOwnershipAfterSerialization = false;
138138

139139
/// The name of the file to which the backend should save YAML optimization
140140
/// records.

branches/tensorflow/include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ def disable_arc_opts : Flag<["-"], "disable-arc-opts">,
229229
def disable_sil_partial_apply : Flag<["-"], "disable-sil-partial-apply">,
230230
HelpText<"Disable use of partial_apply in SIL generation">;
231231

232+
def enable_ownership_stripping_after_serialization
233+
: Flag<["-"], "enable-ownership-stripping-after-serialization">,
234+
HelpText<"Strip ownership after serialization">;
235+
232236
def disable_access_control : Flag<["-"], "disable-access-control">,
233237
HelpText<"Don't respect access control restrictions">;
234238
def enable_access_control : Flag<["-"], "enable-access-control">,

branches/tensorflow/lib/Frontend/CompilerInvocation.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
772772
Args.hasArg(OPT_disable_sil_partial_apply);
773773
Opts.VerifySILOwnership &= !Args.hasArg(OPT_disable_sil_ownership_verifier);
774774
Opts.EnableLargeLoadableTypes |= Args.hasArg(OPT_enable_large_loadable_types);
775+
Opts.StripOwnershipAfterSerialization |= Args.hasArg(OPT_enable_ownership_stripping_after_serialization);
775776

776777
if (const Arg *A = Args.getLastArg(OPT_save_optimization_record_path))
777778
Opts.OptRecordFile = A->getValue();
@@ -902,21 +903,20 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
902903
else
903904
assert(A->getOption().matches(options::OPT_gnone) &&
904905
"unknown -g<kind> option");
905-
906-
if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables) {
907-
if (Args.hasArg(options::OPT_debug_info_store_invocation)) {
908-
ArgStringList RenderedArgs;
909-
for (auto A : Args)
910-
A->render(Args, RenderedArgs);
911-
CompilerInvocation::buildDebugFlags(Opts.DebugFlags,
912-
RenderedArgs, SDKPath,
913-
ResourceDir);
914-
}
915-
// TODO: Should we support -fdebug-compilation-dir?
916-
llvm::SmallString<256> cwd;
917-
llvm::sys::fs::current_path(cwd);
918-
Opts.DebugCompilationDir = cwd.str();
906+
}
907+
if (Opts.DebugInfoLevel >= IRGenDebugInfoLevel::LineTables) {
908+
if (Args.hasArg(options::OPT_debug_info_store_invocation)) {
909+
ArgStringList RenderedArgs;
910+
for (auto A : Args)
911+
A->render(Args, RenderedArgs);
912+
CompilerInvocation::buildDebugFlags(Opts.DebugFlags,
913+
RenderedArgs, SDKPath,
914+
ResourceDir);
919915
}
916+
// TODO: Should we support -fdebug-compilation-dir?
917+
llvm::SmallString<256> cwd;
918+
llvm::sys::fs::current_path(cwd);
919+
Opts.DebugCompilationDir = cwd.str();
920920
}
921921

922922
if (const Arg *A = Args.getLastArg(options::OPT_debug_info_format)) {

branches/tensorflow/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,17 @@ class swift::ParseableInterfaceBuilder {
408408
StringRef DepName = Scratch.str();
409409

410410
assert(moduleCachePath.empty() || !DepName.startswith(moduleCachePath));
411-
assert(prebuiltCachePath.empty() || !DepName.startswith(prebuiltCachePath));
412411

413412
// Serialize the paths of dependencies in the SDK relative to it.
414413
Optional<StringRef> SDKRelativePath = getRelativeDepPath(DepName, SDKPath);
415414
StringRef DepNameToStore = SDKRelativePath.getValueOr(DepName);
416415
bool IsSDKRelative = SDKRelativePath.hasValue();
417416

417+
// Forwarding modules add the underlying prebuilt module to their
418+
// dependency list -- don't serialize that.
419+
if (!prebuiltCachePath.empty() && DepName.startswith(prebuiltCachePath))
420+
continue;
421+
418422
if (AllDepNames.insert(DepName).second && dependencyTracker) {
419423
dependencyTracker->addDependency(DepName, /*isSystem*/IsSDKRelative);
420424
}
@@ -828,6 +832,10 @@ class ParseableInterfaceModuleLoaderImpl {
828832
}
829833
path::append(scratch, path::filename(modulePath));
830834

835+
// If there isn't a file at this location, skip returning a path.
836+
if (!fs.exists(scratch))
837+
return None;
838+
831839
return scratch.str();
832840
}
833841

@@ -914,7 +922,7 @@ class ParseableInterfaceModuleLoaderImpl {
914922
return DiscoveredModule::prebuilt(*path, std::move(moduleBuffer));
915923
} else {
916924
LLVM_DEBUG(llvm::dbgs() << "Found out-of-date prebuilt module at "
917-
<< modulePath << "\n");
925+
<< path->str() << "\n");
918926
}
919927
}
920928
}
@@ -951,40 +959,62 @@ class ParseableInterfaceModuleLoaderImpl {
951959

952960
/// Writes the "forwarding module" that will forward to a module in the
953961
/// prebuilt cache.
962+
///
954963
/// Since forwarding modules track dependencies separately from the module
955964
/// they point to, we'll need to grab the up-to-date file status while doing
956-
/// this.
957-
bool writeForwardingModule(const DiscoveredModule &mod,
958-
StringRef outputPath,
959-
ArrayRef<FileDependency> deps) {
965+
/// this. If the write was successful, it also updates the
966+
/// list of dependencies to match what was written to the forwarding file.
967+
bool writeForwardingModuleAndUpdateDeps(
968+
const DiscoveredModule &mod, StringRef outputPath,
969+
SmallVectorImpl<FileDependency> &deps) {
960970
assert(mod.isPrebuilt() &&
961971
"cannot write forwarding file for non-prebuilt module");
962972
ForwardingModule fwd(mod.path);
963973

974+
SmallVector<FileDependency, 16> depsAdjustedToMTime;
975+
964976
// FIXME: We need to avoid re-statting all these dependencies, otherwise
965977
// we may record out-of-date information.
966-
auto addDependency = [&](StringRef path) {
978+
auto addDependency = [&](StringRef path) -> FileDependency {
967979
auto status = fs.status(path);
968980
uint64_t mtime =
969981
status->getLastModificationTime().time_since_epoch().count();
970982
fwd.addDependency(path, status->getSize(), mtime);
983+
984+
// Construct new FileDependency matching what we've added to the
985+
// forwarding module. This is no longer SDK-relative because the absolute
986+
// path has already been resolved.
987+
return FileDependency::modTimeBased(path, /*isSDKRelative*/false,
988+
status->getSize(), mtime);
971989
};
972990

973-
// Add the prebuilt module as a dependency of the forwarding module.
974-
addDependency(fwd.underlyingModulePath);
991+
// Add the prebuilt module as a dependency of the forwarding module, but
992+
// don't add it to the outer dependency list.
993+
(void)addDependency(fwd.underlyingModulePath);
975994

976-
// Add all the dependencies from the prebuilt module.
995+
// Add all the dependencies from the prebuilt module, and update our list
996+
// of dependencies to reflect what's recorded in the forwarding module.
977997
SmallString<128> SDKRelativeBuffer;
978998
for (auto dep : deps) {
979-
addDependency(getFullDependencyPath(dep, SDKRelativeBuffer));
999+
auto adjustedDep =
1000+
addDependency(getFullDependencyPath(dep, SDKRelativeBuffer));
1001+
depsAdjustedToMTime.push_back(adjustedDep);
9801002
}
9811003

982-
return withOutputFile(diags, outputPath,
1004+
auto hadError = withOutputFile(diags, outputPath,
9831005
[&](llvm::raw_pwrite_stream &out) {
9841006
llvm::yaml::Output yamlWriter(out);
9851007
yamlWriter << fwd;
9861008
return false;
9871009
});
1010+
1011+
if (hadError)
1012+
return true;
1013+
1014+
// If and only if we succeeded writing the forwarding file, update the
1015+
// provided list of dependencies.
1016+
deps = depsAdjustedToMTime;
1017+
return false;
9881018
}
9891019

9901020
/// Looks up the best module to load for a given interface, and returns a
@@ -1033,9 +1063,11 @@ class ParseableInterfaceModuleLoaderImpl {
10331063
if (moduleOrErr) {
10341064
auto module = std::move(moduleOrErr.get());
10351065

1036-
// If it's prebuilt, use this time to generate a forwarding module.
1066+
// If it's prebuilt, use this time to generate a forwarding module and
1067+
// update the dependencies to use modification times.
10371068
if (module.isPrebuilt())
1038-
if (writeForwardingModule(module, cachedOutputPath, allDeps))
1069+
if (writeForwardingModuleAndUpdateDeps(module, cachedOutputPath,
1070+
allDeps))
10391071
return std::make_error_code(std::errc::not_supported);
10401072

10411073
// Report the module's dependencies to the dependencyTracker

branches/tensorflow/lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void addMandatoryOptPipeline(SILPassPipelinePlan &P) {
104104
if (Options.shouldOptimize()) {
105105
P.addSemanticARCOpts();
106106
}
107-
if (Options.StripOwnershipDuringDiagnosticsPipeline)
107+
if (!Options.StripOwnershipAfterSerialization)
108108
P.addOwnershipModelEliminator();
109109
P.addMandatoryInlining();
110110
P.addMandatorySILLinker();
@@ -299,7 +299,7 @@ void addSSAPasses(SILPassPipelinePlan &P, OptimizationLevelKind OpLevel) {
299299
P.addSerializeSILPass();
300300

301301
// Now strip any transparent functions that still have ownership.
302-
if (!P.getOptions().StripOwnershipDuringDiagnosticsPipeline)
302+
if (P.getOptions().StripOwnershipAfterSerialization)
303303
P.addOwnershipModelEliminator();
304304

305305
if (P.getOptions().StopOptimizationAfterSerialization)
@@ -380,7 +380,7 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
380380
P.addDeadFunctionElimination();
381381

382382
// Strip ownership from non-transparent functions.
383-
if (!P.getOptions().StripOwnershipDuringDiagnosticsPipeline)
383+
if (P.getOptions().StripOwnershipAfterSerialization)
384384
P.addNonTransparentFunctionOwnershipModelEliminator();
385385

386386
// Start by cloning functions from stdlib.
@@ -645,7 +645,7 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
645645
P.addSerializeSILPass();
646646

647647
// And then strip ownership...
648-
if (!Options.StripOwnershipDuringDiagnosticsPipeline)
648+
if (Options.StripOwnershipAfterSerialization)
649649
P.addOwnershipModelEliminator();
650650

651651
// Finally perform some small transforms.

0 commit comments

Comments
 (0)