changed: #indexOf:startingAt:
authorClaus Gittinger <cg@exept.de>
Wed, 10 Oct 2012 18:30:53 +0200
changeset 14380 06aa294b80fa
parent 14379 b6ea5a62d5e3
child 14381 dd40729e4157
changed: #indexOf:startingAt: strange anti-tuning
Array.st
--- a/Array.st	Tue Oct 09 17:14:31 2012 +0200
+++ b/Array.st	Wed Oct 10 18:30:53 2012 +0200
@@ -2143,6 +2143,7 @@
                     RETURN (__mkSmallInteger(0));
                 }
 #endif
+#ifdef MAKES_IT_SLOWER_BUT_WHY
                 if (__isSmallInteger(e)) {
                     /* search for a small number */
                     while (index < nIndex) {
@@ -2151,26 +2152,27 @@
                             RETURN ( __mkSmallInteger(index - nInsts) );
                         }
                         if (!__isSmallInteger(element)) {
-                            if ((*eq.ilc_func)(e,
-                                                @symbol(=), 
-                                                nil,&eq,
-                                                element) == true) {
-                                RETURN ( __mkSmallInteger(index - nInsts) );
+                            if (element != nil) {
+                                if ((*eq.ilc_func)(e,
+                                                   @symbol(=), 
+                                                   nil,&eq,
+                                                   element) == true) {
+                                    RETURN ( __mkSmallInteger(index - nInsts) );
+                                }
+                                /*
+                                 * send of #= could have lead to a GC - refetch e
+                                 */
+                                e = anElement;
                             }
-                            /*
-                             * send of #= could have lead to a GC - refetch e
-                             */
-                            e = anElement;
                         }
                     }
                     RETURN (__mkSmallInteger(0));
                 }
+#endif /* MAKES_IT_SLOWER_BUT_WHY */
 
                 while (index < nIndex) {
                     element = __InstPtr(self)->i_instvars[index++];
                     if (element != nil) {
-                        e = anElement;
-
                         if ((element == e) 
                          || ((*eq.ilc_func)(e,
                                             @symbol(=), 
@@ -2178,6 +2180,10 @@
                                             element) == true)) {
                             RETURN ( __mkSmallInteger(index - nInsts) );
                         }
+                        /*
+                         * send of #= could have lead to a GC - refetch e
+                         */
+                        e = anElement;
                     }
                 }
             } else {
@@ -2560,9 +2566,9 @@
 !Array class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.151 2012-07-26 14:06:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.152 2012-10-10 16:30:53 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.151 2012-07-26 14:06:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.152 2012-10-10 16:30:53 cg Exp $'
 ! !