From 319c98fd777c442474825b1704140c33b86ea0b0 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 22 Jun 2023 19:17:18 +0300 Subject: [PATCH 1/4] Improve monomorphization in objc2::declare --- crates/objc2/src/__macro_helpers/mod.rs | 1 + .../objc2/src/declare/declare_class_tests.rs | 2 +- crates/objc2/src/declare/mod.rs | 209 +++++++++++++----- 3 files changed, 158 insertions(+), 54 deletions(-) diff --git a/crates/objc2/src/__macro_helpers/mod.rs b/crates/objc2/src/__macro_helpers/mod.rs index 48839f679..037a320df 100644 --- a/crates/objc2/src/__macro_helpers/mod.rs +++ b/crates/objc2/src/__macro_helpers/mod.rs @@ -595,6 +595,7 @@ impl ClassProtocolMethodsBuilder<'_, '_> { } } + #[inline] pub fn __finish(self) { #[cfg(all(debug_assertions, feature = "verify"))] if let Some(protocol) = self.protocol { diff --git a/crates/objc2/src/declare/declare_class_tests.rs b/crates/objc2/src/declare/declare_class_tests.rs index 50144e22c..2f4bd2eb6 100644 --- a/crates/objc2/src/declare/declare_class_tests.rs +++ b/crates/objc2/src/declare/declare_class_tests.rs @@ -368,7 +368,7 @@ fn test_unreachable() { } #[test] -#[should_panic = "Failed to add ivar _ivar"] +#[should_panic = "failed to add ivar _ivar"] fn test_duplicate_ivar() { declare_class!( struct DeclareClassDuplicateIvar { diff --git a/crates/objc2/src/declare/mod.rs b/crates/objc2/src/declare/mod.rs index d7ee6bcd4..9e0df3e45 100644 --- a/crates/objc2/src/declare/mod.rs +++ b/crates/objc2/src/declare/mod.rs @@ -305,12 +305,20 @@ fn method_type_encoding(ret: &Encoding, args: &[Encoding]) -> CString { CString::new(types).unwrap() } -fn log2_align_of() -> u8 { - let align = mem::align_of::(); - // Alignments are required to be powers of 2 - debug_assert!(align.count_ones() == 1); - // log2 of a power of 2 is the number of trailing zeros - align.trailing_zeros() as u8 +trait Log2Alignment { + const LOG2_ALIGNMENT: u8; +} + +impl Log2Alignment for T { + const LOG2_ALIGNMENT: u8 = { + let align = mem::align_of::(); + assert!( + align.count_ones() == 1, + "alignment required to be a power of 2" + ); + // log2 of a power of 2 is the number of trailing zeros + align.trailing_zeros() as u8 + }; } /// A type for declaring a new class and adding new methods and ivars to it @@ -419,16 +427,28 @@ impl ClassBuilder { T: Message + ?Sized, F: MethodImplementation, { - let enc_args = F::Args::ENCODINGS; - let enc_ret = F::Ret::ENCODING_RETURN; + unsafe { + self.add_method_inner( + sel, + F::Args::ENCODINGS, + F::Ret::ENCODING_RETURN, + func.__imp(), + ) + } + } + unsafe fn add_method_inner( + &mut self, + sel: Sel, + enc_args: &[Encoding], + enc_ret: Encoding, + func: Imp, + ) { let sel_args = sel.number_of_arguments(); assert_eq!( sel_args, enc_args.len(), - "Selector {} accepts {} arguments, but function accepts {}", - sel, - sel_args, + "selector {sel} accepts {sel_args} arguments, but function accepts {}", enc_args.len(), ); @@ -446,14 +466,9 @@ impl ClassBuilder { let types = method_type_encoding(&enc_ret, enc_args); let success = Bool::from_raw(unsafe { - ffi::class_addMethod( - self.as_mut_ptr(), - sel.as_ptr(), - Some(func.__imp()), - types.as_ptr(), - ) + ffi::class_addMethod(self.as_mut_ptr(), sel.as_ptr(), Some(func), types.as_ptr()) }); - assert!(success.as_bool(), "Failed to add method {sel}"); + assert!(success.as_bool(), "failed to add method {sel}"); } fn metaclass_mut(&mut self) -> *mut ffi::objc_class { @@ -476,16 +491,28 @@ impl ClassBuilder { where F: MethodImplementation, { - let enc_args = F::Args::ENCODINGS; - let enc_ret = F::Ret::ENCODING_RETURN; + unsafe { + self.add_class_method_inner( + sel, + F::Args::ENCODINGS, + F::Ret::ENCODING_RETURN, + func.__imp(), + ) + } + } + unsafe fn add_class_method_inner( + &mut self, + sel: Sel, + enc_args: &[Encoding], + enc_ret: Encoding, + func: Imp, + ) { let sel_args = sel.number_of_arguments(); assert_eq!( sel_args, enc_args.len(), - "Selector {} accepts {} arguments, but function accepts {}", - sel, - sel_args, + "selector {sel} accepts {sel_args} arguments, but function accepts {}", enc_args.len(), ); @@ -506,11 +533,11 @@ impl ClassBuilder { ffi::class_addMethod( self.metaclass_mut(), sel.as_ptr(), - Some(func.__imp()), + Some(func), types.as_ptr(), ) }); - assert!(success.as_bool(), "Failed to add class method {sel}"); + assert!(success.as_bool(), "failed to add class method {sel}"); } /// Adds an ivar with type `T` and the provided name. @@ -525,7 +552,14 @@ impl ClassBuilder { unsafe { self.add_ivar_inner::(name, &T::ENCODING) } } - unsafe fn add_ivar_inner(&mut self, name: &str, encoding: &Encoding) { + // Monomorphized version + unsafe fn add_ivar_inner_mono( + &mut self, + name: &str, + size: usize, + align: u8, + encoding: &Encoding, + ) { // `class_addIvar` sadly doesn't check this for us. // // We must _always_ do the check, since there is no way for the user @@ -541,8 +575,6 @@ impl ClassBuilder { let c_name = CString::new(name).unwrap(); let encoding = CString::new(encoding.to_string()).unwrap(); - let size = mem::size_of::(); - let align = log2_align_of::(); let success = Bool::from_raw(unsafe { ffi::class_addIvar( self.as_mut_ptr(), @@ -552,7 +584,11 @@ impl ClassBuilder { encoding.as_ptr(), ) }); - assert!(success.as_bool(), "Failed to add ivar {name}"); + assert!(success.as_bool(), "failed to add ivar {name}"); + } + + unsafe fn add_ivar_inner(&mut self, name: &str, encoding: &Encoding) { + unsafe { self.add_ivar_inner_mono(name, mem::size_of::(), T::LOG2_ALIGNMENT, encoding) } } /// Adds an instance variable from an [`IvarType`]. @@ -574,7 +610,7 @@ impl ClassBuilder { pub fn add_protocol(&mut self, proto: &AnyProtocol) { let success = unsafe { ffi::class_addProtocol(self.as_mut_ptr(), proto.as_ptr()) }; let success = Bool::from_raw(success).as_bool(); - assert!(success, "Failed to add protocol {proto}"); + assert!(success, "failed to add protocol {proto}"); } // fn add_property(&self, name: &str, attributes: &[ffi::objc_property_attribute_t]); @@ -635,53 +671,61 @@ impl ProtocolBuilder { NonNull::new(proto.cast()).map(|proto| Self { proto }) } - fn add_method_description_common( + fn add_method_description_inner( &mut self, sel: Sel, - is_required: bool, - is_instance_method: bool, - ) where - Args: EncodeArguments, - Ret: EncodeReturn, - { - let encs = Args::ENCODINGS; + enc_args: &[Encoding], + enc_ret: Encoding, + required: bool, + instance_method: bool, + ) { let sel_args = sel.number_of_arguments(); assert_eq!( sel_args, - encs.len(), - "Selector {} accepts {} arguments, but function accepts {}", - sel, - sel_args, - encs.len(), + enc_args.len(), + "selector {sel} accepts {sel_args} arguments, but function accepts {}", + enc_args.len(), ); - let types = method_type_encoding(&Ret::ENCODING_RETURN, encs); + let types = method_type_encoding(&enc_ret, enc_args); unsafe { ffi::protocol_addMethodDescription( self.as_mut_ptr(), sel.as_ptr(), types.as_ptr(), - Bool::new(is_required).as_raw(), - Bool::new(is_instance_method).as_raw(), + Bool::new(required).as_raw(), + Bool::new(instance_method).as_raw(), ); } } /// Adds an instance method declaration with a given description. - pub fn add_method_description(&mut self, sel: Sel, is_required: bool) + pub fn add_method_description(&mut self, sel: Sel, required: bool) where Args: EncodeArguments, Ret: EncodeReturn, { - self.add_method_description_common::(sel, is_required, true) + self.add_method_description_inner( + sel, + Args::ENCODINGS, + Ret::ENCODING_RETURN, + required, + true, + ) } /// Adds a class method declaration with a given description. - pub fn add_class_method_description(&mut self, sel: Sel, is_required: bool) + pub fn add_class_method_description(&mut self, sel: Sel, required: bool) where Args: EncodeArguments, Ret: EncodeReturn, { - self.add_method_description_common::(sel, is_required, false) + self.add_method_description_inner( + sel, + Args::ENCODINGS, + Ret::ENCODING_RETURN, + required, + false, + ) } /// Adds a requirement on another protocol. @@ -710,6 +754,48 @@ mod tests { use crate::test_utils; use crate::{declare_class, msg_send, ClassType, ProtocolType}; + #[test] + fn test_alignment() { + assert_eq!(<()>::LOG2_ALIGNMENT, 0); + + assert_eq!(u8::LOG2_ALIGNMENT, 0); + assert_eq!(u16::LOG2_ALIGNMENT, 1); + assert_eq!(u32::LOG2_ALIGNMENT, 2); + + assert_eq!( + u64::LOG2_ALIGNMENT, + if cfg!(target_pointer_width = "64") { + 3 + } else { + 2 + } + ); + + #[repr(align(16))] + struct Align16; + assert_eq!(Align16::LOG2_ALIGNMENT, 4); + + #[repr(align(32))] + struct Align32; + assert_eq!(Align32::LOG2_ALIGNMENT, 5); + + #[repr(align(64))] + struct Align64; + assert_eq!(Align64::LOG2_ALIGNMENT, 6); + + #[repr(align(128))] + struct Align128; + assert_eq!(Align128::LOG2_ALIGNMENT, 7); + + #[repr(align(256))] + struct Align256; + assert_eq!(Align256::LOG2_ALIGNMENT, 8); + + #[repr(align(536870912))] + struct Align536870912; + assert_eq!(Align536870912::LOG2_ALIGNMENT, 29); + } + #[test] fn test_classbuilder_duplicate() { let cls = test_utils::custom_class(); @@ -720,7 +806,7 @@ mod tests { } #[test] - #[should_panic = "Failed to add ivar xyz"] + #[should_panic = "failed to add ivar xyz"] fn duplicate_ivar() { let cls = test_utils::custom_class(); let mut builder = ClassBuilder::new("TestClassBuilderDuplicateIvar", cls).unwrap(); @@ -731,7 +817,7 @@ mod tests { } #[test] - #[should_panic = "Failed to add method xyz"] + #[should_panic = "failed to add method xyz"] fn duplicate_method() { let cls = test_utils::custom_class(); let mut builder = ClassBuilder::new("TestClassBuilderDuplicateMethod", cls).unwrap(); @@ -745,6 +831,23 @@ mod tests { } } + #[test] + #[cfg_attr( + debug_assertions, + should_panic = "selector xyz: accepts 1 arguments, but function accepts 0" + )] + fn wrong_arguments() { + let cls = test_utils::custom_class(); + let mut builder = ClassBuilder::new("TestClassBuilderWrongArguments", cls).unwrap(); + + extern "C" fn xyz(_this: &NSObject, _cmd: Sel) {} + + unsafe { + // Should panic: + builder.add_method(sel!(xyz:), xyz as extern "C" fn(_, _)); + } + } + #[test] #[cfg_attr( debug_assertions, @@ -782,7 +885,7 @@ mod tests { } #[test] - #[should_panic = "Failed to add protocol NSObject"] + #[should_panic = "failed to add protocol NSObject"] fn duplicate_protocol() { let cls = test_utils::custom_class(); let mut builder = ClassBuilder::new("TestClassBuilderDuplicateProtocol", cls).unwrap(); From eaa6ef3b03bedd97de59e0da82e3c6ad02c21ed9 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 23 Jun 2023 16:24:20 +0300 Subject: [PATCH 2/4] Add assembly test for `declare_class!` --- Cargo.lock | 7 + .../crates/test_declare_class/Cargo.toml | 25 + .../expected/apple-aarch64.s | 983 ++++++++++++++++++ .../test_declare_class/expected/apple-armv7.s | 928 +++++++++++++++++ .../expected/apple-armv7s.s | 931 +++++++++++++++++ .../expected/apple-old-x86.s | 958 +++++++++++++++++ .../test_declare_class/expected/apple-x86.s | 958 +++++++++++++++++ .../expected/apple-x86_64.s | 768 ++++++++++++++ .../test_declare_class/expected/gnustep-x86.s | 3 + .../expected/gnustep-x86_64.s | 3 + .../crates/test_declare_class/lib.rs | 114 ++ crates/test-assembly/src/lib.rs | 3 + 12 files changed, 5681 insertions(+) create mode 100644 crates/test-assembly/crates/test_declare_class/Cargo.toml create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-x86.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/gnustep-x86.s create mode 100644 crates/test-assembly/crates/test_declare_class/expected/gnustep-x86_64.s create mode 100644 crates/test-assembly/crates/test_declare_class/lib.rs diff --git a/Cargo.lock b/Cargo.lock index a157358cc..d20f44cc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -486,6 +486,13 @@ dependencies = [ "objc2", ] +[[package]] +name = "test_declare_class" +version = "0.1.0" +dependencies = [ + "objc2", +] + [[package]] name = "test_extern_protocol" version = "0.1.0" diff --git a/crates/test-assembly/crates/test_declare_class/Cargo.toml b/crates/test-assembly/crates/test_declare_class/Cargo.toml new file mode 100644 index 000000000..698ab594c --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "test_declare_class" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +path = "lib.rs" + +[dependencies] +objc2 = { path = "../../../objc2", default-features = false, optional = true } + +[features] +default = ["apple", "std"] +std = ["objc2?/std"] +# Runtime +apple = ["objc2", "objc2?/apple"] +gnustep-1-7 = ["objc2?/gnustep-1-7"] +gnustep-1-8 = ["gnustep-1-7", "objc2?/gnustep-1-8"] +gnustep-1-9 = ["gnustep-1-8", "objc2?/gnustep-1-9"] +gnustep-2-0 = ["gnustep-1-9", "objc2?/gnustep-2-0"] +gnustep-2-1 = ["gnustep-2-0", "objc2?/gnustep-2-1"] + +# Hack to prevent the feature flag from being enabled in the entire project +assembly-features = ["objc2?/unstable-static-sel-inlined", "objc2?/unstable-static-class"] diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s new file mode 100644 index 000000000..27aa8c181 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s @@ -0,0 +1,983 @@ + .section __TEXT,__text,regular,pure_instructions + .p2align 2 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + ret + + .p2align 2 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + sub sp, sp, #112 + stp x22, x21, [sp, #64] + stp x20, x19, [sp, #80] + stp x29, x30, [sp, #96] + add x29, sp, #96 + ldr x8, [x0] + ldrb w9, [x8] + strb wzr, [x8] + cbz w9, LBB1_3 + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov x2, x0 +Lloh0: + adrp x0, l_anon.[ID].11@PAGE +Lloh1: + add x0, x0, l_anon.[ID].11@PAGEOFF + mov w1, #15 + bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + cbz x0, LBB1_4 + str x0, [sp] +Lloh2: + adrp x1, l_anon.[ID].5@PAGE +Lloh3: + add x1, x1, l_anon.[ID].5@PAGEOFF +Lloh4: + adrp x5, l_anon.[ID].6@PAGE +Lloh5: + add x5, x5, l_anon.[ID].6@PAGEOFF + mov x0, sp + mov w2, #4 + mov w3, #1 + mov w4, #0 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) +Lloh6: + adrp x1, l_anon.[ID].7@PAGE +Lloh7: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh8: + adrp x19, l_anon.[ID].8@PAGE +Lloh9: + add x19, x19, l_anon.[ID].8@PAGEOFF + mov x0, sp + mov w2, #4 + mov w3, #8 + mov w4, #3 + mov x5, x19 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) +Lloh10: + adrp x8, L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869@PAGE +Lloh11: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869@PAGEOFF] +Lloh12: + adrp x20, l_anon.[ID].1@PAGE +Lloh13: + add x20, x20, l_anon.[ID].1@PAGEOFF +Lloh14: + adrp x21, l_anon.[ID].12@PAGE +Lloh15: + add x21, x21, l_anon.[ID].12@PAGEOFF +Lloh16: + adrp x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGE +Lloh17: + add x5, x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGEOFF + mov x0, sp + mov x2, x20 + mov x3, #0 + mov x4, x21 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh18: + adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE +Lloh19: + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] +Lloh20: + ldr x1, [x8] +Lloh21: + adrp x5, _init@PAGE +Lloh22: + add x5, x5, _init@PAGEOFF + mov x0, sp + mov x2, x20 + mov x3, #0 + mov x4, x19 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh23: + adrp x8, L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc@PAGE +Lloh24: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc@PAGEOFF] +Lloh25: + adrp x5, _class_method@PAGE +Lloh26: + add x5, x5, _class_method@PAGEOFF + mov x0, sp + mov x2, x20 + mov x3, #0 + mov x4, x21 + bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) +Lloh27: + adrp x8, L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5@PAGE +Lloh28: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5@PAGEOFF] +Lloh29: + adrp x5, _method@PAGE +Lloh30: + add x5, x5, _method@PAGEOFF + mov x0, sp + mov x2, x20 + mov x3, #0 + mov x4, x21 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh31: + adrp x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGE +Lloh32: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGEOFF] +Lloh33: + adrp x21, l_anon.[ID].13@PAGE +Lloh34: + add x21, x21, l_anon.[ID].13@PAGEOFF +Lloh35: + adrp x5, _method_bool@PAGE +Lloh36: + add x5, x5, _method_bool@PAGEOFF + mov x0, sp + mov x2, x21 + mov w3, #1 + mov x4, x21 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh37: + adrp x8, L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498@PAGE +Lloh38: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498@PAGEOFF] +Lloh39: + adrp x5, _method_id@PAGE +Lloh40: + add x5, x5, _method_id@PAGEOFF + mov x0, sp + mov x2, x20 + mov x3, #0 + mov x4, x19 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh41: + adrp x8, L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8@PAGE +Lloh42: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8@PAGEOFF] +Lloh43: + adrp x5, _method_id_with_param@PAGE +Lloh44: + add x5, x5, _method_id_with_param@PAGEOFF + mov x0, sp + mov x2, x21 + mov w3, #1 + mov x4, x19 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) +Lloh45: + adrp x0, l_anon.[ID].14@PAGE +Lloh46: + add x0, x0, l_anon.[ID].14@PAGEOFF + mov w1, #9 + bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + mov x1, x0 + mov x0, sp + bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) +Lloh47: + adrp x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGE +Lloh48: + ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGEOFF] +Lloh49: + adrp x2, l_anon.[ID].17@PAGE +Lloh50: + add x2, x2, l_anon.[ID].17@PAGEOFF +Lloh51: + adrp x5, _copy_with_zone@PAGE +Lloh52: + add x5, x5, _copy_with_zone@PAGEOFF + mov w3, #1 + mov x4, x19 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + ldr x0, [sp] + bl SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + ldp x29, x30, [sp, #96] + ldp x20, x19, [sp, #80] + ldp x22, x21, [sp, #64] + add sp, sp, #112 + ret +LBB1_3: +Lloh53: + adrp x0, l_anon.[ID].2@PAGE +Lloh54: + add x0, x0, l_anon.[ID].2@PAGEOFF +Lloh55: + adrp x2, l_anon.[ID].4@PAGE +Lloh56: + add x2, x2, l_anon.[ID].4@PAGEOFF + mov w1, #43 + bl SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: +Lloh57: + adrp x8, l_anon.[ID].21@PAGE +Lloh58: + add x8, x8, l_anon.[ID].21@PAGEOFF +Lloh59: + adrp x9, SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)@PAGE +Lloh60: + add x9, x9, SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)@PAGEOFF + stp x8, x9, [sp, #48] +Lloh61: + adrp x8, l_anon.[ID].20@PAGE +Lloh62: + add x8, x8, l_anon.[ID].20@PAGEOFF + mov w9, #2 + stp x8, x9, [sp] + add x8, sp, #48 + mov w9, #1 + str x8, [sp, #16] + stp x9, xzr, [sp, #24] +Lloh63: + adrp x1, l_anon.[ID].10@PAGE +Lloh64: + add x1, x1, l_anon.[ID].10@PAGEOFF + mov x0, sp + bl SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + .loh AdrpAdd Lloh0, Lloh1 + .loh AdrpAdd Lloh51, Lloh52 + .loh AdrpAdd Lloh49, Lloh50 + .loh AdrpLdr Lloh47, Lloh48 + .loh AdrpAdd Lloh45, Lloh46 + .loh AdrpAdd Lloh43, Lloh44 + .loh AdrpLdr Lloh41, Lloh42 + .loh AdrpAdd Lloh39, Lloh40 + .loh AdrpLdr Lloh37, Lloh38 + .loh AdrpAdd Lloh35, Lloh36 + .loh AdrpAdd Lloh33, Lloh34 + .loh AdrpLdr Lloh31, Lloh32 + .loh AdrpAdd Lloh29, Lloh30 + .loh AdrpLdr Lloh27, Lloh28 + .loh AdrpAdd Lloh25, Lloh26 + .loh AdrpLdr Lloh23, Lloh24 + .loh AdrpAdd Lloh21, Lloh22 + .loh AdrpLdrGotLdr Lloh18, Lloh19, Lloh20 + .loh AdrpAdd Lloh16, Lloh17 + .loh AdrpAdd Lloh14, Lloh15 + .loh AdrpAdd Lloh12, Lloh13 + .loh AdrpLdr Lloh10, Lloh11 + .loh AdrpAdd Lloh8, Lloh9 + .loh AdrpAdd Lloh6, Lloh7 + .loh AdrpAdd Lloh4, Lloh5 + .loh AdrpAdd Lloh2, Lloh3 + .loh AdrpAdd Lloh55, Lloh56 + .loh AdrpAdd Lloh53, Lloh54 + .loh AdrpAdd Lloh63, Lloh64 + .loh AdrpAdd Lloh61, Lloh62 + .loh AdrpAdd Lloh59, Lloh60 + .loh AdrpAdd Lloh57, Lloh58 + + .p2align 2 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + sub sp, sp, #32 + stp x29, x30, [sp, #16] + add x29, sp, #16 + ldr x8, [x0] + str x8, [sp, #8] + add x0, sp, #8 + bl SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + ldp x29, x30, [sp, #16] + add sp, sp, #32 + ret + + .p2align 2 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + mov x2, x1 + ldp x8, x1, [x0] + mov x0, x8 + b SYM(::fmt::GENERATED_ID, 0) + + .globl _get_class + .p2align 2 +_get_class: + sub sp, sp, #32 + stp x29, x30, [sp, #16] + add x29, sp, #16 +Lloh65: + adrp x8, SYM(::class::REGISTER_CLASS, 0)@PAGE +Lloh66: + add x8, x8, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF + ldapr x8, [x8] + cmp x8, #3 + b.ne LBB4_3 +Lloh67: + adrp x0, l_anon.[ID].11@PAGE +Lloh68: + add x0, x0, l_anon.[ID].11@PAGEOFF + mov w1, #15 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cbz x0, LBB4_4 +LBB4_2: + ldp x29, x30, [sp, #16] + add sp, sp, #32 + ret +LBB4_3: + mov w8, #1 + strb w8, [sp, #7] + add x8, sp, #7 + str x8, [sp, #8] +Lloh69: + adrp x0, SYM(::class::REGISTER_CLASS, 0)@PAGE +Lloh70: + add x0, x0, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF +Lloh71: + adrp x3, l_anon.[ID].0@PAGE +Lloh72: + add x3, x3, l_anon.[ID].0@PAGEOFF +Lloh73: + adrp x4, l_anon.[ID].10@PAGE +Lloh74: + add x4, x4, l_anon.[ID].10@PAGEOFF + add x2, sp, #8 + mov w1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) +Lloh75: + adrp x0, l_anon.[ID].11@PAGE +Lloh76: + add x0, x0, l_anon.[ID].11@PAGEOFF + mov w1, #15 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cbnz x0, LBB4_2 +LBB4_4: +Lloh77: + adrp x0, l_anon.[ID].2@PAGE +Lloh78: + add x0, x0, l_anon.[ID].2@PAGEOFF +Lloh79: + adrp x2, l_anon.[ID].10@PAGE +Lloh80: + add x2, x2, l_anon.[ID].10@PAGEOFF + mov w1, #43 + bl SYM(core::panicking::panic::GENERATED_ID, 0) + .loh AdrpAdd Lloh65, Lloh66 + .loh AdrpAdd Lloh67, Lloh68 + .loh AdrpAdd Lloh75, Lloh76 + .loh AdrpAdd Lloh73, Lloh74 + .loh AdrpAdd Lloh71, Lloh72 + .loh AdrpAdd Lloh69, Lloh70 + .loh AdrpAdd Lloh79, Lloh80 + .loh AdrpAdd Lloh77, Lloh78 + + .globl _get_obj + .p2align 2 +_get_obj: + stp x20, x19, [sp, #-32]! + stp x29, x30, [sp, #16] + add x29, sp, #16 +Lloh81: + adrp x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGE +Lloh82: + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGEOFF] +Lloh83: + ldr x19, [x8] + bl _get_class + mov x1, x19 + ldp x29, x30, [sp, #16] + ldp x20, x19, [sp], #32 + b _objc_msgSend + .loh AdrpLdrGotLdr Lloh81, Lloh82, Lloh83 + + .globl _access_ivars + .p2align 2 +_access_ivars: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + bl _get_obj + mov x19, x0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh84: + adrp x1, l_anon.[ID].5@PAGE +Lloh85: + add x1, x1, l_anon.[ID].5@PAGEOFF +Lloh86: + adrp x3, l_anon.[ID].6@PAGE +Lloh87: + add x3, x3, l_anon.[ID].6@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb w20, [x19, x0] + mov x0, x19 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh88: + adrp x1, l_anon.[ID].7@PAGE +Lloh89: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh90: + adrp x3, l_anon.[ID].8@PAGE +Lloh91: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr x21, [x19, x0] + mov x0, x19 + bl _objc_release + mov x0, x20 + mov x1, x21 + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpAdd Lloh90, Lloh91 + .loh AdrpAdd Lloh88, Lloh89 + .loh AdrpAdd Lloh86, Lloh87 + .loh AdrpAdd Lloh84, Lloh85 + + .globl SYM(::class, 0) + .p2align 2 +SYM(::class, 0): + sub sp, sp, #32 + stp x29, x30, [sp, #16] + add x29, sp, #16 +Lloh92: + adrp x8, SYM(::class::REGISTER_CLASS, 0)@PAGE +Lloh93: + add x8, x8, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF + ldapr x8, [x8] + cmp x8, #3 + b.ne LBB7_3 +Lloh94: + adrp x0, l_anon.[ID].11@PAGE +Lloh95: + add x0, x0, l_anon.[ID].11@PAGEOFF + mov w1, #15 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cbz x0, LBB7_4 +LBB7_2: + ldp x29, x30, [sp, #16] + add sp, sp, #32 + ret +LBB7_3: + mov w8, #1 + strb w8, [sp, #7] + add x8, sp, #7 + str x8, [sp, #8] +Lloh96: + adrp x0, SYM(::class::REGISTER_CLASS, 0)@PAGE +Lloh97: + add x0, x0, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF +Lloh98: + adrp x3, l_anon.[ID].0@PAGE +Lloh99: + add x3, x3, l_anon.[ID].0@PAGEOFF +Lloh100: + adrp x4, l_anon.[ID].10@PAGE +Lloh101: + add x4, x4, l_anon.[ID].10@PAGEOFF + add x2, sp, #8 + mov w1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) +Lloh102: + adrp x0, l_anon.[ID].11@PAGE +Lloh103: + add x0, x0, l_anon.[ID].11@PAGEOFF + mov w1, #15 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cbnz x0, LBB7_2 +LBB7_4: +Lloh104: + adrp x0, l_anon.[ID].2@PAGE +Lloh105: + add x0, x0, l_anon.[ID].2@PAGEOFF +Lloh106: + adrp x2, l_anon.[ID].10@PAGE +Lloh107: + add x2, x2, l_anon.[ID].10@PAGEOFF + mov w1, #43 + bl SYM(core::panicking::panic::GENERATED_ID, 0) + .loh AdrpAdd Lloh92, Lloh93 + .loh AdrpAdd Lloh94, Lloh95 + .loh AdrpAdd Lloh102, Lloh103 + .loh AdrpAdd Lloh100, Lloh101 + .loh AdrpAdd Lloh98, Lloh99 + .loh AdrpAdd Lloh96, Lloh97 + .loh AdrpAdd Lloh106, Lloh107 + .loh AdrpAdd Lloh104, Lloh105 + + .p2align 2 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + sub sp, sp, #48 + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x1 + mov x20, x0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh108: + adrp x1, l_anon.[ID].7@PAGE +Lloh109: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh110: + adrp x3, l_anon.[ID].8@PAGE +Lloh111: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr x0, [x20, x0] + cbz x0, LBB8_2 + bl _objc_release +LBB8_2: + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + stp x20, x0, [sp] + mov x0, sp + mov x1, x19 + bl _objc_msgSendSuper + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + add sp, sp, #48 + ret + .loh AdrpAdd Lloh110, Lloh111 + .loh AdrpAdd Lloh108, Lloh109 + + .globl _init + .p2align 2 +_init: + sub sp, sp, #48 + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x0 +Lloh112: + adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE +Lloh113: + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] +Lloh114: + ldr x20, [x8] + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + stp x19, x0, [sp] + mov x0, sp + mov x1, x20 + bl _objc_msgSendSuper + mov x19, x0 + cbz x0, LBB9_2 + mov x0, x19 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh115: + adrp x1, l_anon.[ID].5@PAGE +Lloh116: + add x1, x1, l_anon.[ID].5@PAGEOFF +Lloh117: + adrp x3, l_anon.[ID].6@PAGE +Lloh118: + add x3, x3, l_anon.[ID].6@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov w8, #42 + strb w8, [x19, x0] + mov x0, x19 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh119: + adrp x1, l_anon.[ID].7@PAGE +Lloh120: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh121: + adrp x3, l_anon.[ID].8@PAGE +Lloh122: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + str xzr, [x19, x0] +LBB9_2: + mov x0, x19 + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + add sp, sp, #48 + ret + .loh AdrpLdrGotLdr Lloh112, Lloh113, Lloh114 + .loh AdrpAdd Lloh121, Lloh122 + .loh AdrpAdd Lloh119, Lloh120 + .loh AdrpAdd Lloh117, Lloh118 + .loh AdrpAdd Lloh115, Lloh116 + + .globl _class_method + .p2align 2 +_class_method: + ret + + .globl _method + .p2align 2 +_method: + ret + + .globl _method_bool + .p2align 2 +_method_bool: + eor w0, w2, #0x1 + ret + + .globl _method_id + .p2align 2 +_method_id: + stp x20, x19, [sp, #-32]! + stp x29, x30, [sp, #16] + add x29, sp, #16 + mov x19, x0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh123: + adrp x1, l_anon.[ID].7@PAGE +Lloh124: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh125: + adrp x3, l_anon.[ID].8@PAGE +Lloh126: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr x0, [x19, x0] + cbz x0, LBB13_2 + bl _objc_retain +LBB13_2: + ldp x29, x30, [sp, #16] + ldp x20, x19, [sp], #32 + b _objc_autoreleaseReturnValue + .loh AdrpAdd Lloh125, Lloh126 + .loh AdrpAdd Lloh123, Lloh124 + + .globl _method_id_with_param + .p2align 2 +_method_id_with_param: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x21, x2 + mov x20, x0 + bl SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov x19, x0 + cbz w21, LBB14_5 + mov x0, x20 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh127: + adrp x1, l_anon.[ID].7@PAGE +Lloh128: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh129: + adrp x3, l_anon.[ID].8@PAGE +Lloh130: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr x0, [x20, x0] + cbz x0, LBB14_3 + bl _objc_retain + mov x20, x0 + b LBB14_4 +LBB14_3: + mov x20, #0 +LBB14_4: + mov x0, x19 + bl _objc_release + mov x19, x20 +LBB14_5: + mov x0, x19 + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + b _objc_autoreleaseReturnValue + .loh AdrpAdd Lloh129, Lloh130 + .loh AdrpAdd Lloh127, Lloh128 + + .globl _copy_with_zone + .p2align 2 +_copy_with_zone: + stp x24, x23, [sp, #-64]! + stp x22, x21, [sp, #16] + stp x20, x19, [sp, #32] + stp x29, x30, [sp, #48] + add x29, sp, #48 + mov x20, x0 + bl _get_obj + mov x19, x0 + cbz x0, LBB15_5 + mov x0, x20 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh131: + adrp x21, l_anon.[ID].5@PAGE +Lloh132: + add x21, x21, l_anon.[ID].5@PAGEOFF +Lloh133: + adrp x22, l_anon.[ID].6@PAGE +Lloh134: + add x22, x22, l_anon.[ID].6@PAGEOFF + mov x1, x21 + mov w2, #4 + mov x3, x22 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb w23, [x20, x0] + mov x0, x19 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + mov x1, x21 + mov w2, #4 + mov x3, x22 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + strb w23, [x19, x0] + mov x0, x20 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh135: + adrp x1, l_anon.[ID].7@PAGE +Lloh136: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh137: + adrp x3, l_anon.[ID].8@PAGE +Lloh138: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr x0, [x20, x0] + cbz x0, LBB15_3 + bl _objc_retain + mov x20, x0 + b LBB15_4 +LBB15_3: + mov x20, #0 +LBB15_4: + mov x0, x19 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) +Lloh139: + adrp x1, l_anon.[ID].7@PAGE +Lloh140: + add x1, x1, l_anon.[ID].7@PAGEOFF +Lloh141: + adrp x3, l_anon.[ID].8@PAGE +Lloh142: + add x3, x3, l_anon.[ID].8@PAGEOFF + mov w2, #4 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + str x20, [x19, x0] +LBB15_5: + mov x0, x19 + ldp x29, x30, [sp, #48] + ldp x20, x19, [sp, #32] + ldp x22, x21, [sp, #16] + ldp x24, x23, [sp], #64 + ret + .loh AdrpAdd Lloh137, Lloh138 + .loh AdrpAdd Lloh135, Lloh136 + .loh AdrpAdd Lloh133, Lloh134 + .loh AdrpAdd Lloh131, Lloh132 + .loh AdrpAdd Lloh141, Lloh142 + .loh AdrpAdd Lloh139, Lloh140 + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].0: + .quad SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\b\000\000\000\000\000\000\000\b\000\000\000\000\000\000" + .quad SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .quad SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "/Users/madsmarquart/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].4: + .quad l_anon.[ID].3 + .asciz "t\000\000\000\000\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +l_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].6: + .byte 5 + .space 39 + + .section __TEXT,__literal4,4byte_literals +l_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].8: + .byte 19 + .space 39 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].10: + .quad l_anon.[ID].9 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 + .p2align 3, 0x0 +l_anon.[ID].12: + .byte 17 + .space 39 + + .p2align 3, 0x0 +l_anon.[ID].13: + .byte 16 + .space 39 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].16: + .byte 28 + .space 7 + .quad l_anon.[ID].15 + .asciz "\007\000\000\000\000\000\000" + .quad l_anon.[ID].1 + .space 8 + + .p2align 3, 0x0 +l_anon.[ID].17: + .byte 25 + .space 7 + .quad l_anon.[ID].16 + .space 24 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].20: + .quad l_anon.[ID].18 + .asciz "\033\000\000\000\000\000\000" + .quad l_anon.[ID].19 + .asciz "0\000\000\000\000\000\000" + + .p2align 3, 0x0 +l_anon.[ID].21: + .quad l_anon.[ID].11 + .asciz "\017\000\000\000\000\000\000" + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .quad L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .quad L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .quad L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .quad L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .quad L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .quad L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .quad L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s new file mode 100644 index 000000000..1fb21a3d2 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s @@ -0,0 +1,928 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .p2align 2 + .code 32 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + bx lr + + .p2align 2 + .code 32 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8, r10, r11} + sub sp, sp, #40 + ldr r0, [r0] + mov r2, #0 + ldrb r1, [r0] + strb r2, [r0] + cmp r1, #0 + beq LBB1_3 + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov r2, r0 + movw r0, :lower16:(l_anon.[ID].11-(LPC1_0+8)) + movt r0, :upper16:(l_anon.[ID].11-(LPC1_0+8)) + mov r1, #15 +LPC1_0: + add r0, pc, r0 + bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + cmp r0, #0 + beq LBB1_4 + movw r1, :lower16:(L_anon.[ID].5-(LPC1_1+8)) + add r4, sp, #8 + movt r1, :upper16:(L_anon.[ID].5-(LPC1_1+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC1_2+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC1_2+8)) +LPC1_1: + add r1, pc, r1 +LPC1_2: + add r3, pc, r3 + mov r2, #0 + str r0, [sp, #8] + mov r0, r4 + strd r2, r3, [sp] + mov r2, #4 + mov r3, #1 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + movw r8, :lower16:(l_anon.[ID].8-(LPC1_3+8)) + mov r0, #2 + movt r8, :upper16:(l_anon.[ID].8-(LPC1_3+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC1_4+8)) + movt r1, :upper16:(L_anon.[ID].7-(LPC1_4+8)) +LPC1_3: + add r8, pc, r8 +LPC1_4: + add r1, pc, r1 + stm sp, {r0, r8} + mov r0, r4 + mov r2, #4 + mov r3, #4 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + movw r10, :lower16:(l_anon.[ID].12-(LPC1_5+8)) + mov r0, r4 + movt r10, :upper16:(l_anon.[ID].12-(LPC1_5+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) + mov r3, #0 +LPC1_6: + ldr r1, [pc, r1] + movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) + movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) + movw r5, :lower16:(l_anon.[ID].1-(LPC1_8+8)) + movt r5, :upper16:(l_anon.[ID].1-(LPC1_8+8)) +LPC1_7: + add r11, pc, r11 +LPC1_8: + add r5, pc, r5 +LPC1_5: + add r10, pc, r10 + strd r10, r11, [sp] + mov r2, r5 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + mov r2, r5 + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + mov r3, #0 +LPC1_9: + ldr r0, [pc, r0] + ldr r1, [r0] + movw r9, :lower16:(_init-(LPC1_10+8)) + movt r9, :upper16:(_init-(LPC1_10+8)) + mov r0, r4 +LPC1_10: + add r9, pc, r9 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_11+8)) + mov r0, r4 + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_11+8)) + mov r2, r5 +LPC1_11: + ldr r1, [pc, r1] + movw r11, :lower16:(_class_method-(LPC1_12+8)) + movt r11, :upper16:(_class_method-(LPC1_12+8)) + mov r3, #0 +LPC1_12: + add r11, pc, r11 + strd r10, r11, [sp] + bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_13+8)) + mov r0, r4 + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_13+8)) + mov r2, r5 +LPC1_13: + ldr r1, [pc, r1] + movw r11, :lower16:(_method-(LPC1_14+8)) + movt r11, :upper16:(_method-(LPC1_14+8)) + mov r3, #0 +LPC1_14: + add r11, pc, r11 + strd r10, r11, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_15+8)) + mov r0, r4 + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_15+8)) +LPC1_15: + ldr r1, [pc, r1] + movw r3, :lower16:(_method_bool-(LPC1_16+8)) + movt r3, :upper16:(_method_bool-(LPC1_16+8)) + movw r10, :lower16:(l_anon.[ID].13-(LPC1_17+8)) + movt r10, :upper16:(l_anon.[ID].13-(LPC1_17+8)) +LPC1_16: + add r3, pc, r3 +LPC1_17: + add r10, pc, r10 + str r10, [sp] + str r3, [sp, #4] + mov r3, #1 + mov r2, r10 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_18+8)) + mov r0, r4 + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_18+8)) + mov r2, r5 +LPC1_18: + ldr r1, [pc, r1] + movw r9, :lower16:(_method_id-(LPC1_19+8)) + movt r9, :upper16:(_method_id-(LPC1_19+8)) + mov r3, #0 +LPC1_19: + add r9, pc, r9 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_20+8)) + mov r0, r4 + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_20+8)) + mov r2, r10 +LPC1_20: + ldr r1, [pc, r1] + movw r9, :lower16:(_method_id_with_param-(LPC1_21+8)) + movt r9, :upper16:(_method_id_with_param-(LPC1_21+8)) + mov r3, #1 +LPC1_21: + add r9, pc, r9 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r0, :lower16:(l_anon.[ID].14-(LPC1_22+8)) + mov r1, #9 + movt r0, :upper16:(l_anon.[ID].14-(LPC1_22+8)) +LPC1_22: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + mov r1, r0 + mov r0, r4 + bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) + movw r2, :lower16:(l_anon.[ID].17-(LPC1_23+8)) + mov r3, #1 + movt r2, :upper16:(l_anon.[ID].17-(LPC1_23+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) +LPC1_23: + add r2, pc, r2 +LPC1_24: + ldr r1, [pc, r1] + movw r9, :lower16:(_copy_with_zone-(LPC1_25+8)) + movt r9, :upper16:(_copy_with_zone-(LPC1_25+8)) +LPC1_25: + add r9, pc, r9 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + ldr r0, [sp, #8] + bl SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + sub sp, r7, #20 + pop {r8, r10, r11} + pop {r4, r5, r7, pc} +LBB1_3: + movw r0, :lower16:(l_anon.[ID].2-(LPC1_26+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC1_26+8)) + movw r2, :lower16:(l_anon.[ID].4-(LPC1_27+8)) + movt r2, :upper16:(l_anon.[ID].4-(LPC1_27+8)) +LPC1_26: + add r0, pc, r0 +LPC1_27: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: + movw r0, :lower16:(l_anon.[ID].20-(LPC1_28+8)) + mov r5, #0 + movt r0, :upper16:(l_anon.[ID].20-(LPC1_28+8)) + movw r2, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_29+8)) + movt r2, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_29+8)) + movw r3, :lower16:(l_anon.[ID].21-(LPC1_30+8)) + movt r3, :upper16:(l_anon.[ID].21-(LPC1_30+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC1_31+8)) +LPC1_28: + add r0, pc, r0 + movt r1, :upper16:(l_anon.[ID].10-(LPC1_31+8)) + str r0, [sp, #8] + mov r0, #1 + str r0, [sp, #20] + sub r0, r7, #28 + str r0, [sp, #16] +LPC1_31: + add r1, pc, r1 + add r0, sp, #8 + str r5, [sp, #24] + mov r5, #2 +LPC1_29: + add r2, pc, r2 +LPC1_30: + add r3, pc, r3 + str r5, [sp, #12] + str r2, [r7, #-24] + str r3, [r7, #-28] + mov lr, pc + b SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + + .p2align 2 + .code 32 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + push {r7, lr} + mov r7, sp + sub sp, sp, #4 + ldr r0, [r0] + str r0, [sp] + mov r0, sp + bl SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + mov sp, r7 + pop {r7, pc} + + .p2align 2 + .code 32 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + mov r2, r1 + ldrd r0, r1, [r0] + b SYM(::fmt::GENERATED_ID, 0) + + .globl _get_class + .p2align 2 + .code 32 +_get_class: + push {r7, lr} + mov r7, sp + sub sp, sp, #12 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_0+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_0+8)) +LPC4_0: + add r0, pc, r0 + ldr r0, [r0] + dmb ish + cmp r0, #3 + bne LBB4_3 +LBB4_1: + movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + mov r1, #15 + movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) +LPC4_4: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cmp r0, #0 + movne sp, r7 + popne {r7, pc} +LBB4_2: + movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC4_6+8)) +LPC4_5: + add r0, pc, r0 +LPC4_6: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB4_3: + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) + mov r2, #1 + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) + movw r3, :lower16:(l_anon.[ID].0-(LPC4_2+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC4_2+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC4_3+8)) + strb r2, [r7, #-5] + sub r2, r7, #5 +LPC4_3: + add r1, pc, r1 + str r2, [r7, #-4] +LPC4_1: + add r0, pc, r0 +LPC4_2: + add r3, pc, r3 + sub r2, r7, #4 + str r1, [sp] + mov r1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + b LBB4_1 + + .globl _get_obj + .p2align 2 + .code 32 +_get_obj: + push {r4, r7, lr} + add r7, sp, #4 + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC5_0+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC5_0+8)) +LPC5_0: + ldr r0, [pc, r0] + ldr r4, [r0] + bl _get_class + mov r1, r4 + pop {r4, r7, lr} + b _objc_msgSend + + .globl _access_ivars + .p2align 2 + .code 32 +_access_ivars: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + bl _get_obj + mov r4, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].5-(LPC6_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].5-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC6_1+8)) +LPC6_0: + add r1, pc, r1 +LPC6_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb r5, [r4, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC6_2+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC6_3+8)) +LPC6_2: + add r1, pc, r1 +LPC6_3: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r6, [r4, r0] + mov r0, r4 + bl _objc_release + mov r0, r5 + mov r1, r6 + pop {r4, r5, r6, r7, pc} + + .globl SYM(::class, 0) + .p2align 2 + .code 32 +SYM(::class, 0): + push {r7, lr} + mov r7, sp + sub sp, sp, #12 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_0+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_0+8)) +LPC7_0: + add r0, pc, r0 + ldr r0, [r0] + dmb ish + cmp r0, #3 + bne LBB7_3 +LBB7_1: + movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + mov r1, #15 + movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) +LPC7_4: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cmp r0, #0 + movne sp, r7 + popne {r7, pc} +LBB7_2: + movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC7_6+8)) +LPC7_5: + add r0, pc, r0 +LPC7_6: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB7_3: + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) + mov r2, #1 + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) + movw r3, :lower16:(l_anon.[ID].0-(LPC7_2+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC7_2+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC7_3+8)) + strb r2, [r7, #-5] + sub r2, r7, #5 +LPC7_3: + add r1, pc, r1 + str r2, [r7, #-4] +LPC7_1: + add r0, pc, r0 +LPC7_2: + add r3, pc, r3 + sub r2, r7, #4 + str r1, [sp] + mov r1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + b LBB7_1 + + .p2align 2 + .code 32 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + push {r4, r5, r7, lr} + add r7, sp, #8 + sub sp, sp, #8 + mov r4, r1 + mov r5, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC8_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC8_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC8_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC8_1+8)) +LPC8_0: + add r1, pc, r1 +LPC8_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB8_2 + bl _objc_release +LBB8_2: + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + str r0, [sp, #4] + mov r0, sp + mov r1, r4 + str r5, [sp] + bl _objc_msgSendSuper + sub sp, r7, #8 + pop {r4, r5, r7, pc} + + .globl _init + .p2align 2 + .code 32 +_init: + push {r4, r5, r7, lr} + add r7, sp, #8 + sub sp, sp, #8 + mov r4, r0 + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) +LPC9_0: + ldr r0, [pc, r0] + ldr r5, [r0] + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + str r0, [sp, #4] + mov r0, sp + mov r1, r5 + str r4, [sp] + bl _objc_msgSendSuper + mov r4, r0 + cmp r0, #0 + beq LBB9_2 + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].5-(LPC9_1+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].5-(LPC9_1+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC9_2+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC9_2+8)) +LPC9_1: + add r1, pc, r1 +LPC9_2: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov r1, #42 + strb r1, [r4, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC9_3+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC9_3+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC9_4+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC9_4+8)) +LPC9_3: + add r1, pc, r1 +LPC9_4: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov r1, #0 + str r1, [r4, r0] +LBB9_2: + mov r0, r4 + sub sp, r7, #8 + pop {r4, r5, r7, pc} + + .globl _class_method + .p2align 2 + .code 32 +_class_method: + bx lr + + .globl _method + .p2align 2 + .code 32 +_method: + bx lr + + .globl _method_bool + .p2align 2 + .code 32 +_method_bool: + clz r0, r2 + lsr r0, r0, #5 + bx lr + + .globl _method_id + .p2align 2 + .code 32 +_method_id: + push {r4, r7, lr} + add r7, sp, #4 + mov r4, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC13_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC13_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC13_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC13_1+8)) +LPC13_0: + add r1, pc, r1 +LPC13_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r4, r0] + cmp r0, #0 + beq LBB13_2 + bl _objc_retain + pop {r4, r7, lr} + b _objc_autoreleaseReturnValue +LBB13_2: + mov r0, #0 + pop {r4, r7, lr} + b _objc_autoreleaseReturnValue + + .globl _method_id_with_param + .p2align 2 + .code 32 +_method_id_with_param: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + mov r6, r2 + mov r5, r0 + bl SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov r4, r0 + cmp r6, #0 + beq LBB14_3 + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC14_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC14_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC14_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC14_1+8)) +LPC14_0: + add r1, pc, r1 +LPC14_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB14_4 + bl _objc_retain + mov r5, r0 + b LBB14_5 +LBB14_3: + mov r5, r4 + mov r0, r5 + pop {r4, r5, r6, r7, lr} + b _objc_autoreleaseReturnValue +LBB14_4: + mov r5, #0 +LBB14_5: + mov r0, r4 + bl _objc_release + mov r0, r5 + pop {r4, r5, r6, r7, lr} + b _objc_autoreleaseReturnValue + + .globl _copy_with_zone + .p2align 2 + .code 32 +_copy_with_zone: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + mov r5, r0 + bl _get_obj + mov r4, r0 + cmp r0, #0 + beq LBB15_5 + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r10, :lower16:(L_anon.[ID].5-(LPC15_0+8)) + mov r2, #4 + movt r10, :upper16:(L_anon.[ID].5-(LPC15_0+8)) + movw r8, :lower16:(l_anon.[ID].6-(LPC15_1+8)) + movt r8, :upper16:(l_anon.[ID].6-(LPC15_1+8)) +LPC15_0: + add r10, pc, r10 +LPC15_1: + add r8, pc, r8 + mov r1, r10 + mov r3, r8 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb r6, [r5, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + mov r1, r10 + mov r2, #4 + mov r3, r8 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + strb r6, [r4, r0] + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC15_2+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC15_2+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC15_3+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC15_3+8)) +LPC15_2: + add r1, pc, r1 +LPC15_3: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB15_3 + bl _objc_retain + mov r5, r0 + b LBB15_4 +LBB15_3: + mov r5, #0 +LBB15_4: + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC15_4+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC15_4+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC15_5+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC15_5+8)) +LPC15_4: + add r1, pc, r1 +LPC15_5: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + str r5, [r4, r0] +LBB15_5: + mov r0, r4 + pop {r8, r10} + pop {r4, r5, r6, r7, pc} + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].0: + .long SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\004\000\000\000\004\000\000" + .long SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .long SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "/Users/madsmarquart/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].4: + .long l_anon.[ID].3 + .asciz "t\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].6: + .byte 5 + .space 19 + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].8: + .byte 19 + .space 19 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].10: + .long l_anon.[ID].9 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .p2align 2, 0x0 +l_anon.[ID].12: + .byte 17 + .space 19 + + .p2align 2, 0x0 +l_anon.[ID].13: + .space 1 + .space 19 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].16: + .byte 28 + .space 3 + .long l_anon.[ID].15 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 + + .p2align 2, 0x0 +l_anon.[ID].17: + .byte 25 + .space 3 + .long l_anon.[ID].16 + .space 12 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].20: + .long l_anon.[ID].18 + .asciz "\033\000\000" + .long l_anon.[ID].19 + .asciz "0\000\000" + + .p2align 2, 0x0 +l_anon.[ID].21: + .long l_anon.[ID].11 + .asciz "\017\000\000" + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .long L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .long L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .long L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .long L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .long L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + + .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers + .p2align 2, 0x0 +LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init + .long 0 +LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_new + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s new file mode 100644 index 000000000..6bda768f0 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s @@ -0,0 +1,931 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .p2align 2 + .code 32 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + bx lr + + .p2align 2 + .code 32 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8, r10, r11} + sub sp, sp, #40 + ldr r0, [r0] + mov r2, #0 + ldrb r1, [r0] + strb r2, [r0] + cmp r1, #0 + beq LBB1_3 + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov r2, r0 + movw r0, :lower16:(l_anon.[ID].11-(LPC1_0+8)) + movt r0, :upper16:(l_anon.[ID].11-(LPC1_0+8)) + mov r1, #15 +LPC1_0: + add r0, pc, r0 + bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + cmp r0, #0 + beq LBB1_4 + movw r1, :lower16:(L_anon.[ID].5-(LPC1_1+8)) + mov r2, #0 + movt r1, :upper16:(L_anon.[ID].5-(LPC1_1+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC1_2+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC1_2+8)) + add r4, sp, #8 +LPC1_2: + add r3, pc, r3 + str r0, [sp, #8] + strd r2, r3, [sp] +LPC1_1: + add r1, pc, r1 + mov r0, r4 + mov r2, #4 + mov r3, #1 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + movw r8, :lower16:(l_anon.[ID].8-(LPC1_3+8)) + mov r0, #2 + movt r8, :upper16:(l_anon.[ID].8-(LPC1_3+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC1_4+8)) + movt r1, :upper16:(L_anon.[ID].7-(LPC1_4+8)) +LPC1_3: + add r8, pc, r8 + stm sp, {r0, r8} +LPC1_4: + add r1, pc, r1 + mov r0, r4 + mov r2, #4 + mov r3, #4 + bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_5+8)) + mov r0, r4 + movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_5+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) +LPC1_5: + add r11, pc, r11 +LPC1_6: + ldr r1, [pc, r1] + movw r10, :lower16:(l_anon.[ID].12-(LPC1_7+8)) + movt r10, :upper16:(l_anon.[ID].12-(LPC1_7+8)) + movw r5, :lower16:(l_anon.[ID].1-(LPC1_8+8)) + movt r5, :upper16:(l_anon.[ID].1-(LPC1_8+8)) +LPC1_7: + add r10, pc, r10 +LPC1_8: + add r5, pc, r5 + mov r3, #0 + mov r2, r5 + strd r10, r11, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + mov r2, r5 + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + mov r3, #0 +LPC1_9: + ldr r0, [pc, r0] + ldr r1, [r0] + movw r9, :lower16:(_init-(LPC1_10+8)) + movt r9, :upper16:(_init-(LPC1_10+8)) + mov r0, r4 +LPC1_10: + add r9, pc, r9 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r11, :lower16:(_class_method-(LPC1_11+8)) + mov r0, r4 + movt r11, :upper16:(_class_method-(LPC1_11+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) +LPC1_11: + add r11, pc, r11 +LPC1_12: + ldr r1, [pc, r1] + mov r2, r5 + mov r3, #0 + strd r10, r11, [sp] + bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) + movw r11, :lower16:(_method-(LPC1_13+8)) + mov r0, r4 + movt r11, :upper16:(_method-(LPC1_13+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) +LPC1_13: + add r11, pc, r11 +LPC1_14: + ldr r1, [pc, r1] + mov r2, r5 + mov r3, #0 + strd r10, r11, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r3, :lower16:(_method_bool-(LPC1_15+8)) + mov r0, r4 + movt r3, :upper16:(_method_bool-(LPC1_15+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) +LPC1_15: + add r3, pc, r3 +LPC1_16: + ldr r1, [pc, r1] + movw r10, :lower16:(l_anon.[ID].13-(LPC1_17+8)) + movt r10, :upper16:(l_anon.[ID].13-(LPC1_17+8)) +LPC1_17: + add r10, pc, r10 + str r10, [sp] + mov r2, r10 + str r3, [sp, #4] + mov r3, #1 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r9, :lower16:(_method_id-(LPC1_18+8)) + mov r0, r4 + movt r9, :upper16:(_method_id-(LPC1_18+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) +LPC1_18: + add r9, pc, r9 +LPC1_19: + ldr r1, [pc, r1] + mov r2, r5 + mov r3, #0 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r9, :lower16:(_method_id_with_param-(LPC1_20+8)) + mov r0, r4 + movt r9, :upper16:(_method_id_with_param-(LPC1_20+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) +LPC1_20: + add r9, pc, r9 +LPC1_21: + ldr r1, [pc, r1] + mov r2, r10 + mov r3, #1 + strd r8, r9, [sp] + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + movw r0, :lower16:(l_anon.[ID].14-(LPC1_22+8)) + mov r1, #9 + movt r0, :upper16:(l_anon.[ID].14-(LPC1_22+8)) +LPC1_22: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + mov r1, r0 + mov r0, r4 + bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) + movw r9, :lower16:(_copy_with_zone-(LPC1_23+8)) + mov r3, #1 + movt r9, :upper16:(_copy_with_zone-(LPC1_23+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) +LPC1_23: + add r9, pc, r9 +LPC1_24: + ldr r1, [pc, r1] + movw r2, :lower16:(l_anon.[ID].17-(LPC1_25+8)) + movt r2, :upper16:(l_anon.[ID].17-(LPC1_25+8)) + strd r8, r9, [sp] +LPC1_25: + add r2, pc, r2 + bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + ldr r0, [sp, #8] + bl SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + sub sp, r7, #20 + pop {r8, r10, r11} + pop {r4, r5, r7, pc} +LBB1_3: + movw r0, :lower16:(l_anon.[ID].2-(LPC1_26+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC1_26+8)) + movw r2, :lower16:(l_anon.[ID].4-(LPC1_27+8)) + movt r2, :upper16:(l_anon.[ID].4-(LPC1_27+8)) +LPC1_26: + add r0, pc, r0 +LPC1_27: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: + movw r0, :lower16:(l_anon.[ID].20-(LPC1_28+8)) + mov r5, #0 + movt r0, :upper16:(l_anon.[ID].20-(LPC1_28+8)) + movw r2, :lower16:(l_anon.[ID].21-(LPC1_29+8)) + movt r2, :upper16:(l_anon.[ID].21-(LPC1_29+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC1_30+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC1_30+8)) + movw r3, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_31+8)) + movt r3, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_31+8)) + str r5, [sp, #24] + mov r5, #2 +LPC1_28: + add r0, pc, r0 + str r5, [sp, #12] + mov r5, #1 +LPC1_29: + add r2, pc, r2 +LPC1_31: + add r3, pc, r3 + str r5, [sp, #20] + sub r5, r7, #28 + str r0, [sp, #8] +LPC1_30: + add r1, pc, r1 + add r0, sp, #8 + str r5, [sp, #16] + str r3, [r7, #-24] + str r2, [r7, #-28] + mov lr, pc + b SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + + .p2align 2 + .code 32 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + push {r7, lr} + mov r7, sp + sub sp, sp, #4 + ldr r0, [r0] + str r0, [sp] + mov r0, sp + bl SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + mov sp, r7 + pop {r7, pc} + + .p2align 2 + .code 32 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + push {r7, lr} + mov r7, sp + mov r2, r1 + ldrd r0, r1, [r0] + bl SYM(::fmt::GENERATED_ID, 0) + pop {r7, pc} + + .globl _get_class + .p2align 2 + .code 32 +_get_class: + push {r7, lr} + mov r7, sp + sub sp, sp, #12 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_0+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_0+8)) +LPC4_0: + add r0, pc, r0 + ldr r0, [r0] + dmb ish + cmp r0, #3 + bne LBB4_3 +LBB4_1: + movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + mov r1, #15 + movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) +LPC4_4: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cmp r0, #0 + movne sp, r7 + popne {r7, pc} +LBB4_2: + movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC4_6+8)) +LPC4_5: + add r0, pc, r0 +LPC4_6: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB4_3: + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) + mov r2, #1 + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC4_1+8)) + movw r3, :lower16:(l_anon.[ID].0-(LPC4_2+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC4_2+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC4_3+8)) + strb r2, [r7, #-5] +LPC4_3: + add r1, pc, r1 + sub r2, r7, #5 + str r2, [r7, #-4] +LPC4_1: + add r0, pc, r0 + str r1, [sp] +LPC4_2: + add r3, pc, r3 + sub r2, r7, #4 + mov r1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + b LBB4_1 + + .globl _get_obj + .p2align 2 + .code 32 +_get_obj: + push {r4, r7, lr} + add r7, sp, #4 + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC5_0+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-(LPC5_0+8)) +LPC5_0: + ldr r0, [pc, r0] + ldr r4, [r0] + bl _get_class + mov r1, r4 + bl _objc_msgSend + pop {r4, r7, pc} + + .globl _access_ivars + .p2align 2 + .code 32 +_access_ivars: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + bl _get_obj + mov r4, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].5-(LPC6_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].5-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC6_1+8)) +LPC6_0: + add r1, pc, r1 +LPC6_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb r5, [r4, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC6_2+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC6_3+8)) +LPC6_2: + add r1, pc, r1 +LPC6_3: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r6, [r4, r0] + mov r0, r4 + bl _objc_release + mov r0, r5 + mov r1, r6 + pop {r4, r5, r6, r7, pc} + + .globl SYM(::class, 0) + .p2align 2 + .code 32 +SYM(::class, 0): + push {r7, lr} + mov r7, sp + sub sp, sp, #12 + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_0+8)) + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_0+8)) +LPC7_0: + add r0, pc, r0 + ldr r0, [r0] + dmb ish + cmp r0, #3 + bne LBB7_3 +LBB7_1: + movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + mov r1, #15 + movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) +LPC7_4: + add r0, pc, r0 + bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + cmp r0, #0 + movne sp, r7 + popne {r7, pc} +LBB7_2: + movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + mov r1, #43 + movt r0, :upper16:(l_anon.[ID].2-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC7_6+8)) +LPC7_5: + add r0, pc, r0 +LPC7_6: + add r2, pc, r2 + mov lr, pc + b SYM(core::panicking::panic::GENERATED_ID, 0) +LBB7_3: + movw r0, :lower16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) + mov r2, #1 + movt r0, :upper16:(SYM(::class::REGISTER_CLASS, 0)-(LPC7_1+8)) + movw r3, :lower16:(l_anon.[ID].0-(LPC7_2+8)) + movt r3, :upper16:(l_anon.[ID].0-(LPC7_2+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC7_3+8)) + strb r2, [r7, #-5] +LPC7_3: + add r1, pc, r1 + sub r2, r7, #5 + str r2, [r7, #-4] +LPC7_1: + add r0, pc, r0 + str r1, [sp] +LPC7_2: + add r3, pc, r3 + sub r2, r7, #4 + mov r1, #0 + bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + b LBB7_1 + + .p2align 2 + .code 32 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + push {r4, r5, r7, lr} + add r7, sp, #8 + sub sp, sp, #8 + mov r4, r1 + mov r5, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC8_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC8_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC8_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC8_1+8)) +LPC8_0: + add r1, pc, r1 +LPC8_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB8_2 + bl _objc_release +LBB8_2: + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + str r0, [sp, #4] + mov r0, sp + mov r1, r4 + str r5, [sp] + bl _objc_msgSendSuper + sub sp, r7, #8 + pop {r4, r5, r7, pc} + + .globl _init + .p2align 2 + .code 32 +_init: + push {r4, r5, r7, lr} + add r7, sp, #8 + sub sp, sp, #8 + mov r4, r0 + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) +LPC9_0: + ldr r0, [pc, r0] + ldr r5, [r0] + bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) + str r0, [sp, #4] + mov r0, sp + mov r1, r5 + str r4, [sp] + bl _objc_msgSendSuper + mov r4, r0 + cmp r0, #0 + beq LBB9_2 + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].5-(LPC9_1+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].5-(LPC9_1+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC9_2+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC9_2+8)) +LPC9_1: + add r1, pc, r1 +LPC9_2: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov r1, #42 + strb r1, [r4, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC9_3+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC9_3+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC9_4+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC9_4+8)) +LPC9_3: + add r1, pc, r1 +LPC9_4: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov r1, #0 + str r1, [r4, r0] +LBB9_2: + mov r0, r4 + sub sp, r7, #8 + pop {r4, r5, r7, pc} + + .globl _class_method + .p2align 2 + .code 32 +_class_method: + bx lr + + .globl _method + .p2align 2 + .code 32 +_method: + bx lr + + .globl _method_bool + .p2align 2 + .code 32 +_method_bool: + clz r0, r2 + lsr r0, r0, #5 + bx lr + + .globl _method_id + .p2align 2 + .code 32 +_method_id: + push {r4, r7, lr} + add r7, sp, #4 + mov r4, r0 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC13_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC13_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC13_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC13_1+8)) +LPC13_0: + add r1, pc, r1 +LPC13_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r4, r0] + cmp r0, #0 + beq LBB13_2 + bl _objc_retain + bl _objc_autoreleaseReturnValue + pop {r4, r7, pc} +LBB13_2: + mov r0, #0 + bl _objc_autoreleaseReturnValue + pop {r4, r7, pc} + + .globl _method_id_with_param + .p2align 2 + .code 32 +_method_id_with_param: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + mov r6, r2 + mov r5, r0 + bl SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov r4, r0 + cmp r6, #0 + beq LBB14_3 + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC14_0+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC14_0+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC14_1+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC14_1+8)) +LPC14_0: + add r1, pc, r1 +LPC14_1: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB14_4 + bl _objc_retain + mov r5, r0 + b LBB14_5 +LBB14_3: + mov r5, r4 + mov r0, r5 + bl _objc_autoreleaseReturnValue + pop {r4, r5, r6, r7, pc} +LBB14_4: + mov r5, #0 +LBB14_5: + mov r0, r4 + bl _objc_release + mov r0, r5 + bl _objc_autoreleaseReturnValue + pop {r4, r5, r6, r7, pc} + + .globl _copy_with_zone + .p2align 2 + .code 32 +_copy_with_zone: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + mov r5, r0 + bl _get_obj + mov r4, r0 + cmp r0, #0 + beq LBB15_5 + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r10, :lower16:(L_anon.[ID].5-(LPC15_0+8)) + mov r2, #4 + movt r10, :upper16:(L_anon.[ID].5-(LPC15_0+8)) + movw r8, :lower16:(l_anon.[ID].6-(LPC15_1+8)) + movt r8, :upper16:(l_anon.[ID].6-(LPC15_1+8)) +LPC15_0: + add r10, pc, r10 +LPC15_1: + add r8, pc, r8 + mov r1, r10 + mov r3, r8 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldrb r6, [r5, r0] + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + mov r1, r10 + mov r2, #4 + mov r3, r8 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + strb r6, [r4, r0] + mov r0, r5 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC15_2+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC15_2+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC15_3+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC15_3+8)) +LPC15_2: + add r1, pc, r1 +LPC15_3: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + ldr r0, [r5, r0] + cmp r0, #0 + beq LBB15_3 + bl _objc_retain + mov r5, r0 + b LBB15_4 +LBB15_3: + mov r5, #0 +LBB15_4: + mov r0, r4 + bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + movw r1, :lower16:(L_anon.[ID].7-(LPC15_4+8)) + mov r2, #4 + movt r1, :upper16:(L_anon.[ID].7-(LPC15_4+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC15_5+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC15_5+8)) +LPC15_4: + add r1, pc, r1 +LPC15_5: + add r3, pc, r3 + bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + str r5, [r4, r0] +LBB15_5: + mov r0, r4 + pop {r8, r10} + pop {r4, r5, r6, r7, pc} + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].0: + .long SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\004\000\000\000\004\000\000" + .long SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .long SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "/Users/madsmarquart/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].4: + .long l_anon.[ID].3 + .asciz "t\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].6: + .byte 5 + .space 19 + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].8: + .byte 19 + .space 19 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].10: + .long l_anon.[ID].9 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .p2align 2, 0x0 +l_anon.[ID].12: + .byte 17 + .space 19 + + .p2align 2, 0x0 +l_anon.[ID].13: + .space 1 + .space 19 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].16: + .byte 28 + .space 3 + .long l_anon.[ID].15 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 + + .p2align 2, 0x0 +l_anon.[ID].17: + .byte 25 + .space 3 + .long l_anon.[ID].16 + .space 12 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].20: + .long l_anon.[ID].18 + .asciz "\033\000\000" + .long l_anon.[ID].19 + .asciz "0\000\000" + + .p2align 2, 0x0 +l_anon.[ID].21: + .long l_anon.[ID].11 + .asciz "\017\000\000" + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .long L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .long L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .long L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .long L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .long L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + + .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers + .p2align 2, 0x0 +LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init + .long 0 +LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_new + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s new file mode 100644 index 000000000..c23001d7a --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s @@ -0,0 +1,958 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .p2align 4, 0x90 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + push ebp + mov ebp, esp + pop ebp + ret + + .p2align 4, 0x90 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 44 + call L1$pb +L1$pb: + pop esi + mov eax, dword ptr [ebp + 8] + mov eax, dword ptr [eax] + cmp byte ptr [eax], 0 + mov byte ptr [eax], 0 + je LBB1_3 + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + sub esp, 4 + lea ecx, [esi + l_anon.[ID].11-L1$pb] + push eax + push 15 + push ecx + call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB1_4 + mov dword ptr [ebp - 40], eax + sub esp, 8 + lea eax, [esi + l_anon.[ID].6-L1$pb] + lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea edi, [ebp - 40] + push eax + push 0 + push 1 + push 4 + push ecx + push edi + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + add esp, 24 + lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea eax, [esi + L_anon.[ID].7-L1$pb] + push ecx + push 2 + push 4 + push 4 + push eax + push edi + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] + lea edx, [esi + l_anon.[ID].12-L1$pb] + lea ebx, [esi + l_anon.[ID].1-L1$pb] + push eax + push edx + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 32 + mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] + sub esp, 8 + lea ecx, [esi + _init-L1$pb] + push ecx + lea ecx, [esi + l_anon.[ID].8-L1$pb] + push ecx + push 0 + push ebx + push dword ptr [eax] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _class_method-L1$pb] + push eax + lea eax, [esi + l_anon.[ID].12-L1$pb] + push eax + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method-L1$pb] + push eax + lea eax, [esi + l_anon.[ID].12-L1$pb] + push eax + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_bool-L1$pb] + lea ecx, [esi + l_anon.[ID].13-L1$pb] + push eax + push ecx + push 1 + push ecx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_id-L1$pb] + push eax + lea ebx, [esi + l_anon.[ID].8-L1$pb] + push ebx + push 0 + lea eax, [esi + l_anon.[ID].1-L1$pb] + push eax + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_id_with_param-L1$pb] + push eax + push ebx + push 1 + lea eax, [esi + l_anon.[ID].13-L1$pb] + push eax + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + l_anon.[ID].14-L1$pb] + push 9 + push eax + call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + add esp, 8 + push eax + push edi + call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) + add esp, 8 + lea ecx, [esi + _copy_with_zone-L1$pb] + lea edx, [esi + l_anon.[ID].17-L1$pb] + push ecx + push ebx + push 1 + push edx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-L1$pb] + push eax + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 20 + push dword ptr [ebp - 40] + call SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + add esp, 60 + pop esi + pop edi + pop ebx + pop ebp + ret +LBB1_3: + sub esp, 4 + lea eax, [esi + l_anon.[ID].4-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: + lea eax, [esi + l_anon.[ID].21-L1$pb] + mov dword ptr [ebp - 48], eax + lea eax, [esi + SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-L1$pb] + mov dword ptr [ebp - 44], eax + lea eax, [esi + l_anon.[ID].20-L1$pb] + mov dword ptr [ebp - 40], eax + mov dword ptr [ebp - 36], 2 + mov dword ptr [ebp - 24], 0 + lea eax, [ebp - 48] + mov dword ptr [ebp - 32], eax + mov dword ptr [ebp - 28], 1 + sub esp, 8 + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [ebp - 40] + push eax + push ecx + call SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + push ebp + mov ebp, esp + sub esp, 24 + mov eax, dword ptr [ebp + 8] + mov eax, dword ptr [eax] + mov dword ptr [ebp - 4], eax + lea eax, [ebp - 4] + mov dword ptr [esp], eax + call SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + add esp, 24 + pop ebp + ret + + .p2align 4, 0x90 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + push ebp + mov ebp, esp + sub esp, 8 + mov eax, dword ptr [ebp + 8] + sub esp, 4 + push dword ptr [ebp + 12] + push dword ptr [eax + 4] + push dword ptr [eax] + call SYM(::fmt::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_class + .p2align 4, 0x90 +_get_class: + push ebp + mov ebp, esp + push edi + push esi + sub esp, 16 + call L4$pb +L4$pb: + pop esi + mov eax, dword ptr [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] + cmp eax, 3 + jne LBB4_1 +LBB4_2: + sub esp, 8 + lea eax, [esi + l_anon.[ID].11-L4$pb] + push 15 + push eax + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB4_4 + add esp, 16 + pop esi + pop edi + pop ebp + ret +LBB4_1: + mov byte ptr [ebp - 9], 1 + lea eax, [ebp - 9] + mov dword ptr [ebp - 16], eax + sub esp, 12 + lea eax, [esi + l_anon.[ID].10-L4$pb] + lea ecx, [esi + l_anon.[ID].0-L4$pb] + lea edx, [ebp - 16] + lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + push 0 + push edi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + add esp, 32 + jmp LBB4_2 +LBB4_4: + sub esp, 4 + lea eax, [esi + l_anon.[ID].10-L4$pb] + lea ecx, [esi + l_anon.[ID].2-L4$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .globl _get_obj + .p2align 4, 0x90 +_get_obj: + push ebp + mov ebp, esp + push esi + push eax + call L5$pb +L5$pb: + pop eax + mov eax, dword ptr [eax + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L5$pb] + mov esi, dword ptr [eax] + call _get_class + sub esp, 8 + push esi + push eax + call _objc_msgSend + add esp, 20 + pop esi + pop ebp + ret + + .globl _access_ivars + .p2align 4, 0x90 +_access_ivars: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L6$pb +L6$pb: + pop edi + call _get_obj + mov esi, eax + sub esp, 12 + push eax + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L6$pb] + lea edx, [edi + L_anon.[ID].5-L6$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + movzx ebx, byte ptr [esi + eax] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L6$pb] + lea edx, [edi + L_anon.[ID].7-L6$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov edi, dword ptr [esi + eax] + sub esp, 12 + push esi + call _objc_release + add esp, 16 + mov eax, ebx + mov edx, edi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl SYM(::class, 0) + .p2align 4, 0x90 +SYM(::class, 0): + push ebp + mov ebp, esp + push edi + push esi + sub esp, 16 + call L7$pb +L7$pb: + pop esi + mov eax, dword ptr [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] + cmp eax, 3 + jne LBB7_1 +LBB7_2: + sub esp, 8 + lea eax, [esi + l_anon.[ID].11-L7$pb] + push 15 + push eax + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB7_4 + add esp, 16 + pop esi + pop edi + pop ebp + ret +LBB7_1: + mov byte ptr [ebp - 9], 1 + lea eax, [ebp - 9] + mov dword ptr [ebp - 16], eax + sub esp, 12 + lea eax, [esi + l_anon.[ID].10-L7$pb] + lea ecx, [esi + l_anon.[ID].0-L7$pb] + lea edx, [ebp - 16] + lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] + push eax + push ecx + push edx + push 0 + push edi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + add esp, 32 + jmp LBB7_2 +LBB7_4: + sub esp, 4 + lea eax, [esi + l_anon.[ID].10-L7$pb] + lea ecx, [esi + l_anon.[ID].2-L7$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L8$pb +L8$pb: + pop ebx + mov esi, dword ptr [ebp + 12] + mov edi, dword ptr [ebp + 8] + sub esp, 12 + push edi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [ebx + l_anon.[ID].8-L8$pb] + lea edx, [ebx + L_anon.[ID].7-L8$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov eax, dword ptr [edi + eax] + test eax, eax + je LBB8_2 + sub esp, 12 + push eax + call _objc_release + add esp, 16 +LBB8_2: + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov dword ptr [ebp - 24], edi + mov dword ptr [ebp - 20], eax + sub esp, 8 + lea eax, [ebp - 24] + push esi + push eax + call _objc_msgSendSuper + add esp, 28 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _init + .p2align 4, 0x90 +_init: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L9$pb +L9$pb: + pop edi + mov esi, dword ptr [ebp + 8] + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] + mov ebx, dword ptr [eax] + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov dword ptr [ebp - 24], esi + mov dword ptr [ebp - 20], eax + sub esp, 8 + lea eax, [ebp - 24] + push ebx + push eax + call _objc_msgSendSuper + add esp, 16 + mov esi, eax + test eax, eax + je LBB9_2 + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L9$pb] + lea edx, [edi + L_anon.[ID].5-L9$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov byte ptr [esi + eax], 42 + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L9$pb] + lea edx, [edi + L_anon.[ID].7-L9$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov dword ptr [esi + eax], 0 +LBB9_2: + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _class_method + .p2align 4, 0x90 +_class_method: + push ebp + mov ebp, esp + pop ebp + ret + + .globl _method + .p2align 4, 0x90 +_method: + push ebp + mov ebp, esp + pop ebp + ret + + .globl _method_bool + .p2align 4, 0x90 +_method_bool: + push ebp + mov ebp, esp + xor eax, eax + cmp byte ptr [ebp + 16], 0 + sete al + pop ebp + ret + + .globl _method_id + .p2align 4, 0x90 +_method_id: + push ebp + mov ebp, esp + push edi + push esi + call L13$pb +L13$pb: + pop edi + mov esi, dword ptr [ebp + 8] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L13$pb] + lea edx, [edi + L_anon.[ID].7-L13$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov eax, dword ptr [esi + eax] + test eax, eax + je LBB13_1 + sub esp, 12 + push eax + call _objc_retain + add esp, 16 + jmp LBB13_3 +LBB13_1: + xor eax, eax +LBB13_3: + sub esp, 12 + push eax + call _objc_autoreleaseReturnValue + add esp, 16 + pop esi + pop edi + pop ebp + ret + + .globl _method_id_with_param + .p2align 4, 0x90 +_method_id_with_param: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 28 + call L14$pb +L14$pb: + pop edi + call SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov esi, eax + cmp byte ptr [ebp + 16], 0 + je LBB14_5 + mov ebx, dword ptr [ebp + 8] + mov dword ptr [esp], ebx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea ecx, [edi + l_anon.[ID].8-L14$pb] + mov dword ptr [esp + 12], ecx + lea ecx, [edi + L_anon.[ID].7-L14$pb] + mov dword ptr [esp + 4], ecx + mov dword ptr [esp], eax + mov dword ptr [esp + 8], 4 + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov eax, dword ptr [ebx + eax] + test eax, eax + je LBB14_2 + mov dword ptr [esp], eax + call _objc_retain + mov edi, eax + jmp LBB14_4 +LBB14_2: + xor edi, edi +LBB14_4: + mov dword ptr [esp], esi + call _objc_release + mov esi, edi +LBB14_5: + mov dword ptr [esp], esi + call _objc_autoreleaseReturnValue + add esp, 28 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _copy_with_zone + .p2align 4, 0x90 +_copy_with_zone: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L15$pb +L15$pb: + pop edi + call _get_obj + mov esi, eax + test eax, eax + je LBB15_5 + mov eax, dword ptr [ebp + 8] + sub esp, 12 + push eax + mov ebx, eax + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea edx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + L_anon.[ID].5-L15$pb] + push edx + push 4 + push ecx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + movzx ebx, byte ptr [ebx + eax] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L15$pb] + push ecx + push 4 + lea ecx, [edi + L_anon.[ID].5-L15$pb] + push ecx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov byte ptr [esi + eax], bl + sub esp, 12 + push dword ptr [ebp + 8] + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L15$pb] + lea ebx, [edi + L_anon.[ID].7-L15$pb] + mov dword ptr [ebp - 16], ecx + push ecx + push 4 + push ebx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov ecx, dword ptr [ebp + 8] + mov eax, dword ptr [ecx + eax] + test eax, eax + je LBB15_2 + sub esp, 12 + push eax + call _objc_retain + add esp, 16 + mov edi, eax + jmp LBB15_4 +LBB15_2: + xor edi, edi +LBB15_4: + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + push dword ptr [ebp - 16] + push 4 + push ebx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov dword ptr [esi + eax], edi +LBB15_5: + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].0: + .long SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\004\000\000\000\004\000\000" + .long SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .long SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "/Users/madsmarquart/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].4: + .long l_anon.[ID].3 + .asciz "t\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].6: + .byte 5 + .space 19 + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].8: + .byte 19 + .space 19 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].10: + .long l_anon.[ID].9 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .p2align 2, 0x0 +l_anon.[ID].12: + .byte 17 + .space 19 + + .p2align 2, 0x0 +l_anon.[ID].13: + .space 1 + .space 19 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].16: + .byte 28 + .space 3 + .long l_anon.[ID].15 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 + + .p2align 2, 0x0 +l_anon.[ID].17: + .byte 25 + .space 3 + .long l_anon.[ID].16 + .space 12 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].20: + .long l_anon.[ID].18 + .asciz "\033\000\000" + .long l_anon.[ID].19 + .asciz "0\000\000" + + .p2align 2, 0x0 +l_anon.[ID].21: + .long l_anon.[ID].11 + .asciz "\017\000\000" + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .long L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .long L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .long L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .long L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .long L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __OBJC,__image_info + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__cstring,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __OBJC,__message_refs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + + .section __IMPORT,__pointers,non_lazy_symbol_pointers +LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init + .long 0 +LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_new + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s new file mode 100644 index 000000000..57ec70a7b --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s @@ -0,0 +1,958 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .p2align 4, 0x90 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + push ebp + mov ebp, esp + pop ebp + ret + + .p2align 4, 0x90 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 44 + call L1$pb +L1$pb: + pop esi + mov eax, dword ptr [ebp + 8] + mov eax, dword ptr [eax] + cmp byte ptr [eax], 0 + mov byte ptr [eax], 0 + je LBB1_3 + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + sub esp, 4 + lea ecx, [esi + l_anon.[ID].11-L1$pb] + push eax + push 15 + push ecx + call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB1_4 + mov dword ptr [ebp - 40], eax + sub esp, 8 + lea eax, [esi + l_anon.[ID].6-L1$pb] + lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea edi, [ebp - 40] + push eax + push 0 + push 1 + push 4 + push ecx + push edi + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + add esp, 24 + lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea eax, [esi + L_anon.[ID].7-L1$pb] + push ecx + push 2 + push 4 + push 4 + push eax + push edi + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] + lea edx, [esi + l_anon.[ID].12-L1$pb] + lea ebx, [esi + l_anon.[ID].1-L1$pb] + push eax + push edx + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 32 + mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] + sub esp, 8 + lea ecx, [esi + _init-L1$pb] + push ecx + lea ecx, [esi + l_anon.[ID].8-L1$pb] + push ecx + push 0 + push ebx + push dword ptr [eax] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _class_method-L1$pb] + push eax + lea eax, [esi + l_anon.[ID].12-L1$pb] + push eax + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method-L1$pb] + push eax + lea eax, [esi + l_anon.[ID].12-L1$pb] + push eax + push 0 + push ebx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_bool-L1$pb] + lea ecx, [esi + l_anon.[ID].13-L1$pb] + push eax + push ecx + push 1 + push ecx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_id-L1$pb] + push eax + lea ebx, [esi + l_anon.[ID].8-L1$pb] + push ebx + push 0 + lea eax, [esi + l_anon.[ID].1-L1$pb] + push eax + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + _method_id_with_param-L1$pb] + push eax + push ebx + push 1 + lea eax, [esi + l_anon.[ID].13-L1$pb] + push eax + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] + push edi + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 24 + lea eax, [esi + l_anon.[ID].14-L1$pb] + push 9 + push eax + call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + add esp, 8 + push eax + push edi + call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) + add esp, 8 + lea ecx, [esi + _copy_with_zone-L1$pb] + lea edx, [esi + l_anon.[ID].17-L1$pb] + push ecx + push ebx + push 1 + push edx + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-L1$pb] + push eax + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + add esp, 20 + push dword ptr [ebp - 40] + call SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + add esp, 60 + pop esi + pop edi + pop ebx + pop ebp + ret +LBB1_3: + sub esp, 4 + lea eax, [esi + l_anon.[ID].4-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: + lea eax, [esi + l_anon.[ID].21-L1$pb] + mov dword ptr [ebp - 48], eax + lea eax, [esi + SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-L1$pb] + mov dword ptr [ebp - 44], eax + lea eax, [esi + l_anon.[ID].20-L1$pb] + mov dword ptr [ebp - 40], eax + mov dword ptr [ebp - 36], 2 + mov dword ptr [ebp - 24], 0 + lea eax, [ebp - 48] + mov dword ptr [ebp - 32], eax + mov dword ptr [ebp - 28], 1 + sub esp, 8 + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [ebp - 40] + push eax + push ecx + call SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + push ebp + mov ebp, esp + sub esp, 24 + mov eax, dword ptr [ebp + 8] + mov eax, dword ptr [eax] + mov dword ptr [ebp - 4], eax + lea eax, [ebp - 4] + mov dword ptr [esp], eax + call SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + add esp, 24 + pop ebp + ret + + .p2align 4, 0x90 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + push ebp + mov ebp, esp + sub esp, 8 + mov eax, dword ptr [ebp + 8] + sub esp, 4 + push dword ptr [ebp + 12] + push dword ptr [eax + 4] + push dword ptr [eax] + call SYM(::fmt::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_class + .p2align 4, 0x90 +_get_class: + push ebp + mov ebp, esp + push edi + push esi + sub esp, 16 + call L4$pb +L4$pb: + pop esi + mov eax, dword ptr [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] + cmp eax, 3 + jne LBB4_1 +LBB4_2: + sub esp, 8 + lea eax, [esi + l_anon.[ID].11-L4$pb] + push 15 + push eax + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB4_4 + add esp, 16 + pop esi + pop edi + pop ebp + ret +LBB4_1: + mov byte ptr [ebp - 9], 1 + lea eax, [ebp - 9] + mov dword ptr [ebp - 16], eax + sub esp, 12 + lea eax, [esi + l_anon.[ID].10-L4$pb] + lea ecx, [esi + l_anon.[ID].0-L4$pb] + lea edx, [ebp - 16] + lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + push 0 + push edi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + add esp, 32 + jmp LBB4_2 +LBB4_4: + sub esp, 4 + lea eax, [esi + l_anon.[ID].10-L4$pb] + lea ecx, [esi + l_anon.[ID].2-L4$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .globl _get_obj + .p2align 4, 0x90 +_get_obj: + push ebp + mov ebp, esp + push esi + push eax + call L5$pb +L5$pb: + pop eax + mov eax, dword ptr [eax + LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr-L5$pb] + mov esi, dword ptr [eax] + call _get_class + sub esp, 8 + push esi + push eax + call _objc_msgSend + add esp, 20 + pop esi + pop ebp + ret + + .globl _access_ivars + .p2align 4, 0x90 +_access_ivars: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L6$pb +L6$pb: + pop edi + call _get_obj + mov esi, eax + sub esp, 12 + push eax + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L6$pb] + lea edx, [edi + L_anon.[ID].5-L6$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + movzx ebx, byte ptr [esi + eax] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L6$pb] + lea edx, [edi + L_anon.[ID].7-L6$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov edi, dword ptr [esi + eax] + sub esp, 12 + push esi + call _objc_release + add esp, 16 + mov eax, ebx + mov edx, edi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl SYM(::class, 0) + .p2align 4, 0x90 +SYM(::class, 0): + push ebp + mov ebp, esp + push edi + push esi + sub esp, 16 + call L7$pb +L7$pb: + pop esi + mov eax, dword ptr [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] + cmp eax, 3 + jne LBB7_1 +LBB7_2: + sub esp, 8 + lea eax, [esi + l_anon.[ID].11-L7$pb] + push 15 + push eax + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + add esp, 16 + test eax, eax + je LBB7_4 + add esp, 16 + pop esi + pop edi + pop ebp + ret +LBB7_1: + mov byte ptr [ebp - 9], 1 + lea eax, [ebp - 9] + mov dword ptr [ebp - 16], eax + sub esp, 12 + lea eax, [esi + l_anon.[ID].10-L7$pb] + lea ecx, [esi + l_anon.[ID].0-L7$pb] + lea edx, [ebp - 16] + lea edi, [esi + SYM(::class::REGISTER_CLASS, 0)-L7$pb] + push eax + push ecx + push edx + push 0 + push edi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + add esp, 32 + jmp LBB7_2 +LBB7_4: + sub esp, 4 + lea eax, [esi + l_anon.[ID].10-L7$pb] + lea ecx, [esi + l_anon.[ID].2-L7$pb] + push eax + push 43 + push ecx + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L8$pb +L8$pb: + pop ebx + mov esi, dword ptr [ebp + 12] + mov edi, dword ptr [ebp + 8] + sub esp, 12 + push edi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [ebx + l_anon.[ID].8-L8$pb] + lea edx, [ebx + L_anon.[ID].7-L8$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov eax, dword ptr [edi + eax] + test eax, eax + je LBB8_2 + sub esp, 12 + push eax + call _objc_release + add esp, 16 +LBB8_2: + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov dword ptr [ebp - 24], edi + mov dword ptr [ebp - 20], eax + sub esp, 8 + lea eax, [ebp - 24] + push esi + push eax + call _objc_msgSendSuper + add esp, 28 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _init + .p2align 4, 0x90 +_init: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L9$pb +L9$pb: + pop edi + mov esi, dword ptr [ebp + 8] + mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] + mov ebx, dword ptr [eax] + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov dword ptr [ebp - 24], esi + mov dword ptr [ebp - 20], eax + sub esp, 8 + lea eax, [ebp - 24] + push ebx + push eax + call _objc_msgSendSuper + add esp, 16 + mov esi, eax + test eax, eax + je LBB9_2 + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L9$pb] + lea edx, [edi + L_anon.[ID].5-L9$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov byte ptr [esi + eax], 42 + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L9$pb] + lea edx, [edi + L_anon.[ID].7-L9$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov dword ptr [esi + eax], 0 +LBB9_2: + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _class_method + .p2align 4, 0x90 +_class_method: + push ebp + mov ebp, esp + pop ebp + ret + + .globl _method + .p2align 4, 0x90 +_method: + push ebp + mov ebp, esp + pop ebp + ret + + .globl _method_bool + .p2align 4, 0x90 +_method_bool: + push ebp + mov ebp, esp + xor eax, eax + cmp byte ptr [ebp + 16], 0 + sete al + pop ebp + ret + + .globl _method_id + .p2align 4, 0x90 +_method_id: + push ebp + mov ebp, esp + push edi + push esi + call L13$pb +L13$pb: + pop edi + mov esi, dword ptr [ebp + 8] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L13$pb] + lea edx, [edi + L_anon.[ID].7-L13$pb] + push ecx + push 4 + push edx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov eax, dword ptr [esi + eax] + test eax, eax + je LBB13_1 + sub esp, 12 + push eax + call _objc_retain + add esp, 16 + jmp LBB13_3 +LBB13_1: + xor eax, eax +LBB13_3: + sub esp, 12 + push eax + call _objc_autoreleaseReturnValue + add esp, 16 + pop esi + pop edi + pop ebp + ret + + .globl _method_id_with_param + .p2align 4, 0x90 +_method_id_with_param: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 28 + call L14$pb +L14$pb: + pop edi + call SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov esi, eax + cmp byte ptr [ebp + 16], 0 + je LBB14_5 + mov ebx, dword ptr [ebp + 8] + mov dword ptr [esp], ebx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea ecx, [edi + l_anon.[ID].8-L14$pb] + mov dword ptr [esp + 12], ecx + lea ecx, [edi + L_anon.[ID].7-L14$pb] + mov dword ptr [esp + 4], ecx + mov dword ptr [esp], eax + mov dword ptr [esp + 8], 4 + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov eax, dword ptr [ebx + eax] + test eax, eax + je LBB14_2 + mov dword ptr [esp], eax + call _objc_retain + mov edi, eax + jmp LBB14_4 +LBB14_2: + xor edi, edi +LBB14_4: + mov dword ptr [esp], esi + call _objc_release + mov esi, edi +LBB14_5: + mov dword ptr [esp], esi + call _objc_autoreleaseReturnValue + add esp, 28 + pop esi + pop edi + pop ebx + pop ebp + ret + + .globl _copy_with_zone + .p2align 4, 0x90 +_copy_with_zone: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L15$pb +L15$pb: + pop edi + call _get_obj + mov esi, eax + test eax, eax + je LBB15_5 + mov eax, dword ptr [ebp + 8] + sub esp, 12 + push eax + mov ebx, eax + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea edx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + L_anon.[ID].5-L15$pb] + push edx + push 4 + push ecx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + movzx ebx, byte ptr [ebx + eax] + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].6-L15$pb] + push ecx + push 4 + lea ecx, [edi + L_anon.[ID].5-L15$pb] + push ecx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov byte ptr [esi + eax], bl + sub esp, 12 + push dword ptr [ebp + 8] + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + lea ecx, [edi + l_anon.[ID].8-L15$pb] + lea ebx, [edi + L_anon.[ID].7-L15$pb] + mov dword ptr [ebp - 16], ecx + push ecx + push 4 + push ebx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov ecx, dword ptr [ebp + 8] + mov eax, dword ptr [ecx + eax] + test eax, eax + je LBB15_2 + sub esp, 12 + push eax + call _objc_retain + add esp, 16 + mov edi, eax + jmp LBB15_4 +LBB15_2: + xor edi, edi +LBB15_4: + sub esp, 12 + push esi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + add esp, 16 + push dword ptr [ebp - 16] + push 4 + push ebx + push eax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + add esp, 16 + mov dword ptr [esi + eax], edi +LBB15_5: + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].0: + .long SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\004\000\000\000\004\000\000" + .long SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .long SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "/Users/madsmarquart/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].4: + .long l_anon.[ID].3 + .asciz "t\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].6: + .byte 5 + .space 19 + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 2, 0x0 +l_anon.[ID].8: + .byte 19 + .space 19 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].10: + .long l_anon.[ID].9 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .p2align 2, 0x0 +l_anon.[ID].12: + .byte 17 + .space 19 + + .p2align 2, 0x0 +l_anon.[ID].13: + .space 1 + .space 19 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].16: + .byte 28 + .space 3 + .long l_anon.[ID].15 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 + + .p2align 2, 0x0 +l_anon.[ID].17: + .byte 25 + .space 3 + .long l_anon.[ID].16 + .space 12 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].20: + .long l_anon.[ID].18 + .asciz "\033\000\000" + .long l_anon.[ID].19 + .asciz "0\000\000" + + .p2align 2, 0x0 +l_anon.[ID].21: + .long l_anon.[ID].11 + .asciz "\017\000\000" + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .long L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .long L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .long L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .long L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .long L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + + .section __IMPORT,__pointers,non_lazy_symbol_pointers +LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init + .long 0 +LL_OBJC_SELECTOR_REFERENCES_new$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_new + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s new file mode 100644 index 000000000..e4c0a7066 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s @@ -0,0 +1,768 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .p2align 4, 0x90 +SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0): + push rbp + mov rbp, rsp + pop rbp + ret + + .p2align 4, 0x90 +SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0): + push rbp + mov rbp, rsp + push r15 + push r14 + push r12 + push rbx + sub rsp, 64 + mov rax, qword ptr [rdi] + cmp byte ptr [rax], 0 + mov byte ptr [rax], 0 + je LBB1_3 + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + lea rdi, [rip + l_anon.[ID].11] + mov esi, 15 + mov rdx, rax + call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) + test rax, rax + je LBB1_4 + mov qword ptr [rbp - 80], rax + lea rsi, [rip + L_anon.[ID].5] + lea r9, [rip + l_anon.[ID].6] + lea rbx, [rbp - 80] + mov edx, 4 + mov ecx, 1 + mov rdi, rbx + xor r8d, r8d + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea r14, [rip + l_anon.[ID].8] + mov edx, 4 + mov ecx, 8 + mov rdi, rbx + mov r8d, 3 + mov r9, r14 + call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869] + lea r15, [rip + l_anon.[ID].1] + lea r12, [rip + l_anon.[ID].12] + lea r9, [rip + SYM(::class::{closure#0}::__objc2_dealloc, 0)] + mov rdi, rbx + mov rdx, r15 + xor ecx, ecx + mov r8, r12 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] + mov rsi, qword ptr [rax] + lea r9, [rip + _init] + mov rdi, rbx + mov rdx, r15 + xor ecx, ecx + mov r8, r14 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc] + lea r9, [rip + _class_method] + mov rdi, rbx + mov rdx, r15 + xor ecx, ecx + mov r8, r12 + call SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5] + lea r9, [rip + _method] + mov rdi, rbx + mov rdx, r15 + xor ecx, ecx + mov r8, r12 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6] + lea r12, [rip + l_anon.[ID].13] + lea r9, [rip + _method_bool] + mov ecx, 1 + mov rdi, rbx + mov rdx, r12 + mov r8, r12 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498] + lea r9, [rip + _method_id] + mov rdi, rbx + mov rdx, r15 + xor ecx, ecx + mov r8, r14 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8] + lea r9, [rip + _method_id_with_param] + mov ecx, 1 + mov rdi, rbx + mov rdx, r12 + mov r8, r14 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + lea rdi, [rip + l_anon.[ID].14] + mov esi, 9 + call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) + mov rdi, rbx + mov rsi, rax + call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) + mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9] + lea rdx, [rip + l_anon.[ID].17] + lea r9, [rip + _copy_with_zone] + mov ecx, 1 + mov rdi, rax + mov r8, r14 + call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) + mov rdi, qword ptr [rbp - 80] + call SYM(objc2::declare::ClassBuilder::register::GENERATED_ID, 0) + add rsp, 64 + pop rbx + pop r12 + pop r14 + pop r15 + pop rbp + ret +LBB1_3: + lea rdi, [rip + l_anon.[ID].2] + lea rdx, [rip + l_anon.[ID].4] + mov esi, 43 + call SYM(core::panicking::panic::GENERATED_ID, 0) +LBB1_4: + lea rax, [rip + l_anon.[ID].21] + mov qword ptr [rbp - 96], rax + lea rax, [rip + SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)] + mov qword ptr [rbp - 88], rax + lea rax, [rip + l_anon.[ID].20] + mov qword ptr [rbp - 80], rax + mov qword ptr [rbp - 72], 2 + mov qword ptr [rbp - 48], 0 + lea rax, [rbp - 96] + mov qword ptr [rbp - 64], rax + mov qword ptr [rbp - 56], 1 + lea rsi, [rip + l_anon.[ID].10] + lea rdi, [rbp - 80] + call SYM(core::panicking::panic_fmt::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): + push rbp + mov rbp, rsp + sub rsp, 16 + mov rax, qword ptr [rdi] + mov qword ptr [rbp - 8], rax + lea rdi, [rbp - 8] + call SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + add rsp, 16 + pop rbp + ret + + .p2align 4, 0x90 +SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0): + push rbp + mov rbp, rsp + mov rdx, rsi + mov rax, qword ptr [rdi] + mov rsi, qword ptr [rdi + 8] + mov rdi, rax + pop rbp + jmp SYM(::fmt::GENERATED_ID, 0) + + .globl _get_class + .p2align 4, 0x90 +_get_class: + push rbp + mov rbp, rsp + sub rsp, 16 + mov rax, qword ptr [rip + SYM(::class::REGISTER_CLASS, 0)] + cmp rax, 3 + jne LBB4_1 +LBB4_2: + lea rdi, [rip + l_anon.[ID].11] + mov esi, 15 + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + test rax, rax + je LBB4_4 + add rsp, 16 + pop rbp + ret +LBB4_1: + mov byte ptr [rbp - 1], 1 + lea rax, [rbp - 1] + mov qword ptr [rbp - 16], rax + lea rdi, [rip + SYM(::class::REGISTER_CLASS, 0)] + lea rcx, [rip + l_anon.[ID].0] + lea r8, [rip + l_anon.[ID].10] + lea rdx, [rbp - 16] + xor esi, esi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + jmp LBB4_2 +LBB4_4: + lea rdi, [rip + l_anon.[ID].2] + lea rdx, [rip + l_anon.[ID].10] + mov esi, 43 + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .globl _get_obj + .p2align 4, 0x90 +_get_obj: + push rbp + mov rbp, rsp + push rbx + push rax + mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_new@GOTPCREL] + mov rbx, qword ptr [rax] + call _get_class + mov rdi, rax + mov rsi, rbx + add rsp, 8 + pop rbx + pop rbp + jmp _objc_msgSend + + .globl _access_ivars + .p2align 4, 0x90 +_access_ivars: + push rbp + mov rbp, rsp + push r15 + push r14 + push rbx + push rax + call _get_obj + mov rbx, rax + mov rdi, rax + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].5] + lea rcx, [rip + l_anon.[ID].6] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + movzx r14d, byte ptr [rbx + rax] + mov rdi, rbx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov r15, qword ptr [rbx + rax] + mov rdi, rbx + call _objc_release + mov eax, r14d + mov rdx, r15 + add rsp, 8 + pop rbx + pop r14 + pop r15 + pop rbp + ret + + .globl SYM(::class, 0) + .p2align 4, 0x90 +SYM(::class, 0): + push rbp + mov rbp, rsp + sub rsp, 16 + mov rax, qword ptr [rip + SYM(::class::REGISTER_CLASS, 0)] + cmp rax, 3 + jne LBB7_1 +LBB7_2: + lea rdi, [rip + l_anon.[ID].11] + mov esi, 15 + call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) + test rax, rax + je LBB7_4 + add rsp, 16 + pop rbp + ret +LBB7_1: + mov byte ptr [rbp - 1], 1 + lea rax, [rbp - 1] + mov qword ptr [rbp - 16], rax + lea rdi, [rip + SYM(::class::REGISTER_CLASS, 0)] + lea rcx, [rip + l_anon.[ID].0] + lea r8, [rip + l_anon.[ID].10] + lea rdx, [rbp - 16] + xor esi, esi + call SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) + jmp LBB7_2 +LBB7_4: + lea rdi, [rip + l_anon.[ID].2] + lea rdx, [rip + l_anon.[ID].10] + mov esi, 43 + call SYM(core::panicking::panic::GENERATED_ID, 0) + + .p2align 4, 0x90 +SYM(::class::{closure#0}::__objc2_dealloc, 0): + push rbp + mov rbp, rsp + push r14 + push rbx + sub rsp, 16 + mov rbx, rsi + mov r14, rdi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov rdi, qword ptr [r14 + rax] + test rdi, rdi + je LBB8_2 + call _objc_release +LBB8_2: + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov qword ptr [rbp - 32], r14 + mov qword ptr [rbp - 24], rax + lea rdi, [rbp - 32] + mov rsi, rbx + call _objc_msgSendSuper + add rsp, 16 + pop rbx + pop r14 + pop rbp + ret + + .globl _init + .p2align 4, 0x90 +_init: + push rbp + mov rbp, rsp + push r14 + push rbx + sub rsp, 16 + mov rbx, rdi + mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] + mov r14, qword ptr [rax] + call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov qword ptr [rbp - 32], rbx + mov qword ptr [rbp - 24], rax + lea rdi, [rbp - 32] + mov rsi, r14 + call _objc_msgSendSuper + mov rbx, rax + test rax, rax + je LBB9_2 + mov rdi, rbx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].5] + lea rcx, [rip + l_anon.[ID].6] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov byte ptr [rbx + rax], 42 + mov rdi, rbx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov qword ptr [rbx + rax], 0 +LBB9_2: + mov rax, rbx + add rsp, 16 + pop rbx + pop r14 + pop rbp + ret + + .globl _class_method + .p2align 4, 0x90 +_class_method: + push rbp + mov rbp, rsp + pop rbp + ret + + .globl _method + .p2align 4, 0x90 +_method: + push rbp + mov rbp, rsp + pop rbp + ret + + .globl _method_bool + .p2align 4, 0x90 +_method_bool: + push rbp + mov rbp, rsp + xor eax, eax + test dl, dl + sete al + pop rbp + ret + + .globl _method_id + .p2align 4, 0x90 +_method_id: + push rbp + mov rbp, rsp + push rbx + push rax + mov rbx, rdi + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov rdi, qword ptr [rbx + rax] + test rdi, rdi + je LBB13_1 + call _objc_retain + mov rdi, rax + add rsp, 8 + pop rbx + pop rbp + jmp _objc_autoreleaseReturnValue +LBB13_1: + xor edi, edi + add rsp, 8 + pop rbx + pop rbp + jmp _objc_autoreleaseReturnValue + + .globl _method_id_with_param + .p2align 4, 0x90 +_method_id_with_param: + push rbp + mov rbp, rsp + push r15 + push r14 + push rbx + push rax + mov r15d, edx + mov r14, rdi + call SYM(objc2::runtime::nsobject::NSObject::new::GENERATED_ID, 0) + mov rbx, rax + test r15b, r15b + je LBB14_5 + mov rdi, r14 + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov rdi, qword ptr [r14 + rax] + test rdi, rdi + je LBB14_2 + call _objc_retain + mov r14, rax + jmp LBB14_4 +LBB14_2: + xor r14d, r14d +LBB14_4: + mov rdi, rbx + call _objc_release + mov rbx, r14 +LBB14_5: + mov rdi, rbx + add rsp, 8 + pop rbx + pop r14 + pop r15 + pop rbp + jmp _objc_autoreleaseReturnValue + + .globl _copy_with_zone + .p2align 4, 0x90 +_copy_with_zone: + push rbp + mov rbp, rsp + push r15 + push r14 + push r13 + push r12 + push rbx + push rax + mov r14, rdi + call _get_obj + mov rbx, rax + test rax, rax + je LBB15_5 + mov rdi, r14 + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea r15, [rip + L_anon.[ID].5] + lea r12, [rip + l_anon.[ID].6] + mov edx, 4 + mov rdi, rax + mov rsi, r15 + mov rcx, r12 + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + movzx r13d, byte ptr [r14 + rax] + mov rdi, rbx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + mov edx, 4 + mov rdi, rax + mov rsi, r15 + mov rcx, r12 + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov byte ptr [rbx + rax], r13b + mov rdi, r14 + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov rdi, qword ptr [r14 + rax] + test rdi, rdi + je LBB15_2 + call _objc_retain + mov r14, rax + jmp LBB15_4 +LBB15_2: + xor r14d, r14d +LBB15_4: + mov rdi, rbx + call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) + lea rsi, [rip + L_anon.[ID].7] + lea rcx, [rip + l_anon.[ID].8] + mov edx, 4 + mov rdi, rax + call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) + mov qword ptr [rbx + rax], r14 +LBB15_5: + mov rax, rbx + add rsp, 8 + pop rbx + pop r12 + pop r13 + pop r14 + pop r15 + pop rbp + ret + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].0: + .quad SYM(core[CRATE_ID]::ptr::drop_in_place::<::call_once<::class::{closure#0}>::{closure#0}>, 0) + .asciz "\b\000\000\000\000\000\000\000\b\000\000\000\000\000\000" + .quad SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0) + .quad SYM(::call_once::<::class::{closure#0}>::{closure#0}, 0) + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].1: + .byte 0 + +l_anon.[ID].2: + .ascii "called `Option::unwrap()` on a `None` value" + +l_anon.[ID].3: + .ascii "$RUSTC/library/std/src/sync/once.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].4: + .quad l_anon.[ID].3 + .asciz "L\000\000\000\000\000\000\000\225\000\000\0002\000\000" + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].5: + .ascii "_foo" + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].6: + .byte 5 + .space 39 + + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].7: + .ascii "_obj" + + .section __TEXT,__const + .p2align 3, 0x0 +l_anon.[ID].8: + .byte 19 + .space 39 + +l_anon.[ID].9: + .ascii "crates/$DIR/lib.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].10: + .quad l_anon.[ID].9 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const +l_anon.[ID].11: + .ascii "CustomClassName" + +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 + .p2align 3, 0x0 +l_anon.[ID].12: + .byte 17 + .space 39 + + .p2align 3, 0x0 +l_anon.[ID].13: + .space 1 + .space 39 + +l_anon.[ID].14: + .ascii "NSCopying" + +l_anon.[ID].15: + .ascii "_NSZone" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].16: + .byte 28 + .space 7 + .quad l_anon.[ID].15 + .asciz "\007\000\000\000\000\000\000" + .quad l_anon.[ID].1 + .space 8 + + .p2align 3, 0x0 +l_anon.[ID].17: + .byte 25 + .space 7 + .quad l_anon.[ID].16 + .space 24 + + .section __TEXT,__const +l_anon.[ID].18: + .ascii "could not create new class " + +l_anon.[ID].19: + .ascii ". Perhaps a class with that name already exists?" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].20: + .quad l_anon.[ID].18 + .asciz "\033\000\000\000\000\000\000" + .quad l_anon.[ID].19 + .asciz "0\000\000\000\000\000\000" + + .p2align 3, 0x0 +l_anon.[ID].21: + .quad l_anon.[ID].11 + .asciz "\017\000\000\000\000\000\000" + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_694e247a0bc88869: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 +L_OBJC_METH_VAR_NAME_694e247a0bc88869: + .asciz "dealloc" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: + .quad L_OBJC_METH_VAR_NAME_694e247a0bc88869 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc +L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc: + .asciz "classMethod" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc: + .quad L_OBJC_METH_VAR_NAME_8dd788dbcc16b9bc + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_450db9db0953dff5 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_450db9db0953dff5: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_450db9db0953dff5 +L_OBJC_METH_VAR_NAME_450db9db0953dff5: + .asciz "method" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5: + .quad L_OBJC_METH_VAR_NAME_450db9db0953dff5 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_783b35bc45c6e4a6 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_783b35bc45c6e4a6: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 +L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6: + .asciz "methodBool:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6: + .quad L_OBJC_METH_VAR_NAME_783b35bc45c6e4a6 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_828e9fbc6d0b4498 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_828e9fbc6d0b4498: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 +L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498: + .asciz "methodId" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498: + .quad L_OBJC_METH_VAR_NAME_828e9fbc6d0b4498 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_788cc14ba6a28eb8 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_788cc14ba6a28eb8: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 +L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8: + .asciz "methodIdWithParam:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8: + .quad L_OBJC_METH_VAR_NAME_788cc14ba6a28eb8 + + .section __DATA,__objc_imageinfo,regular,no_dead_strip + .globl L_OBJC_IMAGE_INFO_f058a81939de2cb9 + .p2align 2, 0x0 +L_OBJC_IMAGE_INFO_f058a81939de2cb9: + .asciz "\000\000\000\000@\000\000" + + .section __TEXT,__objc_methname,cstring_literals + .globl L_OBJC_METH_VAR_NAME_f058a81939de2cb9 +L_OBJC_METH_VAR_NAME_f058a81939de2cb9: + .asciz "copyWithZone:" + + .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip + .globl L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9 + .p2align 3, 0x0 +L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: + .quad L_OBJC_METH_VAR_NAME_f058a81939de2cb9 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86.s b/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86_64.s b/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86_64.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/expected/gnustep-x86_64.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_declare_class/lib.rs b/crates/test-assembly/crates/test_declare_class/lib.rs new file mode 100644 index 000000000..cdaf26188 --- /dev/null +++ b/crates/test-assembly/crates/test_declare_class/lib.rs @@ -0,0 +1,114 @@ +//! Test assembly output of `declare_class!`. +#![deny(unsafe_op_in_unsafe_fn)] +#![cfg(feature = "apple")] +use core::ptr::{self}; + +use objc2::declare::{Ivar, IvarDrop, IvarEncode}; +use objc2::rc::Id; +use objc2::runtime::{AnyClass, NSObject, NSZone, __NSCopying as NSCopying}; +use objc2::{declare_class, msg_send, msg_send_id, mutability, ClassType}; + +declare_class!( + #[no_mangle] + pub struct Custom { + foo: IvarEncode, + obj: IvarDrop>, "_obj">, + } + + mod ivars; + + unsafe impl ClassType for Custom { + type Super = NSObject; + type Mutability = mutability::InteriorMutable; + const NAME: &'static str = "CustomClassName"; + } + + unsafe impl Custom { + #[no_mangle] + #[method(init)] + unsafe fn init(this: *mut Self) -> *mut Self { + let this: Option<&mut Self> = unsafe { msg_send![super(this), init] }; + + this.map(|this| { + Ivar::write(&mut this.foo, 42); + Ivar::write(&mut this.obj, None); + let this: *mut Self = this; + this + }) + .unwrap_or_else(ptr::null_mut) + } + + #[no_mangle] + #[method(classMethod)] + fn class_method() {} + + #[no_mangle] + #[method(method)] + fn method(&self) {} + + #[no_mangle] + #[method(methodBool:)] + fn method_bool(&self, val: bool) -> bool { + !val + } + + #[no_mangle] + #[method_id(methodId)] + fn method_id(&self) -> Option> { + self.obj.clone() + } + + // Test that `objc_autoreleaseReturnValue` is tail-called + #[no_mangle] + #[method_id(methodIdWithParam:)] + fn method_id_with_param(&self, param: bool) -> Option> { + // Explicitly create outside condition + let obj = NSObject::new(); + if param { + self.obj.clone() + } else { + Some(obj) + } + } + } + + unsafe impl NSCopying for Custom { + #[no_mangle] + #[method_id(copyWithZone:)] + fn copy_with_zone(&self, _zone: *const NSZone) -> Option> { + get_obj().map(|new| { + let hack = Id::as_ptr(&new) as *mut Self; + let hack = unsafe { &mut *hack }; + + Ivar::write(&mut hack.foo, *self.foo); + Ivar::write(&mut hack.obj, self.obj.clone()); + new + }) + } + } +); + +#[no_mangle] +#[inline(never)] +pub fn get_class() -> &'static AnyClass { + Custom::class() +} + +#[no_mangle] +#[inline(never)] +pub fn get_obj() -> Option> { + unsafe { msg_send_id![get_class(), new] } +} + +#[no_mangle] +#[inline(never)] +pub fn access_ivars() -> (u8, *const NSObject) { + let obj = unsafe { get_obj().unwrap_unchecked() }; + ( + *obj.foo, + (*obj.obj) + .as_ref() + .map(|obj| Id::as_ptr(&obj)) + .unwrap_or_else(ptr::null), + ) +} diff --git a/crates/test-assembly/src/lib.rs b/crates/test-assembly/src/lib.rs index 84252bee1..9208c67d1 100644 --- a/crates/test-assembly/src/lib.rs +++ b/crates/test-assembly/src/lib.rs @@ -76,6 +76,9 @@ pub fn read_assembly>(path: P, package_path: &Path) -> io::Result .unwrap(), "$DIR", ); + let s = regex::Regex::new(r"/rustc/[0-9a-f]*/") + .unwrap() + .replace_all(&s, |_: ®ex::Captures| "$RUSTC/"); // HACK: Replace Objective-C image info for simulator targets let s = s.replace( ".asciz\t\"\\000\\000\\000\\000`\\000\\000\"", From efeaa0d716ed35491095512ee6152fe33f46e408 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 23 Jun 2023 14:26:51 +0300 Subject: [PATCH 3/4] Optimize `sel!` and `class!` assembly in the normal, dynamic case --- Cargo.lock | 14 + crates/objc2/src/__macro_helpers/cache.rs | 78 +++- crates/objc2/src/macros/mod.rs | 26 +- crates/objc2/src/runtime/mod.rs | 4 +- crates/objc2/tests/track_caller.rs | 11 + .../crates/test_dynamic_class/Cargo.toml | 25 ++ .../expected/apple-aarch64.s | 419 ++++++++++++++++++ .../test_dynamic_class/expected/apple-armv7.s | 354 +++++++++++++++ .../expected/apple-armv7s.s | 366 +++++++++++++++ .../test_dynamic_class/expected/apple-x86.s | 380 ++++++++++++++++ .../expected/apple-x86_64.s | 280 ++++++++++++ .../test_dynamic_class/expected/gnustep-x86.s | 3 + .../expected/gnustep-x86_64.s | 3 + .../crates/test_dynamic_sel/Cargo.toml | 25 ++ .../test_dynamic_sel/expected/apple-aarch64.s | 377 ++++++++++++++++ .../test_dynamic_sel/expected/apple-armv7.s | 324 ++++++++++++++ .../test_dynamic_sel/expected/apple-armv7s.s | 335 ++++++++++++++ .../test_dynamic_sel/expected/apple-x86.s | 374 ++++++++++++++++ .../test_dynamic_sel/expected/apple-x86_64.s | 266 +++++++++++ .../test_dynamic_sel/expected/gnustep-x86.s | 3 + .../expected/gnustep-x86_64.s | 3 + .../expected/apple-aarch64.s | 151 ++++--- .../expected/apple-armv7.s | 93 ++-- .../expected/apple-armv7s.s | 93 ++-- .../expected/apple-x86.s | 89 ++-- .../expected/apple-x86_64.s | 74 ++-- .../expected/gnustep-x86.s | 139 +++--- .../expected/gnustep-x86_64.s | 114 ++--- .../expected/apple-aarch64.s | 32 +- .../test_static_class/expected/apple-armv7.s | 32 +- .../test_static_class/expected/apple-armv7s.s | 32 +- .../expected/apple-old-x86.s | 78 ++-- .../test_static_class/expected/apple-x86.s | 30 +- .../test_static_class/expected/apple-x86_64.s | 30 +- .../crates/test_static_class/lib.rs | 2 +- 35 files changed, 4155 insertions(+), 504 deletions(-) create mode 100644 crates/test-assembly/crates/test_dynamic_class/Cargo.toml create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-aarch64.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7s.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-x86.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/apple-x86_64.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86.s create mode 100644 crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86_64.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/Cargo.toml create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86.s create mode 100644 crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86_64.s diff --git a/Cargo.lock b/Cargo.lock index d20f44cc3..ad6a23895 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -493,6 +493,20 @@ dependencies = [ "objc2", ] +[[package]] +name = "test_dynamic_class" +version = "0.1.0" +dependencies = [ + "objc2", +] + +[[package]] +name = "test_dynamic_sel" +version = "0.1.0" +dependencies = [ + "objc2", +] + [[package]] name = "test_extern_protocol" version = "0.1.0" diff --git a/crates/objc2/src/__macro_helpers/cache.rs b/crates/objc2/src/__macro_helpers/cache.rs index 3b3c81d17..32d6cf0bd 100644 --- a/crates/objc2/src/__macro_helpers/cache.rs +++ b/crates/objc2/src/__macro_helpers/cache.rs @@ -1,11 +1,13 @@ use core::ptr; +use core::str; use core::sync::atomic::{AtomicPtr, Ordering}; +use std::ffi::CStr; +use std::os::raw::c_char; use crate::ffi; use crate::runtime::{AnyClass, Sel}; /// Allows storing a [`Sel`] in a static and lazily loading it. -#[doc(hidden)] pub struct CachedSel { ptr: AtomicPtr, } @@ -18,30 +20,38 @@ impl CachedSel { } } + // Mark as cold since this should only ever be called once (or maybe twice + // if running on multiple threads). + #[cold] + unsafe fn fetch(&self, name: *const c_char) -> Sel { + // The panic inside `Sel::register_unchecked` is unfortunate, but + // strict correctness is more important than speed + + // SAFETY: Input is a non-null, NUL-terminated C-string pointer. + // + // We know this, because we construct it in `sel!` ourselves + let sel = unsafe { Sel::register_unchecked(name) }; + self.ptr + .store(sel.as_ptr() as *mut ffi::objc_selector, Ordering::Relaxed); + sel + } + /// Returns the cached selector. If no selector is yet cached, registers /// one with the given name and stores it. #[inline] - #[doc(hidden)] pub unsafe fn get(&self, name: &str) -> Sel { // `Relaxed` should be fine since `sel_registerName` is thread-safe. let ptr = self.ptr.load(Ordering::Relaxed); - unsafe { Sel::from_ptr(ptr) }.unwrap_or_else(|| { - // The panic inside `Sel::register_unchecked` is unfortunate, but - // strict correctness is more important than speed - - // SAFETY: Input is a non-null, NUL-terminated C-string pointer. - // - // We know this, because we construct it in `sel!` ourselves - let sel = unsafe { Sel::register_unchecked(name.as_ptr().cast()) }; - self.ptr - .store(sel.as_ptr() as *mut ffi::objc_selector, Ordering::Relaxed); + if let Some(sel) = unsafe { Sel::from_ptr(ptr) } { sel - }) + } else { + // SAFETY: Checked by caller + unsafe { self.fetch(name.as_ptr().cast()) } + } } } /// Allows storing a [`AnyClass`] reference in a static and lazily loading it. -#[doc(hidden)] pub struct CachedClass { ptr: AtomicPtr, } @@ -54,19 +64,47 @@ impl CachedClass { } } + // Mark as cold since this should only ever be called once (or maybe twice + // if running on multiple threads). + #[cold] + #[track_caller] + unsafe fn fetch(&self, name: *const c_char) -> &'static AnyClass { + let ptr: *const AnyClass = unsafe { ffi::objc_getClass(name) }.cast(); + self.ptr.store(ptr as *mut AnyClass, Ordering::Relaxed); + if let Some(cls) = unsafe { ptr.as_ref() } { + cls + } else { + // Recover the name from the pointer. We do it like this so that + // we don't have to pass the length of the class to this method, + // improving binary size. + let name = unsafe { CStr::from_ptr(name) }; + let name = str::from_utf8(name.to_bytes()).unwrap(); + panic!("class {name} could not be found") + } + } + /// Returns the cached class. If no class is yet cached, gets one with /// the given name and stores it. #[inline] - #[doc(hidden)] - pub unsafe fn get(&self, name: &str) -> Option<&'static AnyClass> { + #[track_caller] + pub unsafe fn get(&self, name: &str) -> &'static AnyClass { // `Relaxed` should be fine since `objc_getClass` is thread-safe. let ptr = self.ptr.load(Ordering::Relaxed); if let Some(cls) = unsafe { ptr.as_ref() } { - Some(cls) + cls } else { - let ptr: *const AnyClass = unsafe { ffi::objc_getClass(name.as_ptr().cast()) }.cast(); - self.ptr.store(ptr as *mut AnyClass, Ordering::Relaxed); - unsafe { ptr.as_ref() } + // SAFETY: Checked by caller + unsafe { self.fetch(name.as_ptr().cast()) } } } } + +#[cfg(test)] +mod tests { + #[test] + #[should_panic = "class NonExistantClass could not be found"] + #[cfg(not(feature = "unstable-static-class"))] + fn test_not_found() { + let _ = crate::class!(NonExistantClass); + } +} diff --git a/crates/objc2/src/macros/mod.rs b/crates/objc2/src/macros/mod.rs index cf980ae85..913ee87e1 100644 --- a/crates/objc2/src/macros/mod.rs +++ b/crates/objc2/src/macros/mod.rs @@ -47,7 +47,7 @@ mod extern_protocol; /// [`sel!`]: crate::sel /// /// -/// # Example +/// # Examples /// /// Get and compare the class with one returned from [`ClassType::class`]. /// @@ -59,6 +59,15 @@ mod extern_protocol; /// let cls2 = NSObject::class(); /// assert_eq!(cls1, cls2); /// ``` +/// +/// Try to get a non-existing class. +/// +#[cfg_attr(not(feature = "unstable-static-class"), doc = "```should_panic")] +#[cfg_attr(feature = "unstable-static-class", doc = "```ignore")] +/// use objc2::class; +/// +/// let _ = class!(NonExistantClass); +/// ``` #[macro_export] macro_rules! class { ($name:ident) => {{ @@ -74,14 +83,11 @@ macro_rules! class { #[cfg(not(feature = "unstable-static-class"))] macro_rules! __class_inner { ($name:expr, $_hash:expr,) => {{ - use $crate::__macro_helpers::{concat, panic, CachedClass, None, Some}; - static CACHED_CLASS: CachedClass = CachedClass::new(); - let name = concat!($name, '\0'); + static CACHED_CLASS: $crate::__macro_helpers::CachedClass = + $crate::__macro_helpers::CachedClass::new(); #[allow(unused_unsafe)] - let cls = unsafe { CACHED_CLASS.get(name) }; - match cls { - Some(cls) => cls, - None => panic!("Class with name {} could not be found", $name), + unsafe { + CACHED_CLASS.get($crate::__macro_helpers::concat!($name, '\0')) } }}; } @@ -307,8 +313,8 @@ macro_rules! __sel_data { #[cfg(not(feature = "unstable-static-sel"))] macro_rules! __sel_inner { ($data:expr, $_hash:expr) => {{ - use $crate::__macro_helpers::CachedSel; - static CACHED_SEL: CachedSel = CachedSel::new(); + static CACHED_SEL: $crate::__macro_helpers::CachedSel = + $crate::__macro_helpers::CachedSel::new(); #[allow(unused_unsafe)] unsafe { CACHED_SEL.get($data) diff --git a/crates/objc2/src/runtime/mod.rs b/crates/objc2/src/runtime/mod.rs index ab3705afa..dea556e39 100644 --- a/crates/objc2/src/runtime/mod.rs +++ b/crates/objc2/src/runtime/mod.rs @@ -167,6 +167,8 @@ impl Sel { self.ptr.as_ptr() } + // We explicitly don't do #[track_caller] here, since we expect the error + // to never actually happen. pub(crate) unsafe fn register_unchecked(name: *const c_char) -> Self { let ptr = unsafe { ffi::sel_registerName(name) }; // SAFETY: `sel_registerName` declares return type as `SEL _Nonnull`, @@ -180,7 +182,7 @@ impl Sel { // I suspect this will be really uncommon in practice, since the // called selector is almost always going to be present in the binary // already; but alas, we'll handle it! - unsafe { Self::from_ptr(ptr).unwrap() } + unsafe { Self::from_ptr(ptr).expect("failed allocating selector") } } /// Registers a selector with the Objective-C runtime. diff --git a/crates/objc2/tests/track_caller.rs b/crates/objc2/tests/track_caller.rs index 0f2b0e060..8c8640ede 100644 --- a/crates/objc2/tests/track_caller.rs +++ b/crates/objc2/tests/track_caller.rs @@ -85,6 +85,9 @@ fn test_track_caller() { test_catch_all(&checker); test_unwind(&checker); + + #[cfg(not(feature = "unstable-static-class"))] + test_unknown_class(&checker); } pub fn test_nil(checker: &PanicChecker) { @@ -212,3 +215,11 @@ pub fn test_unwind(checker: &PanicChecker) { let _: Id = unsafe { msg_send_id![PanickingClass::class(), panic] }; }); } + +#[cfg(not(feature = "unstable-static-class"))] +pub fn test_unknown_class(checker: &PanicChecker) { + let msg = "class NonExistantClass could not be found"; + checker.assert_panics(msg, line!() + 1, || { + let _ = class!(NonExistantClass); + }); +} diff --git a/crates/test-assembly/crates/test_dynamic_class/Cargo.toml b/crates/test-assembly/crates/test_dynamic_class/Cargo.toml new file mode 100644 index 000000000..756a2c4b3 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "test_dynamic_class" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +path = "../test_static_class/lib.rs" + +[dependencies] +objc2 = { path = "../../../objc2", default-features = false } + +[features] +default = ["apple", "std"] +std = ["objc2/std"] +# Runtime +apple = ["objc2/apple"] +gnustep-1-7 = ["objc2/gnustep-1-7"] +gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] +gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] +gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] +gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] + +# Hack to prevent the feature flag from being enabled in the entire project +assembly-features = [] diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-aarch64.s new file mode 100644 index 000000000..4b28f1a3f --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/apple-aarch64.s @@ -0,0 +1,419 @@ + .section __TEXT,__text,regular,pure_instructions + .globl _get_class + .p2align 2 +_get_class: +Lloh0: + adrp x8, __MergedGlobals@PAGE +Lloh1: + ldr x0, [x8, __MergedGlobals@PAGEOFF] + cbz x0, LBB0_2 + ret +LBB0_2: +Lloh2: + adrp x0, __MergedGlobals@PAGE +Lloh3: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh4: + adrp x1, l_anon.[ID].0@PAGE +Lloh5: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh6: + adrp x2, l_anon.[ID].2@PAGE +Lloh7: + add x2, x2, l_anon.[ID].2@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh0, Lloh1 + .loh AdrpAdd Lloh6, Lloh7 + .loh AdrpAdd Lloh4, Lloh5 + .loh AdrpAdd Lloh2, Lloh3 + + .globl _get_same_class + .p2align 2 +_get_same_class: +Lloh8: + adrp x8, __MergedGlobals@PAGE+8 +Lloh9: + ldr x0, [x8, __MergedGlobals@PAGEOFF+8] + cbz x0, LBB1_2 + ret +LBB1_2: +Lloh10: + adrp x0, __MergedGlobals@PAGE+8 +Lloh11: + add x0, x0, __MergedGlobals@PAGEOFF+8 +Lloh12: + adrp x1, l_anon.[ID].0@PAGE +Lloh13: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh14: + adrp x2, l_anon.[ID].3@PAGE +Lloh15: + add x2, x2, l_anon.[ID].3@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh8, Lloh9 + .loh AdrpAdd Lloh14, Lloh15 + .loh AdrpAdd Lloh12, Lloh13 + .loh AdrpAdd Lloh10, Lloh11 + + .globl _get_different_class + .p2align 2 +_get_different_class: +Lloh16: + adrp x8, __MergedGlobals@PAGE+16 +Lloh17: + ldr x0, [x8, __MergedGlobals@PAGEOFF+16] + cbz x0, LBB2_2 + ret +LBB2_2: +Lloh18: + adrp x0, __MergedGlobals@PAGE+16 +Lloh19: + add x0, x0, __MergedGlobals@PAGEOFF+16 +Lloh20: + adrp x1, l_anon.[ID].4@PAGE +Lloh21: + add x1, x1, l_anon.[ID].4@PAGEOFF +Lloh22: + adrp x2, l_anon.[ID].5@PAGE +Lloh23: + add x2, x2, l_anon.[ID].5@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh16, Lloh17 + .loh AdrpAdd Lloh22, Lloh23 + .loh AdrpAdd Lloh20, Lloh21 + .loh AdrpAdd Lloh18, Lloh19 + + .globl _unused_class + .p2align 2 +_unused_class: +Lloh24: + adrp x8, SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)@PAGE +Lloh25: + ldr x8, [x8, SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)@PAGEOFF] + cbz x8, LBB3_2 + ret +LBB3_2: +Lloh26: + adrp x0, SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)@PAGE +Lloh27: + add x0, x0, SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)@PAGEOFF +Lloh28: + adrp x1, l_anon.[ID].6@PAGE +Lloh29: + add x1, x1, l_anon.[ID].6@PAGEOFF +Lloh30: + adrp x2, l_anon.[ID].7@PAGE +Lloh31: + add x2, x2, l_anon.[ID].7@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh24, Lloh25 + .loh AdrpAdd Lloh30, Lloh31 + .loh AdrpAdd Lloh28, Lloh29 + .loh AdrpAdd Lloh26, Lloh27 + + .globl _use_fns + .p2align 2 +_use_fns: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x8 +Lloh32: + adrp x8, __MergedGlobals@PAGE +Lloh33: + ldr x20, [x8, __MergedGlobals@PAGEOFF] + cbz x20, LBB4_5 +Lloh34: + adrp x8, __MergedGlobals@PAGE+8 +Lloh35: + ldr x21, [x8, __MergedGlobals@PAGEOFF+8] + cbz x21, LBB4_6 +LBB4_2: +Lloh36: + adrp x8, __MergedGlobals@PAGE+16 +Lloh37: + ldr x22, [x8, __MergedGlobals@PAGEOFF+16] + cbz x22, LBB4_7 +LBB4_3: +Lloh38: + adrp x8, __MergedGlobals@PAGE+24 +Lloh39: + ldr x0, [x8, __MergedGlobals@PAGEOFF+24] + cbz x0, LBB4_8 +LBB4_4: + stp x20, x21, [x19] + stp x22, x0, [x19, #16] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret +LBB4_5: +Lloh40: + adrp x0, __MergedGlobals@PAGE +Lloh41: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh42: + adrp x1, l_anon.[ID].0@PAGE +Lloh43: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh44: + adrp x2, l_anon.[ID].2@PAGE +Lloh45: + add x2, x2, l_anon.[ID].2@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov x20, x0 +Lloh46: + adrp x8, __MergedGlobals@PAGE+8 +Lloh47: + ldr x21, [x8, __MergedGlobals@PAGEOFF+8] + cbnz x21, LBB4_2 +LBB4_6: +Lloh48: + adrp x0, __MergedGlobals@PAGE+8 +Lloh49: + add x0, x0, __MergedGlobals@PAGEOFF+8 +Lloh50: + adrp x1, l_anon.[ID].0@PAGE +Lloh51: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh52: + adrp x2, l_anon.[ID].3@PAGE +Lloh53: + add x2, x2, l_anon.[ID].3@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov x21, x0 +Lloh54: + adrp x8, __MergedGlobals@PAGE+16 +Lloh55: + ldr x22, [x8, __MergedGlobals@PAGEOFF+16] + cbnz x22, LBB4_3 +LBB4_7: +Lloh56: + adrp x0, __MergedGlobals@PAGE+16 +Lloh57: + add x0, x0, __MergedGlobals@PAGEOFF+16 +Lloh58: + adrp x1, l_anon.[ID].4@PAGE +Lloh59: + add x1, x1, l_anon.[ID].4@PAGEOFF +Lloh60: + adrp x2, l_anon.[ID].5@PAGE +Lloh61: + add x2, x2, l_anon.[ID].5@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov x22, x0 +Lloh62: + adrp x8, __MergedGlobals@PAGE+24 +Lloh63: + ldr x0, [x8, __MergedGlobals@PAGEOFF+24] + cbnz x0, LBB4_4 +LBB4_8: +Lloh64: + adrp x0, __MergedGlobals@PAGE+24 +Lloh65: + add x0, x0, __MergedGlobals@PAGEOFF+24 +Lloh66: + adrp x1, l_anon.[ID].8@PAGE +Lloh67: + add x1, x1, l_anon.[ID].8@PAGEOFF +Lloh68: + adrp x2, l_anon.[ID].9@PAGE +Lloh69: + add x2, x2, l_anon.[ID].9@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + stp x20, x21, [x19] + stp x22, x0, [x19, #16] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpLdr Lloh32, Lloh33 + .loh AdrpLdr Lloh34, Lloh35 + .loh AdrpLdr Lloh36, Lloh37 + .loh AdrpLdr Lloh38, Lloh39 + .loh AdrpLdr Lloh46, Lloh47 + .loh AdrpAdd Lloh44, Lloh45 + .loh AdrpAdd Lloh42, Lloh43 + .loh AdrpAdd Lloh40, Lloh41 + .loh AdrpLdr Lloh54, Lloh55 + .loh AdrpAdd Lloh52, Lloh53 + .loh AdrpAdd Lloh50, Lloh51 + .loh AdrpAdd Lloh48, Lloh49 + .loh AdrpLdr Lloh62, Lloh63 + .loh AdrpAdd Lloh60, Lloh61 + .loh AdrpAdd Lloh58, Lloh59 + .loh AdrpAdd Lloh56, Lloh57 + .loh AdrpAdd Lloh68, Lloh69 + .loh AdrpAdd Lloh66, Lloh67 + .loh AdrpAdd Lloh64, Lloh65 + + .globl _use_same_twice + .p2align 2 +_use_same_twice: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x8 + adrp x21, __MergedGlobals@PAGE + ldr x20, [x21, __MergedGlobals@PAGEOFF] + cbz x20, LBB5_3 + ldr x0, [x21, __MergedGlobals@PAGEOFF] + cbz x0, LBB5_4 +LBB5_2: + stp x20, x0, [x19] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret +LBB5_3: +Lloh70: + adrp x0, __MergedGlobals@PAGE +Lloh71: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh72: + adrp x1, l_anon.[ID].0@PAGE +Lloh73: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh74: + adrp x2, l_anon.[ID].2@PAGE +Lloh75: + add x2, x2, l_anon.[ID].2@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov x20, x0 + ldr x0, [x21, __MergedGlobals@PAGEOFF] + cbnz x0, LBB5_2 +LBB5_4: +Lloh76: + adrp x0, __MergedGlobals@PAGE +Lloh77: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh78: + adrp x1, l_anon.[ID].0@PAGE +Lloh79: + add x1, x1, l_anon.[ID].0@PAGEOFF +Lloh80: + adrp x2, l_anon.[ID].2@PAGE +Lloh81: + add x2, x2, l_anon.[ID].2@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + stp x20, x0, [x19] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpAdd Lloh74, Lloh75 + .loh AdrpAdd Lloh72, Lloh73 + .loh AdrpAdd Lloh70, Lloh71 + .loh AdrpAdd Lloh80, Lloh81 + .loh AdrpAdd Lloh78, Lloh79 + .loh AdrpAdd Lloh76, Lloh77 + + .globl _use_in_loop + .p2align 2 +_use_in_loop: + stp x24, x23, [sp, #-64]! + stp x22, x21, [sp, #16] + stp x20, x19, [sp, #32] + stp x29, x30, [sp, #48] + add x29, sp, #48 + cbz x0, LBB6_5 + mov x19, x0 + adrp x23, SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)@PAGE +Lloh82: + adrp x20, SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)@PAGE +Lloh83: + add x20, x20, SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)@PAGEOFF +Lloh84: + adrp x21, l_anon.[ID].10@PAGE +Lloh85: + add x21, x21, l_anon.[ID].10@PAGEOFF +Lloh86: + adrp x22, l_anon.[ID].11@PAGE +Lloh87: + add x22, x22, l_anon.[ID].11@PAGEOFF + b LBB6_3 +LBB6_2: + subs x19, x19, #1 + b.eq LBB6_5 +LBB6_3: + ldr x8, [x23, SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)@PAGEOFF] + cbnz x8, LBB6_2 + mov x0, x20 + mov x1, x21 + mov x2, x22 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + b LBB6_2 +LBB6_5: + ldp x29, x30, [sp, #48] + ldp x20, x19, [sp, #32] + ldp x22, x21, [sp, #16] + ldp x24, x23, [sp], #64 + ret + .loh AdrpAdd Lloh86, Lloh87 + .loh AdrpAdd Lloh84, Lloh85 + .loh AdrpAdd Lloh82, Lloh83 + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "NSObject" + +l_anon.[ID].1: + .ascii "crates/$DIR/../test_static_class/lib.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].2: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\b\000\000\000\005\000\000" + + .p2align 3, 0x0 +l_anon.[ID].3: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\r\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].4: + .asciz "NSString" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].5: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\022\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].6: + .asciz "NSData" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].7: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\027\000\000\000\r\000\000" + + .section __TEXT,__const +l_anon.[ID].8: + .asciz "NSException" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].9: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\037\000\000\000\016\000\000" + + .section __TEXT,__const +l_anon.[ID].10: + .asciz "NSLock" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].11: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000-\000\000\000\021\000\000" + +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,__MergedGlobals,32,3 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s new file mode 100644 index 000000000..8d596d8a6 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7.s @@ -0,0 +1,354 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .globl _get_class + .p2align 2 + .code 32 +_get_class: + movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) +LPC0_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + bxne lr +LBB0_1: + movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC0_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC0_3+8)) +LPC0_1: + add r0, pc, r0 +LPC0_2: + add r1, pc, r1 +LPC0_3: + add r2, pc, r2 + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _get_same_class + .p2align 2 + .code 32 +_get_same_class: + movw r3, :lower16:(__MergedGlobals-(LPC1_0+8)) + movt r3, :upper16:(__MergedGlobals-(LPC1_0+8)) +LPC1_0: + add r3, pc, r3 + ldr r0, [r3, #4] + cmp r0, #0 + bxne lr +LBB1_1: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + add r0, r3, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) + movw r2, :lower16:(l_anon.[ID].3-(LPC1_2+8)) + movt r2, :upper16:(l_anon.[ID].3-(LPC1_2+8)) +LPC1_1: + add r1, pc, r1 +LPC1_2: + add r2, pc, r2 + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _get_different_class + .p2align 2 + .code 32 +_get_different_class: + movw r3, :lower16:(__MergedGlobals-(LPC2_0+8)) + movt r3, :upper16:(__MergedGlobals-(LPC2_0+8)) +LPC2_0: + add r3, pc, r3 + ldr r0, [r3, #8] + cmp r0, #0 + bxne lr +LBB2_1: + movw r1, :lower16:(l_anon.[ID].4-(LPC2_1+8)) + add r0, r3, #8 + movt r1, :upper16:(l_anon.[ID].4-(LPC2_1+8)) + movw r2, :lower16:(l_anon.[ID].5-(LPC2_2+8)) + movt r2, :upper16:(l_anon.[ID].5-(LPC2_2+8)) +LPC2_1: + add r1, pc, r1 +LPC2_2: + add r2, pc, r2 + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _unused_class + .p2align 2 + .code 32 +_unused_class: + movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) + movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) +LPC3_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + bxne lr +LBB3_1: + movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) + movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) + movw r1, :lower16:(l_anon.[ID].6-(LPC3_2+8)) + movt r1, :upper16:(l_anon.[ID].6-(LPC3_2+8)) + movw r2, :lower16:(l_anon.[ID].7-(LPC3_3+8)) + movt r2, :upper16:(l_anon.[ID].7-(LPC3_3+8)) +LPC3_1: + add r0, pc, r0 +LPC3_2: + add r1, pc, r1 +LPC3_3: + add r2, pc, r2 + b SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _use_fns + .p2align 2 + .code 32 +_use_fns: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + movw r10, :lower16:(__MergedGlobals-(LPC4_0+8)) + mov r4, r0 + movt r10, :upper16:(__MergedGlobals-(LPC4_0+8)) +LPC4_0: + add r10, pc, r10 + ldr r8, [r10] + cmp r8, #0 + beq LBB4_5 + ldr r6, [r10, #4] + cmp r6, #0 + beq LBB4_6 +LBB4_2: + ldr r5, [r10, #8] + cmp r5, #0 + beq LBB4_7 +LBB4_3: + ldr r0, [r10, #12] + cmp r0, #0 + beq LBB4_8 +LBB4_4: + str r8, [r4] + str r6, [r4, #4] + str r5, [r4, #8] + str r0, [r4, #12] + pop {r8, r10} + pop {r4, r5, r6, r7, pc} +LBB4_5: + movw r0, :lower16:(__MergedGlobals-(LPC4_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC4_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC4_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC4_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC4_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC4_3+8)) +LPC4_1: + add r0, pc, r0 +LPC4_2: + add r1, pc, r1 +LPC4_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r6, [r10, #4] + cmp r6, #0 + bne LBB4_2 +LBB4_6: + movw r1, :lower16:(l_anon.[ID].0-(LPC4_4+8)) + add r0, r10, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC4_4+8)) + movw r2, :lower16:(l_anon.[ID].3-(LPC4_5+8)) + movt r2, :upper16:(l_anon.[ID].3-(LPC4_5+8)) +LPC4_4: + add r1, pc, r1 +LPC4_5: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r6, r0 + ldr r5, [r10, #8] + cmp r5, #0 + bne LBB4_3 +LBB4_7: + movw r1, :lower16:(l_anon.[ID].4-(LPC4_6+8)) + add r0, r10, #8 + movt r1, :upper16:(l_anon.[ID].4-(LPC4_6+8)) + movw r2, :lower16:(l_anon.[ID].5-(LPC4_7+8)) + movt r2, :upper16:(l_anon.[ID].5-(LPC4_7+8)) +LPC4_6: + add r1, pc, r1 +LPC4_7: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r5, r0 + ldr r0, [r10, #12] + cmp r0, #0 + bne LBB4_4 +LBB4_8: + movw r1, :lower16:(l_anon.[ID].8-(LPC4_8+8)) + add r0, r10, #12 + movt r1, :upper16:(l_anon.[ID].8-(LPC4_8+8)) + movw r2, :lower16:(l_anon.[ID].9-(LPC4_9+8)) + movt r2, :upper16:(l_anon.[ID].9-(LPC4_9+8)) +LPC4_8: + add r1, pc, r1 +LPC4_9: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + b LBB4_4 + + .globl _use_same_twice + .p2align 2 + .code 32 +_use_same_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8} + movw r5, :lower16:(__MergedGlobals-(LPC5_0+8)) + mov r4, r0 + movt r5, :upper16:(__MergedGlobals-(LPC5_0+8)) +LPC5_0: + add r5, pc, r5 + ldr r8, [r5] + cmp r8, #0 + beq LBB5_3 + ldr r9, [r5] + cmp r9, #0 + beq LBB5_4 +LBB5_2: + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} +LBB5_3: + movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC5_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC5_3+8)) +LPC5_1: + add r0, pc, r0 +LPC5_2: + add r1, pc, r1 +LPC5_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r9, [r5] + cmp r9, #0 + bne LBB5_2 +LBB5_4: + movw r0, :lower16:(__MergedGlobals-(LPC5_4+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_4+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_5+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_5+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC5_6+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC5_6+8)) +LPC5_4: + add r0, pc, r0 +LPC5_5: + add r1, pc, r1 +LPC5_6: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r9, r0 + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} + + .globl _use_in_loop + .p2align 2 + .code 32 +_use_in_loop: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8} + cmp r0, #0 + beq LBB6_5 + movw r5, :lower16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) + mov r4, r0 + movt r5, :upper16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) + movw r8, :lower16:(l_anon.[ID].10-(LPC6_1+8)) + movt r8, :upper16:(l_anon.[ID].10-(LPC6_1+8)) + movw r6, :lower16:(l_anon.[ID].11-(LPC6_2+8)) + movt r6, :upper16:(l_anon.[ID].11-(LPC6_2+8)) +LPC6_0: + add r5, pc, r5 +LPC6_1: + add r8, pc, r8 +LPC6_2: + add r6, pc, r6 + b LBB6_3 +LBB6_2: + subs r4, r4, #1 + beq LBB6_5 +LBB6_3: + ldr r0, [r5] + cmp r0, #0 + bne LBB6_2 + mov r0, r5 + mov r1, r8 + mov r2, r6 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + b LBB6_2 +LBB6_5: + pop {r8} + pop {r4, r5, r6, r7, pc} + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "NSObject" + +l_anon.[ID].1: + .ascii "crates/$DIR/../test_static_class/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].2: + .long l_anon.[ID].1 + .asciz "J\000\000\000\b\000\000\000\005\000\000" + + .p2align 2, 0x0 +l_anon.[ID].3: + .long l_anon.[ID].1 + .asciz "J\000\000\000\r\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].4: + .asciz "NSString" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].5: + .long l_anon.[ID].1 + .asciz "J\000\000\000\022\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].6: + .asciz "NSData" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].7: + .long l_anon.[ID].1 + .asciz "J\000\000\000\027\000\000\000\r\000\000" + + .section __TEXT,__const +l_anon.[ID].8: + .asciz "NSException" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].9: + .long l_anon.[ID].1 + .asciz "J\000\000\000\037\000\000\000\016\000\000" + + .section __TEXT,__const +l_anon.[ID].10: + .asciz "NSLock" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].11: + .long l_anon.[ID].1 + .asciz "J\000\000\000-\000\000\000\021\000\000" + +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,__MergedGlobals,16,2 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7s.s new file mode 100644 index 000000000..69a186013 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/apple-armv7s.s @@ -0,0 +1,366 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .globl _get_class + .p2align 2 + .code 32 +_get_class: + push {r7, lr} + mov r7, sp + movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) +LPC0_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + popne {r7, pc} +LBB0_1: + movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC0_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC0_3+8)) +LPC0_1: + add r0, pc, r0 +LPC0_2: + add r1, pc, r1 +LPC0_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _get_same_class + .p2align 2 + .code 32 +_get_same_class: + push {r7, lr} + mov r7, sp + movw r3, :lower16:(__MergedGlobals-(LPC1_0+8)) + movt r3, :upper16:(__MergedGlobals-(LPC1_0+8)) +LPC1_0: + add r3, pc, r3 + ldr r0, [r3, #4] + cmp r0, #0 + popne {r7, pc} +LBB1_1: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + add r0, r3, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) + movw r2, :lower16:(l_anon.[ID].3-(LPC1_2+8)) + movt r2, :upper16:(l_anon.[ID].3-(LPC1_2+8)) +LPC1_1: + add r1, pc, r1 +LPC1_2: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _get_different_class + .p2align 2 + .code 32 +_get_different_class: + push {r7, lr} + mov r7, sp + movw r3, :lower16:(__MergedGlobals-(LPC2_0+8)) + movt r3, :upper16:(__MergedGlobals-(LPC2_0+8)) +LPC2_0: + add r3, pc, r3 + ldr r0, [r3, #8] + cmp r0, #0 + popne {r7, pc} +LBB2_1: + movw r1, :lower16:(l_anon.[ID].4-(LPC2_1+8)) + add r0, r3, #8 + movt r1, :upper16:(l_anon.[ID].4-(LPC2_1+8)) + movw r2, :lower16:(l_anon.[ID].5-(LPC2_2+8)) + movt r2, :upper16:(l_anon.[ID].5-(LPC2_2+8)) +LPC2_1: + add r1, pc, r1 +LPC2_2: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _unused_class + .p2align 2 + .code 32 +_unused_class: + push {r7, lr} + mov r7, sp + movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) + movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_0+8)) +LPC3_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + popne {r7, pc} +LBB3_1: + movw r0, :lower16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) + movt r0, :upper16:(SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-(LPC3_1+8)) + movw r1, :lower16:(l_anon.[ID].6-(LPC3_2+8)) + movt r1, :upper16:(l_anon.[ID].6-(LPC3_2+8)) + movw r2, :lower16:(l_anon.[ID].7-(LPC3_3+8)) + movt r2, :upper16:(l_anon.[ID].7-(LPC3_3+8)) +LPC3_1: + add r0, pc, r0 +LPC3_2: + add r1, pc, r1 +LPC3_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _use_fns + .p2align 2 + .code 32 +_use_fns: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + movw r10, :lower16:(__MergedGlobals-(LPC4_0+8)) + mov r4, r0 + movt r10, :upper16:(__MergedGlobals-(LPC4_0+8)) +LPC4_0: + add r10, pc, r10 + ldr r8, [r10] + cmp r8, #0 + beq LBB4_5 + ldr r6, [r10, #4] + cmp r6, #0 + beq LBB4_6 +LBB4_2: + ldr r5, [r10, #8] + cmp r5, #0 + beq LBB4_7 +LBB4_3: + ldr r0, [r10, #12] + cmp r0, #0 + beq LBB4_8 +LBB4_4: + str r8, [r4] + str r6, [r4, #4] + str r5, [r4, #8] + str r0, [r4, #12] + pop {r8, r10} + pop {r4, r5, r6, r7, pc} +LBB4_5: + movw r0, :lower16:(__MergedGlobals-(LPC4_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC4_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC4_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC4_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC4_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC4_3+8)) +LPC4_1: + add r0, pc, r0 +LPC4_2: + add r1, pc, r1 +LPC4_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r6, [r10, #4] + cmp r6, #0 + bne LBB4_2 +LBB4_6: + movw r1, :lower16:(l_anon.[ID].0-(LPC4_4+8)) + add r0, r10, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC4_4+8)) + movw r2, :lower16:(l_anon.[ID].3-(LPC4_5+8)) + movt r2, :upper16:(l_anon.[ID].3-(LPC4_5+8)) +LPC4_4: + add r1, pc, r1 +LPC4_5: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r6, r0 + ldr r5, [r10, #8] + cmp r5, #0 + bne LBB4_3 +LBB4_7: + movw r1, :lower16:(l_anon.[ID].4-(LPC4_6+8)) + add r0, r10, #8 + movt r1, :upper16:(l_anon.[ID].4-(LPC4_6+8)) + movw r2, :lower16:(l_anon.[ID].5-(LPC4_7+8)) + movt r2, :upper16:(l_anon.[ID].5-(LPC4_7+8)) +LPC4_6: + add r1, pc, r1 +LPC4_7: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r5, r0 + ldr r0, [r10, #12] + cmp r0, #0 + bne LBB4_4 +LBB4_8: + movw r1, :lower16:(l_anon.[ID].8-(LPC4_8+8)) + add r0, r10, #12 + movt r1, :upper16:(l_anon.[ID].8-(LPC4_8+8)) + movw r2, :lower16:(l_anon.[ID].9-(LPC4_9+8)) + movt r2, :upper16:(l_anon.[ID].9-(LPC4_9+8)) +LPC4_8: + add r1, pc, r1 +LPC4_9: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + b LBB4_4 + + .globl _use_same_twice + .p2align 2 + .code 32 +_use_same_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8} + movw r5, :lower16:(__MergedGlobals-(LPC5_0+8)) + mov r4, r0 + movt r5, :upper16:(__MergedGlobals-(LPC5_0+8)) +LPC5_0: + add r5, pc, r5 + ldr r8, [r5] + cmp r8, #0 + beq LBB5_3 + ldr r9, [r5] + cmp r9, #0 + beq LBB5_4 +LBB5_2: + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} +LBB5_3: + movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC5_3+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC5_3+8)) +LPC5_1: + add r0, pc, r0 +LPC5_2: + add r1, pc, r1 +LPC5_3: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r9, [r5] + cmp r9, #0 + bne LBB5_2 +LBB5_4: + movw r0, :lower16:(__MergedGlobals-(LPC5_4+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_4+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_5+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_5+8)) + movw r2, :lower16:(l_anon.[ID].2-(LPC5_6+8)) + movt r2, :upper16:(l_anon.[ID].2-(LPC5_6+8)) +LPC5_4: + add r0, pc, r0 +LPC5_5: + add r1, pc, r1 +LPC5_6: + add r2, pc, r2 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r9, r0 + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} + + .globl _use_in_loop + .p2align 2 + .code 32 +_use_in_loop: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8} + cmp r0, #0 + beq LBB6_5 + movw r5, :lower16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) + mov r4, r0 + movt r5, :upper16:(SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-(LPC6_0+8)) + movw r8, :lower16:(l_anon.[ID].10-(LPC6_1+8)) + movt r8, :upper16:(l_anon.[ID].10-(LPC6_1+8)) + movw r6, :lower16:(l_anon.[ID].11-(LPC6_2+8)) + movt r6, :upper16:(l_anon.[ID].11-(LPC6_2+8)) +LPC6_0: + add r5, pc, r5 +LPC6_1: + add r8, pc, r8 +LPC6_2: + add r6, pc, r6 + b LBB6_3 +LBB6_2: + subs r4, r4, #1 + beq LBB6_5 +LBB6_3: + ldr r0, [r5] + cmp r0, #0 + bne LBB6_2 + mov r0, r5 + mov r1, r8 + mov r2, r6 + bl SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + b LBB6_2 +LBB6_5: + pop {r8} + pop {r4, r5, r6, r7, pc} + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "NSObject" + +l_anon.[ID].1: + .ascii "crates/$DIR/../test_static_class/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].2: + .long l_anon.[ID].1 + .asciz "J\000\000\000\b\000\000\000\005\000\000" + + .p2align 2, 0x0 +l_anon.[ID].3: + .long l_anon.[ID].1 + .asciz "J\000\000\000\r\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].4: + .asciz "NSString" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].5: + .long l_anon.[ID].1 + .asciz "J\000\000\000\022\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].6: + .asciz "NSData" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].7: + .long l_anon.[ID].1 + .asciz "J\000\000\000\027\000\000\000\r\000\000" + + .section __TEXT,__const +l_anon.[ID].8: + .asciz "NSException" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].9: + .long l_anon.[ID].1 + .asciz "J\000\000\000\037\000\000\000\016\000\000" + + .section __TEXT,__const +l_anon.[ID].10: + .asciz "NSLock" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].11: + .long l_anon.[ID].1 + .asciz "J\000\000\000-\000\000\000\021\000\000" + +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,__MergedGlobals,16,2 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86.s new file mode 100644 index 000000000..7e8286a91 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86.s @@ -0,0 +1,380 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .globl _get_class + .p2align 4, 0x90 +_get_class: + push ebp + mov ebp, esp + sub esp, 8 + call L0$pb +L0$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L0$pb] + test eax, eax + je LBB0_1 + add esp, 8 + pop ebp + ret +LBB0_1: + sub esp, 4 + lea eax, [ecx + l_anon.[ID].2-L0$pb] + lea edx, [ecx + l_anon.[ID].0-L0$pb] + lea ecx, [ecx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L0$pb] + push eax + push edx + push ecx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_same_class + .p2align 4, 0x90 +_get_same_class: + push ebp + mov ebp, esp + sub esp, 8 + call L1$pb +L1$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)-L1$pb] + test eax, eax + je LBB1_1 + add esp, 8 + pop ebp + ret +LBB1_1: + sub esp, 4 + lea eax, [ecx + l_anon.[ID].3-L1$pb] + lea edx, [ecx + l_anon.[ID].0-L1$pb] + lea ecx, [ecx + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)-L1$pb] + push eax + push edx + push ecx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_different_class + .p2align 4, 0x90 +_get_different_class: + push ebp + mov ebp, esp + sub esp, 8 + call L2$pb +L2$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)-L2$pb] + test eax, eax + je LBB2_1 + add esp, 8 + pop ebp + ret +LBB2_1: + sub esp, 4 + lea eax, [ecx + l_anon.[ID].5-L2$pb] + lea edx, [ecx + l_anon.[ID].4-L2$pb] + lea ecx, [ecx + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)-L2$pb] + push eax + push edx + push ecx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _unused_class + .p2align 4, 0x90 +_unused_class: + push ebp + mov ebp, esp + sub esp, 8 + call L3$pb +L3$pb: + pop eax + mov ecx, dword ptr [eax + SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-L3$pb] + test ecx, ecx + je LBB3_1 + add esp, 8 + pop ebp + ret +LBB3_1: + sub esp, 4 + lea ecx, [eax + l_anon.[ID].7-L3$pb] + lea edx, [eax + l_anon.[ID].6-L3$pb] + lea eax, [eax + SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)-L3$pb] + push ecx + push edx + push eax + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _use_fns + .p2align 4, 0x90 +_use_fns: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L4$pb +L4$pb: + pop edi + mov ecx, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L4$pb] + test ecx, ecx + je LBB4_1 + mov edx, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)-L4$pb] + test edx, edx + je LBB4_3 +LBB4_4: + mov ebx, dword ptr [ebp + 8] + mov esi, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)-L4$pb] + test esi, esi + je LBB4_5 +LBB4_6: + mov eax, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)-L4$pb] + test eax, eax + je LBB4_7 +LBB4_8: + mov dword ptr [ebx], ecx + mov dword ptr [ebx + 4], edx + mov dword ptr [ebx + 8], esi + mov dword ptr [ebx + 12], eax + mov eax, ebx + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret 4 +LBB4_1: + sub esp, 4 + lea eax, [edi + l_anon.[ID].2-L4$pb] + lea ecx, [edi + l_anon.[ID].0-L4$pb] + lea edx, [edi + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 16 + mov ecx, eax + mov edx, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)-L4$pb] + test edx, edx + jne LBB4_4 +LBB4_3: + sub esp, 4 + lea eax, [edi + l_anon.[ID].3-L4$pb] + mov esi, ecx + lea ecx, [edi + l_anon.[ID].0-L4$pb] + lea edx, [edi + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov ecx, esi + add esp, 16 + mov edx, eax + mov ebx, dword ptr [ebp + 8] + mov esi, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)-L4$pb] + test esi, esi + jne LBB4_6 +LBB4_5: + sub esp, 4 + lea eax, [edi + l_anon.[ID].5-L4$pb] + mov dword ptr [ebp - 16], ecx + lea ecx, [edi + l_anon.[ID].4-L4$pb] + mov esi, edx + lea edx, [edi + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov edx, esi + mov ecx, dword ptr [ebp - 16] + add esp, 16 + mov esi, eax + mov eax, dword ptr [edi + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)-L4$pb] + test eax, eax + jne LBB4_8 +LBB4_7: + sub esp, 4 + lea eax, [edi + l_anon.[ID].9-L4$pb] + mov dword ptr [ebp - 16], ecx + lea ecx, [edi + l_anon.[ID].8-L4$pb] + mov dword ptr [ebp - 20], edx + lea edx, [edi + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)-L4$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov edx, dword ptr [ebp - 20] + mov ecx, dword ptr [ebp - 16] + add esp, 16 + jmp LBB4_8 + + .globl _use_same_twice + .p2align 4, 0x90 +_use_same_twice: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L5$pb +L5$pb: + pop ebx + mov esi, dword ptr [ebp + 8] + mov edi, dword ptr [ebx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L5$pb] + test edi, edi + je LBB5_1 + mov eax, dword ptr [ebx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L5$pb] + test eax, eax + je LBB5_3 +LBB5_4: + mov dword ptr [esi], edi + mov dword ptr [esi + 4], eax + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret 4 +LBB5_1: + sub esp, 4 + lea eax, [ebx + l_anon.[ID].2-L5$pb] + lea ecx, [ebx + l_anon.[ID].0-L5$pb] + lea edx, [ebx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L5$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 16 + mov edi, eax + mov eax, dword ptr [ebx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L5$pb] + test eax, eax + jne LBB5_4 +LBB5_3: + sub esp, 4 + lea eax, [ebx + l_anon.[ID].2-L5$pb] + lea ecx, [ebx + l_anon.[ID].0-L5$pb] + lea edx, [ebx + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)-L5$pb] + push eax + push ecx + push edx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB5_4 + + .globl _use_in_loop + .p2align 4, 0x90 +_use_in_loop: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L6$pb +L6$pb: + pop esi + mov edi, dword ptr [ebp + 8] + test edi, edi + je LBB6_5 + lea ebx, [esi + SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-L6$pb] + jmp LBB6_2 + .p2align 4, 0x90 +LBB6_4: + dec edi + je LBB6_5 +LBB6_2: + mov eax, dword ptr [esi + SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)-L6$pb] + test eax, eax + jne LBB6_4 + sub esp, 4 + lea eax, [esi + l_anon.[ID].11-L6$pb] + push eax + lea eax, [esi + l_anon.[ID].10-L6$pb] + push eax + push ebx + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB6_4 +LBB6_5: + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "NSObject" + +l_anon.[ID].1: + .ascii "crates/$DIR/../test_static_class/lib.rs" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].2: + .long l_anon.[ID].1 + .asciz "J\000\000\000\b\000\000\000\005\000\000" + + .p2align 2, 0x0 +l_anon.[ID].3: + .long l_anon.[ID].1 + .asciz "J\000\000\000\r\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].4: + .asciz "NSString" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].5: + .long l_anon.[ID].1 + .asciz "J\000\000\000\022\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].6: + .asciz "NSData" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].7: + .long l_anon.[ID].1 + .asciz "J\000\000\000\027\000\000\000\r\000\000" + + .section __TEXT,__const +l_anon.[ID].8: + .asciz "NSException" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].9: + .long l_anon.[ID].1 + .asciz "J\000\000\000\037\000\000\000\016\000\000" + + .section __TEXT,__const +l_anon.[ID].10: + .asciz "NSLock" + + .section __DATA,__const + .p2align 2, 0x0 +l_anon.[ID].11: + .long l_anon.[ID].1 + .asciz "J\000\000\000-\000\000\000\021\000\000" + +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),4,2 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86_64.s new file mode 100644 index 000000000..7ccd891da --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/apple-x86_64.s @@ -0,0 +1,280 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .globl _get_class + .p2align 4, 0x90 +_get_class: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + test rax, rax + je LBB0_2 + pop rbp + ret +LBB0_2: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].2] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _get_same_class + .p2align 4, 0x90 +_get_same_class: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)] + test rax, rax + je LBB1_2 + pop rbp + ret +LBB1_2: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].3] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _get_different_class + .p2align 4, 0x90 +_get_different_class: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)] + test rax, rax + je LBB2_2 + pop rbp + ret +LBB2_2: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].4] + lea rdx, [rip + l_anon.[ID].5] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _unused_class + .p2align 4, 0x90 +_unused_class: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)] + test rax, rax + je LBB3_2 + pop rbp + ret +LBB3_2: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].6] + lea rdx, [rip + l_anon.[ID].7] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + + .globl _use_fns + .p2align 4, 0x90 +_use_fns: + push rbp + mov rbp, rsp + push r15 + push r14 + push r12 + push rbx + mov rbx, rdi + mov r14, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + test r14, r14 + je LBB4_1 + mov r15, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)] + test r15, r15 + je LBB4_3 +LBB4_4: + mov r12, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)] + test r12, r12 + je LBB4_5 +LBB4_6: + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)] + test rax, rax + je LBB4_7 +LBB4_8: + mov qword ptr [rbx], r14 + mov qword ptr [rbx + 8], r15 + mov qword ptr [rbx + 16], r12 + mov qword ptr [rbx + 24], rax + mov rax, rbx + pop rbx + pop r12 + pop r14 + pop r15 + pop rbp + ret +LBB4_1: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].2] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r14, rax + mov r15, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)] + test r15, r15 + jne LBB4_4 +LBB4_3: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].3] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r15, rax + mov r12, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)] + test r12, r12 + jne LBB4_6 +LBB4_5: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].4] + lea rdx, [rip + l_anon.[ID].5] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r12, rax + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)] + test rax, rax + jne LBB4_8 +LBB4_7: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].8] + lea rdx, [rip + l_anon.[ID].9] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + jmp LBB4_8 + + .globl _use_same_twice + .p2align 4, 0x90 +_use_same_twice: + push rbp + mov rbp, rsp + push r14 + push rbx + mov rbx, rdi + mov r14, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + test r14, r14 + je LBB5_1 + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + test rax, rax + je LBB5_3 +LBB5_4: + mov qword ptr [rbx], r14 + mov qword ptr [rbx + 8], rax + mov rax, rbx + pop rbx + pop r14 + pop rbp + ret +LBB5_1: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].2] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + mov r14, rax + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + test rax, rax + jne LBB5_4 +LBB5_3: + lea rdi, [rip + SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0)] + lea rsi, [rip + l_anon.[ID].0] + lea rdx, [rip + l_anon.[ID].2] + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + jmp LBB5_4 + + .globl _use_in_loop + .p2align 4, 0x90 +_use_in_loop: + push rbp + mov rbp, rsp + push r15 + push r14 + push r12 + push rbx + test rdi, rdi + je LBB6_5 + mov rbx, rdi + lea r14, [rip + SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)] + lea r15, [rip + l_anon.[ID].10] + lea r12, [rip + l_anon.[ID].11] + jmp LBB6_2 + .p2align 4, 0x90 +LBB6_4: + dec rbx + je LBB6_5 +LBB6_2: + mov rax, qword ptr [rip + SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0)] + test rax, rax + jne LBB6_4 + mov rdi, r14 + mov rsi, r15 + mov rdx, r12 + call SYM(objc2::__macro_helpers::cache::CachedClass::fetch::GENERATED_ID, 0) + jmp LBB6_4 +LBB6_5: + pop rbx + pop r12 + pop r14 + pop r15 + pop rbp + ret + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "NSObject" + +l_anon.[ID].1: + .ascii "crates/$DIR/../test_static_class/lib.rs" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].2: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\b\000\000\000\005\000\000" + + .p2align 3, 0x0 +l_anon.[ID].3: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\r\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].4: + .asciz "NSString" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].5: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\022\000\000\000\005\000\000" + + .section __TEXT,__const +l_anon.[ID].6: + .asciz "NSData" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].7: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\027\000\000\000\r\000\000" + + .section __TEXT,__const +l_anon.[ID].8: + .asciz "NSException" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].9: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000\037\000\000\000\016\000\000" + + .section __TEXT,__const +l_anon.[ID].10: + .asciz "NSLock" + + .section __DATA,__const + .p2align 3, 0x0 +l_anon.[ID].11: + .quad l_anon.[ID].1 + .asciz "J\000\000\000\000\000\000\000-\000\000\000\021\000\000" + +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_class::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_same_class::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::get_different_class::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::unused_class::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_fns::CACHED_CLASS, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_class[CRATE_ID]::use_in_loop::CACHED_CLASS, 0),8,3 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86.s b/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86_64.s b/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86_64.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_class/expected/gnustep-x86_64.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_dynamic_sel/Cargo.toml b/crates/test-assembly/crates/test_dynamic_sel/Cargo.toml new file mode 100644 index 000000000..347e32115 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "test_dynamic_sel" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +path = "../test_static_sel/lib.rs" + +[dependencies] +objc2 = { path = "../../../objc2", default-features = false } + +[features] +default = ["apple", "std"] +std = ["objc2/std"] +# Runtime +apple = ["objc2/apple"] +gnustep-1-7 = ["objc2/gnustep-1-7"] +gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8"] +gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9"] +gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0"] +gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1"] + +# Hack to prevent the feature flag from being enabled in the entire project +assembly-features = [] diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s new file mode 100644 index 000000000..080fdb6bd --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s @@ -0,0 +1,377 @@ + .section __TEXT,__text,regular,pure_instructions + .globl _get_sel + .p2align 2 +_get_sel: +Lloh0: + adrp x8, __MergedGlobals@PAGE +Lloh1: + ldr x0, [x8, __MergedGlobals@PAGEOFF] + cbz x0, LBB0_2 + ret +LBB0_2: +Lloh2: + adrp x0, __MergedGlobals@PAGE +Lloh3: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh4: + adrp x1, l_anon.[ID].0@PAGE +Lloh5: + add x1, x1, l_anon.[ID].0@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh0, Lloh1 + .loh AdrpAdd Lloh4, Lloh5 + .loh AdrpAdd Lloh2, Lloh3 + + .globl _get_same_sel + .p2align 2 +_get_same_sel: +Lloh6: + adrp x8, __MergedGlobals@PAGE+8 +Lloh7: + ldr x0, [x8, __MergedGlobals@PAGEOFF+8] + cbz x0, LBB1_2 + ret +LBB1_2: +Lloh8: + adrp x0, __MergedGlobals@PAGE+8 +Lloh9: + add x0, x0, __MergedGlobals@PAGEOFF+8 +Lloh10: + adrp x1, l_anon.[ID].0@PAGE +Lloh11: + add x1, x1, l_anon.[ID].0@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh6, Lloh7 + .loh AdrpAdd Lloh10, Lloh11 + .loh AdrpAdd Lloh8, Lloh9 + + .globl _get_common_twice + .p2align 2 +_get_common_twice: + stp x20, x19, [sp, #-32]! + stp x29, x30, [sp, #16] + add x29, sp, #16 +Lloh12: + adrp x20, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE +Lloh13: + ldr x20, [x20, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] + ldr x19, [x20] + cbz x19, LBB2_3 + ldr x1, [x20] + cbz x1, LBB2_4 +LBB2_2: + mov x0, x19 + ldp x29, x30, [sp, #16] + ldp x20, x19, [sp], #32 + ret +LBB2_3: +Lloh14: + adrp x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE +Lloh15: + ldr x0, [x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] +Lloh16: + adrp x1, l_anon.[ID].1@PAGE +Lloh17: + add x1, x1, l_anon.[ID].1@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x19, x0 + ldr x1, [x20] + cbnz x1, LBB2_2 +LBB2_4: +Lloh18: + adrp x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE +Lloh19: + ldr x0, [x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] +Lloh20: + adrp x1, l_anon.[ID].1@PAGE +Lloh21: + add x1, x1, l_anon.[ID].1@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x1, x0 + mov x0, x19 + ldp x29, x30, [sp, #16] + ldp x20, x19, [sp], #32 + ret + .loh AdrpLdrGot Lloh12, Lloh13 + .loh AdrpAdd Lloh16, Lloh17 + .loh AdrpLdrGot Lloh14, Lloh15 + .loh AdrpAdd Lloh20, Lloh21 + .loh AdrpLdrGot Lloh18, Lloh19 + + .globl _get_different_sel + .p2align 2 +_get_different_sel: +Lloh22: + adrp x8, __MergedGlobals@PAGE+16 +Lloh23: + ldr x0, [x8, __MergedGlobals@PAGEOFF+16] + cbz x0, LBB3_2 + ret +LBB3_2: +Lloh24: + adrp x0, __MergedGlobals@PAGE+16 +Lloh25: + add x0, x0, __MergedGlobals@PAGEOFF+16 +Lloh26: + adrp x1, l_anon.[ID].2@PAGE +Lloh27: + add x1, x1, l_anon.[ID].2@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh22, Lloh23 + .loh AdrpAdd Lloh26, Lloh27 + .loh AdrpAdd Lloh24, Lloh25 + + .globl _unused_sel + .p2align 2 +_unused_sel: +Lloh28: + adrp x8, SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)@PAGE +Lloh29: + ldr x8, [x8, SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)@PAGEOFF] + cbz x8, LBB4_2 + ret +LBB4_2: +Lloh30: + adrp x0, SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)@PAGE +Lloh31: + add x0, x0, SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)@PAGEOFF +Lloh32: + adrp x1, l_anon.[ID].3@PAGE +Lloh33: + add x1, x1, l_anon.[ID].3@PAGEOFF + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + .loh AdrpLdr Lloh28, Lloh29 + .loh AdrpAdd Lloh32, Lloh33 + .loh AdrpAdd Lloh30, Lloh31 + + .globl _use_fns + .p2align 2 +_use_fns: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x8 +Lloh34: + adrp x8, __MergedGlobals@PAGE +Lloh35: + ldr x20, [x8, __MergedGlobals@PAGEOFF] + cbz x20, LBB5_5 +Lloh36: + adrp x8, __MergedGlobals@PAGE+8 +Lloh37: + ldr x21, [x8, __MergedGlobals@PAGEOFF+8] + cbz x21, LBB5_6 +LBB5_2: +Lloh38: + adrp x8, __MergedGlobals@PAGE+16 +Lloh39: + ldr x22, [x8, __MergedGlobals@PAGEOFF+16] + cbz x22, LBB5_7 +LBB5_3: +Lloh40: + adrp x8, __MergedGlobals@PAGE+24 +Lloh41: + ldr x0, [x8, __MergedGlobals@PAGEOFF+24] + cbz x0, LBB5_8 +LBB5_4: + stp x20, x21, [x19] + stp x22, x0, [x19, #16] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret +LBB5_5: +Lloh42: + adrp x0, __MergedGlobals@PAGE +Lloh43: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh44: + adrp x1, l_anon.[ID].0@PAGE +Lloh45: + add x1, x1, l_anon.[ID].0@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x20, x0 +Lloh46: + adrp x8, __MergedGlobals@PAGE+8 +Lloh47: + ldr x21, [x8, __MergedGlobals@PAGEOFF+8] + cbnz x21, LBB5_2 +LBB5_6: +Lloh48: + adrp x0, __MergedGlobals@PAGE+8 +Lloh49: + add x0, x0, __MergedGlobals@PAGEOFF+8 +Lloh50: + adrp x1, l_anon.[ID].0@PAGE +Lloh51: + add x1, x1, l_anon.[ID].0@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x21, x0 +Lloh52: + adrp x8, __MergedGlobals@PAGE+16 +Lloh53: + ldr x22, [x8, __MergedGlobals@PAGEOFF+16] + cbnz x22, LBB5_3 +LBB5_7: +Lloh54: + adrp x0, __MergedGlobals@PAGE+16 +Lloh55: + add x0, x0, __MergedGlobals@PAGEOFF+16 +Lloh56: + adrp x1, l_anon.[ID].2@PAGE +Lloh57: + add x1, x1, l_anon.[ID].2@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x22, x0 +Lloh58: + adrp x8, __MergedGlobals@PAGE+24 +Lloh59: + ldr x0, [x8, __MergedGlobals@PAGEOFF+24] + cbnz x0, LBB5_4 +LBB5_8: +Lloh60: + adrp x0, __MergedGlobals@PAGE+24 +Lloh61: + add x0, x0, __MergedGlobals@PAGEOFF+24 +Lloh62: + adrp x1, l_anon.[ID].4@PAGE +Lloh63: + add x1, x1, l_anon.[ID].4@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + stp x20, x21, [x19] + stp x22, x0, [x19, #16] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpLdr Lloh34, Lloh35 + .loh AdrpLdr Lloh36, Lloh37 + .loh AdrpLdr Lloh38, Lloh39 + .loh AdrpLdr Lloh40, Lloh41 + .loh AdrpLdr Lloh46, Lloh47 + .loh AdrpAdd Lloh44, Lloh45 + .loh AdrpAdd Lloh42, Lloh43 + .loh AdrpLdr Lloh52, Lloh53 + .loh AdrpAdd Lloh50, Lloh51 + .loh AdrpAdd Lloh48, Lloh49 + .loh AdrpLdr Lloh58, Lloh59 + .loh AdrpAdd Lloh56, Lloh57 + .loh AdrpAdd Lloh54, Lloh55 + .loh AdrpAdd Lloh62, Lloh63 + .loh AdrpAdd Lloh60, Lloh61 + + .globl _use_same_twice + .p2align 2 +_use_same_twice: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + mov x19, x8 + adrp x21, __MergedGlobals@PAGE + ldr x20, [x21, __MergedGlobals@PAGEOFF] + cbz x20, LBB6_3 + ldr x0, [x21, __MergedGlobals@PAGEOFF] + cbz x0, LBB6_4 +LBB6_2: + stp x20, x0, [x19] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret +LBB6_3: +Lloh64: + adrp x0, __MergedGlobals@PAGE +Lloh65: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh66: + adrp x1, l_anon.[ID].0@PAGE +Lloh67: + add x1, x1, l_anon.[ID].0@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x20, x0 + ldr x0, [x21, __MergedGlobals@PAGEOFF] + cbnz x0, LBB6_2 +LBB6_4: +Lloh68: + adrp x0, __MergedGlobals@PAGE +Lloh69: + add x0, x0, __MergedGlobals@PAGEOFF +Lloh70: + adrp x1, l_anon.[ID].0@PAGE +Lloh71: + add x1, x1, l_anon.[ID].0@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + stp x20, x0, [x19] + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpAdd Lloh66, Lloh67 + .loh AdrpAdd Lloh64, Lloh65 + .loh AdrpAdd Lloh70, Lloh71 + .loh AdrpAdd Lloh68, Lloh69 + + .globl _use_in_loop + .p2align 2 +_use_in_loop: + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 + cbz x0, LBB7_5 + mov x19, x0 + adrp x22, SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)@PAGE +Lloh72: + adrp x20, SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)@PAGE +Lloh73: + add x20, x20, SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)@PAGEOFF +Lloh74: + adrp x21, l_anon.[ID].5@PAGE +Lloh75: + add x21, x21, l_anon.[ID].5@PAGEOFF + b LBB7_3 +LBB7_2: + subs x19, x19, #1 + b.eq LBB7_5 +LBB7_3: + ldr x8, [x22, SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)@PAGEOFF] + cbnz x8, LBB7_2 + mov x0, x20 + mov x1, x21 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + b LBB7_2 +LBB7_5: + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 + ret + .loh AdrpAdd Lloh74, Lloh75 + .loh AdrpAdd Lloh72, Lloh73 + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "simple" + +l_anon.[ID].1: + .asciz "alloc" + + .section __TEXT,__literal16,16byte_literals +l_anon.[ID].2: + .asciz "i:am:different:" + + .section __TEXT,__const +l_anon.[ID].3: + .asciz "unused" + +l_anon.[ID].4: + .asciz "fourthSel" + +l_anon.[ID].5: + .asciz "loopedSelector" + +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,__MergedGlobals,32,3 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s new file mode 100644 index 000000000..1731d44fa --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s @@ -0,0 +1,324 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .globl _get_sel + .p2align 2 + .code 32 +_get_sel: + movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) +LPC0_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + bxne lr +LBB0_1: + movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) +LPC0_1: + add r0, pc, r0 +LPC0_2: + add r1, pc, r1 + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _get_same_sel + .p2align 2 + .code 32 +_get_same_sel: + movw r2, :lower16:(__MergedGlobals-(LPC1_0+8)) + movt r2, :upper16:(__MergedGlobals-(LPC1_0+8)) +LPC1_0: + add r2, pc, r2 + ldr r0, [r2, #4] + cmp r0, #0 + bxne lr +LBB1_1: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + add r0, r2, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) +LPC1_1: + add r1, pc, r1 + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _get_common_twice + .p2align 2 + .code 32 +_get_common_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + movw r5, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movt r5, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) +LPC2_0: + ldr r5, [pc, r5] + ldr r4, [r5] + cmp r4, #0 + beq LBB2_3 + ldr r1, [r5] + cmp r1, #0 + beq LBB2_4 +LBB2_2: + mov r0, r4 + pop {r4, r5, r7, pc} +LBB2_3: + movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movw r1, :lower16:(l_anon.[ID].1-(LPC2_2+8)) + movt r1, :upper16:(l_anon.[ID].1-(LPC2_2+8)) +LPC2_1: + ldr r0, [pc, r0] +LPC2_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r4, r0 + ldr r1, [r5] + cmp r1, #0 + bne LBB2_2 +LBB2_4: + movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movw r1, :lower16:(l_anon.[ID].1-(LPC2_4+8)) + movt r1, :upper16:(l_anon.[ID].1-(LPC2_4+8)) +LPC2_3: + ldr r0, [pc, r0] +LPC2_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + mov r0, r4 + pop {r4, r5, r7, pc} + + .globl _get_different_sel + .p2align 2 + .code 32 +_get_different_sel: + movw r2, :lower16:(__MergedGlobals-(LPC3_0+8)) + movt r2, :upper16:(__MergedGlobals-(LPC3_0+8)) +LPC3_0: + add r2, pc, r2 + ldr r0, [r2, #8] + cmp r0, #0 + bxne lr +LBB3_1: + movw r1, :lower16:(L_anon.[ID].2-(LPC3_1+8)) + add r0, r2, #8 + movt r1, :upper16:(L_anon.[ID].2-(LPC3_1+8)) +LPC3_1: + add r1, pc, r1 + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _unused_sel + .p2align 2 + .code 32 +_unused_sel: + movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) + movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) +LPC4_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + bxne lr +LBB4_1: + movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) + movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) + movw r1, :lower16:(l_anon.[ID].3-(LPC4_2+8)) + movt r1, :upper16:(l_anon.[ID].3-(LPC4_2+8)) +LPC4_1: + add r0, pc, r0 +LPC4_2: + add r1, pc, r1 + b SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _use_fns + .p2align 2 + .code 32 +_use_fns: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + movw r10, :lower16:(__MergedGlobals-(LPC5_0+8)) + mov r4, r0 + movt r10, :upper16:(__MergedGlobals-(LPC5_0+8)) +LPC5_0: + add r10, pc, r10 + ldr r8, [r10] + cmp r8, #0 + beq LBB5_5 + ldr r6, [r10, #4] + cmp r6, #0 + beq LBB5_6 +LBB5_2: + ldr r5, [r10, #8] + cmp r5, #0 + beq LBB5_7 +LBB5_3: + ldr r0, [r10, #12] + cmp r0, #0 + beq LBB5_8 +LBB5_4: + str r8, [r4] + str r6, [r4, #4] + str r5, [r4, #8] + str r0, [r4, #12] + pop {r8, r10} + pop {r4, r5, r6, r7, pc} +LBB5_5: + movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) +LPC5_1: + add r0, pc, r0 +LPC5_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r6, [r10, #4] + cmp r6, #0 + bne LBB5_2 +LBB5_6: + movw r1, :lower16:(l_anon.[ID].0-(LPC5_3+8)) + add r0, r10, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC5_3+8)) +LPC5_3: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r6, r0 + ldr r5, [r10, #8] + cmp r5, #0 + bne LBB5_3 +LBB5_7: + movw r1, :lower16:(L_anon.[ID].2-(LPC5_4+8)) + add r0, r10, #8 + movt r1, :upper16:(L_anon.[ID].2-(LPC5_4+8)) +LPC5_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r5, r0 + ldr r0, [r10, #12] + cmp r0, #0 + bne LBB5_4 +LBB5_8: + movw r1, :lower16:(l_anon.[ID].4-(LPC5_5+8)) + add r0, r10, #12 + movt r1, :upper16:(l_anon.[ID].4-(LPC5_5+8)) +LPC5_5: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + b LBB5_4 + + .globl _use_same_twice + .p2align 2 + .code 32 +_use_same_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8} + movw r5, :lower16:(__MergedGlobals-(LPC6_0+8)) + mov r4, r0 + movt r5, :upper16:(__MergedGlobals-(LPC6_0+8)) +LPC6_0: + add r5, pc, r5 + ldr r8, [r5] + cmp r8, #0 + beq LBB6_3 + ldr r9, [r5] + cmp r9, #0 + beq LBB6_4 +LBB6_2: + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} +LBB6_3: + movw r0, :lower16:(__MergedGlobals-(LPC6_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC6_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC6_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC6_2+8)) +LPC6_1: + add r0, pc, r0 +LPC6_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r9, [r5] + cmp r9, #0 + bne LBB6_2 +LBB6_4: + movw r0, :lower16:(__MergedGlobals-(LPC6_3+8)) + movt r0, :upper16:(__MergedGlobals-(LPC6_3+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC6_4+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC6_4+8)) +LPC6_3: + add r0, pc, r0 +LPC6_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r9, r0 + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} + + .globl _use_in_loop + .p2align 2 + .code 32 +_use_in_loop: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + cmp r0, #0 + popeq {r4, r5, r6, r7, pc} +LBB7_1: + movw r5, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) + mov r4, r0 + movt r5, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) + movw r6, :lower16:(l_anon.[ID].5-(LPC7_1+8)) + movt r6, :upper16:(l_anon.[ID].5-(LPC7_1+8)) +LPC7_0: + add r5, pc, r5 +LPC7_1: + add r6, pc, r6 + b LBB7_3 +LBB7_2: + subs r4, r4, #1 + beq LBB7_5 +LBB7_3: + ldr r0, [r5] + cmp r0, #0 + bne LBB7_2 + mov r0, r5 + mov r1, r6 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + b LBB7_2 +LBB7_5: + pop {r4, r5, r6, r7, pc} + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "simple" + +l_anon.[ID].1: + .asciz "alloc" + + .section __TEXT,__literal16,16byte_literals +L_anon.[ID].2: + .asciz "i:am:different:" + + .section __TEXT,__const +l_anon.[ID].3: + .asciz "unused" + +l_anon.[ID].4: + .asciz "fourthSel" + +l_anon.[ID].5: + .asciz "loopedSelector" + +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,__MergedGlobals,16,2 + .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers + .p2align 2, 0x0 +LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s new file mode 100644 index 000000000..409cf3e4a --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s @@ -0,0 +1,335 @@ + .section __TEXT,__text,regular,pure_instructions + .syntax unified + .globl _get_sel + .p2align 2 + .code 32 +_get_sel: + push {r7, lr} + mov r7, sp + movw r0, :lower16:(__MergedGlobals-(LPC0_0+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_0+8)) +LPC0_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + popne {r7, pc} +LBB0_1: + movw r0, :lower16:(__MergedGlobals-(LPC0_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC0_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC0_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC0_2+8)) +LPC0_1: + add r0, pc, r0 +LPC0_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _get_same_sel + .p2align 2 + .code 32 +_get_same_sel: + push {r7, lr} + mov r7, sp + movw r2, :lower16:(__MergedGlobals-(LPC1_0+8)) + movt r2, :upper16:(__MergedGlobals-(LPC1_0+8)) +LPC1_0: + add r2, pc, r2 + ldr r0, [r2, #4] + cmp r0, #0 + popne {r7, pc} +LBB1_1: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + add r0, r2, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) +LPC1_1: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _get_common_twice + .p2align 2 + .code 32 +_get_common_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + movw r5, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movt r5, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) +LPC2_0: + ldr r5, [pc, r5] + ldr r4, [r5] + cmp r4, #0 + beq LBB2_3 + ldr r1, [r5] + cmp r1, #0 + beq LBB2_4 +LBB2_2: + mov r0, r4 + pop {r4, r5, r7, pc} +LBB2_3: + movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movw r1, :lower16:(l_anon.[ID].1-(LPC2_2+8)) +LPC2_1: + ldr r0, [pc, r0] + movt r1, :upper16:(l_anon.[ID].1-(LPC2_2+8)) +LPC2_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r4, r0 + ldr r1, [r5] + cmp r1, #0 + bne LBB2_2 +LBB2_4: + movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movw r1, :lower16:(l_anon.[ID].1-(LPC2_4+8)) +LPC2_3: + ldr r0, [pc, r0] + movt r1, :upper16:(l_anon.[ID].1-(LPC2_4+8)) +LPC2_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + mov r0, r4 + pop {r4, r5, r7, pc} + + .globl _get_different_sel + .p2align 2 + .code 32 +_get_different_sel: + push {r7, lr} + mov r7, sp + movw r2, :lower16:(__MergedGlobals-(LPC3_0+8)) + movt r2, :upper16:(__MergedGlobals-(LPC3_0+8)) +LPC3_0: + add r2, pc, r2 + ldr r0, [r2, #8] + cmp r0, #0 + popne {r7, pc} +LBB3_1: + movw r1, :lower16:(L_anon.[ID].2-(LPC3_1+8)) + add r0, r2, #8 + movt r1, :upper16:(L_anon.[ID].2-(LPC3_1+8)) +LPC3_1: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _unused_sel + .p2align 2 + .code 32 +_unused_sel: + push {r7, lr} + mov r7, sp + movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) + movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_0+8)) +LPC4_0: + add r0, pc, r0 + ldr r0, [r0] + cmp r0, #0 + popne {r7, pc} +LBB4_1: + movw r0, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) + movt r0, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-(LPC4_1+8)) + movw r1, :lower16:(l_anon.[ID].3-(LPC4_2+8)) + movt r1, :upper16:(l_anon.[ID].3-(LPC4_2+8)) +LPC4_1: + add r0, pc, r0 +LPC4_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + pop {r7, pc} + + .globl _use_fns + .p2align 2 + .code 32 +_use_fns: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + push {r8, r10} + movw r10, :lower16:(__MergedGlobals-(LPC5_0+8)) + mov r4, r0 + movt r10, :upper16:(__MergedGlobals-(LPC5_0+8)) +LPC5_0: + add r10, pc, r10 + ldr r8, [r10] + cmp r8, #0 + beq LBB5_5 + ldr r6, [r10, #4] + cmp r6, #0 + beq LBB5_6 +LBB5_2: + ldr r5, [r10, #8] + cmp r5, #0 + beq LBB5_7 +LBB5_3: + ldr r0, [r10, #12] + cmp r0, #0 + beq LBB5_8 +LBB5_4: + str r8, [r4] + str r6, [r4, #4] + str r5, [r4, #8] + str r0, [r4, #12] + pop {r8, r10} + pop {r4, r5, r6, r7, pc} +LBB5_5: + movw r0, :lower16:(__MergedGlobals-(LPC5_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC5_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC5_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC5_2+8)) +LPC5_1: + add r0, pc, r0 +LPC5_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r6, [r10, #4] + cmp r6, #0 + bne LBB5_2 +LBB5_6: + movw r1, :lower16:(l_anon.[ID].0-(LPC5_3+8)) + add r0, r10, #4 + movt r1, :upper16:(l_anon.[ID].0-(LPC5_3+8)) +LPC5_3: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r6, r0 + ldr r5, [r10, #8] + cmp r5, #0 + bne LBB5_3 +LBB5_7: + movw r1, :lower16:(L_anon.[ID].2-(LPC5_4+8)) + add r0, r10, #8 + movt r1, :upper16:(L_anon.[ID].2-(LPC5_4+8)) +LPC5_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r5, r0 + ldr r0, [r10, #12] + cmp r0, #0 + bne LBB5_4 +LBB5_8: + movw r1, :lower16:(l_anon.[ID].4-(LPC5_5+8)) + add r0, r10, #12 + movt r1, :upper16:(l_anon.[ID].4-(LPC5_5+8)) +LPC5_5: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + b LBB5_4 + + .globl _use_same_twice + .p2align 2 + .code 32 +_use_same_twice: + push {r4, r5, r7, lr} + add r7, sp, #8 + push {r8} + movw r5, :lower16:(__MergedGlobals-(LPC6_0+8)) + mov r4, r0 + movt r5, :upper16:(__MergedGlobals-(LPC6_0+8)) +LPC6_0: + add r5, pc, r5 + ldr r8, [r5] + cmp r8, #0 + beq LBB6_3 + ldr r9, [r5] + cmp r9, #0 + beq LBB6_4 +LBB6_2: + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} +LBB6_3: + movw r0, :lower16:(__MergedGlobals-(LPC6_1+8)) + movt r0, :upper16:(__MergedGlobals-(LPC6_1+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC6_2+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC6_2+8)) +LPC6_1: + add r0, pc, r0 +LPC6_2: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r8, r0 + ldr r9, [r5] + cmp r9, #0 + bne LBB6_2 +LBB6_4: + movw r0, :lower16:(__MergedGlobals-(LPC6_3+8)) + movt r0, :upper16:(__MergedGlobals-(LPC6_3+8)) + movw r1, :lower16:(l_anon.[ID].0-(LPC6_4+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC6_4+8)) +LPC6_3: + add r0, pc, r0 +LPC6_4: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r9, r0 + strd r8, r9, [r4] + pop {r8} + pop {r4, r5, r7, pc} + + .globl _use_in_loop + .p2align 2 + .code 32 +_use_in_loop: + push {r4, r5, r6, r7, lr} + add r7, sp, #12 + cmp r0, #0 + beq LBB7_5 + movw r5, :lower16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) + mov r4, r0 + movt r5, :upper16:(SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-(LPC7_0+8)) + movw r6, :lower16:(l_anon.[ID].5-(LPC7_1+8)) + movt r6, :upper16:(l_anon.[ID].5-(LPC7_1+8)) +LPC7_0: + add r5, pc, r5 +LPC7_1: + add r6, pc, r6 + b LBB7_3 +LBB7_2: + subs r4, r4, #1 + beq LBB7_5 +LBB7_3: + ldr r0, [r5] + cmp r0, #0 + bne LBB7_2 + mov r0, r5 + mov r1, r6 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + b LBB7_2 +LBB7_5: + pop {r4, r5, r6, r7, pc} + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "simple" + +l_anon.[ID].1: + .asciz "alloc" + + .section __TEXT,__literal16,16byte_literals +L_anon.[ID].2: + .asciz "i:am:different:" + + .section __TEXT,__const +l_anon.[ID].3: + .asciz "unused" + +l_anon.[ID].4: + .asciz "fourthSel" + +l_anon.[ID].5: + .asciz "loopedSelector" + +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,__MergedGlobals,16,2 + .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers + .p2align 2, 0x0 +LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s new file mode 100644 index 000000000..b91bb7bcc --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s @@ -0,0 +1,374 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .globl _get_sel + .p2align 4, 0x90 +_get_sel: + push ebp + mov ebp, esp + sub esp, 8 + call L0$pb +L0$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L0$pb] + test eax, eax + je LBB0_1 + add esp, 8 + pop ebp + ret +LBB0_1: + sub esp, 8 + lea eax, [ecx + l_anon.[ID].0-L0$pb] + lea ecx, [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L0$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_same_sel + .p2align 4, 0x90 +_get_same_sel: + push ebp + mov ebp, esp + sub esp, 8 + call L1$pb +L1$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)-L1$pb] + test eax, eax + je LBB1_1 + add esp, 8 + pop ebp + ret +LBB1_1: + sub esp, 8 + lea eax, [ecx + l_anon.[ID].0-L1$pb] + lea ecx, [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)-L1$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _get_common_twice + .p2align 4, 0x90 +_get_common_twice: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L2$pb +L2$pb: + pop ebx + mov edi, dword ptr [ebx + LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-L2$pb] + mov esi, dword ptr [edi] + test esi, esi + je LBB2_1 + mov edx, dword ptr [edi] + test edx, edx + je LBB2_3 +LBB2_4: + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret +LBB2_1: + sub esp, 8 + lea eax, [ebx + l_anon.[ID].1-L2$pb] + push eax + push edi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + mov esi, eax + mov edx, dword ptr [edi] + test edx, edx + jne LBB2_4 +LBB2_3: + sub esp, 8 + lea eax, [ebx + l_anon.[ID].1-L2$pb] + push eax + push edi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + mov edx, eax + jmp LBB2_4 + + .globl _get_different_sel + .p2align 4, 0x90 +_get_different_sel: + push ebp + mov ebp, esp + sub esp, 8 + call L3$pb +L3$pb: + pop ecx + mov eax, dword ptr [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)-L3$pb] + test eax, eax + je LBB3_1 + add esp, 8 + pop ebp + ret +LBB3_1: + sub esp, 8 + lea eax, [ecx + L_anon.[ID].2-L3$pb] + lea ecx, [ecx + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)-L3$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _unused_sel + .p2align 4, 0x90 +_unused_sel: + push ebp + mov ebp, esp + sub esp, 8 + call L4$pb +L4$pb: + pop eax + mov ecx, dword ptr [eax + SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-L4$pb] + test ecx, ecx + je LBB4_1 + add esp, 8 + pop ebp + ret +LBB4_1: + sub esp, 8 + lea ecx, [eax + l_anon.[ID].3-L4$pb] + lea eax, [eax + SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)-L4$pb] + push ecx + push eax + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 24 + pop ebp + ret + + .globl _use_fns + .p2align 4, 0x90 +_use_fns: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L5$pb +L5$pb: + pop edi + mov ecx, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L5$pb] + test ecx, ecx + je LBB5_1 + mov edx, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)-L5$pb] + test edx, edx + je LBB5_3 +LBB5_4: + mov ebx, dword ptr [ebp + 8] + mov esi, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)-L5$pb] + test esi, esi + je LBB5_5 +LBB5_6: + mov eax, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)-L5$pb] + test eax, eax + je LBB5_7 +LBB5_8: + mov dword ptr [ebx], ecx + mov dword ptr [ebx + 4], edx + mov dword ptr [ebx + 8], esi + mov dword ptr [ebx + 12], eax + mov eax, ebx + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret 4 +LBB5_1: + sub esp, 8 + lea eax, [edi + l_anon.[ID].0-L5$pb] + lea ecx, [edi + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L5$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + mov ecx, eax + mov edx, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)-L5$pb] + test edx, edx + jne LBB5_4 +LBB5_3: + sub esp, 8 + lea eax, [edi + l_anon.[ID].0-L5$pb] + mov esi, ecx + lea ecx, [edi + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)-L5$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov ecx, esi + add esp, 16 + mov edx, eax + mov ebx, dword ptr [ebp + 8] + mov esi, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)-L5$pb] + test esi, esi + jne LBB5_6 +LBB5_5: + sub esp, 8 + lea eax, [edi + L_anon.[ID].2-L5$pb] + mov dword ptr [ebp - 16], ecx + lea ecx, [edi + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)-L5$pb] + push eax + push ecx + mov esi, edx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov edx, esi + mov ecx, dword ptr [ebp - 16] + add esp, 16 + mov esi, eax + mov eax, dword ptr [edi + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)-L5$pb] + test eax, eax + jne LBB5_8 +LBB5_7: + sub esp, 8 + lea eax, [edi + l_anon.[ID].4-L5$pb] + mov dword ptr [ebp - 16], ecx + lea ecx, [edi + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)-L5$pb] + push eax + push ecx + mov edi, edx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov edx, edi + mov ecx, dword ptr [ebp - 16] + add esp, 16 + jmp LBB5_8 + + .globl _use_same_twice + .p2align 4, 0x90 +_use_same_twice: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L6$pb +L6$pb: + pop ebx + mov esi, dword ptr [ebp + 8] + mov edi, dword ptr [ebx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L6$pb] + test edi, edi + je LBB6_1 + mov eax, dword ptr [ebx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L6$pb] + test eax, eax + je LBB6_3 +LBB6_4: + mov dword ptr [esi], edi + mov dword ptr [esi + 4], eax + mov eax, esi + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret 4 +LBB6_1: + sub esp, 8 + lea eax, [ebx + l_anon.[ID].0-L6$pb] + lea ecx, [ebx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L6$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + mov edi, eax + mov eax, dword ptr [ebx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L6$pb] + test eax, eax + jne LBB6_4 +LBB6_3: + sub esp, 8 + lea eax, [ebx + l_anon.[ID].0-L6$pb] + lea ecx, [ebx + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)-L6$pb] + push eax + push ecx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB6_4 + + .globl _use_in_loop + .p2align 4, 0x90 +_use_in_loop: + push ebp + mov ebp, esp + push ebx + push edi + push esi + sub esp, 12 + call L7$pb +L7$pb: + pop esi + mov edi, dword ptr [ebp + 8] + test edi, edi + je LBB7_5 + lea ebx, [esi + SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-L7$pb] + jmp LBB7_2 + .p2align 4, 0x90 +LBB7_4: + dec edi + je LBB7_5 +LBB7_2: + mov eax, dword ptr [esi + SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)-L7$pb] + test eax, eax + jne LBB7_4 + sub esp, 8 + lea eax, [esi + l_anon.[ID].5-L7$pb] + push eax + push ebx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB7_4 +LBB7_5: + add esp, 12 + pop esi + pop edi + pop ebx + pop ebp + ret + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "simple" + +l_anon.[ID].1: + .asciz "alloc" + + .section __TEXT,__literal16,16byte_literals +L_anon.[ID].2: + .asciz "i:am:different:" + + .section __TEXT,__const +l_anon.[ID].3: + .asciz "unused" + +l_anon.[ID].4: + .asciz "fourthSel" + +l_anon.[ID].5: + .asciz "loopedSelector" + +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0),4,2 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),4,2 + .section __IMPORT,__pointers,non_lazy_symbol_pointers +LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) + .long 0 + +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s new file mode 100644 index 000000000..79e17f87d --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s @@ -0,0 +1,266 @@ + .section __TEXT,__text,regular,pure_instructions + .intel_syntax noprefix + .globl _get_sel + .p2align 4, 0x90 +_get_sel: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + test rax, rax + je LBB0_2 + pop rbp + ret +LBB0_2: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _get_same_sel + .p2align 4, 0x90 +_get_same_sel: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)] + test rax, rax + je LBB1_2 + pop rbp + ret +LBB1_2: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _get_common_twice + .p2align 4, 0x90 +_get_common_twice: + push rbp + mov rbp, rsp + push r14 + push rbx + mov r14, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov rbx, qword ptr [r14] + test rbx, rbx + je LBB2_1 + mov rdx, qword ptr [r14] + test rdx, rdx + je LBB2_3 +LBB2_4: + mov rax, rbx + pop rbx + pop r14 + pop rbp + ret +LBB2_1: + mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea rsi, [rip + l_anon.[ID].1] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rbx, rax + mov rdx, qword ptr [r14] + test rdx, rdx + jne LBB2_4 +LBB2_3: + mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea rsi, [rip + l_anon.[ID].1] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rdx, rax + jmp LBB2_4 + + .globl _get_different_sel + .p2align 4, 0x90 +_get_different_sel: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)] + test rax, rax + je LBB3_2 + pop rbp + ret +LBB3_2: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)] + lea rsi, [rip + L_anon.[ID].2] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _unused_sel + .p2align 4, 0x90 +_unused_sel: + push rbp + mov rbp, rsp + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)] + test rax, rax + je LBB4_2 + pop rbp + ret +LBB4_2: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].3] + pop rbp + jmp SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + + .globl _use_fns + .p2align 4, 0x90 +_use_fns: + push rbp + mov rbp, rsp + push r15 + push r14 + push r12 + push rbx + mov rbx, rdi + mov r14, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + test r14, r14 + je LBB5_1 + mov r15, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)] + test r15, r15 + je LBB5_3 +LBB5_4: + mov r12, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)] + test r12, r12 + je LBB5_5 +LBB5_6: + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)] + test rax, rax + je LBB5_7 +LBB5_8: + mov qword ptr [rbx], r14 + mov qword ptr [rbx + 8], r15 + mov qword ptr [rbx + 16], r12 + mov qword ptr [rbx + 24], rax + mov rax, rbx + pop rbx + pop r12 + pop r14 + pop r15 + pop rbp + ret +LBB5_1: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r14, rax + mov r15, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)] + test r15, r15 + jne LBB5_4 +LBB5_3: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r15, rax + mov r12, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)] + test r12, r12 + jne LBB5_6 +LBB5_5: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0)] + lea rsi, [rip + L_anon.[ID].2] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r12, rax + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)] + test rax, rax + jne LBB5_8 +LBB5_7: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].4] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + jmp LBB5_8 + + .globl _use_same_twice + .p2align 4, 0x90 +_use_same_twice: + push rbp + mov rbp, rsp + push r14 + push rbx + mov rbx, rdi + mov r14, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + test r14, r14 + je LBB6_1 + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + test rax, rax + je LBB6_3 +LBB6_4: + mov qword ptr [rbx], r14 + mov qword ptr [rbx + 8], rax + mov rax, rbx + pop rbx + pop r14 + pop rbp + ret +LBB6_1: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r14, rax + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + test rax, rax + jne LBB6_4 +LBB6_3: + lea rdi, [rip + SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0)] + lea rsi, [rip + l_anon.[ID].0] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + jmp LBB6_4 + + .globl _use_in_loop + .p2align 4, 0x90 +_use_in_loop: + push rbp + mov rbp, rsp + push r15 + push r14 + push rbx + push rax + test rdi, rdi + je LBB7_5 + mov rbx, rdi + lea r14, [rip + SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)] + lea r15, [rip + l_anon.[ID].5] + jmp LBB7_2 + .p2align 4, 0x90 +LBB7_4: + dec rbx + je LBB7_5 +LBB7_2: + mov rax, qword ptr [rip + SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0)] + test rax, rax + jne LBB7_4 + mov rdi, r14 + mov rsi, r15 + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + jmp LBB7_4 +LBB7_5: + add rsp, 8 + pop rbx + pop r14 + pop r15 + pop rbp + ret + + .section __TEXT,__const +l_anon.[ID].0: + .asciz "simple" + +l_anon.[ID].1: + .asciz "alloc" + + .section __TEXT,__literal16,16byte_literals +L_anon.[ID].2: + .asciz "i:am:different:" + + .section __TEXT,__const +l_anon.[ID].3: + .asciz "unused" + +l_anon.[ID].4: + .asciz "fourthSel" + +l_anon.[ID].5: + .asciz "loopedSelector" + +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_sel::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_same_sel::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::get_different_sel::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::unused_sel::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0),8,3 +.zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),8,3 +.subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86.s b/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86_64.s b/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86_64.s new file mode 100644 index 000000000..c690d3633 --- /dev/null +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/gnustep-x86_64.s @@ -0,0 +1,3 @@ + .text + .intel_syntax noprefix + .section ".note.GNU-stack","",@progbits diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-aarch64.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-aarch64.s index cdb062984..9a170bdd1 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-aarch64.s @@ -22,32 +22,25 @@ _iter_create: .globl _iter_once .p2align 2 _iter_once: - stp x24, x23, [sp, #-64]! - stp x22, x21, [sp, #16] - stp x20, x19, [sp, #32] - stp x29, x30, [sp, #48] - add x29, sp, #48 + stp x22, x21, [sp, #-48]! + stp x20, x19, [sp, #16] + stp x29, x30, [sp, #32] + add x29, sp, #32 mov x19, x0 ldp x8, x9, [x0, #200] cmp x8, x9 - b.lo LBB1_4 + b.lo LBB1_3 add x20, x19, #8 ldr x21, [x19] add x22, x19, #136 Lloh0: - adrp x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE + adrp x8, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE Lloh1: - ldr x23, [x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] - ldr x1, [x23] - cbnz x1, LBB1_3 + ldr x8, [x8, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] Lloh2: - adrp x0, l_anon.[ID].0@PAGE -Lloh3: - add x0, x0, l_anon.[ID].0@PAGEOFF - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov x1, x0 - str x0, [x23] -LBB1_3: + ldr x1, [x8] + cbz x1, LBB1_5 +LBB1_2: mov x0, x21 mov x2, x22 mov x3, x20 @@ -55,20 +48,32 @@ LBB1_3: bl _objc_msgSend mov x8, #0 stp xzr, x0, [x19, #200] - cbz x0, LBB1_5 -LBB1_4: + cbz x0, LBB1_4 +LBB1_3: ldr x9, [x19, #144] add x10, x8, #1 str x10, [x19, #200] ldr x0, [x9, x8, lsl #3] -LBB1_5: - ldp x29, x30, [sp, #48] - ldp x20, x19, [sp, #32] - ldp x22, x21, [sp, #16] - ldp x24, x23, [sp], #64 +LBB1_4: + ldp x29, x30, [sp, #32] + ldp x20, x19, [sp, #16] + ldp x22, x21, [sp], #48 ret - .loh AdrpLdrGot Lloh0, Lloh1 - .loh AdrpAdd Lloh2, Lloh3 +LBB1_5: +Lloh3: + adrp x0, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE +Lloh4: + ldr x0, [x0, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] +Lloh5: + adrp x1, l_anon.[ID].0@PAGE +Lloh6: + add x1, x1, l_anon.[ID].0@PAGEOFF + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x1, x0 + b LBB1_2 + .loh AdrpLdrGotLdr Lloh0, Lloh1, Lloh2 + .loh AdrpAdd Lloh5, Lloh6 + .loh AdrpLdrGot Lloh3, Lloh4 .globl _use_obj .p2align 2 @@ -108,13 +113,13 @@ _iter: stp xzr, xzr, [sp, #152] str xzr, [sp, #144] str xzr, [sp, #216] -Lloh4: +Lloh7: adrp x22, l_anon.[ID].0@PAGE -Lloh5: +Lloh8: add x22, x22, l_anon.[ID].0@PAGEOFF -Lloh6: +Lloh9: adrp x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE -Lloh7: +Lloh10: ldr x23, [x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] b LBB3_2 LBB3_1: @@ -129,12 +134,8 @@ LBB3_2: cmp x8, x9 b.lo LBB3_1 ldr x1, [x23] - cbnz x1, LBB3_5 - mov x0, x22 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov x1, x0 - str x0, [x23] -LBB3_5: + cbz x1, LBB3_6 +LBB3_4: mov x0, x21 mov x2, x20 mov x3, x19 @@ -144,6 +145,12 @@ LBB3_5: cbz x0, LBB3_7 mov x8, #0 b LBB3_1 +LBB3_6: + mov x0, x23 + mov x1, x22 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x1, x0 + b LBB3_4 LBB3_7: ldp x29, x30, [sp, #272] ldp x20, x19, [sp, #256] @@ -151,8 +158,8 @@ LBB3_7: ldp x24, x23, [sp, #224] add sp, sp, #288 ret - .loh AdrpLdrGot Lloh6, Lloh7 - .loh AdrpAdd Lloh4, Lloh5 + .loh AdrpLdrGot Lloh9, Lloh10 + .loh AdrpAdd Lloh7, Lloh8 .globl _iter_noop .p2align 2 @@ -181,13 +188,13 @@ _iter_noop: stp xzr, xzr, [sp, #152] str xzr, [sp, #144] str xzr, [sp, #216] -Lloh8: +Lloh11: adrp x22, l_anon.[ID].0@PAGE -Lloh9: +Lloh12: add x22, x22, l_anon.[ID].0@PAGEOFF -Lloh10: +Lloh13: adrp x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE -Lloh11: +Lloh14: ldr x23, [x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] b LBB4_2 LBB4_1: @@ -197,12 +204,8 @@ LBB4_2: cmp x8, x0 b.lo LBB4_1 ldr x1, [x23] - cbnz x1, LBB4_5 - mov x0, x22 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov x1, x0 - str x0, [x23] -LBB4_5: + cbz x1, LBB4_6 +LBB4_4: mov x0, x20 mov x2, x21 mov x3, x19 @@ -213,6 +216,12 @@ LBB4_5: mov x8, #0 ldr x20, [sp, #8] b LBB4_1 +LBB4_6: + mov x0, x23 + mov x1, x22 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x1, x0 + b LBB4_4 LBB4_7: ldp x29, x30, [sp, #272] ldp x20, x19, [sp, #256] @@ -220,8 +229,8 @@ LBB4_7: ldp x24, x23, [sp, #224] add sp, sp, #288 ret - .loh AdrpLdrGot Lloh10, Lloh11 - .loh AdrpAdd Lloh8, Lloh9 + .loh AdrpLdrGot Lloh13, Lloh14 + .loh AdrpAdd Lloh11, Lloh12 .globl _iter_retained .p2align 2 @@ -232,7 +241,7 @@ _iter_retained: stp x20, x19, [sp, #256] stp x29, x30, [sp, #272] add x29, sp, #272 - mov x22, x0 + mov x23, x0 mov x9, #0 mov x8, #0 stp xzr, xzr, [sp, #200] @@ -250,14 +259,14 @@ _iter_retained: stp xzr, xzr, [sp, #152] str xzr, [sp, #144] str xzr, [sp, #216] -Lloh12: +Lloh15: adrp x21, l_anon.[ID].0@PAGE -Lloh13: +Lloh16: add x21, x21, l_anon.[ID].0@PAGEOFF -Lloh14: - adrp x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE -Lloh15: - ldr x23, [x23, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] +Lloh17: + adrp x22, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE +Lloh18: + ldr x22, [x22, SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] b LBB5_2 LBB5_1: ldr x9, [sp, #152] @@ -265,23 +274,19 @@ LBB5_1: str x10, [sp, #208] ldr x0, [x9, x8, lsl #3] bl _objc_retain - mov x22, x0 + mov x23, x0 bl _use_obj - mov x0, x22 + mov x0, x23 bl _objc_release - ldr x22, [sp, #8] + ldr x23, [sp, #8] ldp x8, x9, [sp, #208] LBB5_2: cmp x8, x9 b.lo LBB5_1 - ldr x1, [x23] - cbnz x1, LBB5_5 - mov x0, x21 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov x1, x0 - str x0, [x23] -LBB5_5: - mov x0, x22 + ldr x1, [x22] + cbz x1, LBB5_6 +LBB5_4: + mov x0, x23 mov x2, x20 mov x3, x19 mov w4, #16 @@ -290,6 +295,12 @@ LBB5_5: cbz x0, LBB5_7 mov x8, #0 b LBB5_1 +LBB5_6: + mov x0, x22 + mov x1, x21 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov x1, x0 + b LBB5_4 LBB5_7: ldp x29, x30, [sp, #272] ldp x20, x19, [sp, #256] @@ -297,8 +308,8 @@ LBB5_7: ldp x24, x23, [sp, #224] add sp, sp, #288 ret - .loh AdrpLdrGot Lloh14, Lloh15 - .loh AdrpAdd Lloh12, Lloh13 + .loh AdrpLdrGot Lloh17, Lloh18 + .loh AdrpAdd Lloh15, Lloh16 .section __TEXT,__const l_anon.[ID].0: diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s index dc5a4638e..6dede8910 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7.s @@ -28,30 +28,23 @@ _iter_create: _iter_once: push {r4, r5, r6, r7, lr} add r7, sp, #12 - push {r8, r10} + push {r8} sub sp, sp, #4 mov r4, r0 ldrd r0, r1, [r0, #100] cmp r0, r1 - blo LBB1_4 + blo LBB1_3 ldr r6, [r4] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) + movw r0, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) + movt r0, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) add r8, r4, #4 LPC1_0: - ldr r10, [pc, r10] + ldr r0, [pc, r0] add r5, r4, #68 - ldr r1, [r10] + ldr r1, [r0] cmp r1, #0 - bne LBB1_3 - movw r0, :lower16:(l_anon.[ID].0-(LPC1_1+8)) - movt r0, :upper16:(l_anon.[ID].0-(LPC1_1+8)) -LPC1_1: - add r0, pc, r0 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov r1, r0 - str r0, [r10] -LBB1_3: + beq LBB1_5 +LBB1_2: mov r0, #16 mov r2, r5 str r0, [sp] @@ -62,16 +55,24 @@ LBB1_3: mov r0, #0 cmp r1, #0 strd r0, r1, [r4, #100] - beq LBB1_5 -LBB1_4: + beq LBB1_4 +LBB1_3: ldr r1, [r4, #72] add r2, r0, #1 str r2, [r4, #100] ldr r0, [r1, r0, lsl #2] -LBB1_5: - sub sp, r7, #20 - pop {r8, r10} +LBB1_4: + sub sp, r7, #16 + pop {r8} pop {r4, r5, r6, r7, pc} +LBB1_5: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) +LPC1_1: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + b LBB1_2 .globl _use_obj .p2align 2 @@ -115,14 +116,14 @@ _iter: str r0, [sp, #84] str r0, [sp, #80] str r6, [sp, #8] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movw r8, :lower16:(l_anon.[ID].0-(LPC3_1+8)) - movt r8, :upper16:(l_anon.[ID].0-(LPC3_1+8)) + movw r8, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) + movt r8, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) + movw r10, :lower16:(l_anon.[ID].0-(LPC3_1+8)) + movt r10, :upper16:(l_anon.[ID].0-(LPC3_1+8)) LPC3_0: - ldr r10, [pc, r10] + ldr r8, [pc, r8] LPC3_1: - add r8, pc, r8 + add r10, pc, r10 b LBB3_3 LBB3_1: mov r0, r6 @@ -146,13 +147,13 @@ LBB3_2: LBB3_3: cmp r1, r0 blo LBB3_2 - ldr r1, [r10] + ldr r1, [r8] cmp r1, #0 bne LBB3_1 mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) + mov r1, r10 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov r1, r0 - str r0, [r10] b LBB3_1 LBB3_6: sub sp, r7, #24 @@ -189,14 +190,14 @@ _iter_noop: str r0, [sp, #84] str r0, [sp, #80] str r6, [sp, #8] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movw r8, :lower16:(l_anon.[ID].0-(LPC4_1+8)) - movt r8, :upper16:(l_anon.[ID].0-(LPC4_1+8)) + movw r8, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) + movt r8, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) + movw r10, :lower16:(l_anon.[ID].0-(LPC4_1+8)) + movt r10, :upper16:(l_anon.[ID].0-(LPC4_1+8)) LPC4_0: - ldr r10, [pc, r10] + ldr r8, [pc, r8] LPC4_1: - add r8, pc, r8 + add r10, pc, r10 b LBB4_2 LBB4_1: add r1, r1, #1 @@ -204,14 +205,10 @@ LBB4_1: LBB4_2: cmp r1, r0 blo LBB4_1 - ldr r1, [r10] + ldr r1, [r8] cmp r1, #0 - bne LBB4_5 - mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov r1, r0 - str r0, [r10] -LBB4_5: + beq LBB4_6 +LBB4_4: mov r0, r6 mov r2, r5 mov r3, r4 @@ -223,6 +220,12 @@ LBB4_5: ldr r6, [sp, #8] mov r1, #0 b LBB4_1 +LBB4_6: + mov r0, r8 + mov r1, r10 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + b LBB4_4 LBB4_7: sub sp, r7, #24 pop {r8, r10, r11} @@ -296,10 +299,10 @@ LBB5_3: ldr r1, [r10] cmp r1, #0 bne LBB5_1 - mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) + mov r0, r10 + mov r1, r8 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov r1, r0 - str r0, [r10] b LBB5_1 LBB5_6: sub sp, r7, #24 diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7s.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7s.s index 7542f916a..a37c6e0d6 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-armv7s.s @@ -28,30 +28,23 @@ _iter_create: _iter_once: push {r4, r5, r6, r7, lr} add r7, sp, #12 - push {r8, r10} + push {r8} sub sp, sp, #4 mov r4, r0 ldrd r0, r1, [r0, #100] cmp r0, r1 - blo LBB1_4 + blo LBB1_3 ldr r6, [r4] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) + movw r0, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) + movt r0, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC1_0+8)) add r8, r4, #4 LPC1_0: - ldr r10, [pc, r10] + ldr r0, [pc, r0] add r5, r4, #68 - ldr r1, [r10] + ldr r1, [r0] cmp r1, #0 - bne LBB1_3 - movw r0, :lower16:(l_anon.[ID].0-(LPC1_1+8)) - movt r0, :upper16:(l_anon.[ID].0-(LPC1_1+8)) -LPC1_1: - add r0, pc, r0 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov r1, r0 - str r0, [r10] -LBB1_3: + beq LBB1_5 +LBB1_2: mov r0, #16 mov r2, r5 str r0, [sp] @@ -62,16 +55,24 @@ LBB1_3: mov r0, #0 cmp r1, #0 strd r0, r1, [r4, #100] - beq LBB1_5 -LBB1_4: + beq LBB1_4 +LBB1_3: ldr r1, [r4, #72] add r2, r0, #1 str r2, [r4, #100] ldr r0, [r1, r0, lsl #2] -LBB1_5: - sub sp, r7, #20 - pop {r8, r10} +LBB1_4: + sub sp, r7, #16 + pop {r8} pop {r4, r5, r6, r7, pc} +LBB1_5: + movw r1, :lower16:(l_anon.[ID].0-(LPC1_1+8)) + movt r1, :upper16:(l_anon.[ID].0-(LPC1_1+8)) +LPC1_1: + add r1, pc, r1 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + b LBB1_2 .globl _use_obj .p2align 2 @@ -115,14 +116,14 @@ _iter: str r0, [sp, #84] str r0, [sp, #80] str r6, [sp, #8] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) - movw r8, :lower16:(l_anon.[ID].0-(LPC3_1+8)) + movw r8, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) + movt r8, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC3_0+8)) + movw r10, :lower16:(l_anon.[ID].0-(LPC3_1+8)) LPC3_0: - ldr r10, [pc, r10] - movt r8, :upper16:(l_anon.[ID].0-(LPC3_1+8)) + ldr r8, [pc, r8] + movt r10, :upper16:(l_anon.[ID].0-(LPC3_1+8)) LPC3_1: - add r8, pc, r8 + add r10, pc, r10 b LBB3_3 LBB3_1: mov r0, r6 @@ -146,13 +147,13 @@ LBB3_2: LBB3_3: cmp r1, r0 blo LBB3_2 - ldr r1, [r10] + ldr r1, [r8] cmp r1, #0 bne LBB3_1 mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) + mov r1, r10 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov r1, r0 - str r0, [r10] b LBB3_1 LBB3_6: sub sp, r7, #24 @@ -189,14 +190,14 @@ _iter_noop: str r0, [sp, #84] str r0, [sp, #80] str r6, [sp, #8] - movw r10, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movt r10, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) - movw r8, :lower16:(l_anon.[ID].0-(LPC4_1+8)) + movw r8, :lower16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) + movt r8, :upper16:(LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC4_0+8)) + movw r10, :lower16:(l_anon.[ID].0-(LPC4_1+8)) LPC4_0: - ldr r10, [pc, r10] - movt r8, :upper16:(l_anon.[ID].0-(LPC4_1+8)) + ldr r8, [pc, r8] + movt r10, :upper16:(l_anon.[ID].0-(LPC4_1+8)) LPC4_1: - add r8, pc, r8 + add r10, pc, r10 b LBB4_2 LBB4_1: add r1, r1, #1 @@ -204,14 +205,10 @@ LBB4_1: LBB4_2: cmp r1, r0 blo LBB4_1 - ldr r1, [r10] + ldr r1, [r8] cmp r1, #0 - bne LBB4_5 - mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov r1, r0 - str r0, [r10] -LBB4_5: + beq LBB4_6 +LBB4_4: mov r0, r6 mov r2, r5 mov r3, r4 @@ -223,6 +220,12 @@ LBB4_5: ldr r6, [sp, #8] mov r1, #0 b LBB4_1 +LBB4_6: + mov r0, r8 + mov r1, r10 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov r1, r0 + b LBB4_4 LBB4_7: sub sp, r7, #24 pop {r8, r10, r11} @@ -296,10 +299,10 @@ LBB5_3: ldr r1, [r10] cmp r1, #0 bne LBB5_1 - mov r0, r8 - bl SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) + mov r0, r10 + mov r1, r8 + bl SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov r1, r0 - str r0, [r10] b LBB5_1 LBB5_6: sub sp, r7, #24 diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86.s index d615c9ff8..b4a70918f 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86.s @@ -53,29 +53,21 @@ L1$pb: mov eax, dword ptr [esi + 100] cmp eax, dword ptr [esi + 104] jb LBB1_1 - lea eax, [esi + 4] - mov dword ptr [ebp - 20], eax - mov edx, dword ptr [esi] + lea ebx, [esi + 4] + mov eax, dword ptr [esi] + mov dword ptr [ebp - 16], eax lea edi, [esi + 68] - mov ebx, dword ptr [ecx + LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-L1$pb] - mov eax, dword ptr [ebx] + mov edx, dword ptr [ecx + LSYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-L1$pb] + mov eax, dword ptr [edx] test eax, eax - jne LBB1_4 - sub esp, 12 - lea eax, [ecx + l_anon.[ID].0-L1$pb] - push eax - mov dword ptr [ebp - 16], edx - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov edx, dword ptr [ebp - 16] - add esp, 16 - mov dword ptr [ebx], eax + je LBB1_3 LBB1_4: sub esp, 12 push 16 - push dword ptr [ebp - 20] + push ebx push edi push eax - push edx + push dword ptr [ebp - 16] call _objc_msgSend add esp, 32 mov ecx, eax @@ -96,6 +88,14 @@ LBB1_5: pop ebx pop ebp ret +LBB1_3: + sub esp, 8 + lea eax, [ecx + l_anon.[ID].0-L1$pb] + push eax + push edx + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB1_4 .globl _use_obj .p2align 4, 0x90 @@ -191,11 +191,11 @@ LBB3_1: mov eax, dword ptr [esi] test eax, eax jne LBB3_4 - sub esp, 12 + sub esp, 8 push dword ptr [ebp - 16] - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) + push esi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) add esp, 16 - mov dword ptr [esi], eax jmp LBB3_4 LBB3_5: add esp, 124 @@ -261,12 +261,7 @@ LBB4_1: jb LBB4_6 mov eax, dword ptr [esi] test eax, eax - jne LBB4_4 - sub esp, 12 - push dword ptr [ebp - 16] - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - add esp, 16 - mov dword ptr [esi], eax + je LBB4_3 LBB4_4: sub esp, 12 push 16 @@ -283,6 +278,13 @@ LBB4_4: xor ecx, ecx mov ebx, dword ptr [ebp - 128] jmp LBB4_6 +LBB4_3: + sub esp, 8 + push dword ptr [ebp - 16] + push esi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 + jmp LBB4_4 LBB4_7: add esp, 124 pop esi @@ -299,7 +301,7 @@ _iter_retained: push ebx push edi push esi - sub esp, 140 + sub esp, 124 call L5$pb L5$pb: pop eax @@ -340,13 +342,15 @@ L5$pb: jmp LBB5_1 .p2align 4, 0x90 LBB5_4: + sub esp, 12 + push 16 lea ecx, [ebp - 124] - mov dword ptr [esp + 12], ecx - mov dword ptr [esp + 8], ebx - mov dword ptr [esp + 4], eax - mov dword ptr [esp], esi - mov dword ptr [esp + 16], 16 + push ecx + push ebx + push eax + push esi call _objc_msgSend + add esp, 32 mov dword ptr [ebp - 24], eax xor ecx, ecx test eax, eax @@ -355,14 +359,18 @@ LBB5_6: mov eax, dword ptr [ebp - 56] lea edx, [ecx + 1] mov dword ptr [ebp - 28], edx - mov eax, dword ptr [eax + 4*ecx] - mov dword ptr [esp], eax + sub esp, 12 + push dword ptr [eax + 4*ecx] call _objc_retain + add esp, 16 mov esi, eax - mov dword ptr [esp], eax + sub esp, 12 + push eax call _use_obj - mov dword ptr [esp], esi + add esp, 4 + push esi call _objc_release + add esp, 16 mov esi, dword ptr [ebp - 128] mov ecx, dword ptr [ebp - 28] mov eax, dword ptr [ebp - 24] @@ -372,13 +380,14 @@ LBB5_1: mov eax, dword ptr [edi] test eax, eax jne LBB5_4 - mov eax, dword ptr [ebp - 16] - mov dword ptr [esp], eax - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov dword ptr [edi], eax + sub esp, 8 + push dword ptr [ebp - 16] + push edi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + add esp, 16 jmp LBB5_4 LBB5_5: - add esp, 140 + add esp, 124 pop esi pop edi pop ebx diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86_64.s b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86_64.s index 3f8474dda..6f5930796 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86_64.s @@ -43,10 +43,8 @@ _iter_once: mov rbp, rsp push r15 push r14 - push r13 push r12 push rbx - push rax mov rbx, rdi mov rax, qword ptr [rdi + 200] cmp rax, qword ptr [rdi + 208] @@ -54,14 +52,10 @@ _iter_once: lea r14, [rbx + 8] mov r15, qword ptr [rbx] lea r12, [rbx + 136] - mov r13, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - mov rsi, qword ptr [r13] + mov rax, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov rsi, qword ptr [rax] test rsi, rsi - jne LBB1_4 - lea rdi, [rip + l_anon.[ID].0] - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov rsi, rax - mov qword ptr [r13], rax + je LBB1_3 LBB1_4: mov r8d, 16 mov rdi, r15 @@ -80,14 +74,18 @@ LBB1_1: mov qword ptr [rbx + 200], rdx mov rax, qword ptr [rcx + 8*rax] LBB1_5: - add rsp, 8 pop rbx pop r12 - pop r13 pop r14 pop r15 pop rbp ret +LBB1_3: + mov rdi, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea rsi, [rip + l_anon.[ID].0] + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rsi, rax + jmp LBB1_4 .globl _use_obj .p2align 4, 0x90 @@ -143,8 +141,8 @@ _iter: mov qword ptr [rbp - 48], 0 mov qword ptr [rbp - 56], 0 xor ecx, ecx - mov r13, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - lea r12, [rip + l_anon.[ID].0] + mov r12, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea r13, [rip + l_anon.[ID].0] xor eax, eax jmp LBB3_1 .p2align 4, 0x90 @@ -160,13 +158,9 @@ LBB3_6: LBB3_1: cmp rax, rcx jb LBB3_6 - mov rsi, qword ptr [r13] + mov rsi, qword ptr [r12] test rsi, rsi - jne LBB3_4 - mov rdi, r12 - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov rsi, rax - mov qword ptr [r13], rax + je LBB3_3 LBB3_4: mov r8d, 16 mov rdi, r14 @@ -178,6 +172,12 @@ LBB3_4: je LBB3_7 xor eax, eax jmp LBB3_6 +LBB3_3: + mov rdi, r12 + mov rsi, r13 + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rsi, rax + jmp LBB3_4 LBB3_7: add rsp, 216 pop rbx @@ -230,8 +230,8 @@ _iter_noop: mov qword ptr [rbp - 48], 0 mov qword ptr [rbp - 56], 0 xor eax, eax - mov r13, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - lea r12, [rip + l_anon.[ID].0] + mov r12, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea r13, [rip + l_anon.[ID].0] xor ecx, ecx jmp LBB4_1 .p2align 4, 0x90 @@ -241,13 +241,9 @@ LBB4_6: LBB4_1: cmp rcx, rax jb LBB4_6 - mov rsi, qword ptr [r13] + mov rsi, qword ptr [r12] test rsi, rsi - jne LBB4_4 - mov rdi, r12 - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov rsi, rax - mov qword ptr [r13], rax + je LBB4_3 LBB4_4: mov r8d, 16 mov rdi, r14 @@ -260,6 +256,12 @@ LBB4_4: mov r14, qword ptr [rbp - 256] xor ecx, ecx jmp LBB4_6 +LBB4_3: + mov rdi, r12 + mov rsi, r13 + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rsi, rax + jmp LBB4_4 LBB4_7: add rsp, 216 pop rbx @@ -312,8 +314,8 @@ _iter_retained: mov qword ptr [rbp - 48], 0 mov qword ptr [rbp - 56], 0 xor ecx, ecx - mov r13, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - lea r12, [rip + l_anon.[ID].0] + mov r12, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea r13, [rip + l_anon.[ID].0] xor eax, eax jmp LBB5_1 .p2align 4, 0x90 @@ -334,13 +336,9 @@ LBB5_6: LBB5_1: cmp rax, rcx jb LBB5_6 - mov rsi, qword ptr [r13] + mov rsi, qword ptr [r12] test rsi, rsi - jne LBB5_4 - mov rdi, r12 - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0) - mov rsi, rax - mov qword ptr [r13], rax + je LBB5_3 LBB5_4: mov r8d, 16 mov rdi, r15 @@ -352,6 +350,12 @@ LBB5_4: je LBB5_7 xor eax, eax jmp LBB5_6 +LBB5_3: + mov rdi, r12 + mov rsi, r13 + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) + mov rsi, rax + jmp LBB5_4 LBB5_7: add rsp, 216 pop rbx diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86.s b/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86.s index 8102c117c..faefb9417 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86.s @@ -57,29 +57,19 @@ iter_once: mov eax, dword ptr [edi + 100] cmp eax, dword ptr [edi + 104] jb .LBB1_1 - mov ebp, dword ptr [ebx + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOT] lea eax, [edi + 4] - lea ecx, [edi + 68] + mov ebp, dword ptr [edi] mov dword ptr [esp + 8], eax - mov dword ptr [esp + 4], ecx - mov eax, dword ptr [edi] - mov esi, dword ptr [ebp] + lea eax, [edi + 68] + mov dword ptr [esp + 4], eax + mov eax, dword ptr [ebx + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOT] + mov esi, dword ptr [eax] test esi, esi - jne .LBB1_4 - sub esp, 12 - mov dword ptr [esp + 12], eax - lea eax, [ebx + .Lanon.[ID].0@GOTOFF] - push eax - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@PLT - add esp, 16 - mov esi, eax - mov eax, dword ptr [esp] - mov dword ptr [ebp], esi + je .LBB1_3 .LBB1_4: sub esp, 8 push esi - push eax - mov ebp, eax + push ebp call objc_msg_lookup@PLT add esp, 4 push 16 @@ -107,6 +97,15 @@ iter_once: pop ebx pop ebp ret +.LBB1_3: + sub esp, 8 + lea ecx, [ebx + .Lanon.[ID].0@GOTOFF] + push ecx + push eax + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@PLT + add esp, 16 + mov esi, eax + jmp .LBB1_4 .Lfunc_end1: .size iter_once, .Lfunc_end1-iter_once @@ -212,12 +211,12 @@ iter: mov esi, dword ptr [ebp] test esi, esi jne .LBB3_4 - sub esp, 12 - push dword ptr [esp + 24] - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@PLT + sub esp, 8 + push dword ptr [esp + 20] + push ebp + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@PLT add esp, 16 mov esi, eax - mov dword ptr [ebp], eax jmp .LBB3_4 .LBB3_5: add esp, 124 @@ -287,13 +286,7 @@ iter_noop: jb .LBB4_6 mov esi, dword ptr [ebp] test esi, esi - jne .LBB4_4 - sub esp, 12 - push dword ptr [esp + 24] - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@PLT - add esp, 16 - mov esi, eax - mov dword ptr [ebp], eax + je .LBB4_3 .LBB4_4: sub esp, 8 push esi @@ -315,6 +308,14 @@ iter_noop: mov edi, dword ptr [esp + 16] xor ecx, ecx jmp .LBB4_6 +.LBB4_3: + sub esp, 8 + push dword ptr [esp + 20] + push ebp + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@PLT + add esp, 16 + mov esi, eax + jmp .LBB4_4 .LBB4_7: add esp, 124 pop esi @@ -334,24 +335,28 @@ iter_retained: push ebx push edi push esi - sub esp, 140 + sub esp, 124 call .L5$pb .L5$pb: pop ebx - mov ebp, dword ptr [esp + 160] + mov ebp, dword ptr [esp + 144] xor eax, eax - mov dword ptr [esp + 116], 0 + mov dword ptr [esp + 100], 0 + mov dword ptr [esp + 96], 0 + mov dword ptr [esp + 108], 0 + mov dword ptr [esp + 104], 0 mov dword ptr [esp + 112], 0 - mov dword ptr [esp + 124], 0 - mov dword ptr [esp + 120], 0 - mov dword ptr [esp + 128], 0 .Ltmp3: add ebx, offset _GLOBAL_OFFSET_TABLE_+(.Ltmp3-.L5$pb) mov edi, dword ptr [ebx + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOT] lea ecx, [ebx + .Lanon.[ID].0@GOTOFF] - mov dword ptr [esp + 28], ecx + mov dword ptr [esp + 12], ecx xor ecx, ecx - mov dword ptr [esp + 32], ebp + mov dword ptr [esp + 16], ebp + mov dword ptr [esp + 24], 0 + mov dword ptr [esp + 20], 0 + mov dword ptr [esp + 32], 0 + mov dword ptr [esp + 28], 0 mov dword ptr [esp + 40], 0 mov dword ptr [esp + 36], 0 mov dword ptr [esp + 48], 0 @@ -366,60 +371,64 @@ iter_retained: mov dword ptr [esp + 76], 0 mov dword ptr [esp + 88], 0 mov dword ptr [esp + 84], 0 - mov dword ptr [esp + 96], 0 mov dword ptr [esp + 92], 0 - mov dword ptr [esp + 104], 0 - mov dword ptr [esp + 100], 0 - mov dword ptr [esp + 108], 0 - mov dword ptr [esp + 132], 0 - mov dword ptr [esp + 136], 0 + mov dword ptr [esp + 116], 0 + mov dword ptr [esp + 120], 0 jmp .LBB5_1 .p2align 4, 0x90 .LBB5_4: - mov dword ptr [esp + 4], esi - mov dword ptr [esp], ebp + sub esp, 8 + push esi + push ebp call objc_msg_lookup@PLT + add esp, 4 + push 16 lea ecx, [esp + 36] - lea edx, [esp + 100] - mov dword ptr [esp + 4], esi - mov dword ptr [esp], ebp - mov dword ptr [esp + 16], 16 - mov dword ptr [esp + 12], ecx - mov dword ptr [esp + 8], edx + push ecx + lea ecx, [esp + 104] + push ecx + push esi + push ebp call eax + add esp, 32 xor ecx, ecx test eax, eax - mov dword ptr [esp + 136], eax + mov dword ptr [esp + 120], eax je .LBB5_5 .LBB5_6: - mov eax, dword ptr [esp + 104] + mov eax, dword ptr [esp + 88] lea edx, [ecx + 1] - mov dword ptr [esp + 132], edx - mov eax, dword ptr [eax + 4*ecx] - mov dword ptr [esp], eax + mov dword ptr [esp + 116], edx + sub esp, 12 + push dword ptr [eax + 4*ecx] call objc_retain@PLT + add esp, 16 mov esi, eax - mov dword ptr [esp], eax + sub esp, 12 + push eax call use_obj@PLT - mov dword ptr [esp], esi + add esp, 4 + push esi call objc_release@PLT - mov ebp, dword ptr [esp + 32] - mov ecx, dword ptr [esp + 132] - mov eax, dword ptr [esp + 136] + add esp, 16 + mov ebp, dword ptr [esp + 16] + mov ecx, dword ptr [esp + 116] + mov eax, dword ptr [esp + 120] .LBB5_1: cmp ecx, eax jb .LBB5_6 mov esi, dword ptr [edi] test esi, esi jne .LBB5_4 - mov eax, dword ptr [esp + 28] - mov dword ptr [esp], eax - call SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@PLT + sub esp, 8 + push dword ptr [esp + 20] + push edi + call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@PLT + add esp, 16 mov esi, eax - mov dword ptr [edi], eax jmp .LBB5_4 .LBB5_5: - add esp, 140 + add esp, 124 pop esi pop edi pop ebx diff --git a/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86_64.s b/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86_64.s index c4ed1e85a..e17d07896 100644 --- a/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86_64.s +++ b/crates/test-assembly/crates/test_fast_enumeration/expected/gnustep-x86_64.s @@ -31,13 +31,11 @@ iter_create: .p2align 4, 0x90 .type iter_once,@function iter_once: - push rbp push r15 push r14 push r13 push r12 push rbx - push rax mov rbx, rdi mov rax, qword ptr [rdi + 200] cmp rax, qword ptr [rdi + 208] @@ -45,14 +43,10 @@ iter_once: lea r14, [rbx + 8] mov r15, qword ptr [rbx] lea r12, [rbx + 136] - mov rbp, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - mov r13, qword ptr [rbp] + mov rax, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov r13, qword ptr [rax] test r13, r13 - jne .LBB1_4 - lea rdi, [rip + .Lanon.[ID].0] - call qword ptr [rip + SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@GOTPCREL] - mov r13, rax - mov qword ptr [rbp], rax + je .LBB1_3 .LBB1_4: mov rdi, r15 mov rsi, r13 @@ -75,14 +69,18 @@ iter_once: mov qword ptr [rbx + 200], rdx mov rax, qword ptr [rcx + 8*rax] .LBB1_5: - add rsp, 8 pop rbx pop r12 pop r13 pop r14 pop r15 - pop rbp ret +.LBB1_3: + mov rdi, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + lea rsi, [rip + .Lanon.[ID].0] + call qword ptr [rip + SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@GOTPCREL] + mov r13, rax + jmp .LBB1_4 .Lfunc_end1: .size iter_once, .Lfunc_end1-iter_once @@ -130,7 +128,7 @@ iter: mov qword ptr [rsp + 152], 0 movups xmmword ptr [rsp + 200], xmm0 xor ecx, ecx - mov rbp, qword ptr [rip + use_obj@GOTPCREL] + mov r13, qword ptr [rip + use_obj@GOTPCREL] mov r12, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] mov rbx, qword ptr [rip + objc_msg_lookup@GOTPCREL] xor eax, eax @@ -141,27 +139,23 @@ iter: lea rdx, [rax + 1] mov qword ptr [rsp + 200], rdx mov rdi, qword ptr [rcx + 8*rax] - call rbp + call r13 mov r15, qword ptr [rsp] mov rax, qword ptr [rsp + 200] mov rcx, qword ptr [rsp + 208] .LBB3_1: cmp rax, rcx jb .LBB3_6 - mov r13, qword ptr [r12] - test r13, r13 - jne .LBB3_4 - lea rdi, [rip + .Lanon.[ID].0] - call qword ptr [rip + SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@GOTPCREL] - mov r13, rax - mov qword ptr [r12], rax + mov rbp, qword ptr [r12] + test rbp, rbp + je .LBB3_3 .LBB3_4: mov rdi, r15 - mov rsi, r13 + mov rsi, rbp call rbx mov r8d, 16 mov rdi, r15 - mov rsi, r13 + mov rsi, rbp mov rdx, r14 lea rcx, [rsp + 8] call rax @@ -170,6 +164,12 @@ iter: je .LBB3_7 xor eax, eax jmp .LBB3_6 +.LBB3_3: + mov rdi, r12 + lea rsi, [rip + .Lanon.[ID].0] + call qword ptr [rip + SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@GOTPCREL] + mov rbp, rax + jmp .LBB3_4 .LBB3_7: add rsp, 216 pop rbx @@ -214,8 +214,8 @@ iter_noop: mov qword ptr [rsp + 152], 0 movups xmmword ptr [rsp + 200], xmm0 xor eax, eax - mov rbp, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] - mov r12, qword ptr [rip + objc_msg_lookup@GOTPCREL] + mov r12, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov r13, qword ptr [rip + objc_msg_lookup@GOTPCREL] xor ecx, ecx jmp .LBB4_1 .p2align 4, 0x90 @@ -225,20 +225,16 @@ iter_noop: .LBB4_1: cmp rcx, rax jb .LBB4_6 - mov r13, qword ptr [rbp] - test r13, r13 - jne .LBB4_4 - lea rdi, [rip + .Lanon.[ID].0] - call qword ptr [rip + SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@GOTPCREL] - mov r13, rax - mov qword ptr [rbp], rax + mov rbp, qword ptr [r12] + test rbp, rbp + je .LBB4_3 .LBB4_4: mov rdi, r14 - mov rsi, r13 - call r12 + mov rsi, rbp + call r13 mov r8d, 16 mov rdi, r14 - mov rsi, r13 + mov rsi, rbp mov rdx, r15 mov rcx, rbx call rax @@ -248,6 +244,12 @@ iter_noop: mov r14, qword ptr [rsp] xor ecx, ecx jmp .LBB4_6 +.LBB4_3: + mov rdi, r12 + lea rsi, [rip + .Lanon.[ID].0] + call qword ptr [rip + SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@GOTPCREL] + mov rbp, rax + jmp .LBB4_4 .LBB4_7: add rsp, 216 pop rbx @@ -272,7 +274,7 @@ iter_retained: push r12 push rbx sub rsp, 216 - mov r12, rdi + mov r13, rdi xorps xmm0, xmm0 movups xmmword ptr [rsp + 176], xmm0 movups xmmword ptr [rsp + 160], xmm0 @@ -290,10 +292,10 @@ iter_retained: mov qword ptr [rsp + 152], 0 movups xmmword ptr [rsp + 200], xmm0 xor ecx, ecx - mov rbp, qword ptr [rip + objc_retain@GOTPCREL] - mov r15, qword ptr [rip + use_obj@GOTPCREL] - mov rbx, qword ptr [rip + objc_release@GOTPCREL] - mov r14, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov r12, qword ptr [rip + objc_retain@GOTPCREL] + mov rbx, qword ptr [rip + use_obj@GOTPCREL] + mov r14, qword ptr [rip + objc_release@GOTPCREL] + mov r15, qword ptr [rip + SYM(icrate::Foundation::generated::__NSEnumerator::NSFastEnumeration::countByEnumeratingWithState_objects_count::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] xor eax, eax jmp .LBB5_1 .p2align 4, 0x90 @@ -302,32 +304,28 @@ iter_retained: lea rdx, [rax + 1] mov qword ptr [rsp + 200], rdx mov rdi, qword ptr [rcx + 8*rax] - call rbp - mov r12, rax + call r12 + mov r13, rax mov rdi, rax - call r15 - mov rdi, r12 call rbx - mov r12, qword ptr [rsp] + mov rdi, r13 + call r14 + mov r13, qword ptr [rsp] mov rax, qword ptr [rsp + 200] mov rcx, qword ptr [rsp + 208] .LBB5_1: cmp rax, rcx jb .LBB5_6 - mov r13, qword ptr [r14] - test r13, r13 - jne .LBB5_4 - lea rdi, [rip + .Lanon.[ID].0] - call qword ptr [rip + SYM(objc2::runtime::Sel::register_unchecked::GENERATED_ID, 0)@GOTPCREL] - mov r13, rax - mov qword ptr [r14], rax + mov rbp, qword ptr [r15] + test rbp, rbp + je .LBB5_3 .LBB5_4: - mov rdi, r12 - mov rsi, r13 + mov rdi, r13 + mov rsi, rbp call qword ptr [rip + objc_msg_lookup@GOTPCREL] mov r8d, 16 - mov rdi, r12 - mov rsi, r13 + mov rdi, r13 + mov rsi, rbp lea rdx, [rsp + 136] lea rcx, [rsp + 8] call rax @@ -336,6 +334,12 @@ iter_retained: je .LBB5_7 xor eax, eax jmp .LBB5_6 +.LBB5_3: + mov rdi, r15 + lea rsi, [rip + .Lanon.[ID].0] + call qword ptr [rip + SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0)@GOTPCREL] + mov rbp, rax + jmp .LBB5_4 .LBB5_7: add rsp, 216 pop rbx diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_static_class/expected/apple-aarch64.s index 02ad46f63..f7d0283cc 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-aarch64.s @@ -29,9 +29,9 @@ Lloh5: ret .loh AdrpLdr Lloh4, Lloh5 - .globl _unused_sel + .globl _unused_class .p2align 2 -_unused_sel: +_unused_class: ret .globl _use_fns @@ -50,9 +50,9 @@ Lloh10: Lloh11: ldr x11, [x11, L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b@PAGEOFF] Lloh12: - adrp x12, L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb@PAGE + adrp x12, L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063@PAGE Lloh13: - ldr x12, [x12, L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb@PAGEOFF] + ldr x12, [x12, L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063@PAGEOFF] stp x9, x10, [x8] stp x11, x12, [x8, #16] ret @@ -114,39 +114,39 @@ L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: .quad _OBJC_CLASS_$_NSString .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219 + .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219: +L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: .quad _OBJC_CLASS_$_NSData .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb + .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb: +L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: .quad _OBJC_CLASS_$_NSException .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a + .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a: +L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: .quad _OBJC_CLASS_$_NSLock .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s index 4e7dfaa83..4f5266502 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-armv7.s @@ -30,18 +30,18 @@ LPC2_0: ldr r0, [pc, r0] bx lr - .globl _unused_sel + .globl _unused_class .p2align 2 .code 32 -_unused_sel: +_unused_class: bx lr .globl _use_fns .p2align 2 .code 32 _use_fns: - movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb-(LPC4_0+8)) - movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb-(LPC4_0+8)) + movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) + movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) LPC4_0: ldr r9, [pc, r9] movw r2, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) @@ -116,39 +116,39 @@ L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: .long _OBJC_CLASS_$_NSString .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219 + .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219: +L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: .long _OBJC_CLASS_$_NSData .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb + .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb: +L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: .long _OBJC_CLASS_$_NSException .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a + .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a: +L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: .long _OBJC_CLASS_$_NSLock .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s index 4e7dfaa83..4f5266502 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-armv7s.s @@ -30,18 +30,18 @@ LPC2_0: ldr r0, [pc, r0] bx lr - .globl _unused_sel + .globl _unused_class .p2align 2 .code 32 -_unused_sel: +_unused_class: bx lr .globl _use_fns .p2align 2 .code 32 _use_fns: - movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb-(LPC4_0+8)) - movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb-(LPC4_0+8)) + movw r9, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) + movt r9, :upper16:(L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-(LPC4_0+8)) LPC4_0: ldr r9, [pc, r9] movw r2, :lower16:(L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-(LPC4_1+8)) @@ -116,39 +116,39 @@ L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: .long _OBJC_CLASS_$_NSString .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219 + .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219: +L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: .long _OBJC_CLASS_$_NSData .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb + .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb: +L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: .long _OBJC_CLASS_$_NSException .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a + .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a: +L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: .long _OBJC_CLASS_$_NSLock .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-old-x86.s b/crates/test-assembly/crates/test_static_class/expected/apple-old-x86.s index fc372098f..9e8b568d7 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-old-x86.s @@ -36,9 +36,9 @@ L2$pb: pop ebp ret - .globl _unused_sel + .globl _unused_class .p2align 4, 0x90 -_unused_sel: +_unused_class: push ebp mov ebp, esp pop ebp @@ -58,7 +58,7 @@ L4$pb: mov edx, dword ptr [ecx + L_OBJC_CLASS_REFERENCES_928cf03fcc497777-L4$pb] mov esi, dword ptr [ecx + L_OBJC_CLASS_REFERENCES_2fe1990982915f07-L4$pb] mov edi, dword ptr [ecx + L_OBJC_CLASS_REFERENCES_dfff3a06c0bf722b-L4$pb] - mov ecx, dword ptr [ecx + L_OBJC_CLASS_REFERENCES_5ab5a81fcf2763fb-L4$pb] + mov ecx, dword ptr [ecx + L_OBJC_CLASS_REFERENCES_97e6a8c6ed5db063-L4$pb] mov dword ptr [eax], edx mov dword ptr [eax + 4], esi mov dword ptr [eax + 8], edi @@ -182,93 +182,93 @@ L_OBJC_MODULES_dfff3a06c0bf722b: .space 4 .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_f6e054106fdbe219 -L_OBJC_CLASS_NAME_f6e054106fdbe219: + .globl L_OBJC_CLASS_NAME_ea6fbcf172f7f513 +L_OBJC_CLASS_NAME_ea6fbcf172f7f513: .ascii "NSData" .section __OBJC,__cls_refs,literal_pointers,no_dead_strip - .globl L_OBJC_CLASS_REFERENCES_f6e054106fdbe219 + .globl L_OBJC_CLASS_REFERENCES_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_CLASS_REFERENCES_f6e054106fdbe219: - .long L_OBJC_CLASS_NAME_f6e054106fdbe219 +L_OBJC_CLASS_REFERENCES_ea6fbcf172f7f513: + .long L_OBJC_CLASS_NAME_ea6fbcf172f7f513 .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_f6e054106fdbe219_MODULE_INFO -L_OBJC_CLASS_NAME_f6e054106fdbe219_MODULE_INFO: + .globl L_OBJC_CLASS_NAME_ea6fbcf172f7f513_MODULE_INFO +L_OBJC_CLASS_NAME_ea6fbcf172f7f513_MODULE_INFO: .space 1 .section __OBJC,__module_info,regular,no_dead_strip - .globl L_OBJC_MODULES_f6e054106fdbe219 + .globl L_OBJC_MODULES_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_MODULES_f6e054106fdbe219: +L_OBJC_MODULES_ea6fbcf172f7f513: .asciz "\007\000\000\000\020\000\000" - .long L_OBJC_CLASS_NAME_f6e054106fdbe219_MODULE_INFO + .long L_OBJC_CLASS_NAME_ea6fbcf172f7f513_MODULE_INFO .space 4 .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_5ab5a81fcf2763fb -L_OBJC_CLASS_NAME_5ab5a81fcf2763fb: + .globl L_OBJC_CLASS_NAME_97e6a8c6ed5db063 +L_OBJC_CLASS_NAME_97e6a8c6ed5db063: .ascii "NSException" .section __OBJC,__cls_refs,literal_pointers,no_dead_strip - .globl L_OBJC_CLASS_REFERENCES_5ab5a81fcf2763fb + .globl L_OBJC_CLASS_REFERENCES_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_CLASS_REFERENCES_5ab5a81fcf2763fb: - .long L_OBJC_CLASS_NAME_5ab5a81fcf2763fb +L_OBJC_CLASS_REFERENCES_97e6a8c6ed5db063: + .long L_OBJC_CLASS_NAME_97e6a8c6ed5db063 .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_5ab5a81fcf2763fb_MODULE_INFO -L_OBJC_CLASS_NAME_5ab5a81fcf2763fb_MODULE_INFO: + .globl L_OBJC_CLASS_NAME_97e6a8c6ed5db063_MODULE_INFO +L_OBJC_CLASS_NAME_97e6a8c6ed5db063_MODULE_INFO: .space 1 .section __OBJC,__module_info,regular,no_dead_strip - .globl L_OBJC_MODULES_5ab5a81fcf2763fb + .globl L_OBJC_MODULES_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_MODULES_5ab5a81fcf2763fb: +L_OBJC_MODULES_97e6a8c6ed5db063: .asciz "\007\000\000\000\020\000\000" - .long L_OBJC_CLASS_NAME_5ab5a81fcf2763fb_MODULE_INFO + .long L_OBJC_CLASS_NAME_97e6a8c6ed5db063_MODULE_INFO .space 4 .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_54ecac6d305d112a -L_OBJC_CLASS_NAME_54ecac6d305d112a: + .globl L_OBJC_CLASS_NAME_bb5b616899716c0d +L_OBJC_CLASS_NAME_bb5b616899716c0d: .ascii "NSLock" .section __OBJC,__cls_refs,literal_pointers,no_dead_strip - .globl L_OBJC_CLASS_REFERENCES_54ecac6d305d112a + .globl L_OBJC_CLASS_REFERENCES_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_CLASS_REFERENCES_54ecac6d305d112a: - .long L_OBJC_CLASS_NAME_54ecac6d305d112a +L_OBJC_CLASS_REFERENCES_bb5b616899716c0d: + .long L_OBJC_CLASS_NAME_bb5b616899716c0d .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_CLASS_NAME_54ecac6d305d112a_MODULE_INFO -L_OBJC_CLASS_NAME_54ecac6d305d112a_MODULE_INFO: + .globl L_OBJC_CLASS_NAME_bb5b616899716c0d_MODULE_INFO +L_OBJC_CLASS_NAME_bb5b616899716c0d_MODULE_INFO: .space 1 .section __OBJC,__module_info,regular,no_dead_strip - .globl L_OBJC_MODULES_54ecac6d305d112a + .globl L_OBJC_MODULES_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_MODULES_54ecac6d305d112a: +L_OBJC_MODULES_bb5b616899716c0d: .asciz "\007\000\000\000\020\000\000" - .long L_OBJC_CLASS_NAME_54ecac6d305d112a_MODULE_INFO + .long L_OBJC_CLASS_NAME_bb5b616899716c0d_MODULE_INFO .space 4 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-x86.s b/crates/test-assembly/crates/test_static_class/expected/apple-x86.s index 52c1bb6ea..317b0d9cb 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-x86.s @@ -36,9 +36,9 @@ L2$pb: pop ebp ret - .globl _unused_sel + .globl _unused_class .p2align 4, 0x90 -_unused_sel: +_unused_class: push ebp mov ebp, esp pop ebp @@ -58,7 +58,7 @@ L4$pb: mov edx, dword ptr [ecx + L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777-L4$pb] mov esi, dword ptr [ecx + L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07-L4$pb] mov edi, dword ptr [ecx + L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b-L4$pb] - mov ecx, dword ptr [ecx + L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb-L4$pb] + mov ecx, dword ptr [ecx + L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063-L4$pb] mov dword ptr [eax], edx mov dword ptr [eax + 4], esi mov dword ptr [eax + 8], edi @@ -128,39 +128,39 @@ L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: .long _OBJC_CLASS_$_NSString .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219 + .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219: +L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: .long _OBJC_CLASS_$_NSData .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb + .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb: +L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: .long _OBJC_CLASS_$_NSException .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a + .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a: +L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: .long _OBJC_CLASS_$_NSLock .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_static_class/expected/apple-x86_64.s index 09d7ffe07..af7d504c1 100644 --- a/crates/test-assembly/crates/test_static_class/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_static_class/expected/apple-x86_64.s @@ -27,9 +27,9 @@ _get_different_class: pop rbp ret - .globl _unused_sel + .globl _unused_class .p2align 4, 0x90 -_unused_sel: +_unused_class: push rbp mov rbp, rsp pop rbp @@ -44,7 +44,7 @@ _use_fns: mov rcx, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_928cf03fcc497777] mov rdx, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_2fe1990982915f07] mov rsi, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b] - mov rdi, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb] + mov rdi, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063] mov qword ptr [rax], rcx mov qword ptr [rax + 8], rdx mov qword ptr [rax + 16], rsi @@ -109,39 +109,39 @@ L_OBJC_CLASSLIST_REFERENCES_$_dfff3a06c0bf722b: .quad _OBJC_CLASS_$_NSString .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_f6e054106fdbe219 + .globl L_OBJC_IMAGE_INFO_ea6fbcf172f7f513 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_f6e054106fdbe219: +L_OBJC_IMAGE_INFO_ea6fbcf172f7f513: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219 + .globl L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513 .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_f6e054106fdbe219: +L_OBJC_CLASSLIST_REFERENCES_$_ea6fbcf172f7f513: .quad _OBJC_CLASS_$_NSData .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb + .globl L_OBJC_IMAGE_INFO_97e6a8c6ed5db063 .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_5ab5a81fcf2763fb: +L_OBJC_IMAGE_INFO_97e6a8c6ed5db063: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb + .globl L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063 .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_5ab5a81fcf2763fb: +L_OBJC_CLASSLIST_REFERENCES_$_97e6a8c6ed5db063: .quad _OBJC_CLASS_$_NSException .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_54ecac6d305d112a + .globl L_OBJC_IMAGE_INFO_bb5b616899716c0d .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_54ecac6d305d112a: +L_OBJC_IMAGE_INFO_bb5b616899716c0d: .asciz "\000\000\000\000@\000\000" .section __DATA,__objc_classrefs,regular,no_dead_strip - .globl L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a + .globl L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d .p2align 3, 0x0 -L_OBJC_CLASSLIST_REFERENCES_$_54ecac6d305d112a: +L_OBJC_CLASSLIST_REFERENCES_$_bb5b616899716c0d: .quad _OBJC_CLASS_$_NSLock .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_static_class/lib.rs b/crates/test-assembly/crates/test_static_class/lib.rs index f31920d42..31fb5bed8 100644 --- a/crates/test-assembly/crates/test_static_class/lib.rs +++ b/crates/test-assembly/crates/test_static_class/lib.rs @@ -19,7 +19,7 @@ fn get_different_class() -> &'static AnyClass { } #[no_mangle] -fn unused_sel() { +fn unused_class() { let _ = class!(NSData); } From 0405a38874a07556d8b02b5f93bdb0940eddc26b Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 22 Jun 2023 18:50:57 +0300 Subject: [PATCH 4/4] Add cached `dealloc` selector and optimize NSObject class fetching --- .../src/__macro_helpers/common_selectors.rs | 30 ++ crates/objc2/src/__macro_helpers/mod.rs | 25 +- crates/objc2/src/macros/extern_class.rs | 2 +- crates/objc2/src/macros/mod.rs | 19 +- crates/objc2/src/runtime/nsobject.rs | 2 +- crates/objc2/src/runtime/nsproxy.rs | 2 +- .../crates/test_declare_class/Cargo.toml | 2 +- .../expected/apple-aarch64.s | 438 +++++++++--------- .../test_declare_class/expected/apple-armv7.s | 284 ++++++------ .../expected/apple-armv7s.s | 286 ++++++------ .../expected/apple-old-x86.s | 106 ++--- .../test_declare_class/expected/apple-x86.s | 106 ++--- .../expected/apple-x86_64.s | 46 +- .../test_dynamic_sel/expected/apple-aarch64.s | 12 +- .../test_dynamic_sel/expected/apple-armv7.s | 16 +- .../test_dynamic_sel/expected/apple-armv7s.s | 16 +- .../test_dynamic_sel/expected/apple-x86.s | 6 +- .../test_dynamic_sel/expected/apple-x86_64.s | 6 +- 18 files changed, 689 insertions(+), 715 deletions(-) create mode 100644 crates/objc2/src/__macro_helpers/common_selectors.rs diff --git a/crates/objc2/src/__macro_helpers/common_selectors.rs b/crates/objc2/src/__macro_helpers/common_selectors.rs new file mode 100644 index 000000000..508a2f3c1 --- /dev/null +++ b/crates/objc2/src/__macro_helpers/common_selectors.rs @@ -0,0 +1,30 @@ +//! Common selectors. +//! +//! These are put here to deduplicate the cached selector, and when using +//! `unstable-static-sel`, the statics. +//! +//! Note that our assembly tests of `unstable-static-sel-inlined` output a GOT +//! entry for such accesses, but that is just a limitation of our tests - the +//! actual assembly is as one would expect. +use crate::runtime::Sel; +use crate::{__sel_data, __sel_inner}; + +#[inline] +pub fn alloc_sel() -> Sel { + __sel_inner!(__sel_data!(alloc), "alloc") +} + +#[inline] +pub fn init_sel() -> Sel { + __sel_inner!(__sel_data!(init), "init") +} + +#[inline] +pub fn new_sel() -> Sel { + __sel_inner!(__sel_data!(new), "new") +} + +#[inline] +pub fn dealloc_sel() -> Sel { + __sel_inner!(__sel_data!(dealloc), "dealloc") +} diff --git a/crates/objc2/src/__macro_helpers/mod.rs b/crates/objc2/src/__macro_helpers/mod.rs index 037a320df..68047e6c9 100644 --- a/crates/objc2/src/__macro_helpers/mod.rs +++ b/crates/objc2/src/__macro_helpers/mod.rs @@ -13,7 +13,6 @@ use crate::rc::{Allocated, Id}; use crate::runtime::MethodDescription; use crate::runtime::{AnyClass, AnyObject, AnyProtocol, Sel}; use crate::{Message, MessageArguments, MessageReceiver}; -use crate::{__sel_data, __sel_inner}; pub use core::borrow::{Borrow, BorrowMut}; pub use core::cell::UnsafeCell; @@ -29,36 +28,16 @@ pub use core::{compile_error, concat, panic, stringify}; pub use std::sync::Once; mod cache; +mod common_selectors; mod declare_class; pub use self::cache::{CachedClass, CachedSel}; +pub use self::common_selectors::{alloc_sel, dealloc_sel, init_sel, new_sel}; pub use self::declare_class::{ assert_mutability_matches_superclass_mutability, MaybeOptionId, MessageRecieveId, ValidSubclassMutability, }; -// Common selectors. -// -// These are put here to deduplicate the cached selector, and when using -// `unstable-static-sel`, the statics. -// -// Note that our assembly tests of `unstable-static-sel-inlined` output a GOT -// entry for such accesses, but that is just a limitation of our tests - the -// actual assembly is as one would expect. - -#[inline] -pub fn alloc_sel() -> Sel { - __sel_inner!(__sel_data!(alloc), "alloc") -} -#[inline] -pub fn init_sel() -> Sel { - __sel_inner!(__sel_data!(init), "init") -} -#[inline] -pub fn new_sel() -> Sel { - __sel_inner!(__sel_data!(new), "new") -} - /// Helper for specifying the retain semantics for a given selector family. /// /// Note that we can't actually check if a method is in a method family; only diff --git a/crates/objc2/src/macros/extern_class.rs b/crates/objc2/src/macros/extern_class.rs index ffb0c5fda..51f14023c 100644 --- a/crates/objc2/src/macros/extern_class.rs +++ b/crates/objc2/src/macros/extern_class.rs @@ -369,7 +369,7 @@ macro_rules! __inner_extern_class { $crate::__class_inner!( $crate::__select_name!($name; $($name_const)?), - $crate::__hash_idents!($name), + $crate::__hash_idents!($name) ) } diff --git a/crates/objc2/src/macros/mod.rs b/crates/objc2/src/macros/mod.rs index 913ee87e1..e9f235c9f 100644 --- a/crates/objc2/src/macros/mod.rs +++ b/crates/objc2/src/macros/mod.rs @@ -73,7 +73,7 @@ macro_rules! class { ($name:ident) => {{ $crate::__class_inner!( $crate::__macro_helpers::stringify!($name), - $crate::__hash_idents!($name), + $crate::__hash_idents!($name) ) }}; } @@ -82,7 +82,7 @@ macro_rules! class { #[macro_export] #[cfg(not(feature = "unstable-static-class"))] macro_rules! __class_inner { - ($name:expr, $_hash:expr,) => {{ + ($name:expr, $_hash:expr) => {{ static CACHED_CLASS: $crate::__macro_helpers::CachedClass = $crate::__macro_helpers::CachedClass::new(); #[allow(unused_unsafe)] @@ -220,14 +220,17 @@ macro_rules! __class_inner { /// ``` #[macro_export] macro_rules! sel { - (alloc) => ({ - $crate::__macro_helpers::alloc_sel() + (new) => ({ + $crate::__macro_helpers::new_sel() }); (init) => ({ $crate::__macro_helpers::init_sel() }); - (new) => ({ - $crate::__macro_helpers::new_sel() + (alloc) => ({ + $crate::__macro_helpers::alloc_sel() + }); + (dealloc) => ({ + $crate::__macro_helpers::dealloc_sel() }); ($sel:ident) => ({ $crate::__sel_inner!( @@ -660,7 +663,7 @@ macro_rules! __sel_inner { not(feature = "unstable-static-class-inlined") ))] macro_rules! __class_inner { - ($name:expr, $hash:expr,) => {{ + ($name:expr, $hash:expr) => {{ $crate::__inner_statics!(@image_info $hash); $crate::__inner_statics!(@class $name, $hash); @@ -678,7 +681,7 @@ macro_rules! __class_inner { #[macro_export] #[cfg(feature = "unstable-static-class-inlined")] macro_rules! __class_inner { - ($name:expr, $hash:expr,) => {{ + ($name:expr, $hash:expr) => {{ $crate::__inner_statics!(@image_info $hash); $crate::__inner_statics!(@class $name, $hash); diff --git a/crates/objc2/src/runtime/nsobject.rs b/crates/objc2/src/runtime/nsobject.rs index 3f9848a06..4027ae4da 100644 --- a/crates/objc2/src/runtime/nsobject.rs +++ b/crates/objc2/src/runtime/nsobject.rs @@ -52,7 +52,7 @@ unsafe impl ClassType for NSObject { fn class() -> &'static AnyClass { #[cfg(feature = "apple")] { - crate::class!(NSObject) + crate::__class_inner!("NSObject", "NSObject") } #[cfg(feature = "gnustep-1-7")] { diff --git a/crates/objc2/src/runtime/nsproxy.rs b/crates/objc2/src/runtime/nsproxy.rs index cc35ab290..e4ff409c4 100644 --- a/crates/objc2/src/runtime/nsproxy.rs +++ b/crates/objc2/src/runtime/nsproxy.rs @@ -44,7 +44,7 @@ unsafe impl ClassType for NSProxy { fn class() -> &'static AnyClass { #[cfg(feature = "apple")] { - crate::class!(NSProxy) + crate::__class_inner!("NSProxy", "NSProxy") } #[cfg(feature = "gnustep-1-7")] { diff --git a/crates/test-assembly/crates/test_declare_class/Cargo.toml b/crates/test-assembly/crates/test_declare_class/Cargo.toml index 698ab594c..bc46cbaf0 100644 --- a/crates/test-assembly/crates/test_declare_class/Cargo.toml +++ b/crates/test-assembly/crates/test_declare_class/Cargo.toml @@ -22,4 +22,4 @@ gnustep-2-0 = ["gnustep-1-9", "objc2?/gnustep-2-0"] gnustep-2-1 = ["gnustep-2-0", "objc2?/gnustep-2-1"] # Hack to prevent the feature flag from being enabled in the entire project -assembly-features = ["objc2?/unstable-static-sel-inlined", "objc2?/unstable-static-class"] +assembly-features = ["objc2?/unstable-static-sel-inlined", "objc2?/unstable-static-class-inlined"] diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s index 27aa8c181..9468ee1e3 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-aarch64.s @@ -14,36 +14,40 @@ SYM(::call_once::<::class::objc_static_workaround::GENERATED_ID, 0) - mov x2, x0 Lloh0: - adrp x0, l_anon.[ID].11@PAGE + adrp x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGE Lloh1: + ldr x8, [x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGEOFF] +Lloh2: + ldr x2, [x8] +Lloh3: + adrp x0, l_anon.[ID].11@PAGE +Lloh4: add x0, x0, l_anon.[ID].11@PAGEOFF mov w1, #15 bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) cbz x0, LBB1_4 str x0, [sp] -Lloh2: +Lloh5: adrp x1, l_anon.[ID].5@PAGE -Lloh3: +Lloh6: add x1, x1, l_anon.[ID].5@PAGEOFF -Lloh4: +Lloh7: adrp x5, l_anon.[ID].6@PAGE -Lloh5: +Lloh8: add x5, x5, l_anon.[ID].6@PAGEOFF mov x0, sp mov w2, #4 mov w3, #1 mov w4, #0 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) -Lloh6: +Lloh9: adrp x1, l_anon.[ID].7@PAGE -Lloh7: +Lloh10: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh8: +Lloh11: adrp x19, l_anon.[ID].8@PAGE -Lloh9: +Lloh12: add x19, x19, l_anon.[ID].8@PAGEOFF mov x0, sp mov w2, #4 @@ -51,131 +55,133 @@ Lloh9: mov w4, #3 mov x5, x19 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) -Lloh10: - adrp x8, L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869@PAGE -Lloh11: - ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869@PAGEOFF] -Lloh12: - adrp x20, l_anon.[ID].1@PAGE Lloh13: - add x20, x20, l_anon.[ID].1@PAGEOFF + adrp x8, L_OBJC_SELECTOR_REFERENCES_dealloc@GOTPAGE Lloh14: - adrp x21, l_anon.[ID].12@PAGE + ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_dealloc@GOTPAGEOFF] Lloh15: - add x21, x21, l_anon.[ID].12@PAGEOFF + ldr x1, [x8] Lloh16: - adrp x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGE + adrp x20, l_anon.[ID].1@PAGE Lloh17: + add x20, x20, l_anon.[ID].1@PAGEOFF +Lloh18: + adrp x21, l_anon.[ID].12@PAGE +Lloh19: + add x21, x21, l_anon.[ID].12@PAGEOFF +Lloh20: + adrp x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGE +Lloh21: add x5, x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGEOFF mov x0, sp mov x2, x20 mov x3, #0 mov x4, x21 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh18: +Lloh22: adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE -Lloh19: +Lloh23: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] -Lloh20: +Lloh24: ldr x1, [x8] -Lloh21: +Lloh25: adrp x5, _init@PAGE -Lloh22: +Lloh26: add x5, x5, _init@PAGEOFF mov x0, sp mov x2, x20 mov x3, #0 mov x4, x19 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh23: +Lloh27: adrp x8, L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc@PAGE -Lloh24: +Lloh28: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc@PAGEOFF] -Lloh25: +Lloh29: adrp x5, _class_method@PAGE -Lloh26: +Lloh30: add x5, x5, _class_method@PAGEOFF mov x0, sp mov x2, x20 mov x3, #0 mov x4, x21 bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) -Lloh27: +Lloh31: adrp x8, L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5@PAGE -Lloh28: +Lloh32: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5@PAGEOFF] -Lloh29: +Lloh33: adrp x5, _method@PAGE -Lloh30: +Lloh34: add x5, x5, _method@PAGEOFF mov x0, sp mov x2, x20 mov x3, #0 mov x4, x21 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh31: +Lloh35: adrp x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGE -Lloh32: +Lloh36: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGEOFF] -Lloh33: +Lloh37: adrp x21, l_anon.[ID].13@PAGE -Lloh34: +Lloh38: add x21, x21, l_anon.[ID].13@PAGEOFF -Lloh35: +Lloh39: adrp x5, _method_bool@PAGE -Lloh36: +Lloh40: add x5, x5, _method_bool@PAGEOFF mov x0, sp mov x2, x21 mov w3, #1 mov x4, x21 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh37: +Lloh41: adrp x8, L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498@PAGE -Lloh38: +Lloh42: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498@PAGEOFF] -Lloh39: +Lloh43: adrp x5, _method_id@PAGE -Lloh40: +Lloh44: add x5, x5, _method_id@PAGEOFF mov x0, sp mov x2, x20 mov x3, #0 mov x4, x19 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh41: +Lloh45: adrp x8, L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8@PAGE -Lloh42: +Lloh46: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8@PAGEOFF] -Lloh43: +Lloh47: adrp x5, _method_id_with_param@PAGE -Lloh44: +Lloh48: add x5, x5, _method_id_with_param@PAGEOFF mov x0, sp mov x2, x21 mov w3, #1 mov x4, x19 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) -Lloh45: +Lloh49: adrp x0, l_anon.[ID].14@PAGE -Lloh46: +Lloh50: add x0, x0, l_anon.[ID].14@PAGEOFF mov w1, #9 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) mov x1, x0 mov x0, sp bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) -Lloh47: +Lloh51: adrp x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGE -Lloh48: +Lloh52: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGEOFF] -Lloh49: +Lloh53: adrp x2, l_anon.[ID].17@PAGE -Lloh50: +Lloh54: add x2, x2, l_anon.[ID].17@PAGEOFF -Lloh51: +Lloh55: adrp x5, _copy_with_zone@PAGE -Lloh52: +Lloh56: add x5, x5, _copy_with_zone@PAGEOFF mov w3, #1 mov x4, x19 @@ -188,29 +194,29 @@ Lloh52: add sp, sp, #112 ret LBB1_3: -Lloh53: +Lloh57: adrp x0, l_anon.[ID].2@PAGE -Lloh54: +Lloh58: add x0, x0, l_anon.[ID].2@PAGEOFF -Lloh55: +Lloh59: adrp x2, l_anon.[ID].4@PAGE -Lloh56: +Lloh60: add x2, x2, l_anon.[ID].4@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_4: -Lloh57: +Lloh61: adrp x8, l_anon.[ID].21@PAGE -Lloh58: +Lloh62: add x8, x8, l_anon.[ID].21@PAGEOFF -Lloh59: +Lloh63: adrp x9, SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)@PAGE -Lloh60: +Lloh64: add x9, x9, SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)@PAGEOFF stp x8, x9, [sp, #48] -Lloh61: +Lloh65: adrp x8, l_anon.[ID].20@PAGE -Lloh62: +Lloh66: add x8, x8, l_anon.[ID].20@PAGEOFF mov w9, #2 stp x8, x9, [sp] @@ -218,44 +224,45 @@ Lloh62: mov w9, #1 str x8, [sp, #16] stp x9, xzr, [sp, #24] -Lloh63: +Lloh67: adrp x1, l_anon.[ID].10@PAGE -Lloh64: +Lloh68: add x1, x1, l_anon.[ID].10@PAGEOFF mov x0, sp bl SYM(core::panicking::panic_fmt::GENERATED_ID, 0) - .loh AdrpAdd Lloh0, Lloh1 - .loh AdrpAdd Lloh51, Lloh52 + .loh AdrpAdd Lloh3, Lloh4 + .loh AdrpLdrGotLdr Lloh0, Lloh1, Lloh2 + .loh AdrpAdd Lloh55, Lloh56 + .loh AdrpAdd Lloh53, Lloh54 + .loh AdrpLdr Lloh51, Lloh52 .loh AdrpAdd Lloh49, Lloh50 - .loh AdrpLdr Lloh47, Lloh48 - .loh AdrpAdd Lloh45, Lloh46 + .loh AdrpAdd Lloh47, Lloh48 + .loh AdrpLdr Lloh45, Lloh46 .loh AdrpAdd Lloh43, Lloh44 .loh AdrpLdr Lloh41, Lloh42 .loh AdrpAdd Lloh39, Lloh40 - .loh AdrpLdr Lloh37, Lloh38 - .loh AdrpAdd Lloh35, Lloh36 + .loh AdrpAdd Lloh37, Lloh38 + .loh AdrpLdr Lloh35, Lloh36 .loh AdrpAdd Lloh33, Lloh34 .loh AdrpLdr Lloh31, Lloh32 .loh AdrpAdd Lloh29, Lloh30 .loh AdrpLdr Lloh27, Lloh28 .loh AdrpAdd Lloh25, Lloh26 - .loh AdrpLdr Lloh23, Lloh24 - .loh AdrpAdd Lloh21, Lloh22 - .loh AdrpLdrGotLdr Lloh18, Lloh19, Lloh20 + .loh AdrpLdrGotLdr Lloh22, Lloh23, Lloh24 + .loh AdrpAdd Lloh20, Lloh21 + .loh AdrpAdd Lloh18, Lloh19 .loh AdrpAdd Lloh16, Lloh17 - .loh AdrpAdd Lloh14, Lloh15 - .loh AdrpAdd Lloh12, Lloh13 - .loh AdrpLdr Lloh10, Lloh11 - .loh AdrpAdd Lloh8, Lloh9 - .loh AdrpAdd Lloh6, Lloh7 - .loh AdrpAdd Lloh4, Lloh5 - .loh AdrpAdd Lloh2, Lloh3 - .loh AdrpAdd Lloh55, Lloh56 - .loh AdrpAdd Lloh53, Lloh54 - .loh AdrpAdd Lloh63, Lloh64 - .loh AdrpAdd Lloh61, Lloh62 + .loh AdrpLdrGotLdr Lloh13, Lloh14, Lloh15 + .loh AdrpAdd Lloh11, Lloh12 + .loh AdrpAdd Lloh9, Lloh10 + .loh AdrpAdd Lloh7, Lloh8 + .loh AdrpAdd Lloh5, Lloh6 .loh AdrpAdd Lloh59, Lloh60 .loh AdrpAdd Lloh57, Lloh58 + .loh AdrpAdd Lloh67, Lloh68 + .loh AdrpAdd Lloh65, Lloh66 + .loh AdrpAdd Lloh63, Lloh64 + .loh AdrpAdd Lloh61, Lloh62 .p2align 2 SYM(<::call_once<::class::{closure#0}>::{closure#0} as core[CRATE_ID]::ops::function::FnOnce<(&std[CRATE_ID]::sync::once::OnceState,)>>::call_once::{shim:vtable#0}, 0): @@ -283,16 +290,16 @@ _get_class: sub sp, sp, #32 stp x29, x30, [sp, #16] add x29, sp, #16 -Lloh65: +Lloh69: adrp x8, SYM(::class::REGISTER_CLASS, 0)@PAGE -Lloh66: +Lloh70: add x8, x8, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF ldapr x8, [x8] cmp x8, #3 b.ne LBB4_3 -Lloh67: +Lloh71: adrp x0, l_anon.[ID].11@PAGE -Lloh68: +Lloh72: add x0, x0, l_anon.[ID].11@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -306,47 +313,47 @@ LBB4_3: strb w8, [sp, #7] add x8, sp, #7 str x8, [sp, #8] -Lloh69: +Lloh73: adrp x0, SYM(::class::REGISTER_CLASS, 0)@PAGE -Lloh70: +Lloh74: add x0, x0, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF -Lloh71: +Lloh75: adrp x3, l_anon.[ID].0@PAGE -Lloh72: +Lloh76: add x3, x3, l_anon.[ID].0@PAGEOFF -Lloh73: +Lloh77: adrp x4, l_anon.[ID].10@PAGE -Lloh74: +Lloh78: add x4, x4, l_anon.[ID].10@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) -Lloh75: +Lloh79: adrp x0, l_anon.[ID].11@PAGE -Lloh76: +Lloh80: add x0, x0, l_anon.[ID].11@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB4_2 LBB4_4: -Lloh77: +Lloh81: adrp x0, l_anon.[ID].2@PAGE -Lloh78: +Lloh82: add x0, x0, l_anon.[ID].2@PAGEOFF -Lloh79: +Lloh83: adrp x2, l_anon.[ID].10@PAGE -Lloh80: +Lloh84: add x2, x2, l_anon.[ID].10@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) - .loh AdrpAdd Lloh65, Lloh66 - .loh AdrpAdd Lloh67, Lloh68 - .loh AdrpAdd Lloh75, Lloh76 - .loh AdrpAdd Lloh73, Lloh74 - .loh AdrpAdd Lloh71, Lloh72 .loh AdrpAdd Lloh69, Lloh70 + .loh AdrpAdd Lloh71, Lloh72 .loh AdrpAdd Lloh79, Lloh80 .loh AdrpAdd Lloh77, Lloh78 + .loh AdrpAdd Lloh75, Lloh76 + .loh AdrpAdd Lloh73, Lloh74 + .loh AdrpAdd Lloh83, Lloh84 + .loh AdrpAdd Lloh81, Lloh82 .globl _get_obj .p2align 2 @@ -354,18 +361,18 @@ _get_obj: stp x20, x19, [sp, #-32]! stp x29, x30, [sp, #16] add x29, sp, #16 -Lloh81: +Lloh85: adrp x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGE -Lloh82: +Lloh86: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_new@GOTPAGEOFF] -Lloh83: +Lloh87: ldr x19, [x8] bl _get_class mov x1, x19 ldp x29, x30, [sp, #16] ldp x20, x19, [sp], #32 b _objc_msgSend - .loh AdrpLdrGotLdr Lloh81, Lloh82, Lloh83 + .loh AdrpLdrGotLdr Lloh85, Lloh86, Lloh87 .globl _access_ivars .p2align 2 @@ -377,26 +384,26 @@ _access_ivars: bl _get_obj mov x19, x0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh84: +Lloh88: adrp x1, l_anon.[ID].5@PAGE -Lloh85: +Lloh89: add x1, x1, l_anon.[ID].5@PAGEOFF -Lloh86: +Lloh90: adrp x3, l_anon.[ID].6@PAGE -Lloh87: +Lloh91: add x3, x3, l_anon.[ID].6@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldrb w20, [x19, x0] mov x0, x19 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh88: +Lloh92: adrp x1, l_anon.[ID].7@PAGE -Lloh89: +Lloh93: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh90: +Lloh94: adrp x3, l_anon.[ID].8@PAGE -Lloh91: +Lloh95: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -409,10 +416,10 @@ Lloh91: ldp x20, x19, [sp, #16] ldp x22, x21, [sp], #48 ret + .loh AdrpAdd Lloh94, Lloh95 + .loh AdrpAdd Lloh92, Lloh93 .loh AdrpAdd Lloh90, Lloh91 .loh AdrpAdd Lloh88, Lloh89 - .loh AdrpAdd Lloh86, Lloh87 - .loh AdrpAdd Lloh84, Lloh85 .globl SYM(::class, 0) .p2align 2 @@ -420,16 +427,16 @@ SYM(::class::REGISTER_CLASS, 0)@PAGE -Lloh93: +Lloh97: add x8, x8, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF ldapr x8, [x8] cmp x8, #3 b.ne LBB7_3 -Lloh94: +Lloh98: adrp x0, l_anon.[ID].11@PAGE -Lloh95: +Lloh99: add x0, x0, l_anon.[ID].11@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -443,47 +450,47 @@ LBB7_3: strb w8, [sp, #7] add x8, sp, #7 str x8, [sp, #8] -Lloh96: +Lloh100: adrp x0, SYM(::class::REGISTER_CLASS, 0)@PAGE -Lloh97: +Lloh101: add x0, x0, SYM(::class::REGISTER_CLASS, 0)@PAGEOFF -Lloh98: +Lloh102: adrp x3, l_anon.[ID].0@PAGE -Lloh99: +Lloh103: add x3, x3, l_anon.[ID].0@PAGEOFF -Lloh100: +Lloh104: adrp x4, l_anon.[ID].10@PAGE -Lloh101: +Lloh105: add x4, x4, l_anon.[ID].10@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) -Lloh102: +Lloh106: adrp x0, l_anon.[ID].11@PAGE -Lloh103: +Lloh107: add x0, x0, l_anon.[ID].11@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB7_2 LBB7_4: -Lloh104: +Lloh108: adrp x0, l_anon.[ID].2@PAGE -Lloh105: +Lloh109: add x0, x0, l_anon.[ID].2@PAGEOFF -Lloh106: +Lloh110: adrp x2, l_anon.[ID].10@PAGE -Lloh107: +Lloh111: add x2, x2, l_anon.[ID].10@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) - .loh AdrpAdd Lloh92, Lloh93 - .loh AdrpAdd Lloh94, Lloh95 - .loh AdrpAdd Lloh102, Lloh103 - .loh AdrpAdd Lloh100, Lloh101 - .loh AdrpAdd Lloh98, Lloh99 .loh AdrpAdd Lloh96, Lloh97 + .loh AdrpAdd Lloh98, Lloh99 .loh AdrpAdd Lloh106, Lloh107 .loh AdrpAdd Lloh104, Lloh105 + .loh AdrpAdd Lloh102, Lloh103 + .loh AdrpAdd Lloh100, Lloh101 + .loh AdrpAdd Lloh110, Lloh111 + .loh AdrpAdd Lloh108, Lloh109 .p2align 2 SYM(::class::{closure#0}::__objc2_dealloc, 0): @@ -494,13 +501,13 @@ SYM(::class::objc_static_workaround::GENERATED_ID, 0) - stp x20, x0, [sp] +Lloh116: + adrp x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGE +Lloh117: + ldr x8, [x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGEOFF] +Lloh118: + ldr x8, [x8] + stp x20, x8, [sp] mov x0, sp mov x1, x19 bl _objc_msgSendSuper @@ -517,8 +529,9 @@ LBB8_2: ldp x20, x19, [sp, #16] add sp, sp, #48 ret - .loh AdrpAdd Lloh110, Lloh111 - .loh AdrpAdd Lloh108, Lloh109 + .loh AdrpAdd Lloh114, Lloh115 + .loh AdrpAdd Lloh112, Lloh113 + .loh AdrpLdrGotLdr Lloh116, Lloh117, Lloh118 .globl _init .p2align 2 @@ -527,29 +540,32 @@ _init: stp x20, x19, [sp, #16] stp x29, x30, [sp, #32] add x29, sp, #32 - mov x19, x0 -Lloh112: +Lloh119: adrp x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGE -Lloh113: +Lloh120: ldr x8, [x8, L_OBJC_SELECTOR_REFERENCES_init@GOTPAGEOFF] -Lloh114: - ldr x20, [x8] - bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) - stp x19, x0, [sp] +Lloh121: + ldr x1, [x8] +Lloh122: + adrp x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGE +Lloh123: + ldr x8, [x8, L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPAGEOFF] +Lloh124: + ldr x8, [x8] + stp x0, x8, [sp] mov x0, sp - mov x1, x20 bl _objc_msgSendSuper mov x19, x0 cbz x0, LBB9_2 mov x0, x19 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh115: +Lloh125: adrp x1, l_anon.[ID].5@PAGE -Lloh116: +Lloh126: add x1, x1, l_anon.[ID].5@PAGEOFF -Lloh117: +Lloh127: adrp x3, l_anon.[ID].6@PAGE -Lloh118: +Lloh128: add x3, x3, l_anon.[ID].6@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -557,13 +573,13 @@ Lloh118: strb w8, [x19, x0] mov x0, x19 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh119: +Lloh129: adrp x1, l_anon.[ID].7@PAGE -Lloh120: +Lloh130: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh121: +Lloh131: adrp x3, l_anon.[ID].8@PAGE -Lloh122: +Lloh132: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -574,11 +590,12 @@ LBB9_2: ldp x20, x19, [sp, #16] add sp, sp, #48 ret - .loh AdrpLdrGotLdr Lloh112, Lloh113, Lloh114 - .loh AdrpAdd Lloh121, Lloh122 - .loh AdrpAdd Lloh119, Lloh120 - .loh AdrpAdd Lloh117, Lloh118 - .loh AdrpAdd Lloh115, Lloh116 + .loh AdrpLdrGotLdr Lloh122, Lloh123, Lloh124 + .loh AdrpLdrGotLdr Lloh119, Lloh120, Lloh121 + .loh AdrpAdd Lloh131, Lloh132 + .loh AdrpAdd Lloh129, Lloh130 + .loh AdrpAdd Lloh127, Lloh128 + .loh AdrpAdd Lloh125, Lloh126 .globl _class_method .p2align 2 @@ -604,13 +621,13 @@ _method_id: add x29, sp, #16 mov x19, x0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh123: +Lloh133: adrp x1, l_anon.[ID].7@PAGE -Lloh124: +Lloh134: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh125: +Lloh135: adrp x3, l_anon.[ID].8@PAGE -Lloh126: +Lloh136: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -621,8 +638,8 @@ LBB13_2: ldp x29, x30, [sp, #16] ldp x20, x19, [sp], #32 b _objc_autoreleaseReturnValue - .loh AdrpAdd Lloh125, Lloh126 - .loh AdrpAdd Lloh123, Lloh124 + .loh AdrpAdd Lloh135, Lloh136 + .loh AdrpAdd Lloh133, Lloh134 .globl _method_id_with_param .p2align 2 @@ -638,13 +655,13 @@ _method_id_with_param: cbz w21, LBB14_5 mov x0, x20 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh127: +Lloh137: adrp x1, l_anon.[ID].7@PAGE -Lloh128: +Lloh138: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh129: +Lloh139: adrp x3, l_anon.[ID].8@PAGE -Lloh130: +Lloh140: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -665,8 +682,8 @@ LBB14_5: ldp x20, x19, [sp, #16] ldp x22, x21, [sp], #48 b _objc_autoreleaseReturnValue - .loh AdrpAdd Lloh129, Lloh130 - .loh AdrpAdd Lloh127, Lloh128 + .loh AdrpAdd Lloh139, Lloh140 + .loh AdrpAdd Lloh137, Lloh138 .globl _copy_with_zone .p2align 2 @@ -682,13 +699,13 @@ _copy_with_zone: cbz x0, LBB15_5 mov x0, x20 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh131: +Lloh141: adrp x21, l_anon.[ID].5@PAGE -Lloh132: +Lloh142: add x21, x21, l_anon.[ID].5@PAGEOFF -Lloh133: +Lloh143: adrp x22, l_anon.[ID].6@PAGE -Lloh134: +Lloh144: add x22, x22, l_anon.[ID].6@PAGEOFF mov x1, x21 mov w2, #4 @@ -704,13 +721,13 @@ Lloh134: strb w23, [x19, x0] mov x0, x20 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh135: +Lloh145: adrp x1, l_anon.[ID].7@PAGE -Lloh136: +Lloh146: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh137: +Lloh147: adrp x3, l_anon.[ID].8@PAGE -Lloh138: +Lloh148: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -724,13 +741,13 @@ LBB15_3: LBB15_4: mov x0, x19 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) -Lloh139: +Lloh149: adrp x1, l_anon.[ID].7@PAGE -Lloh140: +Lloh150: add x1, x1, l_anon.[ID].7@PAGEOFF -Lloh141: +Lloh151: adrp x3, l_anon.[ID].8@PAGE -Lloh142: +Lloh152: add x3, x3, l_anon.[ID].8@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -742,12 +759,12 @@ LBB15_5: ldp x22, x21, [sp, #16] ldp x24, x23, [sp], #64 ret - .loh AdrpAdd Lloh137, Lloh138 - .loh AdrpAdd Lloh135, Lloh136 - .loh AdrpAdd Lloh133, Lloh134 - .loh AdrpAdd Lloh131, Lloh132 + .loh AdrpAdd Lloh147, Lloh148 + .loh AdrpAdd Lloh145, Lloh146 + .loh AdrpAdd Lloh143, Lloh144 .loh AdrpAdd Lloh141, Lloh142 - .loh AdrpAdd Lloh139, Lloh140 + .loh AdrpAdd Lloh151, Lloh152 + .loh AdrpAdd Lloh149, Lloh150 .section __DATA,__const .p2align 3, 0x0 @@ -861,23 +878,6 @@ l_anon.[ID].21: .quad l_anon.[ID].11 .asciz "\017\000\000\000\000\000\000" - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 3, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .quad L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __DATA,__objc_imageinfo,regular,no_dead_strip .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s index 1fb21a3d2..3e159664e 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7.s @@ -18,24 +18,27 @@ SYM(::call_once::<::class::objc_static_workaround::GENERATED_ID, 0) - mov r2, r0 - movw r0, :lower16:(l_anon.[ID].11-(LPC1_0+8)) - movt r0, :upper16:(l_anon.[ID].11-(LPC1_0+8)) + movw r0, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) mov r1, #15 + movt r0, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) LPC1_0: + ldr r0, [pc, r0] + ldr r2, [r0] + movw r0, :lower16:(l_anon.[ID].11-(LPC1_1+8)) + movt r0, :upper16:(l_anon.[ID].11-(LPC1_1+8)) +LPC1_1: add r0, pc, r0 bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) cmp r0, #0 beq LBB1_4 - movw r1, :lower16:(L_anon.[ID].5-(LPC1_1+8)) + movw r1, :lower16:(L_anon.[ID].5-(LPC1_2+8)) add r4, sp, #8 - movt r1, :upper16:(L_anon.[ID].5-(LPC1_1+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC1_2+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC1_2+8)) -LPC1_1: - add r1, pc, r1 + movt r1, :upper16:(L_anon.[ID].5-(LPC1_2+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC1_3+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC1_3+8)) LPC1_2: + add r1, pc, r1 +LPC1_3: add r3, pc, r3 mov r2, #0 str r0, [sp, #8] @@ -44,146 +47,147 @@ LPC1_2: mov r2, #4 mov r3, #1 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r8, :lower16:(l_anon.[ID].8-(LPC1_3+8)) + movw r8, :lower16:(l_anon.[ID].8-(LPC1_4+8)) mov r0, #2 - movt r8, :upper16:(l_anon.[ID].8-(LPC1_3+8)) - movw r1, :lower16:(L_anon.[ID].7-(LPC1_4+8)) - movt r1, :upper16:(L_anon.[ID].7-(LPC1_4+8)) -LPC1_3: - add r8, pc, r8 + movt r8, :upper16:(l_anon.[ID].8-(LPC1_4+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC1_5+8)) + movt r1, :upper16:(L_anon.[ID].7-(LPC1_5+8)) LPC1_4: + add r8, pc, r8 +LPC1_5: add r1, pc, r1 stm sp, {r0, r8} mov r0, r4 mov r2, #4 mov r3, #4 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r10, :lower16:(l_anon.[ID].12-(LPC1_5+8)) - mov r0, r4 - movt r10, :upper16:(l_anon.[ID].12-(LPC1_5+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) mov r3, #0 + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) + movw r10, :lower16:(l_anon.[ID].12-(LPC1_7+8)) LPC1_6: - ldr r1, [pc, r1] - movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) - movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) - movw r5, :lower16:(l_anon.[ID].1-(LPC1_8+8)) - movt r5, :upper16:(l_anon.[ID].1-(LPC1_8+8)) + ldr r0, [pc, r0] + movt r10, :upper16:(l_anon.[ID].12-(LPC1_7+8)) LPC1_7: - add r11, pc, r11 + add r10, pc, r10 + ldr r1, [r0] + movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_8+8)) + movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_8+8)) + movw r5, :lower16:(l_anon.[ID].1-(LPC1_9+8)) + movt r5, :upper16:(l_anon.[ID].1-(LPC1_9+8)) LPC1_8: + add r11, pc, r11 +LPC1_9: add r5, pc, r5 -LPC1_5: - add r10, pc, r10 + mov r0, r4 strd r10, r11, [sp] mov r2, r5 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) mov r2, r5 - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) mov r3, #0 -LPC1_9: +LPC1_10: ldr r0, [pc, r0] ldr r1, [r0] - movw r9, :lower16:(_init-(LPC1_10+8)) - movt r9, :upper16:(_init-(LPC1_10+8)) + movw r9, :lower16:(_init-(LPC1_11+8)) + movt r9, :upper16:(_init-(LPC1_11+8)) mov r0, r4 -LPC1_10: +LPC1_11: add r9, pc, r9 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_11+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_11+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) mov r2, r5 -LPC1_11: +LPC1_12: ldr r1, [pc, r1] - movw r11, :lower16:(_class_method-(LPC1_12+8)) - movt r11, :upper16:(_class_method-(LPC1_12+8)) + movw r11, :lower16:(_class_method-(LPC1_13+8)) + movt r11, :upper16:(_class_method-(LPC1_13+8)) mov r3, #0 -LPC1_12: +LPC1_13: add r11, pc, r11 strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_13+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_13+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) mov r2, r5 -LPC1_13: +LPC1_14: ldr r1, [pc, r1] - movw r11, :lower16:(_method-(LPC1_14+8)) - movt r11, :upper16:(_method-(LPC1_14+8)) + movw r11, :lower16:(_method-(LPC1_15+8)) + movt r11, :upper16:(_method-(LPC1_15+8)) mov r3, #0 -LPC1_14: +LPC1_15: add r11, pc, r11 strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_15+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_15+8)) -LPC1_15: - ldr r1, [pc, r1] - movw r3, :lower16:(_method_bool-(LPC1_16+8)) - movt r3, :upper16:(_method_bool-(LPC1_16+8)) - movw r10, :lower16:(l_anon.[ID].13-(LPC1_17+8)) - movt r10, :upper16:(l_anon.[ID].13-(LPC1_17+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) LPC1_16: - add r3, pc, r3 + ldr r1, [pc, r1] + movw r3, :lower16:(_method_bool-(LPC1_17+8)) + movt r3, :upper16:(_method_bool-(LPC1_17+8)) + movw r10, :lower16:(l_anon.[ID].13-(LPC1_18+8)) + movt r10, :upper16:(l_anon.[ID].13-(LPC1_18+8)) LPC1_17: + add r3, pc, r3 +LPC1_18: add r10, pc, r10 str r10, [sp] str r3, [sp, #4] mov r3, #1 mov r2, r10 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_18+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_18+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) mov r2, r5 -LPC1_18: +LPC1_19: ldr r1, [pc, r1] - movw r9, :lower16:(_method_id-(LPC1_19+8)) - movt r9, :upper16:(_method_id-(LPC1_19+8)) + movw r9, :lower16:(_method_id-(LPC1_20+8)) + movt r9, :upper16:(_method_id-(LPC1_20+8)) mov r3, #0 -LPC1_19: +LPC1_20: add r9, pc, r9 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_20+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) mov r0, r4 - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_20+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) mov r2, r10 -LPC1_20: +LPC1_21: ldr r1, [pc, r1] - movw r9, :lower16:(_method_id_with_param-(LPC1_21+8)) - movt r9, :upper16:(_method_id_with_param-(LPC1_21+8)) + movw r9, :lower16:(_method_id_with_param-(LPC1_22+8)) + movt r9, :upper16:(_method_id_with_param-(LPC1_22+8)) mov r3, #1 -LPC1_21: +LPC1_22: add r9, pc, r9 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(l_anon.[ID].14-(LPC1_22+8)) + movw r0, :lower16:(l_anon.[ID].14-(LPC1_23+8)) mov r1, #9 - movt r0, :upper16:(l_anon.[ID].14-(LPC1_22+8)) -LPC1_22: + movt r0, :upper16:(l_anon.[ID].14-(LPC1_23+8)) +LPC1_23: add r0, pc, r0 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) mov r1, r0 mov r0, r4 bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) - movw r2, :lower16:(l_anon.[ID].17-(LPC1_23+8)) + movw r2, :lower16:(l_anon.[ID].17-(LPC1_24+8)) mov r3, #1 - movt r2, :upper16:(l_anon.[ID].17-(LPC1_23+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) -LPC1_23: - add r2, pc, r2 + movt r2, :upper16:(l_anon.[ID].17-(LPC1_24+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) LPC1_24: - ldr r1, [pc, r1] - movw r9, :lower16:(_copy_with_zone-(LPC1_25+8)) - movt r9, :upper16:(_copy_with_zone-(LPC1_25+8)) + add r2, pc, r2 LPC1_25: + ldr r1, [pc, r1] + movw r9, :lower16:(_copy_with_zone-(LPC1_26+8)) + movt r9, :upper16:(_copy_with_zone-(LPC1_26+8)) +LPC1_26: add r9, pc, r9 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) @@ -193,42 +197,42 @@ LPC1_25: pop {r8, r10, r11} pop {r4, r5, r7, pc} LBB1_3: - movw r0, :lower16:(l_anon.[ID].2-(LPC1_26+8)) + movw r0, :lower16:(l_anon.[ID].2-(LPC1_27+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC1_26+8)) - movw r2, :lower16:(l_anon.[ID].4-(LPC1_27+8)) - movt r2, :upper16:(l_anon.[ID].4-(LPC1_27+8)) -LPC1_26: - add r0, pc, r0 + movt r0, :upper16:(l_anon.[ID].2-(LPC1_27+8)) + movw r2, :lower16:(l_anon.[ID].4-(LPC1_28+8)) + movt r2, :upper16:(l_anon.[ID].4-(LPC1_28+8)) LPC1_27: + add r0, pc, r0 +LPC1_28: add r2, pc, r2 mov lr, pc b SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_4: - movw r0, :lower16:(l_anon.[ID].20-(LPC1_28+8)) + movw r0, :lower16:(l_anon.[ID].20-(LPC1_29+8)) mov r5, #0 - movt r0, :upper16:(l_anon.[ID].20-(LPC1_28+8)) - movw r2, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_29+8)) - movt r2, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_29+8)) - movw r3, :lower16:(l_anon.[ID].21-(LPC1_30+8)) - movt r3, :upper16:(l_anon.[ID].21-(LPC1_30+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC1_31+8)) -LPC1_28: + movt r0, :upper16:(l_anon.[ID].20-(LPC1_29+8)) + movw r2, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_30+8)) + movt r2, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_30+8)) + movw r3, :lower16:(l_anon.[ID].21-(LPC1_31+8)) + movt r3, :upper16:(l_anon.[ID].21-(LPC1_31+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC1_32+8)) +LPC1_29: add r0, pc, r0 - movt r1, :upper16:(l_anon.[ID].10-(LPC1_31+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC1_32+8)) str r0, [sp, #8] mov r0, #1 str r0, [sp, #20] sub r0, r7, #28 str r0, [sp, #16] -LPC1_31: +LPC1_32: add r1, pc, r1 add r0, sp, #8 str r5, [sp, #24] mov r5, #2 -LPC1_29: - add r2, pc, r2 LPC1_30: + add r2, pc, r2 +LPC1_31: add r3, pc, r3 str r5, [sp, #12] str r2, [r7, #-24] @@ -455,11 +459,15 @@ LPC8_1: beq LBB8_2 bl _objc_release LBB8_2: - bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) - str r0, [sp, #4] - mov r0, sp + movw r0, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_2+8)) mov r1, r4 + movt r0, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_2+8)) str r5, [sp] +LPC8_2: + ldr r0, [pc, r0] + ldr r0, [r0] + str r0, [sp, #4] + mov r0, sp bl _objc_msgSendSuper sub sp, r7, #8 pop {r4, r5, r7, pc} @@ -468,56 +476,57 @@ LBB8_2: .p2align 2 .code 32 _init: - push {r4, r5, r7, lr} - add r7, sp, #8 + push {r4, r7, lr} + add r7, sp, #4 sub sp, sp, #8 - mov r4, r0 - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movw r2, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC9_1+8)) LPC9_0: - ldr r0, [pc, r0] - ldr r5, [r0] - bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) - str r0, [sp, #4] + ldr r1, [pc, r1] + movt r2, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC9_1+8)) +LPC9_1: + ldr r2, [pc, r2] + ldr r1, [r1] + ldr r2, [r2] + stm sp, {r0, r2} mov r0, sp - mov r1, r5 - str r4, [sp] bl _objc_msgSendSuper mov r4, r0 cmp r0, #0 beq LBB9_2 mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].5-(LPC9_1+8)) + movw r1, :lower16:(L_anon.[ID].5-(LPC9_2+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].5-(LPC9_1+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC9_2+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC9_2+8)) -LPC9_1: - add r1, pc, r1 + movt r1, :upper16:(L_anon.[ID].5-(LPC9_2+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC9_3+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC9_3+8)) LPC9_2: + add r1, pc, r1 +LPC9_3: add r3, pc, r3 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) mov r1, #42 strb r1, [r4, r0] mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].7-(LPC9_3+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC9_4+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].7-(LPC9_3+8)) - movw r3, :lower16:(l_anon.[ID].8-(LPC9_4+8)) - movt r3, :upper16:(l_anon.[ID].8-(LPC9_4+8)) -LPC9_3: - add r1, pc, r1 + movt r1, :upper16:(L_anon.[ID].7-(LPC9_4+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC9_5+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC9_5+8)) LPC9_4: + add r1, pc, r1 +LPC9_5: add r3, pc, r3 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) mov r1, #0 str r1, [r4, r0] LBB9_2: mov r0, r4 - sub sp, r7, #8 - pop {r4, r5, r7, pc} + sub sp, r7, #4 + pop {r4, r7, pc} .globl _class_method .p2align 2 @@ -797,23 +806,6 @@ l_anon.[ID].21: .long l_anon.[ID].11 .asciz "\017\000\000" - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __DATA,__objc_imageinfo,regular,no_dead_strip .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 @@ -918,6 +910,12 @@ L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 +LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr: + .indirect_symbol L_OBJC_CLASSLIST_REFERENCES_$_NSObject + .long 0 +LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_dealloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s index 6bda768f0..32b6c2e3c 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-armv7s.s @@ -18,173 +18,177 @@ SYM(::call_once::<::class::objc_static_workaround::GENERATED_ID, 0) - mov r2, r0 - movw r0, :lower16:(l_anon.[ID].11-(LPC1_0+8)) - movt r0, :upper16:(l_anon.[ID].11-(LPC1_0+8)) + movw r0, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) mov r1, #15 + movt r0, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC1_0+8)) LPC1_0: + ldr r0, [pc, r0] + ldr r2, [r0] + movw r0, :lower16:(l_anon.[ID].11-(LPC1_1+8)) + movt r0, :upper16:(l_anon.[ID].11-(LPC1_1+8)) +LPC1_1: add r0, pc, r0 bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) cmp r0, #0 beq LBB1_4 - movw r1, :lower16:(L_anon.[ID].5-(LPC1_1+8)) + movw r1, :lower16:(L_anon.[ID].5-(LPC1_2+8)) mov r2, #0 - movt r1, :upper16:(L_anon.[ID].5-(LPC1_1+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC1_2+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC1_2+8)) + movt r1, :upper16:(L_anon.[ID].5-(LPC1_2+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC1_3+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC1_3+8)) add r4, sp, #8 -LPC1_2: +LPC1_3: add r3, pc, r3 str r0, [sp, #8] strd r2, r3, [sp] -LPC1_1: +LPC1_2: add r1, pc, r1 mov r0, r4 mov r2, #4 mov r3, #1 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r8, :lower16:(l_anon.[ID].8-(LPC1_3+8)) + movw r8, :lower16:(l_anon.[ID].8-(LPC1_4+8)) mov r0, #2 - movt r8, :upper16:(l_anon.[ID].8-(LPC1_3+8)) - movw r1, :lower16:(L_anon.[ID].7-(LPC1_4+8)) - movt r1, :upper16:(L_anon.[ID].7-(LPC1_4+8)) -LPC1_3: + movt r8, :upper16:(l_anon.[ID].8-(LPC1_4+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC1_5+8)) + movt r1, :upper16:(L_anon.[ID].7-(LPC1_5+8)) +LPC1_4: add r8, pc, r8 stm sp, {r0, r8} -LPC1_4: +LPC1_5: add r1, pc, r1 mov r0, r4 mov r2, #4 mov r3, #4 bl SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_5+8)) - mov r0, r4 - movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_5+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-(LPC1_6+8)) -LPC1_5: - add r11, pc, r11 + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) + mov r3, #0 + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-(LPC1_6+8)) + movw r11, :lower16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) LPC1_6: - ldr r1, [pc, r1] - movw r10, :lower16:(l_anon.[ID].12-(LPC1_7+8)) - movt r10, :upper16:(l_anon.[ID].12-(LPC1_7+8)) - movw r5, :lower16:(l_anon.[ID].1-(LPC1_8+8)) - movt r5, :upper16:(l_anon.[ID].1-(LPC1_8+8)) + ldr r0, [pc, r0] + movt r11, :upper16:(SYM(::class::{closure#0}::__objc2_dealloc, 0)-(LPC1_7+8)) LPC1_7: - add r10, pc, r10 + add r11, pc, r11 + ldr r1, [r0] + movw r10, :lower16:(l_anon.[ID].12-(LPC1_8+8)) + movt r10, :upper16:(l_anon.[ID].12-(LPC1_8+8)) + movw r5, :lower16:(l_anon.[ID].1-(LPC1_9+8)) + movt r5, :upper16:(l_anon.[ID].1-(LPC1_9+8)) LPC1_8: + add r10, pc, r10 +LPC1_9: add r5, pc, r5 - mov r3, #0 + mov r0, r4 mov r2, r5 strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) mov r2, r5 - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_9+8)) + movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC1_10+8)) mov r3, #0 -LPC1_9: +LPC1_10: ldr r0, [pc, r0] ldr r1, [r0] - movw r9, :lower16:(_init-(LPC1_10+8)) - movt r9, :upper16:(_init-(LPC1_10+8)) + movw r9, :lower16:(_init-(LPC1_11+8)) + movt r9, :upper16:(_init-(LPC1_11+8)) mov r0, r4 -LPC1_10: +LPC1_11: add r9, pc, r9 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r11, :lower16:(_class_method-(LPC1_11+8)) + movw r11, :lower16:(_class_method-(LPC1_12+8)) mov r0, r4 - movt r11, :upper16:(_class_method-(LPC1_11+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_12+8)) -LPC1_11: - add r11, pc, r11 + movt r11, :upper16:(_class_method-(LPC1_12+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_13+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-(LPC1_13+8)) LPC1_12: + add r11, pc, r11 +LPC1_13: ldr r1, [pc, r1] mov r2, r5 mov r3, #0 strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) - movw r11, :lower16:(_method-(LPC1_13+8)) + movw r11, :lower16:(_method-(LPC1_14+8)) mov r0, r4 - movt r11, :upper16:(_method-(LPC1_13+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_14+8)) -LPC1_13: - add r11, pc, r11 + movt r11, :upper16:(_method-(LPC1_14+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_15+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-(LPC1_15+8)) LPC1_14: + add r11, pc, r11 +LPC1_15: ldr r1, [pc, r1] mov r2, r5 mov r3, #0 strd r10, r11, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r3, :lower16:(_method_bool-(LPC1_15+8)) + movw r3, :lower16:(_method_bool-(LPC1_16+8)) mov r0, r4 - movt r3, :upper16:(_method_bool-(LPC1_15+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_16+8)) -LPC1_15: - add r3, pc, r3 + movt r3, :upper16:(_method_bool-(LPC1_16+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_17+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-(LPC1_17+8)) LPC1_16: - ldr r1, [pc, r1] - movw r10, :lower16:(l_anon.[ID].13-(LPC1_17+8)) - movt r10, :upper16:(l_anon.[ID].13-(LPC1_17+8)) + add r3, pc, r3 LPC1_17: + ldr r1, [pc, r1] + movw r10, :lower16:(l_anon.[ID].13-(LPC1_18+8)) + movt r10, :upper16:(l_anon.[ID].13-(LPC1_18+8)) +LPC1_18: add r10, pc, r10 str r10, [sp] mov r2, r10 str r3, [sp, #4] mov r3, #1 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r9, :lower16:(_method_id-(LPC1_18+8)) + movw r9, :lower16:(_method_id-(LPC1_19+8)) mov r0, r4 - movt r9, :upper16:(_method_id-(LPC1_18+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_19+8)) -LPC1_18: - add r9, pc, r9 + movt r9, :upper16:(_method_id-(LPC1_19+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_20+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-(LPC1_20+8)) LPC1_19: + add r9, pc, r9 +LPC1_20: ldr r1, [pc, r1] mov r2, r5 mov r3, #0 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r9, :lower16:(_method_id_with_param-(LPC1_20+8)) + movw r9, :lower16:(_method_id_with_param-(LPC1_21+8)) mov r0, r4 - movt r9, :upper16:(_method_id_with_param-(LPC1_20+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_21+8)) -LPC1_20: - add r9, pc, r9 + movt r9, :upper16:(_method_id_with_param-(LPC1_21+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_22+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-(LPC1_22+8)) LPC1_21: + add r9, pc, r9 +LPC1_22: ldr r1, [pc, r1] mov r2, r10 mov r3, #1 strd r8, r9, [sp] bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) - movw r0, :lower16:(l_anon.[ID].14-(LPC1_22+8)) + movw r0, :lower16:(l_anon.[ID].14-(LPC1_23+8)) mov r1, #9 - movt r0, :upper16:(l_anon.[ID].14-(LPC1_22+8)) -LPC1_22: + movt r0, :upper16:(l_anon.[ID].14-(LPC1_23+8)) +LPC1_23: add r0, pc, r0 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) mov r1, r0 mov r0, r4 bl SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) - movw r9, :lower16:(_copy_with_zone-(LPC1_23+8)) + movw r9, :lower16:(_copy_with_zone-(LPC1_24+8)) mov r3, #1 - movt r9, :upper16:(_copy_with_zone-(LPC1_23+8)) - movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) - movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_24+8)) -LPC1_23: - add r9, pc, r9 + movt r9, :upper16:(_copy_with_zone-(LPC1_24+8)) + movw r1, :lower16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) + movt r1, :upper16:(L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-(LPC1_25+8)) LPC1_24: + add r9, pc, r9 +LPC1_25: ldr r1, [pc, r1] - movw r2, :lower16:(l_anon.[ID].17-(LPC1_25+8)) - movt r2, :upper16:(l_anon.[ID].17-(LPC1_25+8)) + movw r2, :lower16:(l_anon.[ID].17-(LPC1_26+8)) + movt r2, :upper16:(l_anon.[ID].17-(LPC1_26+8)) strd r8, r9, [sp] -LPC1_25: +LPC1_26: add r2, pc, r2 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) ldr r0, [sp, #8] @@ -193,41 +197,41 @@ LPC1_25: pop {r8, r10, r11} pop {r4, r5, r7, pc} LBB1_3: - movw r0, :lower16:(l_anon.[ID].2-(LPC1_26+8)) + movw r0, :lower16:(l_anon.[ID].2-(LPC1_27+8)) mov r1, #43 - movt r0, :upper16:(l_anon.[ID].2-(LPC1_26+8)) - movw r2, :lower16:(l_anon.[ID].4-(LPC1_27+8)) - movt r2, :upper16:(l_anon.[ID].4-(LPC1_27+8)) -LPC1_26: - add r0, pc, r0 + movt r0, :upper16:(l_anon.[ID].2-(LPC1_27+8)) + movw r2, :lower16:(l_anon.[ID].4-(LPC1_28+8)) + movt r2, :upper16:(l_anon.[ID].4-(LPC1_28+8)) LPC1_27: + add r0, pc, r0 +LPC1_28: add r2, pc, r2 mov lr, pc b SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_4: - movw r0, :lower16:(l_anon.[ID].20-(LPC1_28+8)) + movw r0, :lower16:(l_anon.[ID].20-(LPC1_29+8)) mov r5, #0 - movt r0, :upper16:(l_anon.[ID].20-(LPC1_28+8)) - movw r2, :lower16:(l_anon.[ID].21-(LPC1_29+8)) - movt r2, :upper16:(l_anon.[ID].21-(LPC1_29+8)) - movw r1, :lower16:(l_anon.[ID].10-(LPC1_30+8)) - movt r1, :upper16:(l_anon.[ID].10-(LPC1_30+8)) - movw r3, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_31+8)) - movt r3, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_31+8)) + movt r0, :upper16:(l_anon.[ID].20-(LPC1_29+8)) + movw r2, :lower16:(l_anon.[ID].21-(LPC1_30+8)) + movt r2, :upper16:(l_anon.[ID].21-(LPC1_30+8)) + movw r1, :lower16:(l_anon.[ID].10-(LPC1_31+8)) + movt r1, :upper16:(l_anon.[ID].10-(LPC1_31+8)) + movw r3, :lower16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_32+8)) + movt r3, :upper16:(SYM(<&str as core[CRATE_ID]::fmt::Display>::fmt, 0)-(LPC1_32+8)) str r5, [sp, #24] mov r5, #2 -LPC1_28: +LPC1_29: add r0, pc, r0 str r5, [sp, #12] mov r5, #1 -LPC1_29: +LPC1_30: add r2, pc, r2 -LPC1_31: +LPC1_32: add r3, pc, r3 str r5, [sp, #20] sub r5, r7, #28 str r0, [sp, #8] -LPC1_30: +LPC1_31: add r1, pc, r1 add r0, sp, #8 str r5, [sp, #16] @@ -458,11 +462,15 @@ LPC8_1: beq LBB8_2 bl _objc_release LBB8_2: - bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) - str r0, [sp, #4] - mov r0, sp + movw r0, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_2+8)) mov r1, r4 + movt r0, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC8_2+8)) str r5, [sp] +LPC8_2: + ldr r0, [pc, r0] + ldr r0, [r0] + str r0, [sp, #4] + mov r0, sp bl _objc_msgSendSuper sub sp, r7, #8 pop {r4, r5, r7, pc} @@ -471,56 +479,57 @@ LBB8_2: .p2align 2 .code 32 _init: - push {r4, r5, r7, lr} - add r7, sp, #8 + push {r4, r7, lr} + add r7, sp, #4 sub sp, sp, #8 - mov r4, r0 - movw r0, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) - movt r0, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movw r1, :lower16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movt r1, :upper16:(LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-(LPC9_0+8)) + movw r2, :lower16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC9_1+8)) LPC9_0: - ldr r0, [pc, r0] - ldr r5, [r0] - bl SYM(::class::objc_static_workaround::GENERATED_ID, 0) - str r0, [sp, #4] + ldr r1, [pc, r1] + movt r2, :upper16:(LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-(LPC9_1+8)) +LPC9_1: + ldr r2, [pc, r2] + ldr r1, [r1] + ldr r2, [r2] + stm sp, {r0, r2} mov r0, sp - mov r1, r5 - str r4, [sp] bl _objc_msgSendSuper mov r4, r0 cmp r0, #0 beq LBB9_2 mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].5-(LPC9_1+8)) + movw r1, :lower16:(L_anon.[ID].5-(LPC9_2+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].5-(LPC9_1+8)) - movw r3, :lower16:(l_anon.[ID].6-(LPC9_2+8)) - movt r3, :upper16:(l_anon.[ID].6-(LPC9_2+8)) -LPC9_1: - add r1, pc, r1 + movt r1, :upper16:(L_anon.[ID].5-(LPC9_2+8)) + movw r3, :lower16:(l_anon.[ID].6-(LPC9_3+8)) + movt r3, :upper16:(l_anon.[ID].6-(LPC9_3+8)) LPC9_2: + add r1, pc, r1 +LPC9_3: add r3, pc, r3 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) mov r1, #42 strb r1, [r4, r0] mov r0, r4 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) - movw r1, :lower16:(L_anon.[ID].7-(LPC9_3+8)) + movw r1, :lower16:(L_anon.[ID].7-(LPC9_4+8)) mov r2, #4 - movt r1, :upper16:(L_anon.[ID].7-(LPC9_3+8)) - movw r3, :lower16:(l_anon.[ID].8-(LPC9_4+8)) - movt r3, :upper16:(l_anon.[ID].8-(LPC9_4+8)) -LPC9_3: - add r1, pc, r1 + movt r1, :upper16:(L_anon.[ID].7-(LPC9_4+8)) + movw r3, :lower16:(l_anon.[ID].8-(LPC9_5+8)) + movt r3, :upper16:(l_anon.[ID].8-(LPC9_5+8)) LPC9_4: + add r1, pc, r1 +LPC9_5: add r3, pc, r3 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) mov r1, #0 str r1, [r4, r0] LBB9_2: mov r0, r4 - sub sp, r7, #8 - pop {r4, r5, r7, pc} + sub sp, r7, #4 + pop {r4, r7, pc} .globl _class_method .p2align 2 @@ -800,23 +809,6 @@ l_anon.[ID].21: .long l_anon.[ID].11 .asciz "\017\000\000" - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __DATA,__objc_imageinfo,regular,no_dead_strip .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 @@ -921,6 +913,12 @@ L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 +LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr: + .indirect_symbol L_OBJC_CLASSLIST_REFERENCES_$_NSObject + .long 0 +LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_dealloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s index c23001d7a..6959cefe8 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-old-x86.s @@ -23,10 +23,10 @@ L1$pb: cmp byte ptr [eax], 0 mov byte ptr [eax], 0 je LBB1_3 - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov eax, dword ptr [esi + LL_OBJC_CLASS_REFERENCES_NSObject$non_lazy_ptr-L1$pb] sub esp, 4 lea ecx, [esi + l_anon.[ID].11-L1$pb] - push eax + push dword ptr [eax] push 15 push ecx call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) @@ -37,13 +37,13 @@ L1$pb: sub esp, 8 lea eax, [esi + l_anon.[ID].6-L1$pb] lea ecx, [esi + L_anon.[ID].5-L1$pb] - lea edi, [ebp - 40] + lea ebx, [ebp - 40] push eax push 0 push 1 push 4 push ecx - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) add esp, 24 lea ecx, [esi + l_anon.[ID].8-L1$pb] @@ -53,18 +53,21 @@ L1$pb: push 4 push 4 push eax - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - add esp, 24 - lea eax, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] - lea edx, [esi + l_anon.[ID].12-L1$pb] - lea ebx, [esi + l_anon.[ID].1-L1$pb] - push eax - push edx + add esp, 32 + mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-L1$pb] + sub esp, 8 + lea ecx, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] + lea edi, [esi + l_anon.[ID].12-L1$pb] + lea edx, [esi + l_anon.[ID].1-L1$pb] + push ecx + push edi push 0 + push edx + mov edi, edx + push dword ptr [eax] push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-L1$pb] - push edi call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 32 mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] @@ -74,9 +77,9 @@ L1$pb: lea ecx, [esi + l_anon.[ID].8-L1$pb] push ecx push 0 - push ebx - push dword ptr [eax] push edi + push dword ptr [eax] + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _class_method-L1$pb] @@ -84,9 +87,9 @@ L1$pb: lea eax, [esi + l_anon.[ID].12-L1$pb] push eax push 0 - push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] push edi + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] + push ebx call SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method-L1$pb] @@ -94,9 +97,9 @@ L1$pb: lea eax, [esi + l_anon.[ID].12-L1$pb] push eax push 0 - push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] push edi + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_bool-L1$pb] @@ -106,28 +109,28 @@ L1$pb: push 1 push ecx push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea ebx, [esi + l_anon.[ID].8-L1$pb] - push ebx + lea edi, [esi + l_anon.[ID].8-L1$pb] + push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_id_with_param-L1$pb] push eax - push ebx + push edi push 1 lea eax, [esi + l_anon.[ID].13-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + l_anon.[ID].14-L1$pb] @@ -136,13 +139,13 @@ L1$pb: call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) add esp, 8 push eax - push edi + push ebx call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) add esp, 8 lea ecx, [esi + _copy_with_zone-L1$pb] lea edx, [esi + l_anon.[ID].17-L1$pb] push ecx - push ebx + push edi push 1 push edx push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-L1$pb] @@ -430,7 +433,8 @@ L8$pb: call _objc_release add esp, 16 LBB8_2: - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov eax, dword ptr [ebx + LL_OBJC_CLASS_REFERENCES_NSObject$non_lazy_ptr-L8$pb] + mov eax, dword ptr [eax] mov dword ptr [ebp - 24], edi mov dword ptr [ebp - 20], eax sub esp, 8 @@ -450,22 +454,22 @@ LBB8_2: _init: push ebp mov ebp, esp - push ebx push edi push esi - sub esp, 12 + sub esp, 16 call L9$pb L9$pb: pop edi - mov esi, dword ptr [ebp + 8] - mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] - mov ebx, dword ptr [eax] - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) - mov dword ptr [ebp - 24], esi - mov dword ptr [ebp - 20], eax + mov eax, dword ptr [ebp + 8] + mov ecx, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] + mov ecx, dword ptr [ecx] + mov edx, dword ptr [edi + LL_OBJC_CLASS_REFERENCES_NSObject$non_lazy_ptr-L9$pb] + mov edx, dword ptr [edx] + mov dword ptr [ebp - 16], eax + mov dword ptr [ebp - 12], edx sub esp, 8 - lea eax, [ebp - 24] - push ebx + lea eax, [ebp - 16] + push ecx push eax call _objc_msgSendSuper add esp, 16 @@ -500,10 +504,9 @@ L9$pb: mov dword ptr [esi + eax], 0 LBB9_2: mov eax, esi - add esp, 12 + add esp, 16 pop esi pop edi - pop ebx pop ebp ret @@ -828,23 +831,6 @@ l_anon.[ID].21: .long l_anon.[ID].11 .asciz "\017\000\000" - .section __OBJC,__image_info - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__cstring,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __OBJC,__message_refs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __OBJC,__image_info .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 @@ -948,6 +934,12 @@ L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 .section __IMPORT,__pointers,non_lazy_symbol_pointers +LL_OBJC_CLASS_REFERENCES_NSObject$non_lazy_ptr: + .indirect_symbol L_OBJC_CLASS_REFERENCES_NSObject + .long 0 +LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_dealloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s index 57ec70a7b..b4a2d7af0 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86.s @@ -23,10 +23,10 @@ L1$pb: cmp byte ptr [eax], 0 mov byte ptr [eax], 0 je LBB1_3 - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov eax, dword ptr [esi + LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-L1$pb] sub esp, 4 lea ecx, [esi + l_anon.[ID].11-L1$pb] - push eax + push dword ptr [eax] push 15 push ecx call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) @@ -37,13 +37,13 @@ L1$pb: sub esp, 8 lea eax, [esi + l_anon.[ID].6-L1$pb] lea ecx, [esi + L_anon.[ID].5-L1$pb] - lea edi, [ebp - 40] + lea ebx, [ebp - 40] push eax push 0 push 1 push 4 push ecx - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) add esp, 24 lea ecx, [esi + l_anon.[ID].8-L1$pb] @@ -53,18 +53,21 @@ L1$pb: push 4 push 4 push eax - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_ivar_inner_mono::GENERATED_ID, 0) - add esp, 24 - lea eax, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] - lea edx, [esi + l_anon.[ID].12-L1$pb] - lea ebx, [esi + l_anon.[ID].1-L1$pb] - push eax - push edx + add esp, 32 + mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr-L1$pb] + sub esp, 8 + lea ecx, [esi + SYM(::class::{closure#0}::__objc2_dealloc, 0)-L1$pb] + lea edi, [esi + l_anon.[ID].12-L1$pb] + lea edx, [esi + l_anon.[ID].1-L1$pb] + push ecx + push edi push 0 + push edx + mov edi, edx + push dword ptr [eax] push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869-L1$pb] - push edi call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 32 mov eax, dword ptr [esi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L1$pb] @@ -74,9 +77,9 @@ L1$pb: lea ecx, [esi + l_anon.[ID].8-L1$pb] push ecx push 0 - push ebx - push dword ptr [eax] push edi + push dword ptr [eax] + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _class_method-L1$pb] @@ -84,9 +87,9 @@ L1$pb: lea eax, [esi + l_anon.[ID].12-L1$pb] push eax push 0 - push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] push edi + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_8dd788dbcc16b9bc-L1$pb] + push ebx call SYM(objc2::declare::ClassBuilder::add_class_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method-L1$pb] @@ -94,9 +97,9 @@ L1$pb: lea eax, [esi + l_anon.[ID].12-L1$pb] push eax push 0 - push ebx - push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] push edi + push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_450db9db0953dff5-L1$pb] + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_bool-L1$pb] @@ -106,28 +109,28 @@ L1$pb: push 1 push ecx push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea ebx, [esi + l_anon.[ID].8-L1$pb] - push ebx + lea edi, [esi + l_anon.[ID].8-L1$pb] + push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_828e9fbc6d0b4498-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + _method_id_with_param-L1$pb] push eax - push ebx + push edi push 1 lea eax, [esi + l_anon.[ID].13-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] - push edi + push ebx call SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) add esp, 24 lea eax, [esi + l_anon.[ID].14-L1$pb] @@ -136,13 +139,13 @@ L1$pb: call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) add esp, 8 push eax - push edi + push ebx call SYM(objc2::__macro_helpers::::__add_protocol_methods::GENERATED_ID, 0) add esp, 8 lea ecx, [esi + _copy_with_zone-L1$pb] lea edx, [esi + l_anon.[ID].17-L1$pb] push ecx - push ebx + push edi push 1 push edx push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9-L1$pb] @@ -430,7 +433,8 @@ L8$pb: call _objc_release add esp, 16 LBB8_2: - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov eax, dword ptr [ebx + LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-L8$pb] + mov eax, dword ptr [eax] mov dword ptr [ebp - 24], edi mov dword ptr [ebp - 20], eax sub esp, 8 @@ -450,22 +454,22 @@ LBB8_2: _init: push ebp mov ebp, esp - push ebx push edi push esi - sub esp, 12 + sub esp, 16 call L9$pb L9$pb: pop edi - mov esi, dword ptr [ebp + 8] - mov eax, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] - mov ebx, dword ptr [eax] - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) - mov dword ptr [ebp - 24], esi - mov dword ptr [ebp - 20], eax + mov eax, dword ptr [ebp + 8] + mov ecx, dword ptr [edi + LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr-L9$pb] + mov ecx, dword ptr [ecx] + mov edx, dword ptr [edi + LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr-L9$pb] + mov edx, dword ptr [edx] + mov dword ptr [ebp - 16], eax + mov dword ptr [ebp - 12], edx sub esp, 8 - lea eax, [ebp - 24] - push ebx + lea eax, [ebp - 16] + push ecx push eax call _objc_msgSendSuper add esp, 16 @@ -500,10 +504,9 @@ L9$pb: mov dword ptr [esi + eax], 0 LBB9_2: mov eax, esi - add esp, 12 + add esp, 16 pop esi pop edi - pop ebx pop ebp ret @@ -828,23 +831,6 @@ l_anon.[ID].21: .long l_anon.[ID].11 .asciz "\017\000\000" - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .long L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __DATA,__objc_imageinfo,regular,no_dead_strip .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 @@ -948,6 +934,12 @@ L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9: .long L_OBJC_METH_VAR_NAME_f058a81939de2cb9 .section __IMPORT,__pointers,non_lazy_symbol_pointers +LL_OBJC_CLASSLIST_REFERENCES_$_NSObject$non_lazy_ptr: + .indirect_symbol L_OBJC_CLASSLIST_REFERENCES_$_NSObject + .long 0 +LL_OBJC_SELECTOR_REFERENCES_dealloc$non_lazy_ptr: + .indirect_symbol L_OBJC_SELECTOR_REFERENCES_dealloc + .long 0 LL_OBJC_SELECTOR_REFERENCES_init$non_lazy_ptr: .indirect_symbol L_OBJC_SELECTOR_REFERENCES_init .long 0 diff --git a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s index e4c0a7066..90380c35f 100644 --- a/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_declare_class/expected/apple-x86_64.s @@ -20,10 +20,10 @@ SYM(::call_once::<::class::objc_static_workaround::GENERATED_ID, 0) + mov rax, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPCREL] + mov rdx, qword ptr [rax] lea rdi, [rip + l_anon.[ID].11] mov esi, 15 - mov rdx, rax call SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) test rax, rax je LBB1_4 @@ -44,7 +44,8 @@ SYM(::call_once::<::class::{closure#0}::__objc2_dealloc, 0)] @@ -309,7 +310,8 @@ SYM(::class::objc_static_workaround::GENERATED_ID, 0) + mov rax, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPCREL] + mov rax, qword ptr [rax] mov qword ptr [rbp - 32], r14 mov qword ptr [rbp - 24], rax lea rdi, [rbp - 32] @@ -326,17 +328,15 @@ LBB8_2: _init: push rbp mov rbp, rsp - push r14 push rbx - sub rsp, 16 - mov rbx, rdi + sub rsp, 24 mov rax, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_init@GOTPCREL] - mov r14, qword ptr [rax] - call SYM(::class::objc_static_workaround::GENERATED_ID, 0) - mov qword ptr [rbp - 32], rbx - mov qword ptr [rbp - 24], rax - lea rdi, [rbp - 32] - mov rsi, r14 + mov rsi, qword ptr [rax] + mov rax, qword ptr [rip + L_OBJC_CLASSLIST_REFERENCES_$_NSObject@GOTPCREL] + mov rax, qword ptr [rax] + mov qword ptr [rbp - 24], rdi + mov qword ptr [rbp - 16], rax + lea rdi, [rbp - 24] call _objc_msgSendSuper mov rbx, rax test rax, rax @@ -359,9 +359,8 @@ _init: mov qword ptr [rbx + rax], 0 LBB9_2: mov rax, rbx - add rsp, 16 + add rsp, 24 pop rbx - pop r14 pop rbp ret @@ -646,23 +645,6 @@ l_anon.[ID].21: .quad l_anon.[ID].11 .asciz "\017\000\000\000\000\000\000" - .section __DATA,__objc_imageinfo,regular,no_dead_strip - .globl L_OBJC_IMAGE_INFO_694e247a0bc88869 - .p2align 2, 0x0 -L_OBJC_IMAGE_INFO_694e247a0bc88869: - .asciz "\000\000\000\000@\000\000" - - .section __TEXT,__objc_methname,cstring_literals - .globl L_OBJC_METH_VAR_NAME_694e247a0bc88869 -L_OBJC_METH_VAR_NAME_694e247a0bc88869: - .asciz "dealloc" - - .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip - .globl L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869 - .p2align 3, 0x0 -L_OBJC_SELECTOR_REFERENCES_694e247a0bc88869: - .quad L_OBJC_METH_VAR_NAME_694e247a0bc88869 - .section __DATA,__objc_imageinfo,regular,no_dead_strip .globl L_OBJC_IMAGE_INFO_8dd788dbcc16b9bc .p2align 2, 0x0 diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s index 080fdb6bd..11f072ca7 100644 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-aarch64.s @@ -52,9 +52,9 @@ _get_common_twice: stp x29, x30, [sp, #16] add x29, sp, #16 Lloh12: - adrp x20, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE + adrp x20, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE Lloh13: - ldr x20, [x20, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] + ldr x20, [x20, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] ldr x19, [x20] cbz x19, LBB2_3 ldr x1, [x20] @@ -66,9 +66,9 @@ LBB2_2: ret LBB2_3: Lloh14: - adrp x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE + adrp x0, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE Lloh15: - ldr x0, [x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] + ldr x0, [x0, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] Lloh16: adrp x1, l_anon.[ID].1@PAGE Lloh17: @@ -79,9 +79,9 @@ Lloh17: cbnz x1, LBB2_2 LBB2_4: Lloh18: - adrp x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE + adrp x0, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGE Lloh19: - ldr x0, [x0, SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] + ldr x0, [x0, SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPAGEOFF] Lloh20: adrp x1, l_anon.[ID].1@PAGE Lloh21: diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s index 1731d44fa..a485cb296 100644 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7.s @@ -47,8 +47,8 @@ LPC1_1: _get_common_twice: push {r4, r5, r7, lr} add r7, sp, #8 - movw r5, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) - movt r5, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movw r5, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movt r5, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) LPC2_0: ldr r5, [pc, r5] ldr r4, [r5] @@ -61,8 +61,8 @@ LBB2_2: mov r0, r4 pop {r4, r5, r7, pc} LBB2_3: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) movw r1, :lower16:(l_anon.[ID].1-(LPC2_2+8)) movt r1, :upper16:(l_anon.[ID].1-(LPC2_2+8)) LPC2_1: @@ -75,8 +75,8 @@ LPC2_2: cmp r1, #0 bne LBB2_2 LBB2_4: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) movw r1, :lower16:(l_anon.[ID].1-(LPC2_4+8)) movt r1, :upper16:(l_anon.[ID].1-(LPC2_4+8)) LPC2_3: @@ -317,8 +317,8 @@ l_anon.[ID].5: .zerofill __DATA,__bss,__MergedGlobals,16,2 .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 -LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: - .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) +LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0) .long 0 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s index 409cf3e4a..add9c4df5 100644 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-armv7s.s @@ -53,8 +53,8 @@ LPC1_1: _get_common_twice: push {r4, r5, r7, lr} add r7, sp, #8 - movw r5, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) - movt r5, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movw r5, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) + movt r5, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_0+8)) LPC2_0: ldr r5, [pc, r5] ldr r4, [r5] @@ -67,8 +67,8 @@ LBB2_2: mov r0, r4 pop {r4, r5, r7, pc} LBB2_3: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_1+8)) movw r1, :lower16:(l_anon.[ID].1-(LPC2_2+8)) LPC2_1: ldr r0, [pc, r0] @@ -81,8 +81,8 @@ LPC2_2: cmp r1, #0 bne LBB2_2 LBB2_4: - movw r0, :lower16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) - movt r0, :upper16:(LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movw r0, :lower16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) + movt r0, :upper16:(LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-(LPC2_3+8)) movw r1, :lower16:(l_anon.[ID].1-(LPC2_4+8)) LPC2_3: ldr r0, [pc, r0] @@ -328,8 +328,8 @@ l_anon.[ID].5: .zerofill __DATA,__bss,__MergedGlobals,16,2 .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers .p2align 2, 0x0 -LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: - .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) +LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0) .long 0 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s index b91bb7bcc..7400c6800 100644 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86.s @@ -64,7 +64,7 @@ _get_common_twice: call L2$pb L2$pb: pop ebx - mov edi, dword ptr [ebx + LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-L2$pb] + mov edi, dword ptr [ebx + LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr-L2$pb] mov esi, dword ptr [edi] test esi, esi je LBB2_1 @@ -367,8 +367,8 @@ l_anon.[ID].5: .zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_fns::CACHED_SEL, 0),4,2 .zerofill __DATA,__bss,SYM(test_dynamic_sel[CRATE_ID]::use_in_loop::CACHED_SEL, 0),4,2 .section __IMPORT,__pointers,non_lazy_symbol_pointers -LSYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: - .indirect_symbol SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0) +LSYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)$non_lazy_ptr: + .indirect_symbol SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0) .long 0 .subsections_via_symbols diff --git a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s index 79e17f87d..8216efc2d 100644 --- a/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s +++ b/crates/test-assembly/crates/test_dynamic_sel/expected/apple-x86_64.s @@ -39,7 +39,7 @@ _get_common_twice: mov rbp, rsp push r14 push rbx - mov r14, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov r14, qword ptr [rip + SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] mov rbx, qword ptr [r14] test rbx, rbx je LBB2_1 @@ -53,7 +53,7 @@ LBB2_4: pop rbp ret LBB2_1: - mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] lea rsi, [rip + l_anon.[ID].1] call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov rbx, rax @@ -61,7 +61,7 @@ LBB2_1: test rdx, rdx jne LBB2_4 LBB2_3: - mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] + mov rdi, qword ptr [rip + SYM(objc2::__macro_helpers::common_selectors::alloc_sel::CACHED_SEL::GENERATED_ID, 0)@GOTPCREL] lea rsi, [rip + l_anon.[ID].1] call SYM(objc2::__macro_helpers::cache::CachedSel::fetch::GENERATED_ID, 0) mov rdx, rax