The document discusses Objective-C messaging and the objc_msgSend function. It notes that when a message is sent in Objective-C, the compiler converts it to a call to objc_msgSend. objc_msgSend first finds the method implementation based on the class of the receiver, then calls the method implementation, passing the receiver and arguments. Under the hood, objc_msgSend checks if the receiver is nil, checks if the method implementation is cached, and if not searches up the class hierarchy to find the implementation.
12. Message
1. It first finds the procedure (method
implementation) that the selector refers to. Since
the same method can be implemented differently
by separate classes, the precise procedure that it
finds depends on the class of the receiver.
13. Message
2. It then calls the procedure, passing it the
receiving object (a pointer to its data), along with
any arguments that were specified for the method.
14. Message
3. Finally, it passes on the return value of the
procedure as its own return value.