Skip to content

Commit 3d3d454

Browse files
committed
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2 parents a5bdf9b + 67fda25 commit 3d3d454

File tree

75 files changed

+1887
-890
lines changed

Some content is hidden

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

75 files changed

+1887
-890
lines changed

Diff for: benchmark/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ set(SWIFT_BENCH_MODULES
6565
single-source/PopFrontGeneric
6666
single-source/Prims
6767
single-source/ProtocolDispatch
68+
single-source/ProtocolDispatch2
6869
single-source/RangeAssignment
6970
single-source/RC4
7071
single-source/RecursiveOwnedParameter

Diff for: benchmark/scripts/generate_harness/generate_harness.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
for x in glob.glob(os.path.join(single_source_dir, '*.swift'))]
4141

4242
# CMakeList multi-source
43-
class multi_source_bench(object):
43+
class MultiSourceBench(object):
4444
def __init__(self, path):
4545
self.name = os.path.basename(path)
4646
self.files = [x for x in os.listdir(path)
4747
if x.endswith('.swift')]
4848
if os.path.isdir(multi_source_dir):
4949
multisource_benches = [
50-
multi_source_bench(os.path.join(multi_source_dir, x))
50+
MultiSourceBench(os.path.join(multi_source_dir, x))
5151
for x in os.listdir(multi_source_dir)
5252
if os.path.isdir(os.path.join(multi_source_dir, x))
5353
]

Diff for: benchmark/single-source/ProtocolDispatch2.swift

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//===--- ProtocolDispatch2.swift ------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See http://swift.org/LICENSE.txt for license information
9+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
// This is a simple benchmark that tests the performance of calls to
13+
// existential methods.
14+
//===----------------------------------------------------------------------===//
15+
16+
17+
import TestsUtils
18+
import Foundation
19+
20+
protocol Pingable { func ping() -> Int; func pong() -> Int}
21+
22+
struct Game : Pingable {
23+
func zero() -> Int { return 0}
24+
func ping() -> Int { return 1}
25+
func pong() -> Int { return 2}
26+
func puff() -> Int { return 3}
27+
}
28+
29+
@inline(never)
30+
func use_protocol(val : Int,_ game1 : Pingable, _ game2 : Pingable) -> Int {
31+
var t = game1.ping() + game1.pong()
32+
if (val % 2 == 0) {
33+
t += game1.pong() + game1.ping()
34+
}
35+
t += game1.ping() + game1.pong()
36+
37+
t += game2.ping() + game2.pong()
38+
if (val % 2 == 0) {
39+
t += game2.pong() + game2.ping()
40+
}
41+
t += game2.ping() + game2.pong()
42+
43+
return t
44+
}
45+
46+
@inline(never)
47+
func wrapper(val : Int,_ game1 : Pingable, _ game2 : Pingable) -> Int {
48+
return use_protocol(val, game1, game2)
49+
}
50+
51+
@inline(never)
52+
public func run_ProtocolDispatch2(N: Int) {
53+
var c = 0
54+
let g1 = Game()
55+
let g2 = Game()
56+
for _ in 1...N {
57+
c = 0
58+
for i in 1...5000 {
59+
c += wrapper(i, g1, g2)
60+
}
61+
}
62+
CheckResults(c == 75000, "IncorrectResults in ProtoDispatch")
63+
}
64+

Diff for: benchmark/utils/main.swift

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import PopFront
7070
import PopFrontGeneric
7171
import Prims
7272
import ProtocolDispatch
73+
import ProtocolDispatch2
7374
import RC4
7475
import RGBHistogram
7576
import RangeAssignment
@@ -147,6 +148,7 @@ precommitTests = [
147148
"PopFrontUnsafePointer": run_PopFrontUnsafePointer,
148149
"Prims": run_Prims,
149150
"ProtocolDispatch": run_ProtocolDispatch,
151+
"ProtocolDispatch2": run_ProtocolDispatch2,
150152
"RC4": run_RC4,
151153
"RGBHistogram": run_RGBHistogram,
152154
"RangeAssignment": run_RangeAssignment,

Diff for: docs/SIL.rst

+11-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ number of ways:
461461

462462
- A SIL function type declares the conventions for its results.
463463
The results are written as an unlabelled tuple; the elements of that
464-
tuple must be legal SIL types, optionally decoarted with one of the
464+
tuple must be legal SIL types, optionally decorated with one of the
465465
following convention attributes. Indirect and direct results may
466466
be interleaved.
467467

@@ -2391,6 +2391,16 @@ The second operand may have either object or address type. In the
23912391
latter case, the dependency is on the current value stored in the
23922392
address.
23932393

2394+
strong_pin
2395+
``````````
2396+
2397+
TODO: Fill me in!
2398+
2399+
strong_unpin
2400+
````````````
2401+
2402+
TODO: Fill me in!
2403+
23942404
is_unique
23952405
`````````
23962406

Diff for: docs/archive/LangRef.html

-2
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,6 @@ <h3 id="type-optional">Optional Types</h3>
13001300
<li><code>func _doesOptionalHaveValueAsBool<T>(v : T?) -> Bool</code></li>
13011301
<li><code>func _diagnoseUnexpectedNilOptional()</code></li>
13021302
<li><code>func _getOptionalValue<T>(v : T?) -> T</code></li>
1303-
<li><code>func _injectValueIntoOptional<T>(v : T) -> T?</code></li>
1304-
<li><code>func _injectNothingIntoOptional<T>() -> T?</code></li>
13051303
</ul>
13061304
</p>
13071305

Diff for: include/swift/AST/PrintOptions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ArchetypeTransformContext {
3333
NominalTypeDecl *getNominal();
3434
PrinterArchetypeTransformer *getTransformer() { return Transformer.get(); }
3535
bool isPrintingSynthesizedExtension();
36-
bool isPrintingTypeInteface();
36+
bool isPrintingTypeInterface();
3737
ArchetypeTransformContext(PrinterArchetypeTransformer *Transformer);
3838
ArchetypeTransformContext(PrinterArchetypeTransformer *Transformer,
3939
Type T);

Diff for: include/swift/IDE/ModuleInterfacePrinting.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void printModuleInterface(ModuleDecl *M,
4646
// FIXME: this API should go away when Swift can represent Clang submodules as
4747
// 'swift::Module *' objects.
4848
void printSubmoduleInterface(ModuleDecl *M, ArrayRef<StringRef> FullModuleName,
49-
Optional<StringRef> GroupName,
49+
ArrayRef<StringRef> GroupNames,
5050
ModuleTraversalOptions TraversalOptions,
5151
ASTPrinter &Printer, const PrintOptions &Options,
5252
const bool PrintSynthesizedExtensions);

Diff for: include/swift/SIL/SILArgument.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline bool isIndirectConvention(SILArgumentConvention convention) {
4040
return convention <= SILArgumentConvention::Indirect_Out;
4141
}
4242

43-
/// Turn a ParameterConveneion into a SILArgumentConvention.
43+
/// Turn a ParameterConvention into a SILArgumentConvention.
4444
inline SILArgumentConvention getSILArgumentConvention(ParameterConvention conv){
4545
switch (conv) {
4646
case ParameterConvention::Indirect_In:

0 commit comments

Comments
 (0)