-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How does your message sending work? #1
Comments
Starting with I noticed that change, tested and rewrote my old msg_send to new one. // clang -ObjC -S test.h
#import <Foundation/Foundation.h>
void test(void) {
NSNumber * num = [NSNumber numberWithBool:YES];
} .section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 0 sdk_version 13, 3
.globl _test ; -- Begin function test
.p2align 2
_test: ; @test
.cfi_startproc
; %bb.0:
sub sp, sp, #32
.cfi_def_cfa_offset 32
stp x29, x30, [sp, #16] ; 16-byte Folded Spill
add x29, sp, #16
.cfi_def_cfa w29, 16
.cfi_offset w30, -8
.cfi_offset w29, -16
; implicit-def: $x1
adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE
ldr x0, [x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF]
mov w8, #1
and w2, w8, #0x1
bl "_objc_msgSend$numberWithBool:"
str x0, [sp, #8]
ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
add sp, sp, #32
ret
.cfi_endproc
; -- End function
.section __DATA,__objc_classrefs,regular,no_dead_strip
.p2align 3 ; @"OBJC_CLASSLIST_REFERENCES_$_"
_OBJC_CLASSLIST_REFERENCES_$_:
.quad _OBJC_CLASS_$_NSNumber
.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 64
.subsections_via_symbols One downside - they turn it as optimization. So I have to add opt-level = 1 Another - this is very platform specific, but I'm ok with that if we get zero cost. |
Also implement |
Oh that's very, very cool! Thanks for the video link, I'll probably incorporate something similar into Do you know if it only works on Aarch64, or are these also available for x86_64? |
Not sure about 86_64. |
I've implemented parts of this in madsmtm/objc2#462, the message sending changes will take a bit more to do. |
Closing this issue. Feel free to reopen if needed. |
I see that you're emitting a call to a
objc_msgSend
function, but you somehow move the selector into the link name. How does that work? I assume it'sdyld
magic, but do you have some documentation on it, and some information on since when it has been supported?cidre/cidre-macros/src/lib.rs
Lines 575 to 585 in 0985976
The text was updated successfully, but these errors were encountered: