Skip to content

Commit aec7a83

Browse files
committed
---
yaml --- r: 345911 b: refs/heads/master c: f3915ee h: refs/heads/master i: 345909: 016fd9e 345907: 68f1979 345903: 81d738b
1 parent 9511fb3 commit aec7a83

30 files changed

+104
-192
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a686fca618fb78ab1001d4bb8d862679813876ac
2+
refs/heads/master: f3915eee548278de4d0a63ccd853aead189310ed
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/benchmark/utils/TestsUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public func Random() -> Int64 {
221221
return lfsrRandomGenerator.randInt()
222222
}
223223

224-
@inline(__always)
224+
@inlinable @inline(__always)
225225
public func CheckResults(
226226
_ resultsMatch: Bool,
227227
file: StaticString = #file,

trunk/include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ SIMPLE_DECL_ATTR(unsafe_no_objc_tagged_pointer, UnsafeNoObjCTaggedPointer,
179179
UserInaccessible,
180180
19)
181181
DECL_ATTR(inline, Inline,
182-
OnFunc | OnAccessor | OnConstructor,
182+
OnVar | OnSubscript | OnAbstractFunction,
183183
20)
184184
DECL_ATTR(_semantics, Semantics,
185185
OnAbstractFunction | OnSubscript |

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4097,7 +4097,6 @@ ERROR(usable_from_inline_attr_in_protocol,none,
40974097

40984098
#define FRAGILE_FUNC_KIND \
40994099
"%select{a '@_transparent' function|" \
4100-
"an '@inline(__always)' function|" \
41014100
"an '@inlinable' function|" \
41024101
"a default argument value|" \
41034102
"a property initializer in a '@_fixed_layout' type}"
@@ -4126,7 +4125,7 @@ NOTE(resilience_decl_declared_here,
41264125

41274126
ERROR(class_designated_init_inlinable_resilient,none,
41284127
"initializer for class %0 is "
4129-
"'%select{@_transparent|@inline(__always)|@inlinable|%error}1' and must "
4128+
"'%select{@_transparent|@inlinable|%error}1' and must "
41304129
"delegate to another initializer", (Type, unsigned))
41314130

41324131
ERROR(attribute_invalid_on_stored_property,

trunk/lib/AST/DeclContext.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,18 +323,13 @@ ResilienceExpansion DeclContext::getResilienceExpansion() const {
323323
if (!funcAccess.isPublic())
324324
break;
325325

326-
// Bodies of public transparent and always-inline functions are
327-
// serialized, so use conservative access patterns.
326+
// If the function is public, @_transparent implies @inlinable.
328327
if (AFD->isTransparent())
329328
return ResilienceExpansion::Minimal;
330329

331330
if (AFD->getAttrs().hasAttribute<InlinableAttr>())
332331
return ResilienceExpansion::Minimal;
333332

334-
if (auto attr = AFD->getAttrs().getAttribute<InlineAttr>())
335-
if (attr->getKind() == InlineKind::Always)
336-
return ResilienceExpansion::Minimal;
337-
338333
// If a property or subscript is @inlinable, the accessors are
339334
// @inlinable also.
340335
if (auto accessor = dyn_cast<AccessorDecl>(AFD))

trunk/lib/SIL/SILDeclRef.cpp

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,26 +528,47 @@ IsSerialized_t SILDeclRef::isSerialized() const {
528528
return IsNotSerialized;
529529
}
530530

531-
/// \brief True if the function has noinline attribute.
531+
/// \brief True if the function has an @inline(never) attribute.
532532
bool SILDeclRef::isNoinline() const {
533533
if (!hasDecl())
534534
return false;
535-
if (auto InlineA = getDecl()->getAttrs().getAttribute<InlineAttr>())
536-
if (InlineA->getKind() == InlineKind::Never)
535+
536+
auto *decl = getDecl();
537+
if (auto *attr = decl->getAttrs().getAttribute<InlineAttr>())
538+
if (attr->getKind() == InlineKind::Never)
537539
return true;
538-
if (auto *semanticsA = getDecl()->getAttrs().getAttribute<SemanticsAttr>())
539-
if (semanticsA->Value.equals("keypath.entry"))
540+
541+
if (auto *accessorDecl = dyn_cast<AccessorDecl>(decl)) {
542+
auto *storage = accessorDecl->getStorage();
543+
if (auto *attr = storage->getAttrs().getAttribute<InlineAttr>())
544+
if (attr->getKind() == InlineKind::Never)
545+
return true;
546+
}
547+
548+
if (auto *attr = decl->getAttrs().getAttribute<SemanticsAttr>())
549+
if (attr->Value.equals("keypath.entry"))
540550
return true;
551+
541552
return false;
542553
}
543554

544-
/// \brief True if the function has noinline attribute.
555+
/// \brief True if the function has the @inline(__always) attribute.
545556
bool SILDeclRef::isAlwaysInline() const {
546557
if (!hasDecl())
547558
return false;
548-
if (auto InlineA = getDecl()->getAttrs().getAttribute<InlineAttr>())
549-
if (InlineA->getKind() == InlineKind::Always)
559+
560+
auto *decl = getDecl();
561+
if (auto attr = decl->getAttrs().getAttribute<InlineAttr>())
562+
if (attr->getKind() == InlineKind::Always)
550563
return true;
564+
565+
if (auto *accessorDecl = dyn_cast<AccessorDecl>(decl)) {
566+
auto *storage = accessorDecl->getStorage();
567+
if (auto *attr = storage->getAttrs().getAttribute<InlineAttr>())
568+
if (attr->getKind() == InlineKind::Always)
569+
return true;
570+
}
571+
551572
return false;
552573
}
553574

trunk/lib/Sema/ResilienceDiagnostics.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ TypeChecker::getFragileFunctionKind(const DeclContext *DC) {
5858
return std::make_pair(FragileFunctionKind::Inlinable,
5959
/*treatUsableFromInlineAsPublic=*/true);
6060

61-
if (auto attr = AFD->getAttrs().getAttribute<InlineAttr>())
62-
if (attr->getKind() == InlineKind::Always)
63-
return std::make_pair(FragileFunctionKind::InlineAlways,
64-
/*treatUsableFromInlineAsPublic=*/true);
65-
6661
// If a property or subscript is @inlinable, the accessors are
6762
// @inlinable also.
6863
if (auto accessor = dyn_cast<AccessorDecl>(AFD))

trunk/lib/Sema/TypeChecker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ class TypeChecker final : public LazyResolver {
19561956
/// Used in diagnostic %selects.
19571957
enum class FragileFunctionKind : unsigned {
19581958
Transparent,
1959-
InlineAlways,
19601959
Inlinable,
19611960
DefaultArgument,
19621961
PropertyInitializer

trunk/stdlib/public/SDK/GLKit/GLKMath.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// types.
2222

2323
// Do dirty pointer manipulations to index an opaque struct like an array.
24-
@inline(__always)
24+
@inlinable @inline(__always)
2525
public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
2626
_ index: Int) -> T {
2727
return UnsafeRawPointer(aggregate).load(
@@ -31,7 +31,7 @@ public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
3131
%{
3232
def defineSubscript(Type, limit):
3333
return """
34-
public subscript(i: Int) -> Float {{
34+
@inlinable public subscript(i: Int) -> Float {{
3535
@inline(__always)
3636
get {{
3737
precondition(i >= 0, "Negative {0} index out of range")

trunk/stdlib/public/core/Array.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ extension Array {
384384
}
385385

386386
@_semantics("array.get_element")
387-
@inline(__always)
387+
@inlinable @inline(__always)
388388
public // @testable
389389
func _getElement(
390390
_ index: Int,
@@ -440,7 +440,7 @@ extension Array: _ArrayProtocol {
440440
@inlinable
441441
public // @testable
442442
var _owner: AnyObject? {
443-
@inline(__always)
443+
@inlinable @inline(__always)
444444
get {
445445
return _buffer.owner
446446
}
@@ -1447,7 +1447,7 @@ extension Array {
14471447
/// method's execution.
14481448
/// - Returns: The return value, if any, of the `body` closure parameter.
14491449
@_semantics("array.withUnsafeMutableBufferPointer")
1450-
@inline(__always) // Performance: This method should get inlined into the
1450+
@inlinable @inline(__always) // Performance: This method should get inlined into the
14511451
// caller such that we can combine the partial apply with the apply in this
14521452
// function saving on allocating a closure context. This becomes unnecessary
14531453
// once we allocate noescape closures on the stack.

trunk/stdlib/public/core/ArrayShared.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct _DependenceToken {
2525
/// This function is referenced by the compiler to allocate array literals.
2626
///
2727
/// - Precondition: `storage` is `_ContiguousArrayStorage`.
28-
@inline(__always)
28+
@inlinable @inline(__always)
2929
public // COMPILER_INTRINSIC
3030
func _allocateUninitializedArray<Element>(_ builtinCount: Builtin.Word)
3131
-> (Array<Element>, Builtin.RawPointer) {

trunk/stdlib/public/core/ArraySlice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ extension ArraySlice {
202202
}
203203

204204
@_semantics("array.get_element")
205-
@inline(__always)
205+
@inlinable @inline(__always)
206206
public // @testable
207207
func _getElement(
208208
_ index: Int,
@@ -1192,7 +1192,7 @@ extension ArraySlice {
11921192
/// method's execution.
11931193
/// - Returns: The return value, if any, of the `body` closure parameter.
11941194
@_semantics("array.withUnsafeMutableBufferPointer")
1195-
@inline(__always) // Performance: This method should get inlined into the
1195+
@inlinable @inline(__always) // Performance: This method should get inlined into the
11961196
// caller such that we can combine the partial apply with the apply in this
11971197
// function saving on allocating a closure context. This becomes unnecessary
11981198
// once we allocate noescape closures on the stack.

trunk/stdlib/public/core/ContiguousArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ extension ContiguousArray {
10411041
/// method's execution.
10421042
/// - Returns: The return value, if any, of the `body` closure parameter.
10431043
@_semantics("array.withUnsafeMutableBufferPointer")
1044-
@inline(__always) // Performance: This method should get inlined into the
1044+
@inlinable @inline(__always) // Performance: This method should get inlined into the
10451045
// caller such that we can combine the partial apply with the apply in this
10461046
// function saving on allocating a closure context. This becomes unnecessary
10471047
// once we allocate noescape closures on the stack.

trunk/stdlib/public/core/FloatingPoint.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ extension FloatingPoint {
17221722
/// - If `x` is `leastNonzeroMagnitude`, then `x.nextDown` is `0.0`.
17231723
/// - If `x` is zero, then `x.nextDown` is `-leastNonzeroMagnitude`.
17241724
/// - If `x` is `-greatestFiniteMagnitude`, then `x.nextDown` is `-infinity`.
1725-
public var nextDown: Self {
1725+
@inlinable public var nextDown: Self {
17261726
@inline(__always)
17271727
get {
17281728
return -(-self).nextUp
@@ -1760,7 +1760,7 @@ extension FloatingPoint {
17601760
/// - Parameter other: The value to use when dividing this value.
17611761
/// - Returns: The remainder of this value divided by `other` using
17621762
/// truncating division.
1763-
@inline(__always)
1763+
@inlinable @inline(__always)
17641764
public func truncatingRemainder(dividingBy other: Self) -> Self {
17651765
var lhs = self
17661766
lhs.formTruncatingRemainder(dividingBy: other)
@@ -1799,7 +1799,7 @@ extension FloatingPoint {
17991799
///
18001800
/// - Parameter other: The value to use when dividing this value.
18011801
/// - Returns: The remainder of this value divided by `other`.
1802-
@inline(__always)
1802+
@inlinable @inline(__always)
18031803
public func remainder(dividingBy other: Self) -> Self {
18041804
var lhs = self
18051805
lhs.formRemainder(dividingBy: other)

trunk/stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,24 @@ extension ${Self}: BinaryFloatingPoint {
175175
}
176176
177177
// Implementation details.
178-
@usableFromInline
178+
@inlinable
179179
internal static var _infinityExponent: UInt {
180180
@inline(__always) get { return 1 &<< UInt(exponentBitCount) - 1 }
181181
}
182182
183-
@usableFromInline
183+
@inlinable
184184
internal static var _exponentBias: UInt {
185185
@inline(__always) get { return _infinityExponent &>> 1 }
186186
}
187187
188-
@usableFromInline
188+
@inlinable
189189
internal static var _significandMask: ${RawSignificand} {
190190
@inline(__always) get {
191191
return 1 &<< ${RawSignificand}(significandBitCount) - 1
192192
}
193193
}
194194
195-
@usableFromInline
195+
@inlinable
196196
internal static var _quietNaNMask: ${RawSignificand} {
197197
@inline(__always) get {
198198
return 1 &<< ${RawSignificand}(significandBitCount - 1)
@@ -1103,7 +1103,7 @@ extension ${Self}: BinaryFloatingPoint {
11031103
/// `formRemainder(dividingBy:)` method is always exact.
11041104
///
11051105
/// - Parameter other: The value to use when dividing this value.
1106-
@inline(__always)
1106+
@inlinable @inline(__always)
11071107
public mutating func formRemainder(dividingBy other: ${Self}) {
11081108
self = _stdlib_remainder${cFuncSuffix}(self, other)
11091109
}
@@ -1137,7 +1137,7 @@ extension ${Self}: BinaryFloatingPoint {
11371137
/// method is always exact.
11381138
///
11391139
/// - Parameter other: The value to use when dividing this value.
1140-
@inline(__always)
1140+
@inlinable @inline(__always)
11411141
public mutating func formTruncatingRemainder(dividingBy other: ${Self}) {
11421142
_value = Builtin.frem_FPIEEE${bits}(self._value, other._value)
11431143
}
@@ -1258,7 +1258,7 @@ extension ${Self}: BinaryFloatingPoint {
12581258
/// A *normal* value is a finite number that uses the full precision
12591259
/// available to values of a type. Zero is neither a normal nor a subnormal
12601260
/// number.
1261-
public var isNormal: Bool {
1261+
@inlinable public var isNormal: Bool {
12621262
@inline(__always)
12631263
get {
12641264
return exponentBitPattern > 0 && isFinite
@@ -1269,7 +1269,7 @@ extension ${Self}: BinaryFloatingPoint {
12691269
///
12701270
/// All values other than NaN and infinity are considered finite, whether
12711271
/// normal or subnormal.
1272-
public var isFinite: Bool {
1272+
@inlinable public var isFinite: Bool {
12731273
@inline(__always)
12741274
get {
12751275
return exponentBitPattern < ${Self}._infinityExponent
@@ -1285,7 +1285,7 @@ extension ${Self}: BinaryFloatingPoint {
12851285
/// let x = -0.0
12861286
/// x.isZero // true
12871287
/// x == 0.0 // true
1288-
public var isZero: Bool {
1288+
@inlinable public var isZero: Bool {
12891289
@inline(__always)
12901290
get {
12911291
return exponentBitPattern == 0 && significandBitPattern == 0
@@ -1301,7 +1301,7 @@ extension ${Self}: BinaryFloatingPoint {
13011301
/// Zero is neither a normal nor a subnormal number. Subnormal numbers are
13021302
/// often called *denormal* or *denormalized*---these are different names
13031303
/// for the same concept.
1304-
public var isSubnormal: Bool {
1304+
@inlinable public var isSubnormal: Bool {
13051305
@inline(__always)
13061306
get {
13071307
return exponentBitPattern == 0 && significandBitPattern != 0
@@ -1312,7 +1312,7 @@ extension ${Self}: BinaryFloatingPoint {
13121312
///
13131313
/// Note that `isFinite` and `isInfinite` do not form a dichotomy, because
13141314
/// they are not total: If `x` is `NaN`, then both properties are `false`.
1315-
public var isInfinite: Bool {
1315+
@inlinable public var isInfinite: Bool {
13161316
@inline(__always)
13171317
get {
13181318
return !isFinite && significandBitPattern == 0
@@ -1342,7 +1342,7 @@ extension ${Self}: BinaryFloatingPoint {
13421342
/// // Prints "true"
13431343
///
13441344
/// This property is `true` for both quiet and signaling NaNs.
1345-
public var isNaN: Bool {
1345+
@inlinable public var isNaN: Bool {
13461346
@inline(__always)
13471347
get {
13481348
return !isFinite && significandBitPattern != 0
@@ -1353,7 +1353,7 @@ extension ${Self}: BinaryFloatingPoint {
13531353
///
13541354
/// Signaling NaNs typically raise the Invalid flag when used in general
13551355
/// computing operations.
1356-
public var isSignalingNaN: Bool {
1356+
@inlinable public var isSignalingNaN: Bool {
13571357
@inline(__always)
13581358
get {
13591359
return isNaN && (significandBitPattern & ${Self}._quietNaNMask) == 0
@@ -1447,7 +1447,7 @@ extension ${Self}: BinaryFloatingPoint {
14471447
/// // x == 21.25
14481448
///
14491449
/// - Parameter value: The new floating-point value.
1450-
@inline(__always)
1450+
@inlinable @inline(__always)
14511451
public init(floatLiteral value: ${Self}) {
14521452
self = value
14531453
}
@@ -1590,7 +1590,7 @@ extension ${Self} {
15901590
/// // Use 'abs(_:)' instead of 'magnitude'
15911591
/// print("Missed the target by \(abs(margin)) meters.")
15921592
/// // Prints "Missed the target by 0.25 meters."
1593-
public var magnitude: ${Self} {
1593+
@inlinable public var magnitude: ${Self} {
15941594
@inline(__always)
15951595
get {
15961596
return ${Self}(Builtin.int_fabs_FPIEEE${bits}(_value))
@@ -1614,14 +1614,14 @@ extension ${Self} {
16141614

16151615
// We "shouldn't" need this, but the typechecker barfs on an expression
16161616
// in the test suite without it.
1617-
@inline(__always)
1617+
@inlinable @inline(__always)
16181618
public init(_ v: Int) {
16191619
_value = Builtin.sitofp_Int${word_bits}_FPIEEE${bits}(v._value)
16201620
}
16211621

16221622
// Fast-path for conversion when the source is representable as a 64-bit int,
16231623
// falling back on the generic _convert operation otherwise.
1624-
@inline(__always)
1624+
@inlinable @inline(__always)
16251625
public init<Source : BinaryInteger>(_ value: Source) {
16261626
if value.bitWidth <= ${word_bits} {
16271627
if Source.isSigned {
@@ -1666,7 +1666,7 @@ extension ${Self} {
16661666
/// // z.isNaN == true
16671667
///
16681668
/// - Parameter other: The value to use for the new instance.
1669-
@inline(__always)
1669+
@inlinable @inline(__always)
16701670
public init(_ other: ${That}) {
16711671
% if srcBits > bits:
16721672
_value = Builtin.fptrunc_FPIEEE${srcBits}_FPIEEE${bits}(other._value)

0 commit comments

Comments
 (0)