Skip to content

Commit 1e862e5

Browse files
committed
---
yaml --- r: 341879 b: refs/heads/rxwei-patch-1 c: 1b4b7f9 h: refs/heads/master i: 341877: 49c7efd 341875: 3e81460 341871: d4a0302
1 parent 97188c2 commit 1e862e5

File tree

178 files changed

+2568
-3157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2568
-3157
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: 9496096be49a67513e440fece3ddded86c7fa303
1018+
refs/heads/rxwei-patch-1: 1b4b7f9e17576bdae479c2bb721b08895bee0609
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/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ set(SWIFT_BENCH_MODULES
7979
single-source/DictionarySubscriptDefault
8080
single-source/DictionarySwap
8181
single-source/Diffing
82-
single-source/DiffingMyers
8382
single-source/DropFirst
8483
single-source/DropLast
8584
single-source/DropWhile
@@ -106,6 +105,7 @@ set(SWIFT_BENCH_MODULES
106105
single-source/Memset
107106
single-source/MonteCarloE
108107
single-source/MonteCarloPi
108+
single-source/Myers
109109
single-source/NSDictionaryCastToSwift
110110
single-source/NSError
111111
single-source/NSStringConversion

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

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,111 @@ import TestsUtils
1515
let t: [BenchmarkCategory] = [.api]
1616
public let Diffing = [
1717
BenchmarkInfo(
18-
name: "Diffing.Same",
19-
runFunction: { diff($0, from: longPangram, to: longPangram) },
18+
name: "DiffSame",
19+
runFunction: run_DiffSame,
2020
tags: t,
21-
setUpFunction: { blackHole(longPangram) }),
21+
legacyFactor: 10),
2222
BenchmarkInfo(
23-
name: "Diffing.PangramToAlphabet",
24-
runFunction: { diff($0, from: longPangram, to: alphabets) },
23+
name: "DiffPangramToAlphabet",
24+
runFunction: run_DiffPangramToAlphabet,
2525
tags: t,
26-
setUpFunction: { blackHole((longPangram, alphabets)) }),
26+
legacyFactor: 10),
2727
BenchmarkInfo(
28-
name: "Diffing.Pangrams",
29-
runFunction: { diff($0, from:typingPangram, to: longPangram) },
28+
name: "DiffPangrams",
29+
runFunction: run_DiffPangrams,
3030
tags: t,
31-
setUpFunction: { blackHole((longPangram, typingPangram)) }),
31+
legacyFactor: 10),
3232
BenchmarkInfo(
33-
name: "Diffing.ReversedAlphabets",
34-
runFunction: { diff($0, from:alphabets, to: alphabetsReversed) },
33+
name: "DiffReversedAlphabets",
34+
runFunction: run_DiffReversedAlphabets,
3535
tags: t,
36-
setUpFunction: { blackHole((alphabets, alphabetsReversed)) }),
36+
legacyFactor: 10),
3737
BenchmarkInfo(
38-
name: "Diffing.ReversedLorem",
39-
runFunction: { diff($0, from: loremIpsum, to: loremReversed) },
38+
name: "DiffReversedLorem",
39+
runFunction: run_DiffReversedLorem,
4040
tags: t,
41-
setUpFunction: { blackHole((loremIpsum, loremReversed)) }),
41+
legacyFactor: 10),
4242
BenchmarkInfo(
43-
name: "Diffing.Disparate",
44-
runFunction: { diff($0, from: numbersAndSymbols, to: alphabets) },
43+
name: "DiffDisparate",
44+
runFunction: run_DiffDisparate,
4545
tags: t,
46-
setUpFunction: { blackHole((numbersAndSymbols, alphabets)) }),
46+
legacyFactor: 10),
4747
BenchmarkInfo(
48-
name: "Diffing.Similar",
49-
runFunction: { diff($0, from: unabridgedLorem, to: loremIpsum) },
48+
name: "DiffSimilar",
49+
runFunction: run_DiffSimilar,
5050
tags: t,
51-
setUpFunction: { blackHole((unabridgedLorem, loremIpsum)) }),
51+
legacyFactor: 10),
5252
]
5353

