Skip to content

Commit 8f35a3e

Browse files
committed
runtime: remove pinning in reference counting and pinning runtime entry points
rdar://problem/35401813
1 parent 899a619 commit 8f35a3e

File tree

9 files changed

+49
-537
lines changed

9 files changed

+49
-537
lines changed

Diff for: docs/Runtime.md

-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Returns a random number. Only used by allocation profiling tools.
108108
000000000001cee0 T _swift_release_n
109109
000000000001ce30 T _swift_retain
110110
000000000001ce50 T _swift_retain_n
111-
000000000001d140 T _swift_tryPin
112111
000000000001d240 T _swift_tryRetain
113112
0000000000027b10 T _swift_unknownObjectRelease
114113
0000000000027a70 T _swift_unknownObjectRelease_n
@@ -140,7 +139,6 @@ Returns a random number. Only used by allocation profiling tools.
140139
000000000001d2b0 T _swift_unownedRetainStrong
141140
000000000001d310 T _swift_unownedRetainStrongAndRelease
142141
000000000001d060 T _swift_unownedRetain_n
143-
000000000001d1b0 T _swift_unpin
144142
000000000001ca20 T _swift_verifyEndOfLifetime
145143
000000000001d680 T _swift_weakAssign
146144
000000000001d830 T _swift_weakCopyAssign
@@ -154,10 +152,6 @@ Returns a random number. Only used by allocation profiling tools.
154152
000000000002afe0 T _swift_isUniquelyReferencedNonObjC
155153
000000000002af50 T _swift_isUniquelyReferencedNonObjC_nonNull
156154
000000000002b060 T _swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject
157-
000000000002b200 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull
158-
000000000002b130 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject
159-
000000000002b2f0 T _swift_isUniquelyReferencedOrPinned_native
160-
000000000002b290 T _swift_isUniquelyReferencedOrPinned_nonNull_native
161155
000000000002af00 T _swift_isUniquelyReferenced_native
162156
000000000002aea0 T _swift_isUniquelyReferenced_nonNull_native
163157
00000000000????? T _swift_setDeallocating

Diff for: include/swift/Runtime/HeapObject.h

-45
Original file line numberDiff line numberDiff line change
@@ -168,29 +168,6 @@ HeapObject *swift_tryRetain(HeapObject *object);
168168
SWIFT_RUNTIME_EXPORT
169169
bool swift_isDeallocating(HeapObject *object);
170170

171-
/// Attempts to atomically pin an object and increment its reference
172-
/// count. Returns nil if the object was already pinned.
173-
///
174-
/// The standard protocol is that the caller is responsible for
175-
/// calling swift_unpin on the return value.
176-
///
177-
/// The object reference may not be nil.
178-
SWIFT_RUNTIME_EXPORT
179-
HeapObject *swift_tryPin(HeapObject *object);
180-
181-
SWIFT_RUNTIME_EXPORT
182-
HeapObject *swift_nonatomic_tryPin(HeapObject *object);
183-
184-
/// Given that an object is pinned, atomically unpin it and decrement
185-
/// the reference count.
186-
///
187-
/// The object reference may be nil (to simplify the protocol).
188-
SWIFT_RUNTIME_EXPORT
189-
void swift_unpin(HeapObject *object);
190-
191-
SWIFT_RUNTIME_EXPORT
192-
void swift_nonatomic_unpin(HeapObject *object);
193-
194171
/// Atomically decrements the retain count of an object. If the
195172
/// retain count reaches zero, the object is destroyed as follows:
196173
///
@@ -244,44 +221,22 @@ bool swift_isUniquelyReferencedNonObjC(const void *);
244221
SWIFT_RUNTIME_EXPORT
245222
bool swift_isUniquelyReferencedNonObjC_nonNull(const void *);
246223

247-
/// Is this non-null pointer a reference to an object that uses Swift
248-
/// reference counting and is either uniquely referenced or pinned?
249-
SWIFT_RUNTIME_EXPORT
250-
bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull(const void *);
251-
252224
/// Is this non-null BridgeObject a unique reference to an object
253225
/// that uses Swift reference counting?
254226
SWIFT_RUNTIME_EXPORT
255227
bool swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject(
256228
uintptr_t bits);
257229

258-
/// Is this non-null BridgeObject a unique or pinned reference to an
259-
/// object that uses Swift reference counting?
260-
SWIFT_RUNTIME_EXPORT
261-
bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject(
262-
uintptr_t bits);
263-
264230
/// Is this native Swift pointer a non-null unique reference to
265231
/// an object?
266232
SWIFT_RUNTIME_EXPORT
267233
bool swift_isUniquelyReferenced_native(const struct HeapObject *);
268234

269-
/// Is this native Swift pointer a non-null unique or pinned reference
270-
/// to an object?
271-
SWIFT_RUNTIME_EXPORT
272-
bool swift_isUniquelyReferencedOrPinned_native(const struct HeapObject *);
273-
274235
/// Is this non-null native Swift pointer a unique reference to
275236
/// an object?
276237
SWIFT_RUNTIME_EXPORT
277238
bool swift_isUniquelyReferenced_nonNull_native(const struct HeapObject *);
278239

279-
/// Does this non-null native Swift pointer refer to an object that
280-
/// is either uniquely referenced or pinned?
281-
SWIFT_RUNTIME_EXPORT
282-
bool swift_isUniquelyReferencedOrPinned_nonNull_native(
283-
const struct HeapObject *);
284-
285240
/// Is this native Swift pointer non-null and has a reference count greater than
286241
/// one.
287242
/// This runtime call will print an error message with file name and location if

