File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 28
28
extern " C" {
29
29
#endif
30
30
31
- #define SWIFT_CC __attribute__ ((swiftcall))
32
- #define SWIFT_CONTEXT __attribute__ ((swift_context))
33
-
34
- typedef void SWIFT_CC (*HeapObjectDestroyer)(SWIFT_CONTEXT void *object);
35
-
36
- static inline void _swift_runtime_invoke_heap_object_destroy (
37
- const void *destroy, void *self) {
38
- ((HeapObjectDestroyer)destroy)(self);
31
+ typedef void __attribute__ ((swiftcall)) (*HeapObjectDestroyer)(
32
+ __attribute__ ((swift_context)) void *object);
33
+
34
+ static inline void _swift_embedded_invoke_heap_object_destroy (void *object) {
35
+ void *metadata = *(void **)object;
36
+ void **destroy_location = &((void **)metadata)[1 ];
37
+ #if __has_feature(ptrauth_calls)
38
+ (*(HeapObjectDestroyer __ptrauth (0 ,1 ,0xbbbf ) *)destroy_location)(object);
39
+ #else
40
+ (*(HeapObjectDestroyer *)destroy_location)(object);
41
+ #endif
39
42
}
40
43
41
44
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public func swift_release(object: Builtin.RawPointer) {
117
117
if o. pointee. refcount == HeapObject . immortalRefCount { return }
118
118
o. pointee. refcount -= 1
119
119
if ( o. pointee. refcount & HeapObject . refcountMask) == 0 {
120
- _swift_runtime_invoke_heap_object_destroy ( o . pointee . metadata . pointee . destroy , o)
120
+ _swift_embedded_invoke_heap_object_destroy ( o)
121
121
}
122
122
}
123
123
You can’t perform that action at this time.
0 commit comments