Skip to content

[stdlib] Remove remaining @ininable from @_transparent #17968

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
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: 1 addition & 2 deletions stdlib/public/core/Array.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1339,8 +1339,7 @@ extension Array: CustomStringConvertible, CustomDebugStringConvertible {
}

extension Array {
@inlinable
@_transparent
@usableFromInline @_transparent
internal func _cPointerArgs() -> (AnyObject?, UnsafeRawPointer?) {
let p = _baseAddressIfContiguous
if _fastPath(p != nil || isEmpty) {
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/ArraySlice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,7 @@ extension ArraySlice: CustomStringConvertible, CustomDebugStringConvertible {
}

extension ArraySlice {
@inlinable
@_transparent
@usableFromInline @_transparent
internal func _cPointerArgs() -> (AnyObject?, UnsafeRawPointer?) {
let p = _baseAddressIfContiguous
if _fastPath(p != nil || isEmpty) {
Expand Down
7 changes: 1 addition & 6 deletions stdlib/public/core/AssertCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import SwiftShims
// FIXME: We could go farther with this simplification, e.g. avoiding
// UnsafeMutablePointer

@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isDebugAssertConfiguration() -> Bool {
Expand All @@ -39,7 +38,6 @@ internal func _isReleaseAssertConfiguration() -> Bool {
return Int32(Builtin.assert_configuration()) == 1
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isFastAssertConfiguration() -> Bool {
Expand All @@ -50,7 +48,6 @@ func _isFastAssertConfiguration() -> Bool {
return Int32(Builtin.assert_configuration()) == 2
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isStdlibInternalChecksEnabled() -> Bool {
Expand All @@ -61,8 +58,7 @@ func _isStdlibInternalChecksEnabled() -> Bool {
#endif
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal
func _fatalErrorFlags() -> UInt32 {
// The current flags are:
Expand Down Expand Up @@ -205,7 +201,6 @@ internal func _fatalErrorMessage(

/// Prints a fatal error message when an unimplemented initializer gets
/// called by the Objective-C runtime.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // COMPILER_INTRINSIC
func _unimplementedInitializer(className: StaticString,
Expand Down
5 changes: 1 addition & 4 deletions stdlib/public/core/Bool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public struct Bool {
self._value = Builtin.trunc_Int8_Int1(zero._value)
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal init(_ v: Builtin.Int1) { self._value = v }

/// Creates an instance equal to the given Boolean value.
Expand Down Expand Up @@ -284,7 +283,6 @@ extension Bool {
/// - Parameters:
/// - lhs: The left-hand side of the operation.
/// - rhs: The right-hand side of the operation.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@inline(__always)
public static func && (lhs: Bool, rhs: @autoclosure () throws -> Bool) rethrows
Expand Down Expand Up @@ -325,7 +323,6 @@ extension Bool {
/// - Parameters:
/// - lhs: The left-hand side of the operation.
/// - rhs: The right-hand side of the operation.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@inline(__always)
public static func || (lhs: Bool, rhs: @autoclosure () throws -> Bool) rethrows
Expand Down
10 changes: 4 additions & 6 deletions stdlib/public/core/BridgeObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ public func _getBridgedNonVerbatimObjectiveCType<T>(_: T.Type) -> Any.Type?

// -- Pointer argument bridging

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _nilNativeObject: AnyObject? {
return nil
}
Expand Down Expand Up @@ -438,7 +437,7 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
///
/// - Warning: Accessing `pointee` as a type that is unrelated to
/// the underlying memory's bound type is undefined.
@_transparent
@usableFromInline @_transparent
internal init<U>(_ from: UnsafePointer<U>) {
self._rawValue = from._rawValue
}
Expand All @@ -452,7 +451,7 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
///
/// - Warning: Accessing `pointee` as a type that is unrelated to
/// the underlying memory's bound type is undefined.
@_transparent
@usableFromInline @_transparent
internal init?<U>(_ from: UnsafePointer<U>?) {
guard let unwrapped = from else { return nil }
self.init(unwrapped)
Expand Down Expand Up @@ -540,8 +539,7 @@ internal struct _CocoaFastEnumerationStackBuf {
@usableFromInline // FIXME(sil-serialize-all)
internal var _item15: UnsafeRawPointer?

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var count: Int {
return 16
}
Expand Down
18 changes: 1 addition & 17 deletions stdlib/public/core/Builtin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ internal func _roundUp(_ offset: Int, toAlignment alignment: Int) -> Int {
}

/// Returns a tri-state of 0 = no, 1 = yes, 2 = maybe.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _canBeClass<T>(_: T.Type) -> Int8 {
Expand Down Expand Up @@ -92,7 +91,6 @@ public func unsafeBitCast<T, U>(_ x: T, to type: U.Type) -> U {
/// functions.
///
/// - Requires: `x` has type `U`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _identityCast<T, U>(_ x: T, to expectedType: U.Type) -> U {
_precondition(T.self == expectedType, "_identityCast to wrong type")
Expand Down Expand Up @@ -209,7 +207,6 @@ internal func _isClassOrObjCExistential<T>(_ x: T.Type) -> Bool {
/// Unwrapped `T` and `U` must be convertible to AnyObject. They may
/// be either a class or a class protocol. Either T, U, or both may be
/// optional references.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _unsafeReferenceCast<T, U>(_ x: T, to: U.Type) -> U {
return Builtin.castReference(x)
Expand All @@ -233,14 +230,12 @@ public func _unsafeReferenceCast<T, U>(_ x: T, to: U.Type) -> U {
/// - x: An instance to cast to type `T`.
/// - type: The type `T` to which `x` is cast.
/// - Returns: The instance `x`, cast to type `T`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func unsafeDowncast<T : AnyObject>(_ x: AnyObject, to type: T.Type) -> T {
_debugPrecondition(x is T, "invalid unsafeDowncast")
return Builtin.castReference(x)
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _unsafeUncheckedDowncast<T : AnyObject>(_ x: AnyObject, to type: T.Type) -> T {
_sanityCheck(x is T, "invalid unsafeDowncast")
Expand Down Expand Up @@ -268,23 +263,20 @@ public func _getUnsafePointerToStoredProperties(_ x: AnyObject)
// semantics of these function calls. This won't be necessary with
// mandatory generic inlining.

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
@_semantics("branchhint")
internal func _branchHint(_ actual: Bool, expected: Bool) -> Bool {
return Bool(Builtin.int_expect_Int1(actual._value, expected._value))
}

/// Optimizer hint that `x` is expected to be `true`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@_semantics("fastpath")
public func _fastPath(_ x: Bool) -> Bool {
return _branchHint(x, expected: true)
}

/// Optimizer hint that `x` is expected to be `false`.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@_semantics("slowpath")
public func _slowPath(_ x: Bool) -> Bool {
Expand All @@ -293,7 +285,6 @@ public func _slowPath(_ x: Bool) -> Bool {

/// Optimizer hint that the code where this function is called is on the fast
/// path.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public func _onFastPath() {
Builtin.onFastPath()
Expand Down Expand Up @@ -665,7 +656,6 @@ internal func _isUniqueOrPinned<T>(_ object: inout T) -> Bool {

/// Returns `true` if `object` is uniquely referenced.
/// This provides sanity checks on top of the Builtin.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isUnique_native<T>(_ object: inout T) -> Bool {
Expand All @@ -682,7 +672,6 @@ func _isUnique_native<T>(_ object: inout T) -> Bool {

/// Returns `true` if `object` is uniquely referenced or pinned.
/// This provides sanity checks on top of the Builtin.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isUniqueOrPinned_native<T>(_ object: inout T) -> Bool {
Expand All @@ -698,15 +687,13 @@ func _isUniqueOrPinned_native<T>(_ object: inout T) -> Bool {

/// Returns `true` if type is a POD type. A POD type is a type that does not
/// require any special handling on copying or destruction.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isPOD<T>(_ type: T.Type) -> Bool {
return Bool(Builtin.ispod(type))
}

/// Returns `true` if type is nominally an Optional type.
@inlinable // FIXME(sil-serialize-all)
@_transparent
public // @testable
func _isOptional<T>(_ type: T.Type) -> Bool {
Expand Down Expand Up @@ -850,7 +837,6 @@ func _trueAfterDiagnostics() -> Builtin.Int1 {
///
/// - Parameter value: The value for which to find the dynamic type.
/// - Returns: The dynamic type, which is a metatype instance.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@_semantics("typechecker.type(of:)")
public func type<T, Metatype>(of value: T) -> Metatype {
Expand Down Expand Up @@ -943,7 +929,6 @@ public func type<T, Metatype>(of value: T) -> Metatype {
/// - body: A closure that is executed immediately with an escapable copy of
/// `closure` as its argument.
/// - Returns: The return value, if any, of the `body` closure.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@_semantics("typechecker.withoutActuallyEscaping(_:do:)")
public func withoutActuallyEscaping<ClosureType, ResultType>(
Expand All @@ -959,7 +944,6 @@ public func withoutActuallyEscaping<ClosureType, ResultType>(
Builtin.unreachable()
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@_semantics("typechecker._openExistential(_:do:)")
public func _openExistential<ExistentialType, ContainedType, ResultType>(
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/CTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ public struct OpaquePointer {
@usableFromInline
internal var _rawValue: Builtin.RawPointer

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal init(_ v: Builtin.RawPointer) {
self._rawValue = v
}
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/CocoaArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ internal struct _CocoaArrayWrapper : RandomAccessCollection {
: nil
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal init(_ buffer: _NSArrayCore) {
self.buffer = buffer
}
Expand Down
18 changes: 6 additions & 12 deletions stdlib/public/core/Dictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2580,8 +2580,7 @@ extension _NativeDictionaryBuffer where Key: Hashable
}
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal static func bucketCount(
forCapacity capacity: Int,
maxLoadFactorInverse: Double
Expand Down Expand Up @@ -3246,8 +3245,7 @@ internal enum _VariantDictionaryBuffer<Key: Hashable, Value>: _HashBuffer {
case cocoa(CocoaBuffer)
#endif

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var guaranteedNative: Bool {
return _canBeClass(Key.self) == 0 || _canBeClass(Value.self) == 0
}
Expand Down Expand Up @@ -4394,14 +4392,12 @@ extension Dictionary {
}
#endif

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _guaranteedNative: Bool {
return _canBeClass(Key.self) == 0 && _canBeClass(Value.self) == 0
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _nativeIndex: _NativeIndex {
switch _value {
case ._native(let nativeIndex):
Expand All @@ -4414,8 +4410,7 @@ extension Dictionary {
}

#if _runtime(_ObjC)
@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _cocoaIndex: _CocoaIndex {
switch _value {
case ._native:
Expand Down Expand Up @@ -4649,8 +4644,7 @@ public struct DictionaryIterator<Key: Hashable, Value>: IteratorProtocol {
}
#endif

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _guaranteedNative: Bool {
return _canBeClass(Key.self) == 0 || _canBeClass(Value.self) == 0
}
Expand Down
15 changes: 5 additions & 10 deletions stdlib/public/core/FloatingPointTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -317,28 +317,23 @@ extension ${Self}: BinaryFloatingPoint {
@usableFromInline // FIXME(sil-serialize-all)
internal var _storage: (UInt64, UInt16, /* pad */ UInt16, UInt16, UInt16)

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var explicitSignificand: UInt64 { return _storage.0 }

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var signAndExponent: UInt16 { return _storage.1 }

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var sign: FloatingPointSign {
return FloatingPointSign(rawValue: Int(signAndExponent &>> 15))!
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var exponentBitPattern: UInt {
return UInt(signAndExponent) & 0x7fff
}

@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal init(explicitSignificand: UInt64, signAndExponent: UInt16) {
_storage = (explicitSignificand, signAndExponent, 0, 0, 0)
}
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/Hashing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ internal protocol _HashBuffer {
/// The inverse of the default hash table load factor. Factored out so that it
/// can be used in multiple places in the implementation and stay consistent.
/// Should not be used outside `Dictionary` implementation.
@inlinable // FIXME(sil-serialize-all)
@_transparent
@usableFromInline @_transparent
internal var _hashContainerDefaultMaxLoadFactorInverse: Double {
return 1.0 / 0.75
}
Expand Down
Loading