Diff for: include/swift/Runtime/RuntimeFunctions.def

-58
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,6 @@ FUNCTION(NativeNonAtomicStrongRetain, swift_nonatomic_retain, C_CC,
258258
ARGS(RefCountedPtrTy),
259259
ATTRS(NoUnwind, FirstParamReturned))
260260

261-
// void *swift_tryPin(void *ptr);
262-
FUNCTION(NativeTryPin, swift_tryPin, C_CC,
263-
RETURNS(RefCountedPtrTy),
264-
ARGS(RefCountedPtrTy),
265-
ATTRS(NoUnwind))
266-
267261
// void swift_nonatomic_release(void *ptr);
268262
FUNCTION(NativeNonAtomicStrongRelease, swift_nonatomic_release, C_CC,
269263
RETURNS(VoidTy),
@@ -276,30 +270,12 @@ FUNCTION(NativeTryRetain, swift_tryRetain, C_CC,
276270
ARGS(RefCountedPtrTy),
277271
ATTRS(NoUnwind))
278272

279-
// void swift_unpin(void *ptr);
280-
FUNCTION(NativeUnpin, swift_unpin, C_CC,
281-
RETURNS(VoidTy),
282-
ARGS(RefCountedPtrTy),
283-
ATTRS(NoUnwind))
284-
285273
// bool swift_isDeallocating(void *ptr);
286274
FUNCTION(IsDeallocating, swift_isDeallocating, C_CC,
287275
RETURNS(Int1Ty),
288276
ARGS(RefCountedPtrTy),
289277
ATTRS(NoUnwind, ZExt))
290278

291-
// void *swift_nonatomic_tryPin(void *ptr);
292-
FUNCTION(NonAtomicNativeTryPin, swift_nonatomic_tryPin, C_CC,
293-
RETURNS(RefCountedPtrTy),
294-
ARGS(RefCountedPtrTy),
295-
ATTRS(NoUnwind))
296-
297-
// void swift_nonatomic_unpin(void *ptr);
298-
FUNCTION(NonAtomicNativeUnpin, swift_nonatomic_unpin, C_CC,
299-
RETURNS(VoidTy),
300-
ARGS(RefCountedPtrTy),
301-
ATTRS(NoUnwind))
302-
303279
// void *swift_unknownObjectRetain(void *ptr);
304280
FUNCTION(UnknownObjectRetain, swift_unknownObjectRetain, C_CC,
305281
RETURNS(UnknownRefCountedPtrTy),
@@ -459,14 +435,6 @@ FUNCTION(IsUniquelyReferencedNonObjC_nonNull,
459435
ARGS(UnknownRefCountedPtrTy),
460436
ATTRS(NoUnwind, ZExt))
461437

462-
// bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull(const void *);
463-
FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull,
464-
swift_isUniquelyReferencedOrPinnedNonObjC_nonNull,
465-
C_CC,
466-
RETURNS(Int1Ty),
467-
ARGS(UnknownRefCountedPtrTy),
468-
ATTRS(NoUnwind, ZExt))
469-
470438
// bool swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject(
471439
// uintptr_t bits);
472440
FUNCTION(IsUniquelyReferencedNonObjC_nonNull_bridgeObject,
@@ -476,30 +444,13 @@ FUNCTION(IsUniquelyReferencedNonObjC_nonNull_bridgeObject,
476444
ARGS(BridgeObjectPtrTy),
477445
ATTRS(NoUnwind, ZExt))
478446

479-
// bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject(
480-
// uintptr_t bits);
481-
FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject,
482-
swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject,
483-
C_CC,
484-
RETURNS(Int1Ty),
485-
ARGS(BridgeObjectPtrTy),
486-
ATTRS(NoUnwind, ZExt))
487-
488447
// bool swift_isUniquelyReferenced_native(const struct HeapObject *);
489448
FUNCTION(IsUniquelyReferenced_native, swift_isUniquelyReferenced_native,
490449
C_CC,
491450
RETURNS(Int1Ty),
492451
ARGS(RefCountedPtrTy),
493452
ATTRS(NoUnwind, ZExt))
494453

495-
// bool swift_isUniquelyReferencedOrPinned_native(const struct HeapObject *);
496-
FUNCTION(IsUniquelyReferencedOrPinned_native,
497-
swift_isUniquelyReferencedOrPinned_native,
498-
C_CC,
499-
RETURNS(Int1Ty),
500-
ARGS(RefCountedPtrTy),
501-
ATTRS(NoUnwind, ZExt))
502-
503454
// bool swift_isUniquelyReferenced_nonNull_native(const struct HeapObject *);
504455
FUNCTION(IsUniquelyReferenced_nonNull_native,
505456
swift_isUniquelyReferenced_nonNull_native,
@@ -508,15 +459,6 @@ FUNCTION(IsUniquelyReferenced_nonNull_native,
508459
ARGS(RefCountedPtrTy),
509460
ATTRS(NoUnwind, ZExt))
510461

511-
// bool swift_isUniquelyReferencedOrPinned_nonNull_native(
512-
// const struct HeapObject *);
513-
FUNCTION(IsUniquelyReferencedOrPinned_nonNull_native,
514-
swift_isUniquelyReferencedOrPinned_nonNull_native,
515-
C_CC,
516-
RETURNS(Int1Ty),
517-
ARGS(RefCountedPtrTy),
518-
ATTRS(NoUnwind, ZExt))
519-
520462
// bool swift_isEscapingClosureAtFileLocation(const struct HeapObject *object,
521463
// const unsigned char *filename,
522464
// int32_t filenameLength,

0 commit comments

Comments
 (0)