Skip to content

Commit 9f6e4db

Browse files
authored
---
yaml --- r: 331775 b: refs/heads/rxwei-patch-1 c: b3ca057 h: refs/heads/master i: 331773: 84bab40 331771: cd0cd59 331767: 3d6b144 331759: 1560bed 331743: aca6efb 331711: 5ae08a9 331647: 11ea0ad 331519: fbb6a46 331263: 3016ff9 330751: 015b102 329727: 1e0a705 327679: a75c9d3
1 parent 3551b16 commit 9f6e4db

File tree

125 files changed

+2151
-872
lines changed

Some content is hidden

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

125 files changed

+2151
-872
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: 7e8c007757367cc18d04439b302f7790a65daff6
1018+
refs/heads/rxwei-patch-1: b3ca05708d6f00a61a0140eac71f1b4ca245cda3
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
@@ -56,6 +56,7 @@ set(SWIFT_BENCH_MODULES
5656
single-source/CharacterProperties
5757
single-source/Chars
5858
single-source/ClassArrayGetter
59+
single-source/Codable
5960
single-source/Combos
6061
single-source/CountAlgo
6162
single-source/DataBenchmarks
@@ -94,7 +95,6 @@ set(SWIFT_BENCH_MODULES
9495
single-source/InsertCharacter
9596
single-source/Integrate
9697
single-source/IterateData
97-
single-source/JSON
9898
single-source/Join
9999
single-source/LazyFilter
100100
single-source/LinkedList
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
//===--- JSON.swift -------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2018 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import TestsUtils
14+
import Foundation
15+
16+
#if _runtime(_ObjC)
17+
public let Codable = [
18+
BenchmarkInfo(name: "JSONPerfEncode", runFunction: run_JSONPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_json),
19+
BenchmarkInfo(name: "JSONPerfDecode", runFunction: run_JSONPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_json),
20+
BenchmarkInfo(name: "PlistPerfEncode", runFunction: run_PlistPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_plist),
21+
BenchmarkInfo(name: "PlistPerfDecode", runFunction: run_PlistPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_plist),
22+
]
23+
#else
24+
public let Codable = [
25+
BenchmarkInfo(name: "JSONPerfEncode", runFunction: run_JSONPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_json),
26+
BenchmarkInfo(name: "JSONPerfDecode", runFunction: run_JSONPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_json),
27+
]
28+
#endif
29+
30+
31+
32+
struct Tove: Codable {
33+
var slithy: Bool = true
34+
var gyreInRadians: Double = 0.3
35+
}
36+
37+
struct Borogove : Codable {
38+
var mimsyness: Int = Int.max
39+
}
40+
41+
struct Wabe : Codable {
42+
var toves: [Tove]
43+
var borogoves: [Borogove]?
44+
static var canonical: Wabe {
45+
return Wabe(toves: [Tove(), Tove(), Tove(), Tove(),
46+
Tove(slithy: false, gyreInRadians: 1.8)],
47+
borogoves: [Borogove(mimsyness: 18), Borogove(mimsyness: 74),
48+
Borogove(), Borogove()])
49+
}
50+
}
51+
52+
struct Beast : Codable {
53+
var name: String
54+
}
55+
56+
57+
struct Jabberwocky : Codable {
58+
var time = "brillig"
59+
var wabe = Wabe.canonical
60+
var beware: [Beast] = [ Beast(name: "Jabberwock"), Beast(name: "Bandersnatch"), Beast(name: "Jubjub Bird")]
61+
var swordType = "vörpal"
62+
}
63+
64+
protocol GenericEncoder {
65+
func encode<T : Encodable>(_ value: T) throws -> Data
66+
}
67+
68+
protocol GenericDecoder {
69+
func decode<T : Decodable>(_ type: T.Type, from data: Data) throws -> T
70+
}
71+
72+
extension JSONEncoder : GenericEncoder {}
73+
extension JSONDecoder : GenericDecoder {}
74+
#if _runtime(_ObjC)
75+
extension PropertyListEncoder : GenericEncoder {}
76+
extension PropertyListDecoder : GenericDecoder {}
77+
#endif
78+
79+
struct CodablePerfTester<Enc: GenericEncoder, Dec: GenericDecoder> {
80+
var poems = Array(repeating: Jabberwocky(), count: 6)
81+
var encoder: Enc
82+
var decoder: Dec
83+
var data: Data! = nil
84+
85+
init(encoder e: Enc, decoder d: Dec) {
86+
encoder = e
87+
decoder = d
88+
data = try! encoder.encode(Array(poems.prefix(3)))
89+
//pre-warm everything to try to reduce variance
90+
let _ = try! encoder.encode(poems)
91+
let _ = try! decoder.decode(Array<Jabberwocky>.self,
92+
from: data)
93+
}
94+
95+
func encode() {
96+
let _ = try! encoder.encode(poems)
97+
}
98+
99+
func decode() {
100+
let _ = try! decoder.decode(Array<Jabberwocky>.self, from: data)
101+
}
102+
}
103+
104+
var JSONTester: CodablePerfTester<JSONEncoder, JSONDecoder>! = nil
105+
106+
public func setup_json() {
107+
JSONTester = CodablePerfTester(encoder: JSONEncoder(), decoder: JSONDecoder())
108+
}
109+
110+
@inline(never)
111+
public func run_JSONPerfEncode(_ N: Int) {
112+
for _ in 0 ..< N {
113+
JSONTester.encode()
114+
}
115+
}
116+
117+
@inline(never)
118+
public func run_JSONPerfDecode(_ N: Int) {
119+
for _ in 0 ..< N {
120+
JSONTester.decode()
121+
}
122+
}
123+
124+
#if _runtime(_ObjC)
125+
126+
var plistTester: CodablePerfTester<PropertyListEncoder, PropertyListDecoder>! = nil
127+
128+
public func setup_plist() {
129+
plistTester = CodablePerfTester(encoder: PropertyListEncoder(), decoder: PropertyListDecoder())
130+
}
131+
132+
@inline(never)
133+
public func run_PlistPerfEncode(_ N: Int) {
134+
for _ in 0 ..< N {
135+
plistTester.encode()
136+
}
137+
}
138+
139+
@inline(never)
140+
public func run_PlistPerfDecode(_ N: Int) {
141+
for _ in 0 ..< N {
142+
plistTester.decode()
143+
}
144+
}
145+
146+
#endif

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

Lines changed: 0 additions & 88 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import CharacterLiteralsSmall
4444
import CharacterProperties
4545
import Chars
4646
import ClassArrayGetter
47+
import Codable
4748
import Combos
4849
import CountAlgo
4950
import DataBenchmarks
@@ -82,7 +83,6 @@ import Histogram
8283
import InsertCharacter
8384
import Integrate
8485
import IterateData
85-
import JSON
8686
import Join
8787
import LazyFilter
8888
import LinkedList
@@ -255,7 +255,7 @@ registerBenchmark(Histogram)
255255
registerBenchmark(InsertCharacter)
256256
registerBenchmark(IntegrateTest)
257257
registerBenchmark(IterateData)
258-
registerBenchmark(JSON)
258+
registerBenchmark(Codable)
259259
registerBenchmark(Join)
260260
registerBenchmark(LazyFilter)
261261
registerBenchmark(LinkedList)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,7 @@ function(_add_swift_executable_single name)
21602160
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
21612161
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
21622162
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2163+
set(SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS})
21632164
endif()
21642165

21652166
handle_swift_sources(

branches/rxwei-patch-1/docs/ABI/Mangling.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ Globals
146146
global ::= type protocol-conformance 'WL' // lazy protocol witness table cache variable
147147

148148
global ::= protocol-conformance identifier 'Wt' // associated type metadata accessor (HISTORICAL)
149-
global ::= protocol-conformance assoc-type-list nominal-type 'WT' // associated type witness table accessor
149+
global ::= protocol-conformance assoc-type-list protocol 'WT' // associated type witness table accessor
150+
global ::= protocol-conformance protocol 'Wb' // base protocol witness table accessor
150151
global ::= type protocol-conformance 'Wl' // lazy protocol witness table accessor
151152

152153
global ::= type 'WV' // value witness table
@@ -200,6 +201,7 @@ types where the metadata itself has unknown layout.)
200201
global ::= assoc-type-name 'TM' // default associated type witness accessor (HISTORICAL)
201202
global ::= type assoc-type-list protocol 'Tn' // associated conformance descriptor
202203
global ::= type assoc-type-list protocol 'TN' // default associated conformance witness accessor
204+
global ::= type protocol 'Tb' // base conformance descriptor
203205

204206
REABSTRACT-THUNK-TYPE ::= 'R' // reabstraction thunk helper function
205207
REABSTRACT-THUNK-TYPE ::= 'r' // reabstraction thunk

branches/rxwei-patch-1/include/swift/ABI/Metadata.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,13 +845,15 @@ struct TargetVTableDescriptorHeader {
845845
template <typename Runtime>
846846
struct TargetMethodOverrideDescriptor {
847847
/// The class containing the base method.
848-
TargetRelativeIndirectablePointer<Runtime, TargetClassDescriptor<Runtime>> Class;
848+
TargetRelativeIndirectablePointer<Runtime, TargetClassDescriptor<Runtime>,
849+
/*nullable*/ true> Class;
849850

850851
/// The base method.
851-
TargetRelativeIndirectablePointer<Runtime, TargetMethodDescriptor<Runtime>> Method;
852+
TargetRelativeIndirectablePointer<Runtime, TargetMethodDescriptor<Runtime>,
853+
/*nullable*/ true> Method;
852854

853855
/// The implementation of the override.
854-
TargetRelativeDirectPointer<Runtime, void, /*Nullable=*/true> Impl;
856+
TargetRelativeDirectPointer<Runtime, void, /*nullable*/ true> Impl;
855857
};
856858

857859
/// Header for a class vtable override descriptor. This is a variable-sized

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ namespace swift {
5252
enum class Associativity : unsigned char;
5353
class BoundGenericType;
5454
class ClangNode;
55+
class ConstructorDecl;
5556
class Decl;
5657
class DeclContext;
5758
class DefaultArgumentInitializer;
@@ -513,8 +514,8 @@ class ASTContext final {
513514
/// promises to return non-null.
514515
bool hasArrayLiteralIntrinsics(LazyResolver *resolver) const;
515516

516-
/// Retrieve the declaration of Swift._getBool.
517-
FuncDecl *getGetBoolDecl(LazyResolver *resolver) const;
517+
/// Retrieve the declaration of Swift.Bool.init(_builtinBooleanLiteral:)
518+
ConstructorDecl *getBoolBuiltinInitDecl() const;
518519

519520
/// Retrieve the declaration of Swift.==(Int, Int) -> Bool.
520521
FuncDecl *getEqualIntDecl() const;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ DECL_ATTR(_clangImporterSynthesizedType, ClangImporterSynthesizedType,
362362
NotSerialized, 74)
363363
SIMPLE_DECL_ATTR(_weakLinked, WeakLinked,
364364
OnNominalType | OnAssociatedType | OnFunc | OnAccessor | OnVar |
365-
OnSubscript | OnConstructor | OnEnumElement | UserInaccessible,
365+
OnSubscript | OnConstructor | OnEnumElement | OnExtension | UserInaccessible,
366366
75)
367367
SIMPLE_DECL_ATTR(_frozen, Frozen,
368368
OnEnum |

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,9 +2913,6 @@ class GenericTypeParamDecl : public AbstractTypeParamDecl {
29132913
/// func getNext() -> Element?
29142914
/// }
29152915
/// \endcode
2916-
///
2917-
/// Every protocol has an implicitly-created associated type 'Self' that
2918-
/// describes a type that conforms to the protocol.
29192916
class AssociatedTypeDecl : public AbstractTypeParamDecl {
29202917
/// The location of the initial keyword.
29212918
SourceLoc KeywordLoc;
@@ -3875,6 +3872,14 @@ struct SelfReferenceKind {
38753872
/// protocol Drawable {
38763873
/// func draw()
38773874
/// }
3875+
///
3876+
/// Every protocol has an implicitly-created 'Self' generic parameter that
3877+
/// stands for a type that conforms to the protocol. For example,
3878+
///
3879+
/// protocol Cloneable {
3880+
/// func clone() -> Self
3881+
/// }
3882+
///
38783883
class ProtocolDecl final : public NominalTypeDecl {
38793884
SourceLoc ProtocolLoc;
38803885

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,8 @@ ERROR(attr_availability_unavailable_deprecated,none,
13491349
"'%0' attribute cannot be both unconditionally 'unavailable' and "
13501350
"'deprecated'", (StringRef))
13511351

1352+
WARNING(attr_availability_invalid_duplicate,none,
1353+
"'%0' argument has already been specified", (StringRef))
13521354
WARNING(attr_availability_unknown_platform,none,
13531355
"unknown platform '%0' for attribute '%1'", (StringRef, StringRef))
13541356
ERROR(attr_availability_invalid_renamed,none,

0 commit comments

Comments
 (0)