Skip to content

Commit 9491508

Browse files
committed
---
yaml --- r: 341887 b: refs/heads/rxwei-patch-1 c: 8f1a9b4 h: refs/heads/master i: 341885: 417932a 341883: 6386e33 341879: 1e862e5 341871: d4a0302 341855: 2c10425 341823: c7588a9 341759: cf9612b
1 parent 630d021 commit 9491508

File tree

96 files changed

+1713
-2312
lines changed

Some content is hidden

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

96 files changed

+1713
-2312
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: 8880aaef1ffa7e3ea7894ac89039694bc9935867
1018+
refs/heads/rxwei-patch-1: 8f1a9b47893dc66e74a7991c0be8cebf9c7626f7
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/Builtins.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
#ifndef SWIFT_AST_BUILTINS_H
1818
#define SWIFT_AST_BUILTINS_H
1919

20-
#include "swift/AST/Type.h"
21-
#include "swift/AST/Types.h"
2220
#include "swift/Basic/LLVM.h"
2321
#include "llvm/ADT/SmallVector.h"
2422
#include "llvm/IR/Attributes.h"
23+
#include "swift/AST/Type.h"
2524
#include "llvm/IR/Intrinsics.h"
2625
#include "llvm/Support/ErrorHandling.h"
2726

@@ -30,17 +29,9 @@ enum class AtomicOrdering;
3029
}
3130

3231
namespace swift {
33-
34-
class ASTContext;
35-
class Identifier;
36-
class ValueDecl;
37-
38-
enum class BuiltinTypeKind : std::underlying_type<TypeKind>::type {
39-
#define TYPE(id, parent)
40-
#define BUILTIN_TYPE(id, parent) \
41-
id = std::underlying_type<TypeKind>::type(TypeKind::id),
42-
#include "swift/AST/TypeNodes.def"
43-
};
32+
class ASTContext;
33+
class Identifier;
34+
class ValueDecl;
4435

4536
/// Get the builtin type for the given name.
4637
///
@@ -98,6 +89,7 @@ llvm::Intrinsic::ID getLLVMIntrinsicID(StringRef Name);
9889
llvm::Intrinsic::ID
9990
getLLVMIntrinsicIDForBuiltinWithOverflow(BuiltinValueKind ID);
10091

92+
10193
/// Create a ValueDecl for the builtin with the given name.
10294
///
10395
/// Returns null if the name does not identifier a known builtin value.

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

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,12 +3451,40 @@ 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() {}
3458+
Optional<VarDecl *> operator()(Decl *decl) const;
3459+
};
3460+
3461+
public:
3462+
/// A range for iterating the stored member variables of a structure.
3463+
using StoredPropertyRange = OptionalTransformRange<DeclRange,
3464+
ToStoredProperty>;
3465+
34543466
/// Return a collection of the stored member variables of this type.
3455-
ArrayRef<VarDecl *> getStoredProperties() const;
3467+
StoredPropertyRange getStoredProperties() const;
34563468

3469+
private:
3470+
/// Predicate used to filter StoredPropertyRange.
3471+
struct ToStoredPropertyOrMissingMemberPlaceholder {
3472+
Optional<Decl *> operator()(Decl *decl) const;
3473+
};
3474+
3475+
public:
3476+
/// A range for iterating the stored member variables of a structure.
3477+
using StoredPropertyOrMissingMemberPlaceholderRange
3478+
= OptionalTransformRange<DeclRange,
3479+
ToStoredPropertyOrMissingMemberPlaceholder>;
3480+
34573481
/// Return a collection of the stored member variables of this type, along
34583482
/// with placeholders for unimportable stored properties.
3459-
ArrayRef<Decl *> getStoredPropertiesAndMissingMemberPlaceholders() const;
3483+
StoredPropertyOrMissingMemberPlaceholderRange
3484+
getStoredPropertiesAndMissingMemberPlaceholders() const {
3485+
return StoredPropertyOrMissingMemberPlaceholderRange(getMembers(),
3486+
ToStoredPropertyOrMissingMemberPlaceholder());
3487+
}
34603488

34613489
// Implement isa/cast/dyncast/etc.
34623490
static bool classof(const Decl *D) {

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

Lines changed: 3 additions & 9 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

@@ -3395,12 +3392,9 @@ ERROR(closure_tuple_parameter_destructuring_implicit,none,
33953392
ERROR(nested_tuple_parameter_destructuring,none,
33963393
"nested tuple parameter %0 of function %1 "
33973394
"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))
3395+
ERROR(single_tuple_parameter_mismatch,none,
3396+
"%0 %select{|%1 }3expects a single parameter of type %2",
3397+
(DescriptiveDeclKind, Identifier, Type, bool))
34043398
ERROR(unknown_single_tuple_parameter_mismatch,none,
34053399
"single parameter of type %0 is expected in call", (Type))
34063400

0 commit comments

Comments
 (0)