Opened 11 years ago

#380 new enhancement

nil receivers and x8632 and objc_msgSend_fpret

Reported by: rme Owned by: rme
Priority: trivial Milestone:
Component: Foreign Function Interface Version: trunk
Keywords: objc Cc:

Description

On x8632, there's a special variant of objc_msgSend called objc_msgSend_fpret that is supposed to be used when a method returns a floating-point result. This only matters when we send a message to a NULL receiver. In such a case, objc_msgSend_fpret pushes a 0.0 onto the x87 stack so that the caller will have something to pop off. (The i386 ABI specifies that a floating point result is returned on the x87 stack and must be popped off by the caller.)

Our bridge code uses a function called CHECK-RECEIVER which returns a NULL pointer if the receiver is a NULL pointer (without actually calling objc_msgSend). Given this, I think we can safely leave out the objc_msgSend_fpret special case.

There is, though, some support in the Objective-C runtime for installing a substitute receiver for messages to sent to nil. According to comments in http://www.opensource.apple.com/darwinsource/10.5.5/objc4-371.2/runtime/Messengers.subproj/objc-msg-i386.s, this substitute receiver is usually also nil. If it's ever anything else, our scheme of checking for a nil receiver before calling objc_msgSend will prevent the substitute receiver from being used. If this becomes important, we'll need to revisit CHECK-RECEIVER (and may need to start using objc_msgSend_fpret on i386).

Change History (0)

Note: See TracTickets for help on using tickets.