Vendor things

This commit is contained in:
John Doty 2024-03-08 11:03:01 -08:00
parent 5deceec006
commit 977e3c17e5
19434 changed files with 10682014 additions and 0 deletions

View file

@ -0,0 +1,32 @@
use std::mem;
use runtime::Imp;
extern {
fn objc_msgSend();
fn objc_msgSend_stret();
fn objc_msgSendSuper();
fn objc_msgSendSuper_stret();
}
pub fn msg_send_fn<R>() -> Imp {
// If the size of an object is larger than two eightbytes, it has class MEMORY.
// If the type has class MEMORY, then the caller provides space for the return
// value and passes the address of this storage.
// <http://people.freebsd.org/~obrien/amd64-elf-abi.pdf>
if mem::size_of::<R>() <= 16 {
objc_msgSend
} else {
objc_msgSend_stret
}
}
pub fn msg_send_super_fn<R>() -> Imp {
if mem::size_of::<R>() <= 16 {
objc_msgSendSuper
} else {
objc_msgSendSuper_stret
}
}