Skip to content

Commit 4a34aa7

Browse files
committed
Re-apply "stdlib: Add minimum set of @_versioned attributes to build without -sil-serialize-all"
This reverts commit 2286472.
1 parent 126adba commit 4a34aa7

13 files changed

+36
-1
lines changed

stdlib/public/Platform/tgmath.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ public func lgamma(x: ${T}) -> (${T}, Int) {
293293
#else
294294
% # On Darwin platform,
295295
% # The real lgamma_r is not imported because it hides behind macro _REENTRANT.
296+
@_versioned
296297
@warn_unused_result
297298
@_silgen_name("_swift_Darwin_lgamma${f}_r")
298299
func _swift_Darwin_lgamma${f}_r(_: ${CT},

stdlib/public/core/ArrayBody.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import SwiftShims
1919

2020
internal struct _ArrayBody {
2121
var _storage: _SwiftArrayBodyStorage
22-
22+
23+
@_versioned
2324
init(count: Int, capacity: Int, elementTypeIsBridgedVerbatim: Bool = false) {
2425
_sanityCheck(count >= 0)
2526
_sanityCheck(capacity >= 0)

stdlib/public/core/ArrayBuffer.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ extension _ArrayBuffer {
341341
return _fastPath(_isNative) ? _native.capacity : _nonNative.count
342342
}
343343

344+
@_versioned
344345
@inline(__always)
345346
@warn_unused_result
346347
func getElement(i: Int, wasNativeTypeChecked: Bool) -> Element {
@@ -350,6 +351,7 @@ extension _ArrayBuffer {
350351
return unsafeBitCast(_getElementSlowPath(i), to: Element.self)
351352
}
352353

354+
@_versioned
353355
@inline(never)
354356
@warn_unused_result
355357
func _getElementSlowPath(i: Int) -> AnyObject {
@@ -471,6 +473,7 @@ extension _ArrayBuffer {
471473
typealias Storage = _ContiguousArrayStorage<Element>
472474
public typealias NativeBuffer = _ContiguousArrayBuffer<Element>
473475

476+
@_versioned
474477
var _isNative: Bool {
475478
if !_isClassOrObjCExistential(Element.self) {
476479
return true
@@ -493,6 +496,7 @@ extension _ArrayBuffer {
493496
/// Our native representation.
494497
///
495498
/// - Precondition: `_isNative`.
499+
@_versioned
496500
var _native: NativeBuffer {
497501
return NativeBuffer(
498502
_isClassOrObjCExistential(Element.self)
@@ -502,6 +506,7 @@ extension _ArrayBuffer {
502506
/// Fast access to the native representation.
503507
///
504508
/// - Precondition: `_isNativeTypeChecked`.
509+
@_versioned
505510
var _nativeTypeChecked: NativeBuffer {
506511
return NativeBuffer(_storage.nativeInstance_noSpareBits)
507512
}

stdlib/public/core/Arrays.swift.gyb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ extension ${Self} : _ArrayProtocol {
542542

543543
/// Entry point for `Array` literal construction; builds and returns
544544
/// a ${Self} of `count` uninitialized elements.
545+
@_versioned
545546
@warn_unused_result
546547
@_semantics("array.uninitialized")
547548
internal static func _allocateUninitialized(
@@ -558,6 +559,7 @@ extension ${Self} : _ArrayProtocol {
558559
/// first element.
559560
///
560561
/// - Precondition: `storage is _ContiguousArrayStorage`.
562+
@_versioned
561563
@warn_unused_result
562564
@_semantics("array.uninitialized")
563565
internal static func _adoptStorage(
@@ -1204,6 +1206,7 @@ internal struct _IgnorePointer<T> : _PointerFunction {
12041206
}
12051207
}
12061208

1209+
@_versioned
12071210
@inline(never)
12081211
internal func _outlinedMakeUniqueBuffer<
12091212
_Buffer : _ArrayBufferProtocol where _Buffer.Index == Int

stdlib/public/core/AssertCommon.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func _reportFatalError(
8686
_ message: UnsafePointer<UInt8>, _ messageLength: UInt,
8787
flags: UInt32)
8888

89+
@_versioned
8990
@_silgen_name("_swift_stdlib_reportUnimplementedInitializerInFile")
9091
func _reportUnimplementedInitializerInFile(
9192
className: UnsafePointer<UInt8>, _ classNameLength: UInt,
@@ -94,6 +95,7 @@ func _reportUnimplementedInitializerInFile(
9495
_ line: UInt, _ column: UInt,
9596
flags: UInt32)
9697

98+
@_versioned
9799
@_silgen_name("_swift_stdlib_reportUnimplementedInitializer")
98100
func _reportUnimplementedInitializer(
99101
className: UnsafePointer<UInt8>, _ classNameLength: UInt,
@@ -105,6 +107,7 @@ func _reportUnimplementedInitializer(
105107
///
106108
/// This function should not be inlined because it is cold and inlining just
107109
/// bloats code.
110+
@_versioned
108111
@noreturn @inline(never)
109112
@_semantics("stdlib_binary_only")
110113
func _assertionFailed(
@@ -135,6 +138,7 @@ func _assertionFailed(
135138
///
136139
/// This function should not be inlined because it is cold and inlining just
137140
/// bloats code.
141+
@_versioned
138142
@noreturn @inline(never)
139143
@_semantics("stdlib_binary_only")
140144
func _assertionFailed(
@@ -166,6 +170,7 @@ func _assertionFailed(
166170
///
167171
/// This function should not be inlined because it is cold and it inlining just
168172
/// bloats code.
173+
@_versioned
169174
@noreturn @inline(never)
170175
@_semantics("stdlib_binary_only")
171176
@_semantics("arc.programtermination_point")

stdlib/public/core/Builtin.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public func strideofValue<T>(_:T) -> Int {
7474
return strideof(T.self)
7575
}
7676

77+
@_versioned
7778
@warn_unused_result
7879
internal func _roundUp(offset: Int, toAlignment alignment: Int) -> Int {
7980
_sanityCheck(offset >= 0)
@@ -174,12 +175,14 @@ func _conditionallyUnreachable() {
174175
Builtin.conditionallyUnreachable()
175176
}
176177

178+
@_versioned
177179
@warn_unused_result
178180
@_silgen_name("swift_isClassOrObjCExistentialType")
179181
func _swift_isClassOrObjCExistentialType<T>(x: T.Type) -> Bool
180182

181183
/// Returns `true` iff `T` is a class type or an `@objc` existential such as
182184
/// `AnyObject`.
185+
@_versioned
183186
@inline(__always)
184187
@warn_unused_result
185188
internal func _isClassOrObjCExistential<T>(x: T.Type) -> Bool {
@@ -287,6 +290,7 @@ public func _slowPath<C : Boolean>(x: C) -> Bool {
287290

288291
/// Returns `true` iff the class indicated by `theClass` uses native
289292
/// Swift reference-counting.
293+
@_versioned
290294
@inline(__always)
291295
@warn_unused_result
292296
internal func _usesNativeSwiftReferenceCounting(theClass: AnyClass) -> Bool {
@@ -323,6 +327,7 @@ internal func _class_getInstancePositiveExtentSize(theClass: AnyClass) -> Int {
323327
//===--- Builtin.BridgeObject ---------------------------------------------===//
324328

325329
#if arch(i386) || arch(arm)
330+
@_versioned
326331
internal var _objectPointerSpareBits: UInt {
327332
@inline(__always) get { return 0x0000_0003 }
328333
}
@@ -336,6 +341,7 @@ internal var _objCTaggedPointerBits: UInt {
336341
@inline(__always) get { return 0 }
337342
}
338343
#elseif arch(x86_64)
344+
@_versioned
339345
internal var _objectPointerSpareBits: UInt {
340346
@inline(__always) get { return 0x7F00_0000_0000_0006 }
341347
}
@@ -349,6 +355,7 @@ internal var _objCTaggedPointerBits: UInt {
349355
@inline(__always) get { return 0x8000_0000_0000_0001 }
350356
}
351357
#elseif arch(arm64)
358+
@_versioned
352359
internal var _objectPointerSpareBits: UInt {
353360
@inline(__always) get { return 0x7F00_0000_0000_0007 }
354361
}
@@ -377,6 +384,7 @@ internal var _objCTaggedPointerBits: UInt {
377384
#endif
378385

379386
/// Extract the raw bits of `x`.
387+
@_versioned
380388
@inline(__always)
381389
@warn_unused_result
382390
internal func _bitPattern(x: Builtin.BridgeObject) -> UInt {

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ public struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
320320
return self
321321
}
322322

323+
@_versioned
323324
@warn_unused_result
324325
func getElement(i: Int) -> Element {
325326
_sanityCheck(i >= 0 && i < count, "Array index out of range")

stdlib/public/core/HashedCollections.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,7 @@ final internal class _Native${Self}StorageImpl<${TypeParameters}> :
17491749
}
17501750
}
17511751

1752+
@_versioned
17521753
internal var _capacity: Int {
17531754
@warn_unused_result
17541755
get {

stdlib/public/core/IntegerArithmetic.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public prefix func + <T : SignedNumber>(x: T) -> T {
124124

125125
//===--- abs(x) -----------------------------------------------------------===//
126126
public struct _Abs {}
127+
128+
@_versioned
127129
internal func _abs<Args>(args: Args) -> (_Abs, Args) {
128130
return (_Abs(), args)
129131
}

stdlib/public/core/ManagedBuffer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
220220
/// _debugPreconditions in _checkValidBufferClass for any array. Since we know
221221
/// for the _ContiguousArrayBuffer that this check must always succeed we omit
222222
/// it in this specialized constructor.
223+
@_versioned
223224
internal init(_uncheckedUnsafeBufferObject buffer: AnyObject) {
224225
ManagedBufferPointer._sanityCheckValidBufferClass(buffer.dynamicType)
225226
self._nativeBuffer = Builtin.castToNativeObject(buffer)
@@ -327,6 +328,7 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
327328

328329
/// Internal version for use by _ContiguousArrayBuffer.init where we know that
329330
/// we have a valid buffer class and that the capacity is >= 0.
331+
@_versioned
330332
internal init(
331333
_uncheckedBufferClass: AnyClass,
332334
minimumCapacity: Int

stdlib/public/core/Print.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public func debugPrint<Target : OutputStream>(
118118
items, separator: separator, terminator: terminator, to: &output)
119119
}
120120

121+
@_versioned
121122
@inline(never)
122123
@_semantics("stdlib_binary_only")
123124
internal func _print<Target : OutputStream>(
@@ -137,6 +138,7 @@ internal func _print<Target : OutputStream>(
137138
output.write(terminator)
138139
}
139140

141+
@_versioned
140142
@inline(never)
141143
@_semantics("stdlib_binary_only")
142144
internal func _debugPrint<Target : OutputStream>(

stdlib/public/core/Process.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public enum Process {
3232
return result
3333
}
3434

35+
@_versioned
3536
internal static var _argc: CInt = CInt()
37+
38+
@_versioned
3639
internal static var _unsafeArgv:
3740
UnsafeMutablePointer<UnsafeMutablePointer<Int8>>
3841
= nil

stdlib/public/core/SliceBuffer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ struct _SliceBuffer<Element> : _ArrayBufferProtocol {
244244
return isUniquelyReferencedOrPinnedNonObjC(&owner)
245245
}
246246

247+
@_versioned
247248
@warn_unused_result
248249
func getElement(i: Int) -> Element {
249250
_sanityCheck(i >= startIndex, "negative slice index is out of range")

0 commit comments

Comments
 (0)