mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[embedded] Fix arm64e pointer signing in embedded heap object destruction
This commit is contained in:
@@ -33,9 +33,14 @@ extern "C" {
|
|||||||
|
|
||||||
typedef void SWIFT_CC (*HeapObjectDestroyer)(SWIFT_CONTEXT void *object);
|
typedef void SWIFT_CC (*HeapObjectDestroyer)(SWIFT_CONTEXT void *object);
|
||||||
|
|
||||||
static inline void _swift_runtime_invoke_heap_object_destroy(
|
static inline void _swift_embedded_invoke_heap_object_destroy(void *object) {
|
||||||
const void *destroy, void *self) {
|
void *metadata = *(void **)object;
|
||||||
((HeapObjectDestroyer)destroy)(self);
|
void **destroy_location = &((void **)metadata)[1];
|
||||||
|
#if __has_feature(ptrauth_calls)
|
||||||
|
(*(__ptrauth(0,1,0xbbbf) HeapObjectDestroyer *)destroy_location)(object);
|
||||||
|
#else
|
||||||
|
(*(HeapObjectDestroyer *)destroy_location)(object);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public func swift_release(object: Builtin.RawPointer) {
|
|||||||
if o.pointee.refcount == HeapObject.immortalRefCount { return }
|
if o.pointee.refcount == HeapObject.immortalRefCount { return }
|
||||||
o.pointee.refcount -= 1
|
o.pointee.refcount -= 1
|
||||||
if (o.pointee.refcount & HeapObject.refcountMask) == 0 {
|
if (o.pointee.refcount & HeapObject.refcountMask) == 0 {
|
||||||
_swift_runtime_invoke_heap_object_destroy(o.pointee.metadata.pointee.destroy, o)
|
_swift_embedded_invoke_heap_object_destroy(o)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user