Skip to content

Commit 5481728

Browse files
authored
---
yaml --- r: 341478 b: refs/heads/rxwei-patch-1 c: 7da25d7 h: refs/heads/master
1 parent 8c9f225 commit 5481728

39 files changed

+1054
-498
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: c195fdcc5c0419e72c81918cebea7650091c57b8
1018+
refs/heads/rxwei-patch-1: 7da25d7318730df2e9c843a0ce1fc299054f2195
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/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
1818
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
1919
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
20-
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
20+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
2121
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
2222
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
2323
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|

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

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

17-
public let AngryPhonebook = BenchmarkInfo(
18-
name: "AngryPhonebook",
19-
runFunction: run_AngryPhonebook,
20-
tags: [.validation, .api, .String],
21-
legacyFactor: 7)
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+
]
2270

2371
let words = [
2472
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
@@ -38,3 +86,67 @@ public func run_AngryPhonebook(_ N: Int) {
3886
}
3987
}
4088
}
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,20 @@ 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+
554568
#undef BUILTIN_MISC_OPERATION
555569

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

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

Lines changed: 4 additions & 1 deletion
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 dianostics.
487+
// OS log optimization diagnostics.
488488

489489
ERROR(oslog_message_argument_not_found, none, "no argument of type %0 in "
490490
" the os log call", (Identifier))
@@ -505,6 +505,9 @@ 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+
508511
#ifndef DIAG_NO_UNDEF
509512
# if defined(DIAG)
510513
# undef DIAG

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,6 @@ namespace swift {
314314
/// and faster rebuilds.
315315
bool EnableExperimentalDependencies = false;
316316

317-
/// Enable the experimental opaque result types feature.
318-
bool EnableOpaqueResultTypes = true;
319-
320317
/// To mimic existing system, set to false.
321318
/// To experiment with including file-private and private dependency info,
322319
/// set to true.

branches/rxwei-patch-1/include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,6 @@ def solver_enable_operator_designated_types :
413413
Flag<["-"], "solver-enable-operator-designated-types">,
414414
HelpText<"Enable operator designated types in constraint solver">;
415415

416-
def enable_opaque_result_types :
417-
Flag<["-"], "enable-opaque-result-types">,
418-
HelpText<"Enable experimental opaque result types feature">;
419-
420416
def switch_checking_invocation_threshold_EQ : Joined<["-"],
421417
"switch-checking-invocation-threshold=">;
422418

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,13 @@ 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+
954961
static ValueDecl *getPoundAssert(ASTContext &Context, Identifier Id) {
955962
auto int1Type = BuiltinIntegerType::get(1, Context);
956963
auto optionalRawPointerType = BoundGenericEnumType::get(
@@ -1960,6 +1967,9 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
19601967
case BuiltinValueKind::GetObjCTypeEncoding:
19611968
return getGetObjCTypeEncodingOperation(Context, Id);
19621969

1970+
case BuiltinValueKind::GlobalStringTablePointer:
1971+
return getGlobalStringTablePointer(Context, Id);
1972+
19631973
case BuiltinValueKind::PoundAssert:
19641974
return getPoundAssert(Context, Id);
19651975

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,16 +1233,23 @@ CanType TypeBase::getCanonicalType(GenericSignature *sig) {
12331233
}
12341234

12351235
TypeBase *TypeBase::reconstituteSugar(bool Recursive) {
1236-
auto Func = [](Type Ty) -> Type {
1236+
auto Func = [Recursive](Type Ty) -> Type {
12371237
if (auto boundGeneric = dyn_cast<BoundGenericType>(Ty.getPointer())) {
1238+
1239+
auto getGenericArg = [&](unsigned i) -> Type {
1240+
auto arg = boundGeneric->getGenericArgs()[i];
1241+
if (Recursive)
1242+
arg = arg->reconstituteSugar(Recursive);
1243+
return arg;
1244+
};
1245+
12381246
auto &ctx = boundGeneric->getASTContext();
12391247
if (boundGeneric->getDecl() == ctx.getArrayDecl())
1240-
return ArraySliceType::get(boundGeneric->getGenericArgs()[0]);
1248+
return ArraySliceType::get(getGenericArg(0));
12411249
if (boundGeneric->getDecl() == ctx.getDictionaryDecl())
1242-
return DictionaryType::get(boundGeneric->getGenericArgs()[0],
1243-
boundGeneric->getGenericArgs()[1]);
1250+
return DictionaryType::get(getGenericArg(0), getGenericArg(1));
12441251
if (boundGeneric->getDecl() == ctx.getOptionalDecl())
1245-
return OptionalType::get(boundGeneric->getGenericArgs()[0]);
1252+
return OptionalType::get(getGenericArg(0));
12461253
}
12471254
return Ty;
12481255
};

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
276276
Opts.EnableOperatorDesignatedTypes |=
277277
Args.hasArg(OPT_enable_operator_designated_types);
278278

279-
Opts.EnableOpaqueResultTypes |=
280-
Args.hasArg(OPT_enable_opaque_result_types);
281-
282279
// Always enable operator designated types for the standard library.
283280
Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib;
284281

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,18 @@ 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+
357369
if (Builtin.ID == BuiltinValueKind::WillThrow) {
358370
// willThrow is emitted like a Swift function call with the error in
359371
// the error return register. We also have to pass a fake context

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ 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
8184
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
85+
#endif
8286
}
8387

8488
static bool tryLoadLibrary(LinkLibrary linkLib,

branches/rxwei-patch-1/lib/Parse/ParseType.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
697697
// This is only semantically allowed in certain contexts, but we parse it
698698
// generally for diagnostics and recovery.
699699
SourceLoc opaqueLoc;
700-
if (Context.LangOpts.EnableOpaqueResultTypes
701-
&& Tok.is(tok::identifier)
702-
&& Tok.getRawText() == "some") {
700+
if (Tok.is(tok::identifier) && Tok.getRawText() == "some") {
703701
// Treat some as a keyword.
704702
TokReceiver->registerTokenKindChange(Tok.getLoc(), tok::contextual_keyword);
705703
opaqueLoc = consumeToken();
@@ -765,9 +763,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
765763
}
766764

767765
// Diagnose invalid `some` after an ampersand.
768-
if (Context.LangOpts.EnableOpaqueResultTypes
769-
&& Tok.is(tok::identifier)
770-
&& Tok.getRawText() == "some") {
766+
if (Tok.is(tok::identifier) && Tok.getRawText() == "some") {
771767
auto badLoc = consumeToken();
772768

773769
// TODO: Fixit to move to beginning of composition.

branches/rxwei-patch-1/lib/SIL/OperandOwnership.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,16 @@ CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, Swift3ImplicitObjCEntrypoint)
10571057
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, PoundAssert)
10581058
#undef CONSTANT_OWNERSHIP_BUILTIN
10591059

1060+
// CONSTANT_OWNERSHIP_BUILTIN(Owned, MustBeLive, GlobalStringTablePointer)
1061+
1062+
OperandOwnershipKindMap
1063+
OperandOwnershipKindBuiltinClassifier::visitGlobalStringTablePointer(
1064+
BuiltinInst *bi, StringRef attr) {
1065+
return Map::compatibilityMap(
1066+
{{ValueOwnershipKind::Guaranteed, UseLifetimeConstraint::MustBeLive},
1067+
{ValueOwnershipKind::Owned, UseLifetimeConstraint::MustBeLive}});
1068+
}
1069+
10601070
// Builtins that should be lowered to SIL instructions so we should never see
10611071
// them.
10621072
#define BUILTIN_SIL_OPERATION(ID, NAME, CATEGORY) \

branches/rxwei-patch-1/lib/SIL/SILUndef.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@
1616
using namespace swift;
1717

1818
static ValueOwnershipKind getOwnershipKindForUndef(SILType type, const SILFunction &f) {
19-
if (type.isAddress()) {
20-
// If we have an address only type and we are supposed to use
21-
// lowered addresses, return Owned. Otherwise addresses are any.
22-
if (type.isAddressOnly(f) && f.getConventions().useLoweredAddresses()) {
23-
return ValueOwnershipKind::Owned;
24-
}
25-
return ValueOwnershipKind::Any;
26-
}
27-
28-
if (type.isTrivial(f))
19+
if (type.isAddress() || type.isTrivial(f))
2920
return ValueOwnershipKind::Any;
3021
return ValueOwnershipKind::Owned;
3122
}

branches/rxwei-patch-1/lib/SIL/ValueOwnership.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ CONSTANT_OWNERSHIP_BUILTIN(Any, OnceWithContext)
491491
CONSTANT_OWNERSHIP_BUILTIN(Any, TSanInoutAccess)
492492
CONSTANT_OWNERSHIP_BUILTIN(Any, Swift3ImplicitObjCEntrypoint)
493493
CONSTANT_OWNERSHIP_BUILTIN(Any, PoundAssert)
494+
CONSTANT_OWNERSHIP_BUILTIN(Any, GlobalStringTablePointer)
494495

495496
#undef CONSTANT_OWNERSHIP_BUILTIN
496497

branches/rxwei-patch-1/lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,12 +4057,14 @@ CallEmission::applySpecializedEmitter(SpecializedEmitter &specializedEmitter,
40574057
return firstLevelResult;
40584058
}
40594059

4060-
// Builtins.
4060+
// Named Builtins.
40614061
assert(specializedEmitter.isNamedBuiltin());
40624062
auto builtinName = specializedEmitter.getBuiltinName();
40634063
SmallVector<SILValue, 4> consumedArgs;
40644064
for (auto arg : uncurriedArgs) {
4065-
// Builtins have a special convention that takes everything at +1.
4065+
// Named builtins are by default assumed to take all arguments at +1 i.e.,
4066+
// as Owned or Trivial. Named builtins that don't follow this convention
4067+
// must use a specialized emitter.
40664068
auto maybePlusOne = arg.ensurePlusOne(SGF, uncurriedLoc.getValue());
40674069
consumedArgs.push_back(maybePlusOne.forward(SGF));
40684070
}

0 commit comments

Comments
 (0)