Skip to content

Commit 615ed9d

Browse files
Inline for various builtins (almost all inline-always) (#19610)
1 parent 9034066 commit 615ed9d

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

stdlib/public/core/Builtin.swift

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ internal func _conditionallyUnreachable() -> Never {
178178
Builtin.conditionallyUnreachable()
179179
}
180180

181-
@inlinable // FIXME(sil-serialize-all)
181+
@usableFromInline
182182
@_silgen_name("_swift_isClassOrObjCExistentialType")
183183
internal func _swift_isClassOrObjCExistentialType<T>(_ x: T.Type) -> Bool
184184

185185
/// Returns `true` iff `T` is a class type or an `@objc` existential such as
186186
/// `AnyObject`.
187-
@inlinable // FIXME(sil-serialize-all)
187+
@inlinable
188188
@inline(__always)
189189
internal func _isClassOrObjCExistential<T>(_ x: T.Type) -> Bool {
190190

@@ -244,7 +244,7 @@ public func _unsafeUncheckedDowncast<T : AnyObject>(_ x: AnyObject, to type: T.T
244244

245245
import SwiftShims
246246

247-
@inlinable // FIXME(sil-serialize-all)
247+
@inlinable
248248
@inline(__always)
249249
public func _getUnsafePointerToStoredProperties(_ x: AnyObject)
250250
-> UnsafeMutableRawPointer {
@@ -298,28 +298,28 @@ public func _onFastPath() {
298298
// Declare it here instead of RuntimeShims.h, because we need to specify
299299
// the type of argument to be AnyClass. This is currently not possible
300300
// when using RuntimeShims.h
301-
@inlinable // FIXME(sil-serialize-all)
301+
@usableFromInline
302302
@_silgen_name("_objcClassUsesNativeSwiftReferenceCounting")
303303
internal func _usesNativeSwiftReferenceCounting(_ theClass: AnyClass) -> Bool
304304
#else
305-
@inlinable // FIXME(sil-serialize-all)
305+
@inlinable
306306
@inline(__always)
307307
internal func _usesNativeSwiftReferenceCounting(_ theClass: AnyClass) -> Bool {
308308
return true
309309
}
310310
#endif
311311

312-
@inlinable // FIXME(sil-serialize-all)
312+
@usableFromInline
313313
@_silgen_name("_getSwiftClassInstanceExtents")
314314
internal func getSwiftClassInstanceExtents(_ theClass: AnyClass)
315315
-> (negative: UInt, positive: UInt)
316316

317-
@inlinable // FIXME(sil-serialize-all)
317+
@usableFromInline
318318
@_silgen_name("_getObjCClassInstanceExtents")
319319
internal func getObjCClassInstanceExtents(_ theClass: AnyClass)
320320
-> (negative: UInt, positive: UInt)
321321

322-
@inlinable // FIXME(sil-serialize-all)
322+
@inlinable
323323
@inline(__always)
324324
internal func _class_getInstancePositiveExtentSize(_ theClass: AnyClass) -> Int {
325325
#if _runtime(_ObjC)
@@ -330,8 +330,7 @@ internal func _class_getInstancePositiveExtentSize(_ theClass: AnyClass) -> Int
330330
}
331331

332332
@inlinable
333-
internal
334-
func _isValidAddress(_ address: UInt) -> Bool {
333+
internal func _isValidAddress(_ address: UInt) -> Bool {
335334
// TODO: define (and use) ABI max valid pointer value
336335
return address >= _swift_abi_LeastValidPointerValue
337336
}
@@ -340,17 +339,17 @@ func _isValidAddress(_ address: UInt) -> Bool {
340339

341340
// TODO(<rdar://problem/34837023>): Get rid of superfluous UInt constructor
342341
// calls
343-
@inlinable // FIXME(sil-serialize-all)
342+
@inlinable
344343
internal var _objCTaggedPointerBits: UInt {
345344
@inline(__always) get { return UInt(_swift_BridgeObject_TaggedPointerBits) }
346345
}
347-
@inlinable // FIXME(sil-serialize-all)
346+
@inlinable
348347
internal var _objectPointerSpareBits: UInt {
349348
@inline(__always) get {
350349
return UInt(_swift_abi_SwiftSpareBitsMask) & ~_objCTaggedPointerBits
351350
}
352351
}
353-
@inlinable // FIXME(sil-serialize-all)
352+
@inlinable
354353
internal var _objectPointerLowSpareBitShift: UInt {
355354
@inline(__always) get {
356355
_sanityCheck(_swift_abi_ObjCReservedLowBits < 2,
@@ -361,37 +360,37 @@ internal var _objectPointerLowSpareBitShift: UInt {
361360

362361
#if arch(i386) || arch(arm) || arch(powerpc64) || arch(powerpc64le) || arch(
363362
s390x)
364-
@inlinable // FIXME(sil-serialize-all)
363+
@inlinable
365364
internal var _objectPointerIsObjCBit: UInt {
366365
@inline(__always) get { return 0x0000_0002 }
367366
}
368367
#else
369-
@inlinable // FIXME(sil-serialize-all)
368+
@inlinable
370369
internal var _objectPointerIsObjCBit: UInt {
371370
@inline(__always) get { return 0x4000_0000_0000_0000 }
372371
}
373372
#endif
374373

375374
/// Extract the raw bits of `x`.
376-
@inlinable // FIXME(sil-serialize-all)
375+
@inlinable
377376
@inline(__always)
378377
internal func _bitPattern(_ x: Builtin.BridgeObject) -> UInt {
379378
return UInt(Builtin.castBitPatternFromBridgeObject(x))
380379
}
381380

382381
/// Extract the raw spare bits of `x`.
383-
@inlinable // FIXME(sil-serialize-all)
382+
@inlinable
384383
@inline(__always)
385384
internal func _nonPointerBits(_ x: Builtin.BridgeObject) -> UInt {
386385
return _bitPattern(x) & _objectPointerSpareBits
387386
}
388387

389-
@inlinable // FIXME(sil-serialize-all)
388+
@inlinable
390389
@inline(__always)
391390
internal func _isObjCTaggedPointer(_ x: AnyObject) -> Bool {
392391
return (Builtin.reinterpretCast(x) & _objCTaggedPointerBits) != 0
393392
}
394-
@inlinable // FIXME(sil-serialize-all)
393+
@inlinable
395394
@inline(__always)
396395
internal func _isObjCTaggedPointer(_ x: UInt) -> Bool {
397396
return (x & _objCTaggedPointerBits) != 0
@@ -507,24 +506,25 @@ public func _bridgeObject(
507506
// NativeObject
508507
//
509508

510-
@inline(__always)
511509
@inlinable
510+
@inline(__always)
512511
public func _nativeObject(fromNative x: AnyObject) -> Builtin.NativeObject {
513512
_sanityCheck(!_isObjCTaggedPointer(x))
514513
let native = Builtin.unsafeCastToNativeObject(x)
515514
// _sanityCheck(native == Builtin.castToNativeObject(x))
516515
return native
517516
}
518-
@inline(__always)
517+
519518
@inlinable
519+
@inline(__always)
520520
public func _nativeObject(
521521
fromBridge x: Builtin.BridgeObject
522522
) -> Builtin.NativeObject {
523523
return _nativeObject(fromNative: _bridgeObject(toNative: x))
524524
}
525525

526-
@inline(__always)
527526
@inlinable
527+
@inline(__always)
528528
public func _nativeObject(toNative x: Builtin.NativeObject) -> AnyObject {
529529
return Builtin.castFromNativeObject(x)
530530
}
@@ -547,7 +547,7 @@ extension ManagedBufferPointer {
547547
///
548548
/// - Precondition: `bits & _objectPointerIsObjCBit == 0`,
549549
/// `bits & _objectPointerSpareBits == bits`.
550-
@inlinable // FIXME(sil-serialize-all)
550+
@inlinable
551551
@inline(__always)
552552
internal func _makeNativeBridgeObject(
553553
_ nativeObject: AnyObject, _ bits: UInt
@@ -560,7 +560,7 @@ internal func _makeNativeBridgeObject(
560560
}
561561

562562
/// Create a `BridgeObject` around the given `objCObject`.
563-
@inlinable // FIXME(sil-serialize-all)
563+
@inlinable
564564
@inline(__always)
565565
public // @testable
566566
func _makeObjCBridgeObject(
@@ -580,7 +580,7 @@ func _makeObjCBridgeObject(
580580
/// 2. if `object` is a tagged pointer, `bits == 0`. Otherwise,
581581
/// `object` is either a native object, or `bits ==
582582
/// _objectPointerIsObjCBit`.
583-
@inlinable // FIXME(sil-serialize-all)
583+
@inlinable
584584
@inline(__always)
585585
internal func _makeBridgeObject(
586586
_ object: AnyObject, _ bits: UInt
@@ -609,14 +609,13 @@ internal func _swift_class_getSuperclass(_ t: AnyClass) -> AnyClass?
609609

610610
/// Returns the superclass of `t`, if any. The result is `nil` if `t` is
611611
/// a root class or class protocol.
612-
public
613-
func _getSuperclass(_ t: AnyClass) -> AnyClass? {
612+
public func _getSuperclass(_ t: AnyClass) -> AnyClass? {
614613
return _swift_class_getSuperclass(t)
615614
}
616615

617616
/// Returns the superclass of `t`, if any. The result is `nil` if `t` is
618617
/// not a class, is a root class, or is a class protocol.
619-
@inlinable // FIXME(sil-serialize-all)
618+
@inlinable
620619
@inline(__always)
621620
public // @testable
622621
func _getSuperclass(_ t: Any.Type) -> AnyClass? {
@@ -688,7 +687,7 @@ func _isOptional<T>(_ type: T.Type) -> Bool {
688687
}
689688

690689
/// Extract an object reference from an Any known to contain an object.
691-
@inlinable // FIXME(sil-serialize-all)
690+
@inlinable
692691
internal func _unsafeDowncastToAnyObject(fromAny any: Any) -> AnyObject {
693692
_sanityCheck(type(of: any) is AnyObject.Type
694693
|| type(of: any) is AnyObject.Protocol,
@@ -712,7 +711,7 @@ internal func _unsafeDowncastToAnyObject(fromAny any: Any) -> AnyObject {
712711
// definitions below after the stdlib's diagnostic passes run, so that the
713712
// `staticReport`s don't fire while building the standard library, but do
714713
// fire if they ever show up in code that uses the standard library.
715-
@inlinable // FIXME(sil-serialize-all)
714+
@inlinable
716715
@inline(__always)
717716
public // internal with availability
718717
func _trueAfterDiagnostics() -> Builtin.Int1 {

0 commit comments

Comments
 (0)