Skip to content

Commit

Permalink
runtime: remove pinning in reference counting and pinning runtime ent…
Browse files Browse the repository at this point in the history
…ry points

rdar://problem/35401813
  • Loading branch information
eeckstein committed Aug 25, 2018
1 parent 899a619 commit 8f35a3e
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 537 deletions.
6 changes: 0 additions & 6 deletions docs/Runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ Returns a random number. Only used by allocation profiling tools.
000000000001cee0 T _swift_release_n
000000000001ce30 T _swift_retain
000000000001ce50 T _swift_retain_n
000000000001d140 T _swift_tryPin
000000000001d240 T _swift_tryRetain
0000000000027b10 T _swift_unknownObjectRelease
0000000000027a70 T _swift_unknownObjectRelease_n
Expand Down Expand Up @@ -140,7 +139,6 @@ Returns a random number. Only used by allocation profiling tools.
000000000001d2b0 T _swift_unownedRetainStrong
000000000001d310 T _swift_unownedRetainStrongAndRelease
000000000001d060 T _swift_unownedRetain_n
000000000001d1b0 T _swift_unpin
000000000001ca20 T _swift_verifyEndOfLifetime
000000000001d680 T _swift_weakAssign
000000000001d830 T _swift_weakCopyAssign
Expand All @@ -154,10 +152,6 @@ Returns a random number. Only used by allocation profiling tools.
000000000002afe0 T _swift_isUniquelyReferencedNonObjC
000000000002af50 T _swift_isUniquelyReferencedNonObjC_nonNull
000000000002b060 T _swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject
000000000002b200 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull
000000000002b130 T _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject
000000000002b2f0 T _swift_isUniquelyReferencedOrPinned_native
000000000002b290 T _swift_isUniquelyReferencedOrPinned_nonNull_native
000000000002af00 T _swift_isUniquelyReferenced_native
000000000002aea0 T _swift_isUniquelyReferenced_nonNull_native
00000000000????? T _swift_setDeallocating
Expand Down
45 changes: 0 additions & 45 deletions include/swift/Runtime/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,6 @@ HeapObject *swift_tryRetain(HeapObject *object);
SWIFT_RUNTIME_EXPORT
bool swift_isDeallocating(HeapObject *object);

/// Attempts to atomically pin an object and increment its reference
/// count. Returns nil if the object was already pinned.
///
/// The standard protocol is that the caller is responsible for
/// calling swift_unpin on the return value.
///
/// The object reference may not be nil.
SWIFT_RUNTIME_EXPORT
HeapObject *swift_tryPin(HeapObject *object);

SWIFT_RUNTIME_EXPORT
HeapObject *swift_nonatomic_tryPin(HeapObject *object);

/// Given that an object is pinned, atomically unpin it and decrement
/// the reference count.
///
/// The object reference may be nil (to simplify the protocol).
SWIFT_RUNTIME_EXPORT
void swift_unpin(HeapObject *object);

SWIFT_RUNTIME_EXPORT
void swift_nonatomic_unpin(HeapObject *object);

/// Atomically decrements the retain count of an object. If the
/// retain count reaches zero, the object is destroyed as follows:
///
Expand Down Expand Up @@ -244,44 +221,22 @@ bool swift_isUniquelyReferencedNonObjC(const void *);
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedNonObjC_nonNull(const void *);

/// Is this non-null pointer a reference to an object that uses Swift
/// reference counting and is either uniquely referenced or pinned?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull(const void *);

/// Is this non-null BridgeObject a unique reference to an object
/// that uses Swift reference counting?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject(
uintptr_t bits);

/// Is this non-null BridgeObject a unique or pinned reference to an
/// object that uses Swift reference counting?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject(
uintptr_t bits);

/// Is this native Swift pointer a non-null unique reference to
/// an object?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferenced_native(const struct HeapObject *);

/// Is this native Swift pointer a non-null unique or pinned reference
/// to an object?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedOrPinned_native(const struct HeapObject *);

/// Is this non-null native Swift pointer a unique reference to
/// an object?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferenced_nonNull_native(const struct HeapObject *);

