Skip to content

[NFC][stdlib] Add FIXME markers to simplify audit #20576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benchmark/utils/TestsUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ public func Random() -> Int64 {
return lfsrRandomGenerator.randInt()
}

@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public func CheckResults(
_ resultsMatch: Bool,
file: StaticString = #file,
Expand Down
6 changes: 4 additions & 2 deletions stdlib/public/SDK/GLKit/GLKMath.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
// types.

// Do dirty pointer manipulations to index an opaque struct like an array.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
_ index: Int) -> T {
return UnsafeRawPointer(aggregate).load(
Expand All @@ -31,7 +32,8 @@ public func _indexHomogeneousValue<TTT, T>(_ aggregate: UnsafePointer<TTT>,
%{
def defineSubscript(Type, limit):
return """
@inlinable public subscript(i: Int) -> Float {{
@inlinable // FIXME(inline-always)
public subscript(i: Int) -> Float {{
@inline(__always)
get {{
precondition(i >= 0, "Negative {0} index out of range")
Expand Down
9 changes: 6 additions & 3 deletions stdlib/public/core/Array.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ extension Array {
}

@_semantics("array.get_element")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public // @testable
func _getElement(
_ index: Int,
Expand Down Expand Up @@ -440,7 +441,8 @@ extension Array: _ArrayProtocol {
@inlinable
public // @testable
var _owner: AnyObject? {
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
get {
return _buffer.owner
}
Expand Down Expand Up @@ -1447,7 +1449,8 @@ extension Array {
/// method's execution.
/// - Returns: The return value, if any, of the `body` closure parameter.
@_semantics("array.withUnsafeMutableBufferPointer")
@inlinable @inline(__always) // Performance: This method should get inlined into the
@inlinable // FIXME(inline-always)
@inline(__always) // Performance: This method should get inlined into the
// caller such that we can combine the partial apply with the apply in this
// function saving on allocating a closure context. This becomes unnecessary
// once we allocate noescape closures on the stack.
Expand Down
3 changes: 2 additions & 1 deletion stdlib/public/core/ArrayShared.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public struct _DependenceToken {
/// This function is referenced by the compiler to allocate array literals.
///
/// - Precondition: `storage` is `_ContiguousArrayStorage`.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public // COMPILER_INTRINSIC
func _allocateUninitializedArray<Element>(_ builtinCount: Builtin.Word)
-> (Array<Element>, Builtin.RawPointer) {
Expand Down
6 changes: 4 additions & 2 deletions stdlib/public/core/ArraySlice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ extension ArraySlice {
}

@_semantics("array.get_element")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public // @testable
func _getElement(
_ index: Int,
Expand Down Expand Up @@ -1192,7 +1193,8 @@ extension ArraySlice {
/// method's execution.
/// - Returns: The return value, if any, of the `body` closure parameter.
@_semantics("array.withUnsafeMutableBufferPointer")
@inlinable @inline(__always) // Performance: This method should get inlined into the
@inlinable // FIXME(inline-always)
@inline(__always) // Performance: This method should get inlined into the
// caller such that we can combine the partial apply with the apply in this
// function saving on allocating a closure context. This becomes unnecessary
// once we allocate noescape closures on the stack.
Expand Down
3 changes: 2 additions & 1 deletion stdlib/public/core/ContiguousArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,8 @@ extension ContiguousArray {
/// method's execution.
/// - Returns: The return value, if any, of the `body` closure parameter.
@_semantics("array.withUnsafeMutableBufferPointer")
@inlinable @inline(__always) // Performance: This method should get inlined into the
@inlinable // FIXME(inline-always)
@inline(__always) // Performance: This method should get inlined into the
// caller such that we can combine the partial apply with the apply in this
// function saving on allocating a closure context. This becomes unnecessary
// once we allocate noescape closures on the stack.
Expand Down
9 changes: 6 additions & 3 deletions stdlib/public/core/FloatingPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,8 @@ extension FloatingPoint {
/// - If `x` is `leastNonzeroMagnitude`, then `x.nextDown` is `0.0`.
/// - If `x` is zero, then `x.nextDown` is `-leastNonzeroMagnitude`.
/// - If `x` is `-greatestFiniteMagnitude`, then `x.nextDown` is `-infinity`.
@inlinable public var nextDown: Self {
@inlinable // FIXME(inline-always)
public var nextDown: Self {
@inline(__always)
get {
return -(-self).nextUp
Expand Down Expand Up @@ -1760,7 +1761,8 @@ extension FloatingPoint {
/// - Parameter other: The value to use when dividing this value.
/// - Returns: The remainder of this value divided by `other` using
/// truncating division.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public func truncatingRemainder(dividingBy other: Self) -> Self {
var lhs = self
lhs.formTruncatingRemainder(dividingBy: other)
Expand Down Expand Up @@ -1799,7 +1801,8 @@ extension FloatingPoint {
///
/// - Parameter other: The value to use when dividing this value.
/// - Returns: The remainder of this value divided by `other`.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public func remainder(dividingBy other: Self) -> Self {
var lhs = self
lhs.formRemainder(dividingBy: other)
Expand Down
50 changes: 32 additions & 18 deletions stdlib/public/core/FloatingPointTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,24 @@ extension ${Self}: BinaryFloatingPoint {
}

// Implementation details.
@inlinable
@inlinable // FIXME(inline-always) was usableFromInline
internal static var _infinityExponent: UInt {
@inline(__always) get { return 1 &<< UInt(exponentBitCount) - 1 }
}

@inlinable
@inlinable // FIXME(inline-always) was usableFromInline
internal static var _exponentBias: UInt {
@inline(__always) get { return _infinityExponent &>> 1 }
}

@inlinable
@inlinable // FIXME(inline-always) was usableFromInline
internal static var _significandMask: ${RawSignificand} {
@inline(__always) get {
return 1 &<< ${RawSignificand}(significandBitCount) - 1
}
}

@inlinable
@inlinable // FIXME(inline-always) was usableFromInline
internal static var _quietNaNMask: ${RawSignificand} {
@inline(__always) get {
return 1 &<< ${RawSignificand}(significandBitCount - 1)
Expand Down Expand Up @@ -1103,7 +1103,8 @@ extension ${Self}: BinaryFloatingPoint {
/// `formRemainder(dividingBy:)` method is always exact.
///
/// - Parameter other: The value to use when dividing this value.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public mutating func formRemainder(dividingBy other: ${Self}) {
self = _stdlib_remainder${cFuncSuffix}(self, other)
}
Expand Down Expand Up @@ -1137,7 +1138,8 @@ extension ${Self}: BinaryFloatingPoint {
/// method is always exact.
///
/// - Parameter other: The value to use when dividing this value.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public mutating func formTruncatingRemainder(dividingBy other: ${Self}) {
_value = Builtin.frem_FPIEEE${bits}(self._value, other._value)
}
Expand Down Expand Up @@ -1258,7 +1260,8 @@ extension ${Self}: BinaryFloatingPoint {
/// A *normal* value is a finite number that uses the full precision
/// available to values of a type. Zero is neither a normal nor a subnormal
/// number.
@inlinable public var isNormal: Bool {
@inlinable // FIXME(inline-always)
public var isNormal: Bool {
@inline(__always)
get {
return exponentBitPattern > 0 && isFinite
Expand All @@ -1269,7 +1272,8 @@ extension ${Self}: BinaryFloatingPoint {
///
/// All values other than NaN and infinity are considered finite, whether
/// normal or subnormal.
@inlinable public var isFinite: Bool {
@inlinable // FIXME(inline-always)
public var isFinite: Bool {
@inline(__always)
get {
return exponentBitPattern < ${Self}._infinityExponent
Expand All @@ -1285,7 +1289,8 @@ extension ${Self}: BinaryFloatingPoint {
/// let x = -0.0
/// x.isZero // true
/// x == 0.0 // true
@inlinable public var isZero: Bool {
@inlinable // FIXME(inline-always)
public var isZero: Bool {
@inline(__always)
get {
return exponentBitPattern == 0 && significandBitPattern == 0
Expand All @@ -1301,7 +1306,8 @@ extension ${Self}: BinaryFloatingPoint {
/// Zero is neither a normal nor a subnormal number. Subnormal numbers are
/// often called *denormal* or *denormalized*---these are different names
/// for the same concept.
@inlinable public var isSubnormal: Bool {
@inlinable // FIXME(inline-always)
public var isSubnormal: Bool {
@inline(__always)
get {
return exponentBitPattern == 0 && significandBitPattern != 0
Expand All @@ -1312,7 +1318,8 @@ extension ${Self}: BinaryFloatingPoint {
///
/// Note that `isFinite` and `isInfinite` do not form a dichotomy, because
/// they are not total: If `x` is `NaN`, then both properties are `false`.
@inlinable public var isInfinite: Bool {
@inlinable // FIXME(inline-always)
public var isInfinite: Bool {
@inline(__always)
get {
return !isFinite && significandBitPattern == 0
Expand Down Expand Up @@ -1342,7 +1349,8 @@ extension ${Self}: BinaryFloatingPoint {
/// // Prints "true"
///
/// This property is `true` for both quiet and signaling NaNs.
@inlinable public var isNaN: Bool {
@inlinable // FIXME(inline-always)
public var isNaN: Bool {
@inline(__always)
get {
return !isFinite && significandBitPattern != 0
Expand All @@ -1353,7 +1361,8 @@ extension ${Self}: BinaryFloatingPoint {
///
/// Signaling NaNs typically raise the Invalid flag when used in general
/// computing operations.
@inlinable public var isSignalingNaN: Bool {
@inlinable // FIXME(inline-always)
public var isSignalingNaN: Bool {
@inline(__always)
get {
return isNaN && (significandBitPattern & ${Self}._quietNaNMask) == 0
Expand Down Expand Up @@ -1447,7 +1456,8 @@ extension ${Self}: BinaryFloatingPoint {
/// // x == 21.25
///
/// - Parameter value: The new floating-point value.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init(floatLiteral value: ${Self}) {
self = value
}
Expand Down Expand Up @@ -1590,7 +1600,8 @@ extension ${Self} {
/// // Use 'abs(_:)' instead of 'magnitude'
/// print("Missed the target by \(abs(margin)) meters.")
/// // Prints "Missed the target by 0.25 meters."
@inlinable public var magnitude: ${Self} {
@inlinable // FIXME(inline-always)
public var magnitude: ${Self} {
@inline(__always)
get {
return ${Self}(Builtin.int_fabs_FPIEEE${bits}(_value))
Expand All @@ -1614,14 +1625,16 @@ extension ${Self} {

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

// Fast-path for conversion when the source is representable as a 64-bit int,
// falling back on the generic _convert operation otherwise.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init<Source : BinaryInteger>(_ value: Source) {
if value.bitWidth <= ${word_bits} {
if Source.isSigned {
Expand Down Expand Up @@ -1666,7 +1679,8 @@ extension ${Self} {
/// // z.isNaN == true
///
/// - Parameter other: The value to use for the new instance.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init(_ other: ${That}) {
% if srcBits > bits:
_value = Builtin.fptrunc_FPIEEE${srcBits}_FPIEEE${bits}(other._value)
Expand Down
24 changes: 16 additions & 8 deletions stdlib/public/core/Integers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3049,7 +3049,8 @@ extension FixedWidthInteger {
/// // 'y' has a binary representation of 11111111_11101011
///
/// - Parameter source: An integer to convert to this type.
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init<T : BinaryInteger>(truncatingIfNeeded source: T) {
if Self.bitWidth <= Int.bitWidth {
self = Self(_truncatingBits: source._lowWord)
Expand Down Expand Up @@ -3290,15 +3291,17 @@ extension UnsignedInteger {
/// to find an absolute value. In addition, because `abs(_:)` always returns
/// a value of the same type, even in a generic context, using the function
/// instead of the `magnitude` property is encouraged.
@inlinable public var magnitude: Self {
@inlinable // FIXME(inline-always)
public var magnitude: Self {
@inline(__always)
get { return self }
}

/// A Boolean value indicating whether this type is a signed integer type.
///
/// This property is always `false` for unsigned integer types.
@inlinable public static var isSigned: Bool {
@inlinable // FIXME(inline-always)
public static var isSigned: Bool {
@inline(__always)
get { return false }
}
Expand All @@ -3325,7 +3328,8 @@ extension UnsignedInteger where Self : FixedWidthInteger {
/// - Parameter source: A value to convert to this type of integer. The value
/// passed as `source` must be representable in this type.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init<T : BinaryInteger>(_ source: T) {
// This check is potentially removable by the optimizer
if T.isSigned {
Expand Down Expand Up @@ -3355,7 +3359,8 @@ extension UnsignedInteger where Self : FixedWidthInteger {
///
/// - Parameter source: A value to convert to this type of integer.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init?<T : BinaryInteger>(exactly source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source < (0 as T) {
Expand Down Expand Up @@ -3399,7 +3404,8 @@ extension SignedInteger {
/// A Boolean value indicating whether this type is a signed integer type.
///
/// This property is always `true` for signed integer types.
@inlinable public static var isSigned: Bool {
@inlinable // FIXME(inline-always)
public static var isSigned: Bool {
@inline(__always)
get { return true }
}
Expand All @@ -3426,7 +3432,8 @@ extension SignedInteger where Self : FixedWidthInteger {
/// - Parameter source: A value to convert to this type of integer. The value
/// passed as `source` must be representable in this type.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init<T : BinaryInteger>(_ source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source.bitWidth > Self.bitWidth {
Expand Down Expand Up @@ -3458,7 +3465,8 @@ extension SignedInteger where Self : FixedWidthInteger {
///
/// - Parameter source: A value to convert to this type of integer.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable @inline(__always)
@inlinable // FIXME(inline-always)
@inline(__always)
public init?<T : BinaryInteger>(exactly source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source.bitWidth > Self.bitWidth && source < Self.min {
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/NativeDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ extension _NativeDictionary { // Low-level unchecked operations
return _values[bucket.offset]
}

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

@inlinable
@inlinable // FIXME(inline-always) was usableFromInline
@inline(__always)
internal func uncheckedDestroy(at bucket: Bucket) {
defer { _fixLifetime(self) }
Expand Down
Loading