Debian Codegraph @

third_party/rust/objc/src/message/apple/x86_64.rs

raw
1 use std::mem;
2
3 use runtime::Imp;
4
5 extern {
6 fn objc_msgSend();
7 fn objc_msgSend_stret();
8
9 fn objc_msgSendSuper();
10 fn objc_msgSendSuper_stret();
11 }
12
13 pub fn msg_send_fn<R>() -> Imp {
14 // If the size of an object is larger than two eightbytes, it has class MEMORY.
15 // If the type has class MEMORY, then the caller provides space for the return
16 // value and passes the address of this storage.
17 // <http://people.freebsd.org/~obrien/amd64-elf-abi.pdf>
18
19 if mem::size_of::<R>() <= 16 {
20 objc_msgSend
21 } else {
22 objc_msgSend_stret
23 }
24 }
25
26 pub fn msg_send_super_fn<R>() -> Imp {
27 if mem::size_of::<R>() <= 16 {
28 objc_msgSendSuper
29 } else {
30 objc_msgSendSuper_stret
31 }
32 }