super-send fallBacks
authorClaus Gittinger <cg@exept.de>
Tue, 20 Jun 2000 11:56:11 +0200
changeset 5403 55cbe7c0a58f
parent 5402 d3cd213d13ec
child 5404 633f3ccac244
super-send fallBacks
Array.st
--- a/Array.st	Mon Jun 19 16:53:43 2000 +0200
+++ b/Array.st	Tue Jun 20 11:56:11 2000 +0200
@@ -1777,17 +1777,18 @@
     el1 = anElement; el2 = alternative; 
     op = & (__InstPtr(self)->i_instvars[index]);
     while (index++ < nIndex) {
-	if ((o = *op++) == el1) {
-	    RETURN ( __MKSMALLINT(index - nInsts) );
-	}
-	if (o == el2) {
-	    if (altIndex == 0) {
-		altIndex = index;
-	    }
-	}
+        if ((o = *op++) == el1) {
+            RETURN ( __MKSMALLINT(index - nInsts) );
+        }
+        if (o == el2) {
+            if (altIndex == 0) {
+                altIndex = index;
+            }
+        }
     }
     RETURN ( __MKSMALLINT(altIndex) );
-%}
+%}.
+    ^ super identityIndexOf:anElement or:alternative
 
     "
      #(1 2 3 4 5 6 7 8 9) identityIndexOf:3 or:5