5454
let numbersAndSymbols = Array("0123456789`~!@#$%^&*()+=_-\"'?/<,>.\\{}'")
5555
let alphabets = Array("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
56-
let alphabetsReversed = Array(alphabets.reversed())
56+
let alphabetsReversed = Array("ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba")
5757
let longPangram = Array("This pangram contains four As, one B, two Cs, one D, thirty Es, six Fs, five Gs, seven Hs, eleven Is, one J, one K, two Ls, two Ms, eighteen Ns, fifteen Os, two Ps, one Q, five Rs, twenty-seven Ss, eighteen Ts, two Us, seven Vs, eight Ws, two Xs, three Ys, & one Z")
5858
let typingPangram = Array("The quick brown fox jumps over the lazy dog")
5959
let loremIpsum = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
6060
let unabridgedLorem = Array("Lorem ipsum, quia dolor sit amet consectetur adipisci[ng] velit, sed quia non-numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliqua.")
61-
let loremReversed = Array(loremIpsum.reversed())
61+
let loremReverse = Array(".auqila angam erolod te erobal tu tnudidicni ropmet domsuie od des ,tile gnicsipida rutetcesnoc ,tema tis rolod muspi meroL")
6262

63-
@inline(never) func diff(_ N: Int, from older: [Character], to newer: [Character]) {
63+
64+
@inline(never)
65+
public func run_DiffSame(_ N: Int) {
66+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
67+
for _ in 1...N {
68+
let _ = longPangram.difference(from: longPangram)
69+
}
70+
}
71+
}
72+
73+
@inline(never)
74+
public func run_DiffPangramToAlphabet(_ N: Int) {
75+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
76+
for _ in 1...N {
77+
let _ = longPangram.difference(from: alphabets)
78+
}
79+
}
80+
}
81+
82+
@inline(never)
83+
public func run_DiffPangrams(_ N: Int) {
84+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
85+
for _ in 1...N {
86+
let _ = longPangram.difference(from: typingPangram)
87+
}
88+
}
89+
}
90+
91+
@inline(never)
92+
public func run_DiffReversedAlphabets(_ N: Int) {
93+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
94+
for _ in 1...N {
95+
let _ = alphabets.difference(from: alphabetsReversed)
96+
}
97+
}
98+
}
99+
100+
@inline(never)
101+
public func run_DiffReversedLorem(_ N: Int) {
102+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
103+
for _ in 1...N {
104+
let _ = loremIpsum.difference(from: loremReverse)
105+
}
106+
}
107+
}
108+
109+
@inline(never)
110+
public func run_DiffDisparate(_ N: Int) {
111+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
112+
for _ in 1...N {
113+
let _ = alphabets.difference(from: numbersAndSymbols)
114+
}
115+
}
116+
}
117+
118+
@inline(never)
119+
public func run_DiffSimilar(_ N: Int) {
64120
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
65121
for _ in 1...N {
66-
blackHole(newer.difference(from: older))
122+
let _ = loremIpsum.difference(from: unabridgedLorem)
67123
}
68124
}
69125
}

branches/rxwei-patch-1/benchmark/single-source/DiffingMyers.swift renamed to branches/rxwei-patch-1/benchmark/single-source/Myers.swift

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- DiffingMyers.swift -----------------------------------------------===//
1+
//===--- Myers.swift -------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -12,25 +12,18 @@
1212

1313
import TestsUtils
1414

15-
// The DiffingMyers test benchmarks Swift's performance running the algorithm
16-
// described in Myers (1986). The Diffing benchmark tracks the performance
17-
// of `Collection.difference(from:to:)`.
15+
public let Myers = [
16+
BenchmarkInfo(name: "Myers", runFunction: run_Myers, tags: [.algorithm]),
17+
]
1818

19-
public let DiffingMyers = BenchmarkInfo(
20-
name: "Diffing.Myers.Similar",
21-
runFunction: run_Myers,
22-
tags: [.algorithm],
23-
setUpFunction: { blackHole((loremIpsum, unabridgedLorem)) })
24-
25-
26-
let loremIpsum = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
27-
let unabridgedLorem = Array("Lorem ipsum, quia dolor sit amet consectetur adipisci[ng] velit, sed quia non-numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliqua.")
19+
let loremShort = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
20+
let loremLong = Array("Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet consectetur adipisci[ng] velit, sed quia non-numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum[d] exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?")
2821

2922
@inline(never)
3023
public func run_Myers(N: Int) {
3124
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
3225
for _ in 1...N {
33-
blackHole(myers(from: unabridgedLorem, to: loremIpsum, using: ==))
26+
let _ = myers(from: loremShort, to: loremLong, using: ==)
3427
}
3528
}
3629
}
@@ -200,4 +193,4 @@ fileprivate func myers<C,D>(
200193
return CollectionDifference(_formChanges(from: a, to: b, using:_descent(from: a, to: b)))!
201194
}
202195
}
203-
}
196+
}

