+/***********************************************************************
+* _freedHandler.
+**********************************************************************/
+static void _freedHandler(id obj, SEL sel)
+{
+ __objc_error (obj, "message %s sent to freed object=%p",
+ sel_getName(sel), obj);
+}
+
+/***********************************************************************
+* _nonexistentHandler.
+**********************************************************************/
+static void _nonexistentHandler(id obj, SEL sel)
+{
+ __objc_error (obj, "message %s sent to non-existent object=%p",
+ sel_getName(sel), obj);
+}
+
+
+/***********************************************************************
+* ABI-specific lookUpMethod helpers.
+**********************************************************************/
+__private_extern__ void lockForMethodLookup(void)
+{
+ mutex_lock(&methodListLock);
+}
+__private_extern__ void unlockForMethodLookup(void)
+{
+ mutex_unlock(&methodListLock);
+}
+__private_extern__ IMP prepareForMethodLookup(Class cls, SEL sel, BOOL init)
+{
+ mutex_assert_unlocked(&methodListLock);
+
+ // Check for freed class
+ if (cls == _class_getFreedObjectClass())
+ return (IMP) _freedHandler;
+
+ // Check for nonexistent class
+ if (cls == _class_getNonexistentObjectClass())
+ return (IMP) _nonexistentHandler;
+
+ if (init && !_class_isInitialized(cls)) {
+ _class_initialize (cls);
+ // If sel == initialize, _class_initialize will send +initialize and
+ // then the messenger will send +initialize again after this
+ // procedure finishes. Of course, if this is not being called
+ // from the messenger then it won't happen. 2778172
+ }
+
+ return NULL;
+}
+