@@ -1814,96 +1815,96 @@
     int nInsts;
 
     if (__isSmallInteger(start)) {
-	index = __intVal(start) - 1;
-	if (index >= 0) {
-	    nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
-	    index += nInsts;
-	    nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
-	    el = anElement;
-	    op = & (__InstPtr(self)->i_instvars[index]);
+        index = __intVal(start) - 1;
+        if (index >= 0) {
+            nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+            index += nInsts;
+            nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+            el = anElement;
+            op = & (__InstPtr(self)->i_instvars[index]);
 
 #if defined(memsrch4)
-	    if (index < nIndex) {
-		OBJ *p;
+            if (index < nIndex) {
+                OBJ *p;
 
-		p = memsrch4(op, (INT)el, (nIndex - index));
-		if (p) {
-		    index += (p - op + 1);
-		    RETURN ( __MKSMALLINT(index) ); 
-		}
-	    }
+                p = memsrch4(op, (INT)el, (nIndex - index));
+                if (p) {
+                    index += (p - op + 1);
+                    RETURN ( __MKSMALLINT(index) ); 
+                }
+            }
 #else
 
 # if defined(UNROLL_LOOPS)
-	    {
-		/*
-		 * dont argue about those gotos below - they speed up that thing by 30%;
-		 * its better to exit the loops below with a goto,
-		 * since the generated code will then be:
-		 *   compare
-		 *   branch-on-equal found
-		 *
-		 * otherwise (with ret as if-statement), we get:
-		 *   compare
-		 *   branch-on-not-equal skipLabel
-		 *   move-to-ret-register true
-		 *   goto ret-label
-		 * skipLabel
-		 *
-		 * therefore, WITH the so-much-blamed goto, we only branch
-		 * when found; without the goto, we branch always.
-		 * Pipelined CPUs do usually not like taken branches.
-		 */
+            {
+                /*
+                 * dont argue about those gotos below - they speed up that thing by 30%;
+                 * its better to exit the loops below with a goto,
+                 * since the generated code will then be:
+                 *   compare
+                 *   branch-on-equal found
+                 *
+                 * otherwise (with ret as if-statement), we get:
+                 *   compare
+                 *   branch-on-not-equal skipLabel
+                 *   move-to-ret-register true
+                 *   goto ret-label
+                 * skipLabel
+                 *
+                 * therefore, WITH the so-much-blamed goto, we only branch
+                 * when found; without the goto, we branch always.
+                 * Pipelined CPUs do usually not like taken branches.
+                 */
 
-		unsigned int i8;
+                unsigned int i8;
                 
-		while ((i8 = index + 8) < nIndex) {
-		    if (op[0] == el) goto found1;
-		    if (op[1] == el) goto found2;
-		    if (op[2] == el) goto found3;
-		    if (op[3] == el) goto found4;
-		    if (op[4] == el) goto found5;
-		    if (op[5] == el) goto found6;
-		    if (op[6] == el) goto found7;
-		    if (op[7] == el) goto found8;
-		    index = i8;
-		    op += 8;
-		}
-		if (0) {
-		    found1:
-			RETURN ( __MKSMALLINT(index + 1 - nInsts) );
-		    found2:
-			RETURN ( __MKSMALLINT(index + 2 - nInsts) );
-		    found3:
-			RETURN ( __MKSMALLINT(index + 3 - nInsts) );
-		    found4:
-			RETURN ( __MKSMALLINT(index + 4 - nInsts) );
-		    found5:
-			RETURN ( __MKSMALLINT(index + 5 - nInsts) );
-		    found6:
-			RETURN ( __MKSMALLINT(index + 6 - nInsts) );
-		    found7:
-			RETURN ( __MKSMALLINT(index + 7 - nInsts) );
-		    found8:
-			RETURN ( __MKSMALLINT(index + 8 - nInsts) );
-		}
-	    }
+                while ((i8 = index + 8) < nIndex) {
+                    if (op[0] == el) goto found1;
+                    if (op[1] == el) goto found2;
+                    if (op[2] == el) goto found3;
+                    if (op[3] == el) goto found4;
+                    if (op[4] == el) goto found5;
+                    if (op[5] == el) goto found6;
+                    if (op[6] == el) goto found7;
+                    if (op[7] == el) goto found8;
+                    index = i8;
+                    op += 8;
+                }
+                if (0) {
+                    found1:
+                        RETURN ( __MKSMALLINT(index + 1 - nInsts) );
+                    found2:
+                        RETURN ( __MKSMALLINT(index + 2 - nInsts) );
+                    found3:
+                        RETURN ( __MKSMALLINT(index + 3 - nInsts) );
+                    found4:
+                        RETURN ( __MKSMALLINT(index + 4 - nInsts) );
+                    found5:
+                        RETURN ( __MKSMALLINT(index + 5 - nInsts) );
+                    found6:
+                        RETURN ( __MKSMALLINT(index + 6 - nInsts) );
+                    found7:
+                        RETURN ( __MKSMALLINT(index + 7 - nInsts) );
+                    found8:
+                        RETURN ( __MKSMALLINT(index + 8 - nInsts) );
+                }
+            }
 # endif /* UNROLLED_LOOPS */
 
-	    while (index++ < nIndex) {
-		if (*op++ == el) goto found0;
-	    }
+            while (index++ < nIndex) {
+                if (*op++ == el) goto found0;
+            }
 
-	    if (0) {
-		found0:
-		    RETURN ( __MKSMALLINT(index - nInsts) );
-	    }
+            if (0) {
+                found0:
+                    RETURN ( __MKSMALLINT(index - nInsts) );
+            }
 #endif /* no memsrch */
-	}
-	RETURN ( __MKSMALLINT(0) );
+        }
+        RETURN ( __MKSMALLINT(0) );
     }
 %}.
-    ^ self indexNotInteger
+    ^ super identityIndexOf:anElement startingAt:start
 !
 
 identityIndexOf:anElement startingAt:start endingAt:stop