branches/rxwei-patch-1/benchmark/utils/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import DictionaryRemove
6767
import DictionarySubscriptDefault
6868
import DictionarySwap
6969
import Diffing
70-
import DiffingMyers
7170
import DropFirst
7271
import DropLast
7372
import DropWhile
@@ -94,6 +93,7 @@ import MapReduce
9493
import Memset
9594
import MonteCarloE
9695
import MonteCarloPi
96+
import Myers
9797
import NibbleSort
9898
import NIOChannelPipeline
9999
import NSDictionaryCastToSwift
@@ -243,7 +243,6 @@ registerBenchmark(DictionaryRemove)
243243
registerBenchmark(DictionarySubscriptDefault)
244244
registerBenchmark(DictionarySwap)
245245
registerBenchmark(Diffing)
246-
registerBenchmark(DiffingMyers)
247246
registerBenchmark(DropFirst)
248247
registerBenchmark(DropLast)
249248
registerBenchmark(DropWhile)
@@ -271,6 +270,7 @@ registerBenchmark(MapReduce)
271270
registerBenchmark(Memset)
272271
registerBenchmark(MonteCarloE)
273272
registerBenchmark(MonteCarloPi)
273+
registerBenchmark(Myers)
274274
registerBenchmark(NSDictionaryCastToSwift)
275275
registerBenchmark(NSErrorTest)
276276
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
//===----------------------------------------------------------------------===//
1717
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
1818
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)
19-
SWIFT_TYPEID_NAMED(Decl *, Decl)
2019
SWIFT_TYPEID(Type)
2120
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
2221
SWIFT_TYPEID(PropertyWrapperTypeInfo)

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,12 +3451,42 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
34513451
/// Retrieve information about this type as a property wrapper.
34523452
PropertyWrapperTypeInfo getPropertyWrapperTypeInfo() const;
34533453

3454+
private:
3455+
/// Predicate used to filter StoredPropertyRange.
3456+
struct ToStoredProperty {
3457+
ToStoredProperty(bool skipInaccessible = false) :
3458+
skipUserInaccessible(skipInaccessible) {}
3459+
bool skipUserInaccessible;
3460+
Optional<VarDecl *> operator()(Decl *decl) const;
3461+
};
3462+
3463+
public:
3464+
/// A range for iterating the stored member variables of a structure.
3465+
using StoredPropertyRange = OptionalTransformRange<DeclRange,
3466+
ToStoredProperty>;
3467+
34543468
/// Return a collection of the stored member variables of this type.
3455-
ArrayRef<VarDecl *> getStoredProperties() const;
3469+
StoredPropertyRange getStoredProperties(bool skipInaccessible = false) const;
3470+
3471+
private:
3472+
/// Predicate used to filter StoredPropertyRange.
3473+
struct ToStoredPropertyOrMissingMemberPlaceholder {
3474+
Optional<Decl *> operator()(Decl *decl) const;
3475+
};
34563476

3477+
public:
3478+
/// A range for iterating the stored member variables of a structure.
3479+
using StoredPropertyOrMissingMemberPlaceholderRange
3480+
= OptionalTransformRange<DeclRange,
3481+
ToStoredPropertyOrMissingMemberPlaceholder>;
3482+
34573483
/// Return a collection of the stored member variables of this type, along
34583484
/// with placeholders for unimportable stored properties.
3459-
ArrayRef<Decl *> getStoredPropertiesAndMissingMemberPlaceholders() const;
3485+
StoredPropertyOrMissingMemberPlaceholderRange
3486+
getStoredPropertiesAndMissingMemberPlaceholders() const {
3487+
return StoredPropertyOrMissingMemberPlaceholderRange(getMembers(),
3488+
ToStoredPropertyOrMissingMemberPlaceholder());
3489+
}
34603490

34613491
// Implement isa/cast/dyncast/etc.
34623492
static bool classof(const Decl *D) {
@@ -5743,11 +5773,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
57435773
setBodyKind(BodyKind::Unparsed);
57445774
}
57455775

5746-
/// Provide the parsed body for the function.
5747-
void setBodyParsed(BraceStmt *S) {
5748-
setBody(S, BodyKind::Parsed);
5749-
}
5750-
57515776
/// Note that parsing for the body was delayed.
57525777
///
57535778
/// The function should return the body statement and a flag indicating
@@ -5768,6 +5793,14 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
57685793
setBodyKind(BodyKind::MemberwiseInitializer);
57695794
}
57705795