/// Does this non-null native Swift pointer refer to an object that
/// is either uniquely referenced or pinned?
SWIFT_RUNTIME_EXPORT
bool swift_isUniquelyReferencedOrPinned_nonNull_native(
const struct HeapObject *);

/// Is this native Swift pointer non-null and has a reference count greater than
/// one.
/// This runtime call will print an error message with file name and location if
Expand Down
58 changes: 0 additions & 58 deletions include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,6 @@ FUNCTION(NativeNonAtomicStrongRetain, swift_nonatomic_retain, C_CC,
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, FirstParamReturned))

// void *swift_tryPin(void *ptr);
FUNCTION(NativeTryPin, swift_tryPin, C_CC,
RETURNS(RefCountedPtrTy),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind))

// void swift_nonatomic_release(void *ptr);
FUNCTION(NativeNonAtomicStrongRelease, swift_nonatomic_release, C_CC,
RETURNS(VoidTy),
Expand All @@ -276,30 +270,12 @@ FUNCTION(NativeTryRetain, swift_tryRetain, C_CC,
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind))

// void swift_unpin(void *ptr);
FUNCTION(NativeUnpin, swift_unpin, C_CC,
RETURNS(VoidTy),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind))

// bool swift_isDeallocating(void *ptr);
FUNCTION(IsDeallocating, swift_isDeallocating, C_CC,
RETURNS(Int1Ty),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// void *swift_nonatomic_tryPin(void *ptr);
FUNCTION(NonAtomicNativeTryPin, swift_nonatomic_tryPin, C_CC,
RETURNS(RefCountedPtrTy),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind))

// void swift_nonatomic_unpin(void *ptr);
FUNCTION(NonAtomicNativeUnpin, swift_nonatomic_unpin, C_CC,
RETURNS(VoidTy),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind))

// void *swift_unknownObjectRetain(void *ptr);
FUNCTION(UnknownObjectRetain, swift_unknownObjectRetain, C_CC,
RETURNS(UnknownRefCountedPtrTy),
Expand Down Expand Up @@ -459,14 +435,6 @@ FUNCTION(IsUniquelyReferencedNonObjC_nonNull,
ARGS(UnknownRefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull(const void *);
FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull,
swift_isUniquelyReferencedOrPinnedNonObjC_nonNull,
C_CC,
RETURNS(Int1Ty),
ARGS(UnknownRefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject(
// uintptr_t bits);
FUNCTION(IsUniquelyReferencedNonObjC_nonNull_bridgeObject,
Expand All @@ -476,30 +444,13 @@ FUNCTION(IsUniquelyReferencedNonObjC_nonNull_bridgeObject,
ARGS(BridgeObjectPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject(
// uintptr_t bits);
FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject,
swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject,
C_CC,
RETURNS(Int1Ty),
ARGS(BridgeObjectPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferenced_native(const struct HeapObject *);
FUNCTION(IsUniquelyReferenced_native, swift_isUniquelyReferenced_native,
C_CC,
RETURNS(Int1Ty),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferencedOrPinned_native(const struct HeapObject *);
FUNCTION(IsUniquelyReferencedOrPinned_native,
swift_isUniquelyReferencedOrPinned_native,
C_CC,
RETURNS(Int1Ty),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferenced_nonNull_native(const struct HeapObject *);
FUNCTION(IsUniquelyReferenced_nonNull_native,
swift_isUniquelyReferenced_nonNull_native,
Expand All @@ -508,15 +459,6 @@ FUNCTION(IsUniquelyReferenced_nonNull_native,
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isUniquelyReferencedOrPinned_nonNull_native(
// const struct HeapObject *);
FUNCTION(IsUniquelyReferencedOrPinned_nonNull_native,
swift_isUniquelyReferencedOrPinned_nonNull_native,
C_CC,
RETURNS(Int1Ty),
ARGS(RefCountedPtrTy),
ATTRS(NoUnwind, ZExt))

// bool swift_isEscapingClosureAtFileLocation(const struct HeapObject *object,
// const unsigned char *filename,
// int32_t filenameLength,
Expand Down
Loading

0 comments on commit 8f35a3e

Please sign in to comment.