Skip to content

Commit

Permalink
Optimize objc_retainAutoreleasedReturnValue on Aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jun 16, 2023
1 parent be1f1d9 commit cb69e2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/objc2/src/rc/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,14 @@ impl<T: Message> Id<T> {
};

// Supported since macOS 10.10.
#[cfg(target_arch = "aarch64")]
//
// On macOS 13.0 / iOS 16.0 / tvOS 16.0 / watchOS 9.0, the runtime
// instead checks the return pointer address, so we no longer need
// to emit these extra instructions, see this video from WWDC22:
// https://developer.apple.com/videos/play/wwdc2022/110363/
#[cfg(all(target_arch = "aarch64", not(feature = "unstable-apple-new")))]
unsafe {
// Same as `mov x29, x29`
core::arch::asm!("mov fp, fp", options(nomem, preserves_flags, nostack))
};

Expand Down

0 comments on commit cb69e2a

Please sign in to comment.