Skip to content

Commit 7b10e30

Browse files
authored
Merge pull request #20576 from moiseev/inlinable-audit-markers
[NFC][stdlib] Add FIXME markers to simplify audit
2 parents d3547fd + cbf83ac commit 7b10e30

14 files changed

+83
-45
lines changed

benchmark/utils/TestsUtils.swift

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

224-
@inlinable @inline(__always)
224+
@inlinable // FIXME(inline-always)
225+
@inline(__always)
225226
public func CheckResults(
226227
_ resultsMatch: Bool,
227228
file: StaticString = #file,

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

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

2323
// Do dirty pointer manipulations to index an opaque struct like an array.
24-
@inlinable @inline(__always)
24+
@inlinable // FIXME(inline-always)
25+
@inline(__always)
2526
public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
2627
_ index: Int) -> T {
2728
return UnsafeRawPointer(aggregate).load(
@@ -31,7 +32,8 @@ public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
3132
%{
3233
def defineSubscript(Type, limit):
3334
return """
34-
@inlinable public subscript(i: Int) -> Float {{
35+
@inlinable // FIXME(inline-always)
36+
public subscript(i: Int) -> Float {{
3537
@inline(__always)
3638
get {{
3739
precondition(i >= 0, "Negative {0} index out of range")

stdlib/public/core/Array.swift

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

386386
@_semantics("array.get_element")
387-
@inlinable @inline(__always)
387+
@inlinable // FIXME(inline-always)
388+
@inline(__always)
388389
public // @testable
389390
func _getElement(
390391
_ index: Int,
@@ -440,7 +441,8 @@ extension Array: _ArrayProtocol {
440441
@inlinable
441442
public // @testable
442443
var _owner: AnyObject? {
443-
@inlinable @inline(__always)
444+
@inlinable // FIXME(inline-always)
445+
@inline(__always)
444446
get {
445447
return _buffer.owner
446448
}
@@ -1447,7 +1449,8 @@ extension Array {
14471449
/// method's execution.
14481450
/// - Returns: The return value, if any, of the `body` closure parameter.
14491451
@_semantics("array.withUnsafeMutableBufferPointer")
1450-
@inlinable @inline(__always) // Performance: This method should get inlined into the
1452+
@inlinable // FIXME(inline-always)
1453+
@inline(__always) // Performance: This method should get inlined into the
14511454
// caller such that we can combine the partial apply with the apply in this
14521455
// function saving on allocating a closure context. This becomes unnecessary
14531456
// once we allocate noescape closures on the stack.

stdlib/public/core/ArrayShared.swift

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

stdlib/public/core/ArraySlice.swift

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

204204
@_semantics("array.get_element")
205-
@inlinable @inline(__always)
205+
@inlinable // FIXME(inline-always)
206+
@inline(__always)
206207
public // @testable
207208
func _getElement(
208209
_ index: Int,
@@ -1192,7 +1193,8 @@ extension ArraySlice {
11921193
/// method's execution.
11931194
/// - Returns: The return value, if any, of the `body` closure parameter.
11941195
@_semantics("array.withUnsafeMutableBufferPointer")
1195-
@inlinable @inline(__always) // Performance: This method should get inlined into the
1196+
@inlinable // FIXME(inline-always)
1197+
@inline(__always) // Performance: This method should get inlined into the
11961198
// caller such that we can combine the partial apply with the apply in this
11971199
// function saving on allocating a closure context. This becomes unnecessary
11981200
// once we allocate noescape closures on the stack.

stdlib/public/core/ContiguousArray.swift

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

stdlib/public/core/FloatingPoint.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,8 @@ 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-
@inlinable public var nextDown: Self {
1725+
@inlinable // FIXME(inline-always)
1726+
public var nextDown: Self {
17261727
@inline(__always)
17271728
get {
17281729
return -(-self).nextUp
@@ -1760,7 +1761,8 @@ extension FloatingPoint {
17601761
/// - Parameter other: The value to use when dividing this value.
17611762
/// - Returns: The remainder of this value divided by `other` using
17621763
/// truncating division.
1763-
@inlinable @inline(__always)
1764+
@inlinable // FIXME(inline-always)
1765+
@inline(__always)
17641766
public func truncatingRemainder(dividingBy other: Self) -> Self {
17651767
var lhs = self
17661768
lhs.formTruncatingRemainder(dividingBy: other)
@@ -1799,7 +1801,8 @@ extension FloatingPoint {
17991801
///
18001802
/// - Parameter other: The value to use when dividing this value.
18011803
/// - Returns: The remainder of this value divided by `other`.
1802-
@inlinable @inline(__always)
1804+
@inlinable // FIXME(inline-always)
1805+
@inline(__always)
18031806
public func remainder(dividingBy other: Self) -> Self {
18041807
var lhs = self
18051808
lhs.formRemainder(dividingBy: other)

stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,24 @@ extension ${Self}: BinaryFloatingPoint {
175175
}
176176
177177
// Implementation details.
178-
@inlinable
178+
@inlinable // FIXME(inline-always) was usableFromInline
179179
internal static var _infinityExponent: UInt {
180180
@inline(__always) get { return 1 &<< UInt(exponentBitCount) - 1 }
181181
}
182182
183-
@inlinable
183+
@inlinable // FIXME(inline-always) was usableFromInline
184184
internal static var _exponentBias: UInt {
185185
@inline(__always) get { return _infinityExponent &>> 1 }
186186
}
187187
188-
@inlinable
188+
@inlinable // FIXME(inline-always) was usableFromInline
189189
internal static var _significandMask: ${RawSignificand} {
190190
@inline(__always) get {
191191
return 1 &<< ${RawSignificand}(significandBitCount) - 1
192192
}
193193
}
194194
195-
@inlinable
195+
@inlinable // FIXME(inline-always) was usableFromInline
196196
internal static var _quietNaNMask: ${RawSignificand} {
197197
@inline(__always) get {
198198
return 1 &<< ${RawSignificand}(significandBitCount - 1)
@@ -1103,7 +1103,8 @@ extension ${Self}: BinaryFloatingPoint {
11031103
/// `formRemainder(dividingBy:)` method is always exact.
11041104
///
11051105
/// - Parameter other: The value to use when dividing this value.
1106-
@inlinable @inline(__always)
1106+
@inlinable // FIXME(inline-always)
1107+
@inline(__always)
11071108
public mutating func formRemainder(dividingBy other: ${Self}) {
11081109
self = _stdlib_remainder${cFuncSuffix}(self, other)
11091110
}
@@ -1137,7 +1138,8 @@ extension ${Self}: BinaryFloatingPoint {
11371138
/// method is always exact.
11381139
///
11391140
/// - Parameter other: The value to use when dividing this value.
1140-
@inlinable @inline(__always)
1141+
@inlinable // FIXME(inline-always)
1142+
@inline(__always)
11411143
public mutating func formTruncatingRemainder(dividingBy other: ${Self}) {
11421144
_value = Builtin.frem_FPIEEE${bits}(self._value, other._value)
11431145
}
@@ -1258,7 +1260,8 @@ extension ${Self}: BinaryFloatingPoint {
12581260
/// A *normal* value is a finite number that uses the full precision
12591261
/// available to values of a type. Zero is neither a normal nor a subnormal
12601262
/// number.
1261-
@inlinable public var isNormal: Bool {
1263+
@inlinable // FIXME(inline-always)
1264+
public var isNormal: Bool {
12621265
@inline(__always)
12631266
get {
12641267
return exponentBitPattern > 0 && isFinite
@@ -1269,7 +1272,8 @@ extension ${Self}: BinaryFloatingPoint {
12691272
///
12701273
/// All values other than NaN and infinity are considered finite, whether
12711274
/// normal or subnormal.
1272-
@inlinable public var isFinite: Bool {
1275+
@inlinable // FIXME(inline-always)
1276+
public var isFinite: Bool {
12731277
@inline(__always)
12741278
get {
12751279
return exponentBitPattern < ${Self}._infinityExponent
@@ -1285,7 +1289,8 @@ extension ${Self}: BinaryFloatingPoint {
12851289
/// let x = -0.0
12861290
/// x.isZero // true
12871291
/// x == 0.0 // true
1288-
@inlinable public var isZero: Bool {
1292+
@inlinable // FIXME(inline-always)
1293+
public var isZero: Bool {
12891294
@inline(__always)
12901295
get {
12911296
return exponentBitPattern == 0 && significandBitPattern == 0
@@ -1301,7 +1306,8 @@ extension ${Self}: BinaryFloatingPoint {
13011306
/// Zero is neither a normal nor a subnormal number. Subnormal numbers are
13021307
/// often called *denormal* or *denormalized*---these are different names
13031308
/// for the same concept.
1304-
@inlinable public var isSubnormal: Bool {
1309+
@inlinable // FIXME(inline-always)
1310+
public var isSubnormal: Bool {
13051311
@inline(__always)
13061312
get {
13071313
return exponentBitPattern == 0 && significandBitPattern != 0
@@ -1312,7 +1318,8 @@ extension ${Self}: BinaryFloatingPoint {
13121318
///
13131319
/// Note that `isFinite` and `isInfinite` do not form a dichotomy, because
13141320
/// they are not total: If `x` is `NaN`, then both properties are `false`.
1315-
@inlinable public var isInfinite: Bool {
1321+
@inlinable // FIXME(inline-always)
1322+
public var isInfinite: Bool {
13161323
@inline(__always)
13171324
get {
13181325
return !isFinite && significandBitPattern == 0
@@ -1342,7 +1349,8 @@ extension ${Self}: BinaryFloatingPoint {
13421349
/// // Prints "true"
13431350
///
13441351
/// This property is `true` for both quiet and signaling NaNs.
1345-
@inlinable public var isNaN: Bool {
1352+
@inlinable // FIXME(inline-always)
1353+
public var isNaN: Bool {
13461354
@inline(__always)
13471355
get {
13481356
return !isFinite && significandBitPattern != 0
@@ -1353,7 +1361,8 @@ extension ${Self}: BinaryFloatingPoint {
13531361
///
13541362
/// Signaling NaNs typically raise the Invalid flag when used in general
13551363
/// computing operations.
1356-
@inlinable public var isSignalingNaN: Bool {
1364+
@inlinable // FIXME(inline-always)
1365+
public var isSignalingNaN: Bool {
13571366
@inline(__always)
13581367
get {
13591368
return isNaN && (significandBitPattern & ${Self}._quietNaNMask) == 0
@@ -1447,7 +1456,8 @@ extension ${Self}: BinaryFloatingPoint {
14471456
/// // x == 21.25
14481457
///
14491458
/// - Parameter value: The new floating-point value.
1450-
@inlinable @inline(__always)
1459+
@inlinable // FIXME(inline-always)
1460+
@inline(__always)
14511461
public init(floatLiteral value: ${Self}) {
14521462
self = value
14531463
}
@@ -1590,7 +1600,8 @@ extension ${Self} {
15901600
/// // Use 'abs(_:)' instead of 'magnitude'
15911601
/// print("Missed the target by \(abs(margin)) meters.")
15921602
/// // Prints "Missed the target by 0.25 meters."
1593-
@inlinable public var magnitude: ${Self} {
1603+
@inlinable // FIXME(inline-always)
1604+
public var magnitude: ${Self} {
15941605
@inline(__always)
15951606
get {
15961607
return ${Self}(Builtin.int_fabs_FPIEEE${bits}(_value))
@@ -1614,14 +1625,16 @@ extension ${Self} {
16141625

16151626
// We "shouldn't" need this, but the typechecker barfs on an expression
16161627
// in the test suite without it.
1617-
@inlinable @inline(__always)
1628+
@inlinable // FIXME(inline-always)
1629+
@inline(__always)
16181630
public init(_ v: Int) {
16191631
_value = Builtin.sitofp_Int${word_bits}_FPIEEE${bits}(v._value)
16201632
}
16211633

16221634
// Fast-path for conversion when the source is representable as a 64-bit int,
16231635
// falling back on the generic _convert operation otherwise.
1624-
@inlinable @inline(__always)
1636+
@inlinable // FIXME(inline-always)
1637+
@inline(__always)
16251638
public init<Source : BinaryInteger>(_ value: Source) {
16261639
if value.bitWidth <= ${word_bits} {
16271640
if Source.isSigned {
@@ -1666,7 +1679,8 @@ extension ${Self} {
16661679
/// // z.isNaN == true
16671680
///
16681681
/// - Parameter other: The value to use for the new instance.
1669-
@inlinable @inline(__always)
1682+
@inlinable // FIXME(inline-always)
1683+
@inline(__always)
16701684
public init(_ other: ${That}) {
16711685
% if srcBits > bits:
16721686
_value = Builtin.fptrunc_FPIEEE${srcBits}_FPIEEE${bits}(other._value)

stdlib/public/core/Integers.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,8 @@ extension FixedWidthInteger {
30493049
/// // 'y' has a binary representation of 11111111_11101011
30503050
///
30513051
/// - Parameter source: An integer to convert to this type.
3052-
@inlinable @inline(__always)
3052+
@inlinable // FIXME(inline-always)
3053+
@inline(__always)
30533054
public init<T : BinaryInteger>(truncatingIfNeeded source: T) {
30543055
if Self.bitWidth <= Int.bitWidth {
30553056
self = Self(_truncatingBits: source._lowWord)
@@ -3290,15 +3291,17 @@ extension UnsignedInteger {
32903291
/// to find an absolute value. In addition, because `abs(_:)` always returns
32913292
/// a value of the same type, even in a generic context, using the function
32923293
/// instead of the `magnitude` property is encouraged.
3293-
@inlinable public var magnitude: Self {
3294+
@inlinable // FIXME(inline-always)
3295+
public var magnitude: Self {
32943296
@inline(__always)
32953297
get { return self }
32963298
}
32973299

32983300
/// A Boolean value indicating whether this type is a signed integer type.
32993301
///
33003302
/// This property is always `false` for unsigned integer types.
3301-
@inlinable public static var isSigned: Bool {
3303+
@inlinable // FIXME(inline-always)
3304+
public static var isSigned: Bool {
33023305
@inline(__always)
33033306
get { return false }
33043307
}
@@ -3325,7 +3328,8 @@ extension UnsignedInteger where Self : FixedWidthInteger {
33253328
/// - Parameter source: A value to convert to this type of integer. The value
33263329
/// passed as `source` must be representable in this type.
33273330
@_semantics("optimize.sil.specialize.generic.partial.never")
3328-
@inlinable @inline(__always)
3331+
@inlinable // FIXME(inline-always)
3332+
@inline(__always)
33293333
public init<T : BinaryInteger>(_ source: T) {
33303334
// This check is potentially removable by the optimizer
33313335
if T.isSigned {
@@ -3355,7 +3359,8 @@ extension UnsignedInteger where Self : FixedWidthInteger {
33553359
///
33563360
/// - Parameter source: A value to convert to this type of integer.
33573361
@_semantics("optimize.sil.specialize.generic.partial.never")
3358-
@inlinable @inline(__always)
3362+
@inlinable // FIXME(inline-always)
3363+
@inline(__always)
33593364
public init?<T : BinaryInteger>(exactly source: T) {
33603365
// This check is potentially removable by the optimizer
33613366
if T.isSigned && source < (0 as T) {
@@ -3399,7 +3404,8 @@ extension SignedInteger {
33993404
/// A Boolean value indicating whether this type is a signed integer type.
34003405
///
34013406
/// This property is always `true` for signed integer types.
3402-
@inlinable public static var isSigned: Bool {
3407+
@inlinable // FIXME(inline-always)
3408+
public static var isSigned: Bool {
34033409
@inline(__always)
34043410
get { return true }
34053411
}
@@ -3426,7 +3432,8 @@ extension SignedInteger where Self : FixedWidthInteger {
34263432
/// - Parameter source: A value to convert to this type of integer. The value
34273433
/// passed as `source` must be representable in this type.
34283434
@_semantics("optimize.sil.specialize.generic.partial.never")
3429-
@inlinable @inline(__always)
3435+
@inlinable // FIXME(inline-always)
3436+
@inline(__always)
34303437
public init<T : BinaryInteger>(_ source: T) {
34313438
// This check is potentially removable by the optimizer
34323439
if T.isSigned && source.bitWidth > Self.bitWidth {
@@ -3458,7 +3465,8 @@ extension SignedInteger where Self : FixedWidthInteger {
34583465
///
34593466
/// - Parameter source: A value to convert to this type of integer.
34603467
@_semantics("optimize.sil.specialize.generic.partial.never")
3461-
@inlinable @inline(__always)
3468+
@inlinable // FIXME(inline-always)
3469+
@inline(__always)
34623470
public init?<T : BinaryInteger>(exactly source: T) {
34633471
// This check is potentially removable by the optimizer
34643472
if T.isSigned && source.bitWidth > Self.bitWidth && source < Self.min {

stdlib/public/core/NativeDictionary.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extension _NativeDictionary { // Low-level unchecked operations
121121
return _values[bucket.offset]
122122
}
123123

124-
@inlinable
124+
@inlinable // FIXME(inline-always) was usableFromInline
125125
@inline(__always)
126126
internal func uncheckedInitialize(
127127
at bucket: Bucket,
@@ -133,7 +133,7 @@ extension _NativeDictionary { // Low-level unchecked operations
133133
(_values + bucket.offset).initialize(to: value)
134134
}
135135

136-
@inlinable
136+
@inlinable // FIXME(inline-always) was usableFromInline
137137
@inline(__always)
138138
internal func uncheckedDestroy(at bucket: Bucket) {
139139
defer { _fixLifetime(self) }

0 commit comments

Comments
 (0)