@@ -1921,82 +1922,82 @@
     int nInsts;
 
     if (__bothSmallInteger(start, stop)) {
-	index = __intVal(start) - 1;
-	if (index >= 0) {
-	    nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
-	    index += nInsts;
-	    lastIndex = nInsts + __intVal(stop);
-	    nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
-	    if (nIndex < lastIndex) {
-		lastIndex = nIndex;
-	    }
-	    el = anElement;
-	    op = & (__InstPtr(self)->i_instvars[index]);
+        index = __intVal(start) - 1;
+        if (index >= 0) {
+            nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+            index += nInsts;
+            lastIndex = nInsts + __intVal(stop);
+            nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+            if (nIndex < lastIndex) {
+                lastIndex = nIndex;
+            }
+            el = anElement;
+            op = & (__InstPtr(self)->i_instvars[index]);
 
 #if defined(memsrch4)
-	    if (index < lastIndex) {
-		OBJ *p;
+            if (index < lastIndex) {
+                OBJ *p;
 
-		p = memsrch4(op, (INT)el, (lastIndex - index));
-		if (p) {
-		    index += (p - op + 1);
-		    RETURN ( __MKSMALLINT(index) ); 
-		}
-	    }
+                p = memsrch4(op, (INT)el, (lastIndex - index));
+                if (p) {
+                    index += (p - op + 1);
+                    RETURN ( __MKSMALLINT(index) ); 
+                }
+            }
 #else
 
 # if defined(UNROLL_LOOPS)
-	    {
-		unsigned int i8;
+            {
+                unsigned int i8;
 
-		while ((i8 = index + 8) < lastIndex) {
-		    if (op[0] == el) goto found1;
-		    if (op[1] == el) goto found2;
-		    if (op[2] == el) goto found3;
-		    if (op[3] == el) goto found4;
-		    if (op[4] == el) goto found5;
-		    if (op[5] == el) goto found6;
-		    if (op[6] == el) goto found7;
-		    if (op[7] == el) goto found8;
-		    index = i8;
-		    op += 8;
-		}
+                while ((i8 = index + 8) < lastIndex) {
+                    if (op[0] == el) goto found1;
+                    if (op[1] == el) goto found2;
+                    if (op[2] == el) goto found3;
+                    if (op[3] == el) goto found4;
+                    if (op[4] == el) goto found5;
+                    if (op[5] == el) goto found6;
+                    if (op[6] == el) goto found7;
+                    if (op[7] == el) goto found8;
+                    index = i8;
+                    op += 8;
+                }
 
-		if (0) {
-	    found1:
-		    RETURN ( __MKSMALLINT(index + 1 - nInsts) );
-	    found2:
-		    RETURN ( __MKSMALLINT(index + 2 - nInsts) );
-	    found3:
-		    RETURN ( __MKSMALLINT(index + 3 - nInsts) );
-	    found4:
-		    RETURN ( __MKSMALLINT(index + 4 - nInsts) );
-	    found5:
-		    RETURN ( __MKSMALLINT(index + 5 - nInsts) );
-	    found6:
-		    RETURN ( __MKSMALLINT(index + 6 - nInsts) );
-	    found7:
-		    RETURN ( __MKSMALLINT(index + 7 - nInsts) );
-	    found8:
-		    RETURN ( __MKSMALLINT(index + 8 - nInsts) );
-		}
-	    }
+                if (0) {
+            found1:
+                    RETURN ( __MKSMALLINT(index + 1 - nInsts) );
+            found2:
+                    RETURN ( __MKSMALLINT(index + 2 - nInsts) );
+            found3:
+                    RETURN ( __MKSMALLINT(index + 3 - nInsts) );
+            found4:
+                    RETURN ( __MKSMALLINT(index + 4 - nInsts) );
+            found5:
+                    RETURN ( __MKSMALLINT(index + 5 - nInsts) );
+            found6:
+                    RETURN ( __MKSMALLINT(index + 6 - nInsts) );
+            found7:
+                    RETURN ( __MKSMALLINT(index + 7 - nInsts) );
+            found8:
+                    RETURN ( __MKSMALLINT(index + 8 - nInsts) );
+                }
+            }
 # endif /* UNROLL_LOOPS */
 
-	    while (index++ < lastIndex) {
-		if (*op++ == el) goto found0;
-	    }
+            while (index++ < lastIndex) {
+                if (*op++ == el) goto found0;
+            }
 
-	    if (0) {
-		found0:
-		    RETURN ( __MKSMALLINT(index - nInsts) );
-	    }
+            if (0) {
+                found0:
+                    RETURN ( __MKSMALLINT(index - nInsts) );
+            }
 #endif
-	}
-	RETURN ( __MKSMALLINT(0) );
+        }
+        RETURN ( __MKSMALLINT(0) );
     }
 %}.
