diff --git a/crates/objc2/src/declare/ivar_forwarding_impls.rs b/crates/objc2/src/declare/ivar_forwarding_impls.rs index 23a16df5e..3b80f25c7 100644 --- a/crates/objc2/src/declare/ivar_forwarding_impls.rs +++ b/crates/objc2/src/declare/ivar_forwarding_impls.rs @@ -14,7 +14,7 @@ use core::fmt; use core::future::Future; use core::hash; use core::iter::FusedIterator; -use core::ops::{Deref, DerefMut}; +use core::ops::Deref; use core::pin::Pin; use core::task::{Context, Poll}; use std::error::Error; @@ -192,25 +192,27 @@ impl FusedIterator for Ivar where ::Target: Fused // impl borrow::Borrow<::Target> for Ivar { // fn borrow(&self) -> &::Target { -// Deref::deref(self) +// self // } // } // // impl borrow::BorrowMut<::Target> for Ivar { // fn borrow_mut(&mut self) -> &mut ::Target { -// DerefMut::deref_mut(self) +// self // } // } impl AsRef<::Target> for Ivar { fn as_ref(&self) -> &::Target { - Deref::deref(self) + // Auto-derefs + self } } impl AsMut<::Target> for Ivar { fn as_mut(&mut self) -> &mut ::Target { - DerefMut::deref_mut(self) + // Auto-derefs + self } } diff --git a/crates/objc2/src/declare/mod.rs b/crates/objc2/src/declare/mod.rs index 8a54835b5..97088959f 100644 --- a/crates/objc2/src/declare/mod.rs +++ b/crates/objc2/src/declare/mod.rs @@ -432,7 +432,7 @@ impl ClassBuilder { self.add_method_inner( sel, F::Args::ENCODINGS, - F::Ret::ENCODING_RETURN, + &F::Ret::ENCODING_RETURN, func.__imp(), ) } @@ -442,7 +442,7 @@ impl ClassBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, func: Imp, ) { let sel_args = sel.number_of_arguments(); @@ -458,14 +458,14 @@ impl ClassBuilder { #[cfg(debug_assertions)] if let Some(superclass) = self.superclass() { if let Some(method) = superclass.instance_method(sel) { - if let Err(err) = crate::verify::verify_method_signature(method, enc_args, &enc_ret) + if let Err(err) = crate::verify::verify_method_signature(method, enc_args, enc_ret) { panic!("declared invalid method -[{} {sel}]: {err}", self.name()) } } } - let types = method_type_encoding(&enc_ret, enc_args); + 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), types.as_ptr()) }); @@ -496,7 +496,7 @@ impl ClassBuilder { self.add_class_method_inner( sel, F::Args::ENCODINGS, - F::Ret::ENCODING_RETURN, + &F::Ret::ENCODING_RETURN, func.__imp(), ) } @@ -506,7 +506,7 @@ impl ClassBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, func: Imp, ) { let sel_args = sel.number_of_arguments(); @@ -522,14 +522,14 @@ impl ClassBuilder { #[cfg(debug_assertions)] if let Some(superclass) = self.superclass() { if let Some(method) = superclass.class_method(sel) { - if let Err(err) = crate::verify::verify_method_signature(method, enc_args, &enc_ret) + if let Err(err) = crate::verify::verify_method_signature(method, enc_args, enc_ret) { panic!("declared invalid method +[{} {sel}]: {err}", self.name()) } } } - let types = method_type_encoding(&enc_ret, enc_args); + let types = method_type_encoding(enc_ret, enc_args); let success = Bool::from_raw(unsafe { ffi::class_addMethod( self.metaclass_mut(), @@ -681,7 +681,7 @@ impl ProtocolBuilder { &mut self, sel: Sel, enc_args: &[Encoding], - enc_ret: Encoding, + enc_ret: &Encoding, required: bool, instance_method: bool, ) { @@ -692,7 +692,7 @@ impl ProtocolBuilder { "selector {sel} accepts {sel_args} arguments, but function accepts {}", enc_args.len(), ); - let types = method_type_encoding(&enc_ret, enc_args); + let types = method_type_encoding(enc_ret, enc_args); unsafe { ffi::protocol_addMethodDescription( self.as_mut_ptr(), @@ -713,7 +713,7 @@ impl ProtocolBuilder { self.add_method_description_inner( sel, Args::ENCODINGS, - Ret::ENCODING_RETURN, + &Ret::ENCODING_RETURN, required, true, ) @@ -728,7 +728,7 @@ impl ProtocolBuilder { self.add_method_description_inner( sel, Args::ENCODINGS, - Ret::ENCODING_RETURN, + &Ret::ENCODING_RETURN, required, false, ) diff --git a/crates/objc2/src/message/mod.rs b/crates/objc2/src/message/mod.rs index 68ba65f9f..1cc4ce48f 100644 --- a/crates/objc2/src/message/mod.rs +++ b/crates/objc2/src/message/mod.rs @@ -68,7 +68,7 @@ fn msg_send_check( VerificationError::from(Inner::MethodNotFound) }; - panic_verify(cls, sel, err); + panic_verify(cls, sel, &err); } #[cfg(debug_assertions)] @@ -79,7 +79,7 @@ fn panic_null(sel: Sel) -> ! { #[cfg(debug_assertions)] #[track_caller] -fn panic_verify(cls: &AnyClass, sel: Sel, err: crate::runtime::VerificationError) -> ! { +fn panic_verify(cls: &AnyClass, sel: Sel, err: &crate::runtime::VerificationError) -> ! { panic!( "invalid message send to {}[{cls} {sel}]: {err}", if cls.is_metaclass() { "+" } else { "-" }, @@ -269,7 +269,7 @@ pub unsafe trait MessageReceiver: private::Sealed + Sized { panic_null(sel); } if let Err(err) = superclass.verify_sel::(sel) { - panic_verify(superclass, sel, err); + panic_verify(superclass, sel, &err); } } unsafe { diff --git a/crates/objc2/src/rc/id_forwarding_impls.rs b/crates/objc2/src/rc/id_forwarding_impls.rs index d113aaf7a..90bfad0c4 100644 --- a/crates/objc2/src/rc/id_forwarding_impls.rs +++ b/crates/objc2/src/rc/id_forwarding_impls.rs @@ -13,7 +13,6 @@ use core::cmp::Ordering; use core::fmt; use core::future::Future; use core::hash; -use core::ops::{Deref, DerefMut}; use core::pin::Pin; use core::task::{Context, Poll}; use std::error::Error; @@ -132,25 +131,29 @@ impl fmt::Debug for Id { impl borrow::Borrow for Id { fn borrow(&self) -> &T { - Deref::deref(self) + // Auto-derefs + self } } impl borrow::BorrowMut for Id { fn borrow_mut(&mut self) -> &mut T { - DerefMut::deref_mut(self) + // Auto-derefs + self } } impl AsRef for Id { fn as_ref(&self) -> &T { - Deref::deref(self) + // Auto-derefs + self } } impl AsMut for Id { fn as_mut(&mut self) -> &mut T { - DerefMut::deref_mut(self) + // Auto-derefs + self } } diff --git a/crates/objc2/src/rc/test_object.rs b/crates/objc2/src/rc/test_object.rs index debc48b04..339a8b0ae 100644 --- a/crates/objc2/src/rc/test_object.rs +++ b/crates/objc2/src/rc/test_object.rs @@ -54,7 +54,7 @@ impl __ThreadTestData { } std::thread_local! { - static TEST_DATA: RefCell<__ThreadTestData> = RefCell::new(Default::default()); + static TEST_DATA: RefCell<__ThreadTestData> = RefCell::default(); } declare_class!( diff --git a/crates/objc2/src/runtime/protocol_object.rs b/crates/objc2/src/runtime/protocol_object.rs index 7b4f6688e..cdcaeeab7 100644 --- a/crates/objc2/src/runtime/protocol_object.rs +++ b/crates/objc2/src/runtime/protocol_object.rs @@ -137,29 +137,24 @@ impl hash::Hash for ProtocolObject< impl fmt::Debug for ProtocolObject

{ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let description = self.__description(); - - match description { - // Attempt to format description string - Some(description) => { - // We use a leaking autorelease pool since often the string - // will be UTF-8, and in that case the pool will be - // irrelevant. Also, it allows us to pass the formatter into - // the pool (since it may contain a pool internally that it - // assumes is current when writing). - autoreleasepool_leaking(|pool| { - // SAFETY: `description` selector is guaranteed to always - // return an instance of `NSString`. - let s = unsafe { nsstring_to_str(&description, pool) }; - fmt::Display::fmt(s, f) - }) - } + // Attempt to format description string + if let Some(description) = self.__description() { + // We use a leaking autorelease pool since often the string + // will be UTF-8, and in that case the pool will be + // irrelevant. Also, it allows us to pass the formatter into + // the pool (since it may contain a pool internally that it + // assumes is current when writing). + autoreleasepool_leaking(|pool| { + // SAFETY: `description` selector is guaranteed to always + // return an instance of `NSString`. + let s = unsafe { nsstring_to_str(&description, pool) }; + fmt::Display::fmt(s, f) + }) + } else { // If description was `NULL`, use `AnyObject`'s `Debug` impl // instead - None => { - let obj: &AnyObject = &self.inner; - fmt::Debug::fmt(obj, f) - } + let obj: &AnyObject = &self.inner; + fmt::Debug::fmt(obj, f) } } } 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 ec60189d2..59304b69b 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 @@ -21,34 +21,34 @@ Lloh1: Lloh2: ldr x2, [x8] Lloh3: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh4: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::declare::ClassBuilder::new::GENERATED_ID, 0) cbz x0, LBB1_4 str x0, [sp] Lloh5: - adrp x1, l_anon.[ID].5@PAGE + adrp x1, l_anon.[ID].11@PAGE Lloh6: - add x1, x1, l_anon.[ID].5@PAGEOFF + add x1, x1, l_anon.[ID].11@PAGEOFF Lloh7: - adrp x5, l_anon.[ID].6@PAGE + adrp x5, l_anon.[ID].12@PAGE Lloh8: - add x5, x5, l_anon.[ID].6@PAGEOFF + add x5, x5, l_anon.[ID].12@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) Lloh9: - adrp x1, l_anon.[ID].7@PAGE + adrp x1, l_anon.[ID].13@PAGE Lloh10: - add x1, x1, l_anon.[ID].7@PAGEOFF + add x1, x1, l_anon.[ID].13@PAGEOFF Lloh11: - adrp x19, l_anon.[ID].8@PAGE + adrp x19, l_anon.[ID].2@PAGE Lloh12: - add x19, x19, l_anon.[ID].8@PAGEOFF + add x19, x19, l_anon.[ID].2@PAGEOFF mov x0, sp mov w2, #4 mov w3, #8 @@ -66,9 +66,9 @@ Lloh16: Lloh17: add x20, x20, l_anon.[ID].1@PAGEOFF Lloh18: - adrp x21, l_anon.[ID].12@PAGE + adrp x21, l_anon.[ID].3@PAGE Lloh19: - add x21, x21, l_anon.[ID].12@PAGEOFF + add x21, x21, l_anon.[ID].3@PAGEOFF Lloh20: adrp x5, SYM(::class::{closure#0}::__objc2_dealloc, 0)@PAGE Lloh21: @@ -124,9 +124,9 @@ Lloh35: Lloh36: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_783b35bc45c6e4a6@PAGEOFF] Lloh37: - adrp x21, l_anon.[ID].13@PAGE + adrp x21, l_anon.[ID].4@PAGE Lloh38: - add x21, x21, l_anon.[ID].13@PAGEOFF + add x21, x21, l_anon.[ID].4@PAGEOFF Lloh39: adrp x5, _method_bool@PAGE Lloh40: @@ -163,9 +163,9 @@ Lloh48: mov x4, x19 bl SYM(objc2::declare::ClassBuilder::add_method_inner::GENERATED_ID, 0) Lloh49: - adrp x0, l_anon.[ID].14@PAGE + adrp x0, l_anon.[ID].17@PAGE Lloh50: - add x0, x0, l_anon.[ID].14@PAGEOFF + add x0, x0, l_anon.[ID].17@PAGEOFF mov w1, #9 bl SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) mov x1, x0 @@ -176,9 +176,9 @@ Lloh51: Lloh52: ldr x1, [x8, L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9@PAGEOFF] Lloh53: - adrp x2, l_anon.[ID].17@PAGE + adrp x2, l_anon.[ID].7@PAGE Lloh54: - add x2, x2, l_anon.[ID].17@PAGEOFF + add x2, x2, l_anon.[ID].7@PAGEOFF Lloh55: adrp x5, _copy_with_zone@PAGE Lloh56: @@ -195,13 +195,13 @@ Lloh56: ret LBB1_3: Lloh57: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh58: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh59: - adrp x2, l_anon.[ID].4@PAGE + adrp x2, l_anon.[ID].10@PAGE Lloh60: - add x2, x2, l_anon.[ID].4@PAGEOFF + add x2, x2, l_anon.[ID].10@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) LBB1_4: @@ -225,9 +225,9 @@ Lloh66: str x8, [sp, #16] stp x9, xzr, [sp, #24] Lloh67: - adrp x1, l_anon.[ID].10@PAGE + adrp x1, l_anon.[ID].15@PAGE Lloh68: - add x1, x1, l_anon.[ID].10@PAGEOFF + add x1, x1, l_anon.[ID].15@PAGEOFF mov x0, sp bl SYM(core::panicking::panic_fmt::GENERATED_ID, 0) .loh AdrpAdd Lloh3, Lloh4 @@ -298,9 +298,9 @@ Lloh70: cmp x8, #3 b.ne LBB4_3 Lloh71: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh72: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbz x0, LBB4_4 @@ -322,28 +322,28 @@ Lloh75: Lloh76: add x3, x3, l_anon.[ID].0@PAGEOFF Lloh77: - adrp x4, l_anon.[ID].10@PAGE + adrp x4, l_anon.[ID].15@PAGE Lloh78: - add x4, x4, l_anon.[ID].10@PAGEOFF + add x4, x4, l_anon.[ID].15@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) Lloh79: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh80: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB4_2 LBB4_4: Lloh81: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh82: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh83: - adrp x2, l_anon.[ID].10@PAGE + adrp x2, l_anon.[ID].15@PAGE Lloh84: - add x2, x2, l_anon.[ID].10@PAGEOFF + add x2, x2, l_anon.[ID].15@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) .loh AdrpAdd Lloh69, Lloh70 @@ -385,26 +385,26 @@ _access_ivars: mov x19, x0 bl SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) Lloh88: - adrp x1, l_anon.[ID].5@PAGE + adrp x1, l_anon.[ID].11@PAGE Lloh89: - add x1, x1, l_anon.[ID].5@PAGEOFF + add x1, x1, l_anon.[ID].11@PAGEOFF Lloh90: - adrp x3, l_anon.[ID].6@PAGE + adrp x3, l_anon.[ID].12@PAGE Lloh91: - add x3, x3, l_anon.[ID].6@PAGEOFF + add x3, x3, l_anon.[ID].12@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) Lloh92: - adrp x1, l_anon.[ID].7@PAGE + adrp x1, l_anon.[ID].13@PAGE Lloh93: - add x1, x1, l_anon.[ID].7@PAGEOFF + add x1, x1, l_anon.[ID].13@PAGEOFF Lloh94: - adrp x3, l_anon.[ID].8@PAGE + adrp x3, l_anon.[ID].2@PAGE Lloh95: - add x3, x3, l_anon.[ID].8@PAGEOFF + add x3, x3, l_anon.[ID].2@PAGEOFF mov w2, #4 bl SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) ldr x21, [x19, x0] @@ -435,9 +435,9 @@ Lloh97: cmp x8, #3 b.ne LBB7_3 Lloh98: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh99: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbz x0, LBB7_4 @@ -459,28 +459,28 @@ Lloh102: Lloh103: add x3, x3, l_anon.[ID].0@PAGEOFF Lloh104: - adrp x4, l_anon.[ID].10@PAGE + adrp x4, l_anon.[ID].15@PAGE Lloh105: - add x4, x4, l_anon.[ID].10@PAGEOFF + add x4, x4, l_anon.[ID].15@PAGEOFF add x2, sp, #8 mov w1, #0 bl SYM(std::sys_common::once::queue::Once::call::GENERATED_ID, 0) Lloh106: - adrp x0, l_anon.[ID].11@PAGE + adrp x0, l_anon.[ID].16@PAGE Lloh107: - add x0, x0, l_anon.[ID].11@PAGEOFF + add x0, x0, l_anon.[ID].16@PAGEOFF mov w1, #15 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) cbnz x0, LBB7_2 LBB7_4: Lloh108: - adrp x0, l_anon.[ID].2@PAGE + adrp x0, l_anon.[ID].8@PAGE Lloh109: - add x0, x0, l_anon.[ID].2@PAGEOFF + add x0, x0, l_anon.[ID].8@PAGEOFF Lloh110: - adrp x2, l_anon.[ID].10@PAGE + adrp x2, l_anon.[ID].15@PAGE Lloh111: - add x2, x2, l_anon.[ID].10@PAGEOFF + add x2, x2, l_anon.[ID].15@PAGEOFF mov w1, #43 bl SYM(core::panicking::panic::GENERATED_ID, 0) .loh AdrpAdd Lloh96, Lloh97 @@ -502,13 +502,13 @@ SYM(::class::REGISTER_CLASS, 0),8,3 + .section __TEXT,__const .p2align 3, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 39 - .p2align 3, 0x0 + .section __TEXT,__literal4,4byte_literals l_anon.[ID].13: - .byte 16 - .space 39 + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 3, 0x0 +l_anon.[ID].15: + .quad l_anon.[ID].14 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const 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 + .ascii "CustomClassName" - .p2align 3, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 l_anon.[ID].17: - .byte 25 - .space 7 - .quad l_anon.[ID].16 - .space 24 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -875,7 +875,7 @@ l_anon.[ID].20: .p2align 3, 0x0 l_anon.[ID].21: - .quad l_anon.[ID].11 + .quad l_anon.[ID].16 .asciz "\017\000\000\000\000\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip 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 f6b37478c..c380efdab 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 @@ -24,18 +24,18 @@ SYM(::call_once::<::__add_protocol_methods::GENERATED_ID, 0) - movw r2, :lower16:(l_anon.[ID].17-(LPC1_24+8)) + movw r2, :lower16:(l_anon.[ID].7-(LPC1_24+8)) mov r3, #1 - movt r2, :upper16:(l_anon.[ID].17-(LPC1_24+8)) + movt r2, :upper16:(l_anon.[ID].7-(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: @@ -197,11 +197,11 @@ LPC1_26: pop {r8, r10, r11} pop {r4, r5, r7, pc} LBB1_3: - movw r0, :lower16:(l_anon.[ID].2-(LPC1_27+8)) + movw r0, :lower16:(l_anon.[ID].8-(LPC1_27+8)) mov r1, #43 - 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)) + movt r0, :upper16:(l_anon.[ID].8-(LPC1_27+8)) + movw r2, :lower16:(l_anon.[ID].10-(LPC1_28+8)) + movt r2, :upper16:(l_anon.[ID].10-(LPC1_28+8)) LPC1_27: add r0, pc, r0 LPC1_28: @@ -216,10 +216,10 @@ LBB1_4: 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)) + movw r1, :lower16:(l_anon.[ID].15-(LPC1_32+8)) LPC1_29: add r0, pc, r0 - movt r1, :upper16:(l_anon.[ID].10-(LPC1_32+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC1_32+8)) str r0, [sp, #8] mov r0, #1 str r0, [sp, #20] @@ -276,9 +276,9 @@ LPC4_0: cmp r0, #3 bne LBB4_3 LBB4_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC4_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC4_4+8)) LPC4_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -286,11 +286,11 @@ LPC4_4: movne sp, r7 popne {r7, pc} LBB4_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(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)) + movt r0, :upper16:(l_anon.[ID].8-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC4_6+8)) LPC4_5: add r0, pc, r0 LPC4_6: @@ -303,8 +303,8 @@ LBB4_3: 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)) + movw r1, :lower16:(l_anon.[ID].15-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC4_3+8)) strb r2, [r7, #-5] sub r2, r7, #5 LPC4_3: @@ -345,11 +345,11 @@ _access_ivars: 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)) + movw r1, :lower16:(L_anon.[ID].11-(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)) + movt r1, :upper16:(L_anon.[ID].11-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].12-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].12-(LPC6_1+8)) LPC6_0: add r1, pc, r1 LPC6_1: @@ -358,11 +358,11 @@ LPC6_1: 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)) + movw r1, :lower16:(L_anon.[ID].13-(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)) + movt r1, :upper16:(L_anon.[ID].13-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].2-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].2-(LPC6_3+8)) LPC6_2: add r1, pc, r1 LPC6_3: @@ -391,9 +391,9 @@ LPC7_0: cmp r0, #3 bne LBB7_3 LBB7_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC7_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC7_4+8)) LPC7_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -401,11 +401,11 @@ LPC7_4: movne sp, r7 popne {r7, pc} LBB7_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(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)) + movt r0, :upper16:(l_anon.[ID].8-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC7_6+8)) LPC7_5: add r0, pc, r0 LPC7_6: @@ -418,8 +418,8 @@ LBB7_3: 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)) + movw r1, :lower16:(l_anon.[ID].15-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC7_3+8)) strb r2, [r7, #-5] sub r2, r7, #5 LPC7_3: @@ -444,11 +444,11 @@ SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -803,7 +803,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip 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 718a0d1fe..da99dfe97 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 @@ -24,18 +24,18 @@ SYM(::call_once::<::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] @@ -279,9 +279,9 @@ LPC4_0: cmp r0, #3 bne LBB4_3 LBB4_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC4_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC4_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC4_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC4_4+8)) LPC4_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -289,11 +289,11 @@ LPC4_4: movne sp, r7 popne {r7, pc} LBB4_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC4_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(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)) + movt r0, :upper16:(l_anon.[ID].8-(LPC4_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC4_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC4_6+8)) LPC4_5: add r0, pc, r0 LPC4_6: @@ -306,8 +306,8 @@ LBB4_3: 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)) + movw r1, :lower16:(l_anon.[ID].15-(LPC4_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC4_3+8)) strb r2, [r7, #-5] LPC4_3: add r1, pc, r1 @@ -348,11 +348,11 @@ _access_ivars: 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)) + movw r1, :lower16:(L_anon.[ID].11-(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)) + movt r1, :upper16:(L_anon.[ID].11-(LPC6_0+8)) + movw r3, :lower16:(l_anon.[ID].12-(LPC6_1+8)) + movt r3, :upper16:(l_anon.[ID].12-(LPC6_1+8)) LPC6_0: add r1, pc, r1 LPC6_1: @@ -361,11 +361,11 @@ LPC6_1: 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)) + movw r1, :lower16:(L_anon.[ID].13-(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)) + movt r1, :upper16:(L_anon.[ID].13-(LPC6_2+8)) + movw r3, :lower16:(l_anon.[ID].2-(LPC6_3+8)) + movt r3, :upper16:(l_anon.[ID].2-(LPC6_3+8)) LPC6_2: add r1, pc, r1 LPC6_3: @@ -394,9 +394,9 @@ LPC7_0: cmp r0, #3 bne LBB7_3 LBB7_1: - movw r0, :lower16:(l_anon.[ID].11-(LPC7_4+8)) + movw r0, :lower16:(l_anon.[ID].16-(LPC7_4+8)) mov r1, #15 - movt r0, :upper16:(l_anon.[ID].11-(LPC7_4+8)) + movt r0, :upper16:(l_anon.[ID].16-(LPC7_4+8)) LPC7_4: add r0, pc, r0 bl SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -404,11 +404,11 @@ LPC7_4: movne sp, r7 popne {r7, pc} LBB7_2: - movw r0, :lower16:(l_anon.[ID].2-(LPC7_5+8)) + movw r0, :lower16:(l_anon.[ID].8-(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)) + movt r0, :upper16:(l_anon.[ID].8-(LPC7_5+8)) + movw r2, :lower16:(l_anon.[ID].15-(LPC7_6+8)) + movt r2, :upper16:(l_anon.[ID].15-(LPC7_6+8)) LPC7_5: add r0, pc, r0 LPC7_6: @@ -421,8 +421,8 @@ LBB7_3: 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)) + movw r1, :lower16:(l_anon.[ID].15-(LPC7_3+8)) + movt r1, :upper16:(l_anon.[ID].15-(LPC7_3+8)) strb r2, [r7, #-5] LPC7_3: add r1, pc, r1 @@ -447,11 +447,11 @@ SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -806,7 +806,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip 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 736669c17..8226e0df6 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 @@ -25,7 +25,7 @@ L1$pb: je LBB1_3 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] + lea ecx, [esi + l_anon.[ID].16-L1$pb] push dword ptr [eax] push 15 push ecx @@ -35,8 +35,8 @@ L1$pb: je LBB1_4 mov dword ptr [ebp - 36], eax sub esp, 8 - lea eax, [esi + l_anon.[ID].6-L1$pb] - lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea eax, [esi + l_anon.[ID].12-L1$pb] + lea ecx, [esi + L_anon.[ID].11-L1$pb] lea ebx, [ebp - 36] push eax push 0 @@ -46,8 +46,8 @@ L1$pb: 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] - lea eax, [esi + L_anon.[ID].7-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + L_anon.[ID].13-L1$pb] push ecx push 2 push 4 @@ -59,7 +59,7 @@ L1$pb: 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 edi, [esi + l_anon.[ID].3-L1$pb] lea edx, [esi + l_anon.[ID].1-L1$pb] push ecx push edi @@ -74,7 +74,7 @@ L1$pb: sub esp, 8 lea ecx, [esi + _init-L1$pb] push ecx - lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] push ecx push 0 push edi @@ -84,7 +84,7 @@ L1$pb: add esp, 24 lea eax, [esi + _class_method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -94,7 +94,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -103,7 +103,7 @@ L1$pb: 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] + lea ecx, [esi + l_anon.[ID].4-L1$pb] push eax push ecx push 1 @@ -114,7 +114,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea edi, [esi + l_anon.[ID].8-L1$pb] + lea edi, [esi + l_anon.[ID].2-L1$pb] push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] @@ -127,13 +127,13 @@ L1$pb: push eax push edi push 1 - lea eax, [esi + l_anon.[ID].13-L1$pb] + lea eax, [esi + l_anon.[ID].4-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] 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] + lea eax, [esi + l_anon.[ID].17-L1$pb] push 9 push eax call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) @@ -143,7 +143,7 @@ L1$pb: 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] + lea edx, [esi + l_anon.[ID].7-L1$pb] push ecx push edi push 1 @@ -162,8 +162,8 @@ L1$pb: ret LBB1_3: sub esp, 4 - lea eax, [esi + l_anon.[ID].4-L1$pb] - lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [esi + l_anon.[ID].8-L1$pb] push eax push 43 push ecx @@ -181,7 +181,7 @@ LBB1_4: mov dword ptr [ebp - 28], eax mov dword ptr [ebp - 24], 1 sub esp, 8 - lea eax, [esi + l_anon.[ID].10-L1$pb] + lea eax, [esi + l_anon.[ID].15-L1$pb] lea ecx, [ebp - 36] push eax push ecx @@ -233,7 +233,7 @@ L4$pb: jne LBB4_1 LBB4_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L4$pb] + lea eax, [esi + l_anon.[ID].16-L4$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -250,7 +250,7 @@ LBB4_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L4$pb] + lea eax, [esi + l_anon.[ID].15-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] @@ -264,8 +264,8 @@ LBB4_1: 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] + lea eax, [esi + l_anon.[ID].15-L4$pb] + lea ecx, [esi + l_anon.[ID].8-L4$pb] push eax push 43 push ecx @@ -311,8 +311,8 @@ L6$pb: 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] + lea ecx, [edi + l_anon.[ID].12-L6$pb] + lea edx, [edi + L_anon.[ID].11-L6$pb] push ecx push 4 push edx @@ -324,8 +324,8 @@ L6$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L6$pb] + lea edx, [edi + L_anon.[ID].13-L6$pb] push ecx push 4 push edx @@ -362,7 +362,7 @@ L7$pb: jne LBB7_1 LBB7_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L7$pb] + lea eax, [esi + l_anon.[ID].16-L7$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -379,7 +379,7 @@ LBB7_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L7$pb] + lea eax, [esi + l_anon.[ID].15-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] @@ -393,8 +393,8 @@ LBB7_1: 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] + lea eax, [esi + l_anon.[ID].15-L7$pb] + lea ecx, [esi + l_anon.[ID].8-L7$pb] push eax push 43 push ecx @@ -417,8 +417,8 @@ L8$pb: 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] + lea ecx, [ebx + l_anon.[ID].2-L8$pb] + lea edx, [ebx + L_anon.[ID].13-L8$pb] push ecx push 4 push edx @@ -480,8 +480,8 @@ L9$pb: 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] + lea ecx, [edi + l_anon.[ID].12-L9$pb] + lea edx, [edi + L_anon.[ID].11-L9$pb] push ecx push 4 push edx @@ -493,8 +493,8 @@ L9$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L9$pb] + lea edx, [edi + L_anon.[ID].13-L9$pb] push ecx push 4 push edx @@ -552,8 +552,8 @@ L13$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L13$pb] + lea edx, [edi + L_anon.[ID].13-L13$pb] push ecx push 4 push edx @@ -599,9 +599,9 @@ L14$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L14$pb] mov dword ptr [esp + 12], ecx - lea ecx, [edi + L_anon.[ID].7-L14$pb] + lea ecx, [edi + L_anon.[ID].13-L14$pb] mov dword ptr [esp + 4], ecx mov dword ptr [esp], eax mov dword ptr [esp + 8], 4 @@ -651,8 +651,8 @@ L15$pb: 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] + lea edx, [edi + l_anon.[ID].12-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push edx push 4 push ecx @@ -664,10 +664,10 @@ L15$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + l_anon.[ID].12-L15$pb] push ecx push 4 - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push ecx push eax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -677,8 +677,8 @@ L15$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L15$pb] + lea ebx, [edi + L_anon.[ID].13-L15$pb] mov dword ptr [ebp - 16], ecx push ecx push 4 @@ -732,86 +732,86 @@ l_anon.[ID].0: l_anon.[ID].1: .byte 0 + .p2align 2, 0x0 l_anon.[ID].2: - .ascii "called `Option::unwrap()` on a `None` value" + .byte 19 + .space 19 + .p2align 2, 0x0 l_anon.[ID].3: - .ascii "$RUSTC/library/std/src/sync/once.rs" + .byte 17 + .space 19 - .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].4: - .long l_anon.[ID].3 - .asciz "p\000\000\000\225\000\000\0002\000\000" + .space 1 + .space 19 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].5: - .ascii "_foo" +l_anon.[ID].5: + .ascii "_NSZone" - .section __TEXT,__const + .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].6: - .byte 5 - .space 19 + .byte 28 + .space 3 + .long l_anon.[ID].5 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].7: - .ascii "_obj" + .p2align 2, 0x0 +l_anon.[ID].7: + .byte 25 + .space 3 + .long l_anon.[ID].6 + .space 12 .section __TEXT,__const - .p2align 2, 0x0 l_anon.[ID].8: - .byte 19 - .space 19 + .ascii "called `Option::unwrap()` on a `None` value" l_anon.[ID].9: - .ascii "crates/$DIR/lib.rs" + .ascii "$RUSTC/library/std/src/sync/once.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" + .asciz "p\000\000\000\225\000\000\0002\000\000" - .section __TEXT,__const -l_anon.[ID].11: - .ascii "CustomClassName" + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].11: + .ascii "_foo" -.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -828,7 +828,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __OBJC,__image_info 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 cb0432314..79f70b9c1 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 @@ -25,7 +25,7 @@ L1$pb: je LBB1_3 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] + lea ecx, [esi + l_anon.[ID].16-L1$pb] push dword ptr [eax] push 15 push ecx @@ -35,8 +35,8 @@ L1$pb: je LBB1_4 mov dword ptr [ebp - 36], eax sub esp, 8 - lea eax, [esi + l_anon.[ID].6-L1$pb] - lea ecx, [esi + L_anon.[ID].5-L1$pb] + lea eax, [esi + l_anon.[ID].12-L1$pb] + lea ecx, [esi + L_anon.[ID].11-L1$pb] lea ebx, [ebp - 36] push eax push 0 @@ -46,8 +46,8 @@ L1$pb: 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] - lea eax, [esi + L_anon.[ID].7-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + L_anon.[ID].13-L1$pb] push ecx push 2 push 4 @@ -59,7 +59,7 @@ L1$pb: 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 edi, [esi + l_anon.[ID].3-L1$pb] lea edx, [esi + l_anon.[ID].1-L1$pb] push ecx push edi @@ -74,7 +74,7 @@ L1$pb: sub esp, 8 lea ecx, [esi + _init-L1$pb] push ecx - lea ecx, [esi + l_anon.[ID].8-L1$pb] + lea ecx, [esi + l_anon.[ID].2-L1$pb] push ecx push 0 push edi @@ -84,7 +84,7 @@ L1$pb: add esp, 24 lea eax, [esi + _class_method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -94,7 +94,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method-L1$pb] push eax - lea eax, [esi + l_anon.[ID].12-L1$pb] + lea eax, [esi + l_anon.[ID].3-L1$pb] push eax push 0 push edi @@ -103,7 +103,7 @@ L1$pb: 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] + lea ecx, [esi + l_anon.[ID].4-L1$pb] push eax push ecx push 1 @@ -114,7 +114,7 @@ L1$pb: add esp, 24 lea eax, [esi + _method_id-L1$pb] push eax - lea edi, [esi + l_anon.[ID].8-L1$pb] + lea edi, [esi + l_anon.[ID].2-L1$pb] push edi push 0 lea eax, [esi + l_anon.[ID].1-L1$pb] @@ -127,13 +127,13 @@ L1$pb: push eax push edi push 1 - lea eax, [esi + l_anon.[ID].13-L1$pb] + lea eax, [esi + l_anon.[ID].4-L1$pb] push eax push dword ptr [esi + L_OBJC_SELECTOR_REFERENCES_788cc14ba6a28eb8-L1$pb] 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] + lea eax, [esi + l_anon.[ID].17-L1$pb] push 9 push eax call SYM(objc2::runtime::AnyProtocol::get::GENERATED_ID, 0) @@ -143,7 +143,7 @@ L1$pb: 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] + lea edx, [esi + l_anon.[ID].7-L1$pb] push ecx push edi push 1 @@ -162,8 +162,8 @@ L1$pb: ret LBB1_3: sub esp, 4 - lea eax, [esi + l_anon.[ID].4-L1$pb] - lea ecx, [esi + l_anon.[ID].2-L1$pb] + lea eax, [esi + l_anon.[ID].10-L1$pb] + lea ecx, [esi + l_anon.[ID].8-L1$pb] push eax push 43 push ecx @@ -181,7 +181,7 @@ LBB1_4: mov dword ptr [ebp - 28], eax mov dword ptr [ebp - 24], 1 sub esp, 8 - lea eax, [esi + l_anon.[ID].10-L1$pb] + lea eax, [esi + l_anon.[ID].15-L1$pb] lea ecx, [ebp - 36] push eax push ecx @@ -233,7 +233,7 @@ L4$pb: jne LBB4_1 LBB4_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L4$pb] + lea eax, [esi + l_anon.[ID].16-L4$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -250,7 +250,7 @@ LBB4_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L4$pb] + lea eax, [esi + l_anon.[ID].15-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] @@ -264,8 +264,8 @@ LBB4_1: 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] + lea eax, [esi + l_anon.[ID].15-L4$pb] + lea ecx, [esi + l_anon.[ID].8-L4$pb] push eax push 43 push ecx @@ -311,8 +311,8 @@ L6$pb: 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] + lea ecx, [edi + l_anon.[ID].12-L6$pb] + lea edx, [edi + L_anon.[ID].11-L6$pb] push ecx push 4 push edx @@ -324,8 +324,8 @@ L6$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L6$pb] + lea edx, [edi + L_anon.[ID].13-L6$pb] push ecx push 4 push edx @@ -362,7 +362,7 @@ L7$pb: jne LBB7_1 LBB7_2: sub esp, 8 - lea eax, [esi + l_anon.[ID].11-L7$pb] + lea eax, [esi + l_anon.[ID].16-L7$pb] push 15 push eax call SYM(objc2::runtime::AnyClass::get::GENERATED_ID, 0) @@ -379,7 +379,7 @@ LBB7_1: lea eax, [ebp - 9] mov dword ptr [ebp - 16], eax sub esp, 12 - lea eax, [esi + l_anon.[ID].10-L7$pb] + lea eax, [esi + l_anon.[ID].15-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] @@ -393,8 +393,8 @@ LBB7_1: 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] + lea eax, [esi + l_anon.[ID].15-L7$pb] + lea ecx, [esi + l_anon.[ID].8-L7$pb] push eax push 43 push ecx @@ -417,8 +417,8 @@ L8$pb: 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] + lea ecx, [ebx + l_anon.[ID].2-L8$pb] + lea edx, [ebx + L_anon.[ID].13-L8$pb] push ecx push 4 push edx @@ -480,8 +480,8 @@ L9$pb: 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] + lea ecx, [edi + l_anon.[ID].12-L9$pb] + lea edx, [edi + L_anon.[ID].11-L9$pb] push ecx push 4 push edx @@ -493,8 +493,8 @@ L9$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L9$pb] + lea edx, [edi + L_anon.[ID].13-L9$pb] push ecx push 4 push edx @@ -552,8 +552,8 @@ L13$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L13$pb] + lea edx, [edi + L_anon.[ID].13-L13$pb] push ecx push 4 push edx @@ -599,9 +599,9 @@ L14$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L14$pb] mov dword ptr [esp + 12], ecx - lea ecx, [edi + L_anon.[ID].7-L14$pb] + lea ecx, [edi + L_anon.[ID].13-L14$pb] mov dword ptr [esp + 4], ecx mov dword ptr [esp], eax mov dword ptr [esp + 8], 4 @@ -651,8 +651,8 @@ L15$pb: 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] + lea edx, [edi + l_anon.[ID].12-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push edx push 4 push ecx @@ -664,10 +664,10 @@ L15$pb: push esi call SYM(objc2::runtime::AnyObject::class::GENERATED_ID, 0) add esp, 16 - lea ecx, [edi + l_anon.[ID].6-L15$pb] + lea ecx, [edi + l_anon.[ID].12-L15$pb] push ecx push 4 - lea ecx, [edi + L_anon.[ID].5-L15$pb] + lea ecx, [edi + L_anon.[ID].11-L15$pb] push ecx push eax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -677,8 +677,8 @@ L15$pb: 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] + lea ecx, [edi + l_anon.[ID].2-L15$pb] + lea ebx, [edi + L_anon.[ID].13-L15$pb] mov dword ptr [ebp - 16], ecx push ecx push 4 @@ -732,86 +732,86 @@ l_anon.[ID].0: l_anon.[ID].1: .byte 0 + .p2align 2, 0x0 l_anon.[ID].2: - .ascii "called `Option::unwrap()` on a `None` value" + .byte 19 + .space 19 + .p2align 2, 0x0 l_anon.[ID].3: - .ascii "$RUSTC/library/std/src/sync/once.rs" + .byte 17 + .space 19 - .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].4: - .long l_anon.[ID].3 - .asciz "p\000\000\000\225\000\000\0002\000\000" + .space 1 + .space 19 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].5: - .ascii "_foo" +l_anon.[ID].5: + .ascii "_NSZone" - .section __TEXT,__const + .section __DATA,__const .p2align 2, 0x0 l_anon.[ID].6: - .byte 5 - .space 19 + .byte 28 + .space 3 + .long l_anon.[ID].5 + .asciz "\007\000\000" + .long l_anon.[ID].1 + .space 4 - .section __TEXT,__literal4,4byte_literals -L_anon.[ID].7: - .ascii "_obj" + .p2align 2, 0x0 +l_anon.[ID].7: + .byte 25 + .space 3 + .long l_anon.[ID].6 + .space 12 .section __TEXT,__const - .p2align 2, 0x0 l_anon.[ID].8: - .byte 19 - .space 19 + .ascii "called `Option::unwrap()` on a `None` value" l_anon.[ID].9: - .ascii "crates/$DIR/lib.rs" + .ascii "$RUSTC/library/std/src/sync/once.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" + .asciz "p\000\000\000\225\000\000\0002\000\000" - .section __TEXT,__const -l_anon.[ID].11: - .ascii "CustomClassName" + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].11: + .ascii "_foo" -.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 + .section __TEXT,__const .p2align 2, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 19 - .p2align 2, 0x0 -l_anon.[ID].13: - .space 1 - .space 19 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 2, 0x0 +l_anon.[ID].15: + .long l_anon.[ID].14 + .asciz "5\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const l_anon.[ID].16: - .byte 28 - .space 3 - .long l_anon.[ID].15 - .asciz "\007\000\000" - .long l_anon.[ID].1 - .space 4 + .ascii "CustomClassName" - .p2align 2, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),4,2 l_anon.[ID].17: - .byte 25 - .space 3 - .long l_anon.[ID].16 - .space 12 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -828,7 +828,7 @@ l_anon.[ID].20: .p2align 2, 0x0 l_anon.[ID].21: - .long l_anon.[ID].11 + .long l_anon.[ID].16 .asciz "\017\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip 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 3586c0da7..e0e3d301f 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 @@ -22,22 +22,22 @@ SYM(::call_once::<::call_once::<::class::{closure#0}::__objc2_dealloc, 0)] mov rdi, rbx mov rdx, r15 @@ -77,7 +77,7 @@ SYM(::call_once::<::call_once::<::__add_protocol_methods::GENERATED_ID, 0) mov rsi, qword ptr [rip + L_OBJC_SELECTOR_REFERENCES_f058a81939de2cb9] - lea rdx, [rip + l_anon.[ID].17] + lea rdx, [rip + l_anon.[ID].7] lea r9, [rip + _copy_with_zone] mov ecx, 1 mov rdi, rax @@ -121,8 +121,8 @@ SYM(::call_once::<::class::REGISTER_CLASS, 0)] lea rcx, [rip + l_anon.[ID].0] - lea r8, [rip + l_anon.[ID].10] + lea r8, [rip + l_anon.[ID].15] 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] + lea rdi, [rip + l_anon.[ID].8] + lea rdx, [rip + l_anon.[ID].15] mov esi, 43 call SYM(core::panicking::panic::GENERATED_ID, 0) @@ -230,16 +230,16 @@ _access_ivars: 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] + lea rsi, [rip + L_anon.[ID].11] + lea rcx, [rip + l_anon.[ID].12] 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] + lea rsi, [rip + L_anon.[ID].13] + lea rcx, [rip + l_anon.[ID].2] mov edx, 4 mov rdi, rax call SYM(objc2::runtime::ivar_offset::GENERATED_ID, 0) @@ -265,7 +265,7 @@ SYM(::class::REGISTER_CLASS, 0)] lea rcx, [rip + l_anon.[ID].0] - lea r8, [rip + l_anon.[ID].10] + lea r8, [rip + l_anon.[ID].15] 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] + lea rdi, [rip + l_anon.[ID].8] + lea rdx, [rip + l_anon.[ID].15] mov esi, 43 call SYM(core::panicking::panic::GENERATED_ID, 0) @@ -300,8 +300,8 @@ SYM(::class::REGISTER_CLASS, 0),8,3 + .section __TEXT,__const .p2align 3, 0x0 l_anon.[ID].12: - .byte 17 + .byte 5 .space 39 - .p2align 3, 0x0 -l_anon.[ID].13: - .space 1 - .space 39 + .section __TEXT,__literal4,4byte_literals +L_anon.[ID].13: + .ascii "_obj" + .section __TEXT,__const l_anon.[ID].14: - .ascii "NSCopying" - -l_anon.[ID].15: - .ascii "_NSZone" + .ascii "crates/$DIR/lib.rs" .section __DATA,__const .p2align 3, 0x0 +l_anon.[ID].15: + .quad l_anon.[ID].14 + .asciz "5\000\000\000\000\000\000\000\013\000\000\000\001\000\000" + + .section __TEXT,__const 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 + .ascii "CustomClassName" - .p2align 3, 0x0 +.zerofill __DATA,__bss,SYM(::class::REGISTER_CLASS, 0),8,3 l_anon.[ID].17: - .byte 25 - .space 7 - .quad l_anon.[ID].16 - .space 24 + .ascii "NSCopying" - .section __TEXT,__const l_anon.[ID].18: .ascii "could not create new class " @@ -642,7 +642,7 @@ l_anon.[ID].20: .p2align 3, 0x0 l_anon.[ID].21: - .quad l_anon.[ID].11 + .quad l_anon.[ID].16 .asciz "\017\000\000\000\000\000\000" .section __DATA,__objc_imageinfo,regular,no_dead_strip