5796+
/// If a body has been loaded, flag that it's been type-checked.
5797+
/// This is kindof a hacky operation, but it avoids some unnecessary
5798+
/// duplication of work.
5799+
void setBodyTypeCheckedIfPresent() {
5800+
if (getBodyKind() == BodyKind::Parsed)
5801+
setBodyKind(BodyKind::TypeChecked);
5802+
}
5803+
57715804
/// Gets the body of this function, stripping the unused portions of #if
57725805
/// configs inside the body. If this function was not deserialized from a
57735806
/// .swiftmodule, this body is reconstructed from the original
@@ -7120,6 +7153,32 @@ inline bool ValueDecl::isSettable(const DeclContext *UseDC,
71207153
return false;
71217154
}
71227155

7156+
inline Optional<VarDecl *>
7157+
NominalTypeDecl::ToStoredProperty::operator()(Decl *decl) const {
7158+
if (auto var = dyn_cast<VarDecl>(decl)) {
7159+
if (!var->isStatic() && var->hasStorage() &&
7160+
(!skipUserInaccessible || var->isUserAccessible()))
7161+
return var;
7162+
}
7163+
7164+
return None;
7165+
}
7166+
7167+
inline Optional<Decl *>
7168+
NominalTypeDecl::ToStoredPropertyOrMissingMemberPlaceholder
7169+
::operator()(Decl *decl) const {
7170+
if (auto var = dyn_cast<VarDecl>(decl)) {
7171+
if (!var->isStatic() && var->hasStorage())
7172+
return var;
7173+
}
7174+
if (auto missing = dyn_cast<MissingMemberDecl>(decl)) {
7175+
if (missing->getNumberOfFieldOffsetVectorEntries() > 0)
7176+
return missing;
7177+
}
7178+
7179+
return None;
7180+
}
7181+
71237182
inline void
71247183
AbstractStorageDecl::overwriteSetterAccess(AccessLevel accessLevel) {
71257184
Accessors.setInt(accessLevel);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ WARNING(warn_use_filelists_deprecated, none,
166166
ERROR(cannot_find_migration_script, none,
167167
"missing migration script from path '%0'", (StringRef))
168168

169-
ERROR(error_darwin_static_stdlib_not_supported, none,
170-
"-static-stdlib is no longer supported on Apple platforms", ())
171-
172169
#ifndef DIAG_NO_UNDEF
173170
# if defined(DIAG)
174171
# undef DIAG

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,6 @@ ERROR(cannot_convert_default_arg_value,none,
350350
(Type,Type))
351351
ERROR(cannot_convert_default_arg_value_protocol,none,
352352
"default argument value of type %0 does not conform to %1", (Type,Type))
353-
ERROR(default_argument_literal_cannot_convert, none,
354-
"cannot call %0 %1 because default argument of type %2 cannot be "
355-
"converted to type %3", (DescriptiveDeclKind, DeclName, Type, Type))
356353
ERROR(cannot_convert_default_arg_value_nil,none,
357354
"nil default argument value cannot be converted to type %0", (Type))
358355

@@ -2343,10 +2340,6 @@ WARNING(override_swift3_objc_inference,none,
23432340
"override of %0 %1 from extension of %2 depends on deprecated "
23442341
"inference of '@objc'",
23452342
(DescriptiveDeclKind, DeclName, Identifier))
2346-
ERROR(override_method_different_generic_sig,none,
2347-
"overridden method %0 has generic signature %1 which is incompatible with "
2348-
"base method's generic signature %2; expected generic signature to be %3",
2349-
(DeclBaseName, StringRef, StringRef, StringRef))
23502343

23512344
// Inheritance
23522345
ERROR(duplicate_inheritance,none,
@@ -3395,12 +3388,9 @@ ERROR(closure_tuple_parameter_destructuring_implicit,none,
33953388
ERROR(nested_tuple_parameter_destructuring,none,
33963389
"nested tuple parameter %0 of function %1 "
33973390
"does not support destructuring", (Type, Type))
3398-
ERROR(single_tuple_parameter_mismatch_special,none,
3399-
"%0 expects a single parameter of type %1%2",
3400-
(DescriptiveDeclKind, Type, StringRef))
3401-
ERROR(single_tuple_parameter_mismatch_normal,none,
3402-
"%0 %1 expects a single parameter of type %2%3",
3403-
(DescriptiveDeclKind, DeclBaseName, Type, StringRef))
3391+
ERROR(single_tuple_parameter_mismatch,none,
3392+
"%0 %select{|%1 }3expects a single parameter of type %2",
3393+
(DescriptiveDeclKind, Identifier, Type, bool))
34043394
ERROR(unknown_single_tuple_parameter_mismatch,none,
34053395
"single parameter of type %0 is expected in call", (Type))
34063396

0 commit comments

Comments
 (0)