-    ^ self indexNotInteger
+    ^ super identityIndexOf:anElement startingAt:start endingAt:stop
 
 !
 
@@ -2265,7 +2266,6 @@
     |element|
 
 %{  /* NOCONTEXT */
-
     /* 
      * first, do a quick check using ==
      * this does not need a context or message send.
@@ -2274,7 +2274,6 @@
     REGISTER int index;
     REGISTER OBJ o;
     unsigned int nIndex;
-    static struct inlineCache eq = _ILC1;
 
     nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
     index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
@@ -2288,18 +2287,18 @@
      * (except if searching for nil - there is no need for equal compare ...)
      */
     if (nIndex > 500) {
-	if (o != nil)
-	    nIndex = 500;
+        if (o != nil)
+            nIndex = 500;
     }
 
 # ifdef memsrch4
     if (index < nIndex) {
-	OBJ *p;
+        OBJ *p;
 
-	p = memsrch4(&(__InstPtr(self)->i_instvars[index]), (INT)o, (nIndex - index));
-	if (p) {
-	    RETURN ( true );
-	}
+        p = memsrch4(&(__InstPtr(self)->i_instvars[index]), (INT)o, (nIndex - index));
+        if (p) {
+            RETURN ( true );
+        }
     }
 
 # else
@@ -2325,36 +2324,43 @@
      */
 #  if defined(UNROLL_LOOPS)
     {
-	unsigned int i8;
-	REGISTER OBJ slf = self;
+        unsigned int i8;
+        REGISTER OBJ slf = self;
 
-	while ((i8 = index + 8) < nIndex) {
-	    if (__InstPtr(slf)->i_instvars[index] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+1] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+2] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+3] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+4] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+5] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+6] == o) goto found;
-	    if (__InstPtr(slf)->i_instvars[index+7] == o) goto found;
-	    index = i8;
-	}
+        while ((i8 = index + 8) < nIndex) {
+            if (__InstPtr(slf)->i_instvars[index] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+1] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+2] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+3] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+4] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+5] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+6] == o) goto found;
+            if (__InstPtr(slf)->i_instvars[index+7] == o) goto found;
+            index = i8;
+        }
     }
 #  endif /* UNROLL_LOOPS */
 
     while (index < nIndex) {
-	if (__InstPtr(self)->i_instvars[index++] == o) goto found;
+        if (__InstPtr(self)->i_instvars[index++] == o) goto found;
     }
     if (0) {
-	found:
-	    RETURN (true);
+        found:
+            RETURN (true);
     }
 
 # endif /* no memsrch */
 
     if (o == nil) {
-	RETURN ( false );
+        RETURN ( false );
     }
+%}.
+
+%{
+    REGISTER int index;
+    REGISTER OBJ o;
+    unsigned int nIndex;
+    static struct inlineCache eq = _ILC1;
 
     /* 
      * then do a slow(er) check using =
@@ -2367,18 +2373,19 @@
     index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
 
     while (index < nIndex) {
-	element = __InstPtr(self)->i_instvars[index++];
-	if (element != nil) {
-	    if ((*eq.ilc_func)(anObject,
-			       @symbol(=),
-			       nil,&eq,
-			       element)==true) {
-		RETURN ( true );
-	    }
-	}
+        element = __InstPtr(self)->i_instvars[index++];
+        if (element != nil) {
+            if ((*eq.ilc_func)(anObject,
+                               @symbol(=),
+                               nil,&eq,
+                               element)==true) {
+                RETURN ( true );
+            }
+        }
     }
+    RETURN (false);
 %}.
-    ^ false
+    ^ super includes:anObject
 !
 
 includesIdentical:anObject
@@ -2408,5 +2415,5 @@
 !Array class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.122 2000-04-01 10:40:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.123 2000-06-20 09:56:11 cg Exp $'
 ! !