Index: sendmsg.c
===================================================================
--- sendmsg.c	(revision 25522)
+++ sendmsg.c	(working copy)
@@ -221,6 +221,43 @@
   IMP result;
   if (receiver)
     {
+	  /* Check for per-object dispatch */
+      if(CLS_ISOBJECTMESSAGEDISPATCH(receiver->class_pointer))
+        {
+          static SEL selector = NULL;
+		  if (selector == NULL)
+		    {
+			  selector = sel_get_any_uid ("messageLookupForObject:selector:");
+			}
+          IMP alternate = objc_msg_lookup ((id)receiver->class_pointer, selector);
+          if (alternate != NULL)
+            {
+			  IMP method = (IMP)alternate ((id)receiver->class_pointer, selector, receiver, op);
+			  if(method != NULL)
+			    {
+                  return method;
+                }
+            }
+        }
+
+      /* Check for a custom message lookup mechanism */
+      if(CLS_ISCUSTOMMESSAGEDISPATCH(receiver->class_pointer))
+        {
+          static SEL selector = NULL;
+		  if (selector == NULL)
+		    {
+			  selector = sel_get_any_uid ("messageLookupForSelector:");
+			}
+          IMP alternate = objc_msg_lookup ((id)receiver->class_pointer, selector);
+          if (alternate != NULL)
+            {
+			  IMP method = (IMP)alternate ((id)receiver->class_pointer, selector, op);
+			  if(method != NULL)
+			    {
+                  return method;
+                }
+            }
+        }
       result = sarray_get_safe (receiver->class_pointer->dtable, 
 				(sidx)op->sel_id);
       if (result == 0)
Index: objc/objc-api.h
===================================================================
--- objc/objc-api.h	(revision 25522)
+++ objc/objc-api.h	(working copy)
@@ -304,6 +304,20 @@
 #define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
 
 /*
+** The class handles message dispatch on its own.
+*/
+#define _CLS_CUSTOMMESSAGEDISPATCH 0x40L
+#define CLS_ISCUSTOMMESSAGEDISPATCH(cls) __CLS_ISINFO(cls, _CLS_CUSTOMMESSAGEDISPATCH)
+#define CLS_SETCUSTOMMESSAGEDISPATCH(cls) __CLS_SETINFO(cls, _CLS_CUSTOMMESSAGEDISPATCH)
+
+/*
+** The class handles message dispatch differently for different instances.
+*/
+#define _CLS_OBJECTMESSAGEDISPATCH 0x80L
+#define CLS_ISOBJECTMESSAGEDISPATCH(cls) __CLS_ISINFO(cls, _CLS_OBJECTMESSAGEDISPATCH)
+#define CLS_SETOBJECTMESSAGEDISPATCH(cls) __CLS_SETINFO(cls, _CLS_OBJECTMESSAGEDISPATCH)
+
+/*
 ** The class number of this class.  This must be the same for both the 
 ** class and its meta class object
 */
