Skip to content

Commit 07f6fca

Browse files
committed
---
yaml --- r: 341435 b: refs/heads/rxwei-patch-1 c: f359cef h: refs/heads/master i: 341433: f337638 341431: 2724e76
1 parent 4d7ce9b commit 07f6fca

36 files changed

+196
-514
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 259571a7f7d95472fe53270a21951702efa02d8b
1018+
refs/heads/rxwei-patch-1: f359cef5d0b86840cbea97a52717c2ed0acbb386
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/benchmark/single-source/AngryPhonebook.swift

Lines changed: 5 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,11 @@
1414
// to test uppercase and lowercase ASCII string fast paths.
1515
import TestsUtils
1616

17-
let t: [BenchmarkCategory] = [.validation, .api, .String]
18-
19-
public let AngryPhonebook = [
20-
BenchmarkInfo(
21-
name: "AngryPhonebook",
22-
runFunction: run_AngryPhonebook,
23-
tags: t,
24-
legacyFactor: 7),
25-
26-
// Small String Workloads
27-
BenchmarkInfo(
28-
name: "AngryPhonebook.ASCII.Small",
29-
runFunction: { angryPhonebook($0, ascii) },
30-
tags: t,
31-
setUpFunction: { blackHole(ascii) }),
32-
BenchmarkInfo(
33-
name: "AngryPhonebook.Strasse.Small",
34-
runFunction: { angryPhonebook($0, strasse) },
35-
tags: t,
36-
setUpFunction: { blackHole(strasse) }),
37-
BenchmarkInfo(
38-
name: "AngryPhonebook.Armenian.Small",
39-
runFunction: { angryPhonebook($0, armenian) },
40-
tags: t,
41-
setUpFunction: { blackHole(armenian) }),
42-
BenchmarkInfo(
43-
name: "AngryPhonebook.Cyrillic.Small",
44-
runFunction: { angryPhonebook($0, cyrillic) },
45-
tags: t,
46-
setUpFunction: { blackHole(cyrillic) }),
47-
48-
// Regular String Workloads
49-
BenchmarkInfo(
50-
name: "AngryPhonebook.ASCII",
51-
runFunction: { angryPhonebook($0, precomposed: longASCII) },
52-
tags: t,
53-
setUpFunction: { blackHole(longASCII) }),
54-
BenchmarkInfo(
55-
name: "AngryPhonebook.Strasse",
56-
runFunction: { angryPhonebook($0, precomposed: longStrasse) },
57-
tags: t,
58-
setUpFunction: { blackHole(longStrasse) }),
59-
BenchmarkInfo(
60-
name: "AngryPhonebook.Armenian",
61-
runFunction: { angryPhonebook($0, precomposed: longArmenian) },
62-
tags: t,
63-
setUpFunction: { blackHole(longArmenian) }),
64-
BenchmarkInfo(
65-
name: "AngryPhonebook.Cyrillic",
66-
runFunction: { angryPhonebook($0, precomposed: longCyrillic) },
67-
tags: t,
68-
setUpFunction: { blackHole(longCyrillic) })
69-
]
17+
public let AngryPhonebook = BenchmarkInfo(
18+
name: "AngryPhonebook",
19+
runFunction: run_AngryPhonebook,
20+
tags: [.validation, .api, .String],
21+
legacyFactor: 7)
7022

7123
let words = [
7224
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
@@ -86,67 +38,3 @@ public func run_AngryPhonebook(_ N: Int) {
8638
}
8739
}
8840
}
89-
90-
// Workloads for various scripts. Always 20 names for 400 pairings.
91-
// To keep the performance of various scripts roughly comparable, aim for
92-
// a total length of approximately 120 characters.
93-
// E.g.: `ascii.joined(separator: "").count == 124`
94-
// Every name should fit in 15-bytes UTF-8 encoded, to excercise the small
95-
// string optimization.
96-
// E.g.: `armenian.allSatisfy { $0._guts.isSmall } == true`
97-
98-
// Workload Size Statistics
99-
// SMALL | UTF-8 | UTF-16 | REGULAR | UTF-8 | UTF-16
100-
// ---------|-------|--------|--------------|---------|--------
101-
// ascii | 124 B | 248 B | longASCII | 6158 B | 12316 B
102-
// strasse | 140 B | 240 B | longStrasse | 6798 B | 11996 B
103-
// armenian | 232 B | 232 B | longArmenian | 10478 B | 11676 B
104-
// cyrillic | 238 B | 238 B | longCyrillic | 10718 B | 11916 B
105-
106-
let ascii = Array(words.prefix(20))
107-
// Pathological case, uppercase: ß -> SS
108-
let strasse = Array(repeating: "Straße", count: 20)
109-
110-
let armenian = [
111-
"Արմեն", "Աննա", "Հարութ", "Միքայել", "Մարիա", "Դավիթ", "Վարդան",
112-
"Նարինե", "Տիգրան", "Տաթևիկ", "Թագուհի", "Թամարա", "Ազնաուր", "Գրիգոր",
113-
"Կոմիտաս", "Հայկ", "Գառնիկ", "Վահրամ", "Վահագն", "Գևորգ"]
114-
115-
let cyrillic = [
116-
"Ульяна", "Аркадий", "Аня", "Даниил", "Дмитрий", "Эдуард", "Юрій", "Давид",
117-
"Анна", "Дмитрий", "Евгений", "Борис", "Ксения", "Артур", "Аполлон",
118-
"Соломон", "Николай", "Кристи", "Надежда", "Спартак"]
119-
120-
/// Precompose the phonebook into one large string of comma separated names.
121-
func phonebook(_ names: [String]) -> String {
122-
names.map { firstName in
123-
names.map { lastName in
124-
firstName + " " + lastName
125-
}.joined(separator: ", ")
126-
}.joined(separator: ", ")
127-
}
128-
129-
let longASCII = phonebook(ascii)
130-
let longStrasse = phonebook(strasse)
131-
let longArmenian = phonebook(armenian)
132-
let longCyrillic = phonebook(cyrillic)
133-
134-
@inline(never)
135-
public func angryPhonebook(_ N: Int, _ names: [String]) {
136-
assert(names.count == 20)
137-
// Permute the names.
138-
for _ in 1...N {
139-
for firstname in names {
140-
for lastname in names {
141-
blackHole((firstname.uppercased(), lastname.lowercased()))
142-
}
143-
}
144-
}
145-
}
146-
147-
@inline(never)
148-
public func angryPhonebook(_ N: Int, precomposed names: String) {
149-
for _ in 1...N {
150-
blackHole((names.uppercased(), names.lowercased()))
151-
}
152-
}

branches/rxwei-patch-1/cmake/modules/AddSwift.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ function(add_swift_target_library name)
19051905
if(SWIFTLIB_SHARED)
19061906
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
19071907
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
1908-
elseif(${sdk} STREQUAL ANDROID)
1908+
elseif(sdk STREQUAL ANDROID)
19091909
list(APPEND swiftlib_link_flags_all "-shared")
19101910
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
19111911
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")

branches/rxwei-patch-1/include/swift/AST/Builtins.def

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -551,20 +551,6 @@ BUILTIN_MISC_OPERATION(WillThrow, "willThrow", "", Special)
551551
/// poundAssert has type (Builtin.Int1, Builtin.RawPointer) -> ().
552552
BUILTIN_MISC_OPERATION(PoundAssert, "poundAssert", "", Special)
553553

554-
// BUILTIN_MISC_OPERATION_WITH_SILGEN - Miscellaneous operations that are
555-
// specially emitted during SIL generation.
556-
#ifndef BUILTIN_MISC_OPERATION_WITH_SILGEN
557-
#define BUILTIN_MISC_OPERATION_WITH_SILGEN(Id, Name, Attrs, Overload) \
558-
BUILTIN_MISC_OPERATION(Id, Name, Attrs, Overload)
559-
#endif
560-
561-
/// globalStringTablePointer has type String -> Builtin.RawPointer.
562-
/// It returns an immortal, global string table pointer for strings constructed
563-
/// from string literals.
564-
BUILTIN_MISC_OPERATION_WITH_SILGEN(GlobalStringTablePointer, "globalStringTablePointer", "", Special)
565-
566-
#undef BUILTIN_MISC_OPERATION_WITH_SILGEN
567-
568554
#undef BUILTIN_MISC_OPERATION
569555

570556
/// Builtins for instrumentation added by sanitizers during SILGen.

branches/rxwei-patch-1/include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ WARNING(implicit_bridging_header_imported_from_module,none,
9191
"is deprecated and will be removed in a later version of Swift",
9292
(StringRef, Identifier))
9393

94-
WARNING(clang_vfs_overlay_is_ignored,none,
95-
"ignoring '-ivfsoverlay' options provided to '-Xcc' in favor of "
96-
"'-vfsoverlay'", ())
97-
9894
#ifndef DIAG_NO_UNDEF
9995
# if defined(DIAG)
10096
# undef DIAG

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSIL.def

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ NOTE(switch_value_case_doesnt_yield, none, "missing yield in the %0 case",
484484
NOTE(try_branch_doesnt_yield, none, "missing yield when error is "
485485
"%select{not |}0thrown", (bool))
486486

487-
// OS log optimization diagnostics.
487+
// OS log optimization dianostics.
488488

489489
ERROR(oslog_message_argument_not_found, none, "no argument of type %0 in "
490490
" the os log call", (Identifier))
@@ -505,9 +505,6 @@ ERROR(oslog_non_constant_interpolation, none, "'OSLogInterpolation' struct is "
505505
ERROR(oslog_property_not_constant, none, "'OSLogInterpolation.%0' is not a "
506506
"constant: formatting and privacy options must be literals", (StringRef))
507507

508-
ERROR(global_string_pointer_on_non_constant, none, "globalStringTablePointer "
509-
"builtin must used only on string literals", ())
510-
511508
#ifndef DIAG_NO_UNDEF
512509
# if defined(DIAG)
513510
# undef DIAG

branches/rxwei-patch-1/include/swift/Basic/SourceManager.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@
2323

2424
namespace swift {
2525

26+
static inline llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>
27+
getRealOverlayFileSystem() {
28+
return llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
29+
new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
30+
}
31+
2632
/// This class manages and owns source buffers.
2733
class SourceManager {
2834
llvm::SourceMgr LLVMSourceMgr;
29-
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem;
35+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FileSystem;
3036
unsigned CodeCompletionBufferID = 0U;
3137
unsigned CodeCompletionOffset;
3238

@@ -49,9 +55,9 @@ class SourceManager {
4955
mutable std::pair<const char *, const VirtualFile*> CachedVFile = {nullptr, nullptr};
5056

5157
public:
52-
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS =
53-
llvm::vfs::getRealFileSystem())
54-
: FileSystem(FS) {}
58+
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FS =
59+
getRealOverlayFileSystem())
60+
: FileSystem(FS) {}
5561

5662
llvm::SourceMgr &getLLVMSourceMgr() {
5763
return LLVMSourceMgr;
@@ -60,11 +66,12 @@ class SourceManager {
6066
return LLVMSourceMgr;
6167
}
6268

63-
void setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
69+
void
70+
setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FS) {
6471
FileSystem = FS;
6572
}
6673

67-
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> getFileSystem() {
74+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> getFileSystem() {
6875
return FileSystem;
6976
}
7077

@@ -254,4 +261,3 @@ class SourceManager {
254261
} // end namespace swift
255262

256263
#endif // SWIFT_BASIC_SOURCEMANAGER_H
257-

branches/rxwei-patch-1/lib/AST/Builtins.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -951,13 +951,6 @@ static ValueDecl *getGetObjCTypeEncodingOperation(ASTContext &Context,
951951
return builder.build(Id);
952952
}
953953

954-
static ValueDecl *getGlobalStringTablePointer(ASTContext &Context,
955-
Identifier Id) {
956-
// String -> Builtin.RawPointer
957-
auto stringType = NominalType::get(Context.getStringDecl(), Type(), Context);
958-
return getBuiltinFunction(Id, {stringType}, Context.TheRawPointerType);
959-
}
960-
961954
static ValueDecl *getPoundAssert(ASTContext &Context, Identifier Id) {
962955
auto int1Type = BuiltinIntegerType::get(1, Context);
963956
auto optionalRawPointerType = BoundGenericEnumType::get(
@@ -1967,9 +1960,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
19671960
case BuiltinValueKind::GetObjCTypeEncoding:
19681961
return getGetObjCTypeEncodingOperation(Context, Id);
19691962

1970-
case BuiltinValueKind::GlobalStringTablePointer:
1971-
return getGlobalStringTablePointer(Context, Id);
1972-
19731963
case BuiltinValueKind::PoundAssert:
19741964
return getPoundAssert(Context, Id);
19751965

branches/rxwei-patch-1/lib/ClangImporter/ClangImporter.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,14 +1012,35 @@ ClangImporter::create(ASTContext &ctx,
10121012

10131013
// Set up the file manager.
10141014
{
1015-
if (!ctx.SearchPathOpts.VFSOverlayFiles.empty()) {
1016-
// If the clang instance has overlays it means the user has provided
1017-
// -ivfsoverlay options and swift -vfsoverlay options. We're going to
1018-
// clobber their file system with our own, so warn about it.
1019-
if (!instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
1020-
ctx.Diags.diagnose(SourceLoc(), diag::clang_vfs_overlay_is_ignored);
1021-
}
1015+
if (instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
10221016
instance.setVirtualFileSystem(ctx.SourceMgr.getFileSystem());
1017+
} else {
1018+
// Initialize the clang VFS from its compiler invocation.
1019+
instance.createFileManager();
1020+
1021+
// Create a new overlay file system for the clang importer with the clang
1022+
// VFS as its root.
1023+
auto ClangImporterFS =
1024+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
1025+
new llvm::vfs::OverlayFileSystem(
1026+
&instance.getVirtualFileSystem()));
1027+
1028+
auto SwiftFS = ctx.SourceMgr.getFileSystem();
1029+
auto it = SwiftFS->overlays_rbegin();
1030+
auto end = SwiftFS->overlays_rend();
1031+
1032+
// The Swift file system is an overlay file system with the real file
1033+
// system as its root. Skip the root so we query the other overlays
1034+
// before falling back to the real file system.
1035+
it++;
1036+
1037+
// Add all remaining Swift overlay file systems to the new file system.
1038+
while (it != end) {
1039+
ClangImporterFS->pushOverlay(*it);
1040+
it++;
1041+
}
1042+
1043+
instance.setVirtualFileSystem(ClangImporterFS);
10231044
}
10241045
instance.createFileManager();
10251046
}

branches/rxwei-patch-1/lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ static bool loadAndValidateVFSOverlay(
235235
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &BaseFS,
236236
const llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> &OverlayFS,
237237
DiagnosticEngine &Diag) {
238-
// FIXME: It should be possible to allow chained lookup of later VFS overlays
239-
// through the mapping defined by earlier overlays.
240-
// See rdar://problem/39440687
241238
auto Buffer = BaseFS->getBufferForFile(File);
242239
if (!Buffer) {
243240
Diag.diagnose(SourceLoc(), diag::cannot_open_file, File,
@@ -264,14 +261,7 @@ bool CompilerInstance::setUpVirtualFileSystemOverlays() {
264261
hadAnyFailure |=
265262
loadAndValidateVFSOverlay(File, BaseFS, OverlayFS, Diagnostics);
266263
}
267-
268-
// If we successfully loaded all the overlays, let the source manager and
269-
// diagnostic engine take advantage of the overlay file system.
270-
if (!hadAnyFailure &&
271-
(OverlayFS->overlays_begin() != OverlayFS->overlays_end())) {
272-
SourceMgr.setFileSystem(OverlayFS);
273-
}
274-
264+
SourceMgr.setFileSystem(OverlayFS);
275265
return hadAnyFailure;
276266
}
277267

branches/rxwei-patch-1/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static Optional<StringRef> getRelativeDepPath(StringRef DepPath,
273273
/// output path.
274274
/// \note Needs to be in the swift namespace so CompilerInvocation can see it.
275275
class swift::ParseableInterfaceBuilder {
276-
llvm::vfs::FileSystem &fs;
276+
llvm::vfs::OverlayFileSystem &fs;
277277
DiagnosticEngine &diags;
278278
const StringRef interfacePath;
279279
const StringRef moduleName;
@@ -765,7 +765,7 @@ class ParseableInterfaceModuleLoaderImpl {
765765
using AccessPathElem = std::pair<Identifier, SourceLoc>;
766766
friend class swift::ParseableInterfaceModuleLoader;
767767
ASTContext &ctx;
768-
llvm::vfs::FileSystem &fs;
768+
llvm::vfs::OverlayFileSystem &fs;
769769
DiagnosticEngine &diags;
770770
ModuleRebuildInfo rebuildInfo;
771771
const StringRef modulePath;

branches/rxwei-patch-1/lib/IRGen/GenBuiltin.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,6 @@ if (Builtin.ID == BuiltinValueKind::id) { \
354354
#define BUILTIN(ID, Name, Attrs) // Ignore the rest.
355355
#include "swift/AST/Builtins.def"
356356

357-
if (Builtin.ID == BuiltinValueKind::GlobalStringTablePointer) {
358-
// This builtin should be used only on strings constructed from a
359-
// string literal. If we ever get to the point of executing this builtin
360-
// at run time, it implies an incorrect use of the builtin and must result
361-
// in a trap.
362-
IGF.emitTrap(/*Unreachable=*/false);
363-
auto returnValue = llvm::UndefValue::get(IGF.IGM.Int8PtrTy);
364-
// Consume the arguments of the builtin.
365-
(void)args.claimAll();
366-
return out.add(returnValue);
367-
}
368-
369357
if (Builtin.ID == BuiltinValueKind::WillThrow) {
370358
// willThrow is emitted like a Swift function call with the error in
371359
// the error return register. We also have to pass a fake context

branches/rxwei-patch-1/lib/Immediate/Immediate.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ static void *loadRuntimeLib(StringRef sharedLibName,
7878

7979
void *swift::immediate::loadSwiftRuntime(ArrayRef<std::string>
8080
runtimeLibPaths) {
81-
#if defined(_WIN32)
82-
return loadRuntimeLib("swiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
83-
#else
8481
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
85-
#endif
8682
}
8783

8884
static bool tryLoadLibrary(LinkLibrary linkLib,

0 commit comments

Comments
 (0)