Array.st
branchjv
changeset 18017 7fef9e17913f
parent 18011 deb0c3355881
parent 14687 e718f7219911
child 18043 03660093fe98
--- a/Array.st	Wed Jan 23 10:08:55 2013 +0000
+++ b/Array.st	Mon Jan 28 21:53:19 2013 +0000
@@ -100,7 +100,8 @@
 %{  /* NOCONTEXT */
 
     OBJ newobj;
-    unsigned INT instsize, nInstVars;
+    unsigned INT nInstVars;
+    unsigned INT instsize;
     INT nindexedinstvars;
     REGISTER OBJ *op;
 
@@ -159,7 +160,7 @@
 #     define LONGLONG INT64
 #    else
 #     define LONGLONG long long
-#   endif
+#    endif
 
 		op = __InstPtr(newobj)->i_instvars;
 		if (nInstVars > 8) {
@@ -190,6 +191,14 @@
 		    op += 2;
 		}
 #     endif
+		while (nInstVars >= 8) {
+		    nInstVars -= 8;
+		    op[0] = nil; op[1] = nil;
+		    op[2] = nil; op[3] = nil;
+		    op[4] = nil; op[5] = nil;
+		    op[6] = nil; op[7] = nil;
+		    op += 8;
+		}
 		while (nInstVars--)
 		    *op++ = nil;
 #    endif
@@ -210,7 +219,7 @@
 		 *  allocation failure)
 		 */
 		__PROTECT_CONTEXT__
-		newobj = __STX___new(instsize);
+		newobj = __STX___new((INT)instsize);
 		__UNPROTECT_CONTEXT__
 		if (newobj != nil) {
 		    goto ok;
@@ -282,9 +291,9 @@
 
 %{  /* NOCONTEXT */
 
-    REGISTER int indx;
+    REGISTER INT indx;
     REGISTER OBJ slf;
-    REGISTER unsigned int nIndex;
+    REGISTER unsigned INT nIndex;
     REGISTER OBJ cls;
 
     if (__isSmallInteger(index)) {
@@ -296,7 +305,7 @@
 	    if (indx < 0) goto badIndex;
 	    indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
 	}
-	if ((unsigned)indx < (unsigned)nIndex) {
+	if ((unsigned INT)indx < (unsigned INT)nIndex) {
 	    RETURN ( __InstPtr(slf)->i_instvars[indx] );
 	}
     }
@@ -316,9 +325,9 @@
 
 %{  /* NOCONTEXT */
 
-    REGISTER int indx;
+    REGISTER INT indx;
     REGISTER OBJ slf;
-    REGISTER unsigned int nIndex;
+    REGISTER unsigned INT nIndex;
     REGISTER OBJ cls;
 
     if (__isSmallInteger(index)) {
@@ -330,7 +339,7 @@
 	    if (indx < 0) goto badIndex;
 	    indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
 	}
-	if ((unsigned)indx < (unsigned)nIndex) {
+	if ((unsigned INT)indx < (unsigned INT)nIndex) {
 	    __InstPtr(slf)->i_instvars[indx] = anObject;
 	    __STORE(slf, anObject);
 	    RETURN ( anObject );
@@ -350,9 +359,9 @@
 
 %{  /* NOCONTEXT */
 
-    REGISTER int indx;
+    REGISTER INT indx;
     REGISTER OBJ slf;
-    REGISTER unsigned int nIndex;
+    REGISTER unsigned INT nIndex;
     REGISTER OBJ cls;
 
     if (__isSmallInteger(index)) {
@@ -364,7 +373,7 @@
 	    if (indx < 0) goto badIndex;
 	    indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
 	}
-	if ((unsigned)indx < (unsigned)nIndex) {
+	if ((unsigned INT)indx < (unsigned INT)nIndex) {
 	    RETURN ( __InstPtr(slf)->i_instvars[indx] );
 	}
     }
@@ -380,9 +389,9 @@
 
 %{  /* NOCONTEXT */
 
-    REGISTER int indx;
+    REGISTER INT indx;
     REGISTER OBJ slf;
-    REGISTER unsigned int nIndex;
+    REGISTER unsigned INT nIndex;
     REGISTER OBJ cls;
 
     if (__isSmallInteger(index)) {
@@ -394,7 +403,7 @@
 	    if (indx < 0) goto badIndex;
 	    indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
 	}
-	if ((unsigned)indx < (unsigned)nIndex) {
+	if ((unsigned INT)indx < (unsigned INT)nIndex) {
 	    __InstPtr(slf)->i_instvars[indx] = anObject;
 	    __STORE(slf, anObject);
 	    RETURN ( anObject );
@@ -452,8 +461,8 @@
 
 %{  /* NOCONTEXT */
     OBJ nObj;
-    unsigned int sz;
-    unsigned int nIndex;
+    unsigned INT sz;
+    unsigned INT nIndex;
     REGISTER OBJ *srcP, *dstP;
     REGISTER int spc;
 
@@ -564,11 +573,11 @@
     sz := self size.
 %{
     REGISTER OBJFUNC codeVal;
-    REGISTER int index;
-    unsigned int nIndex;
+    REGISTER INT index;
+    unsigned INT nIndex;
     static struct inlineCache val = _ILC1;
     REGISTER OBJ rHome;
-    int actualSize;
+    INT actualSize;
 
     {
 	OBJ mySelf = self;
@@ -781,12 +790,12 @@
 
 %{
     REGISTER OBJFUNC codeVal;
-    REGISTER int index;
+    REGISTER INT index;
     REGISTER OBJ rHome;
     OBJ slf;
-    int nIndex, nInsts;
+    INT nIndex, nInsts;
     static struct inlineCache val = _ILC1;
-    int indexHigh;
+    INT indexHigh;
     OBJ myClass;
 
     slf = self;
@@ -803,7 +812,7 @@
 	}
 	if (indexHigh <= nIndex) {
 	    OBJ __aBlock = aBlock;
-	    int n;
+	    INT n;
 
 	    index--;                            /* 0-based */
 	    n = indexHigh - index;
@@ -1061,11 +1070,11 @@
 
 %{
     REGISTER OBJFUNC codeVal;
-    REGISTER int index;
+    REGISTER INT index;
     REGISTER OBJ rHome;
-    int nIndex;
+    INT nIndex;
     static struct inlineCache val = _ILC1;
-    int indexLow, indexHigh;
+    INT indexLow, indexHigh;
 
     if (__bothSmallInteger(start, stop)
      && (__qClass(self) == @global(Array))
@@ -1148,7 +1157,7 @@
     REGISTER INT index;
     static struct inlineCache val2 = _ILC2;
     REGISTER OBJ rHome;
-    int actualSize;
+    INT actualSize;
     OBJ myClass;
 
     myClass = __qClass(self);
@@ -1323,11 +1332,11 @@
     sz := self size.
 %{
     REGISTER OBJFUNC codeVal;
-    REGISTER int index;
-    unsigned int nIndex;
-    int endIndex;
+    REGISTER INT index;
+    unsigned INT nIndex;
+    INT endIndex;
     static struct inlineCache val = _ILC1;
-    int actualSize;
+    INT actualSize;
     OBJ myClass;
 
     myClass = __qClass(self);
@@ -1439,9 +1448,9 @@
 
 %{  /* NOCONTEXT */
 
-    REGISTER int index;
-    unsigned int nIndex;
-    unsigned int endIndex;
+    REGISTER INT index;
+    unsigned INT nIndex;
+    unsigned INT endIndex;
     REGISTER OBJ *dst;
 
     if ((__qClass(self) == Array)
@@ -1468,7 +1477,7 @@
 		{
 # ifdef __UNROLL_LOOPS__
 		    {
-			int i8;
+			INT i8;
 
 			while ((i8 = index + 8) <= endIndex) {
 			    dst[3] = dst[2] = dst[1] = dst[0] = anObject;
@@ -1500,15 +1509,15 @@
 
 %{  /* NOCONTEXT */
 
-    unsigned int nIndex;
-    unsigned int repNIndex;
-    int startIndex, stopIndex;
+    unsigned INT nIndex;
+    unsigned INT repNIndex;
+    INT startIndex, stopIndex;
     REGISTER OBJ *src;
     REGISTER OBJ *dst;
-    int repStopIndex;
-    REGISTER int repStartIndex;
+    INT repStopIndex;
+    REGISTER INT repStartIndex;
     REGISTER OBJ t;
-    REGISTER int count;
+    REGISTER INT count;
     OBJ myClass;
 
     if (
@@ -1850,7 +1859,7 @@
     REGISTER OBJ *op;
     REGISTER unsigned INT nIndex;
     INT altIndex = 0;
-    int nInsts;
+    INT nInsts;
 
     index = 0;
     nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
@@ -1894,7 +1903,7 @@
     REGISTER OBJ el;
     REGISTER OBJ *op;
     REGISTER unsigned INT nIndex;
-    int nInsts;
+    INT nInsts;
 
     if (__isSmallInteger(start)) {
 	index = __intVal(start) - 1;
@@ -1938,7 +1947,7 @@
 		 * 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;
@@ -1999,9 +2008,9 @@
     REGISTER INT index;
     REGISTER OBJ el;
     REGISTER OBJ *op;
-    REGISTER unsigned int lastIndex;
+    REGISTER unsigned INT lastIndex;
     unsigned INT nIndex;
-    int nInsts;
+    INT nInsts;
 
     if (__bothSmallInteger(start, stop)) {
 	index = __intVal(start) - 1;
@@ -2030,7 +2039,7 @@
 
 # ifdef __UNROLL_LOOPS__
 	    {
-		unsigned int i8;
+		unsigned INT i8;
 
 		while ((i8 = index + 8) < lastIndex) {
 		    if (op[0] == el) goto found1;
@@ -2091,7 +2100,7 @@
 %{
     REGISTER INT index;
     unsigned INT nIndex;
-    unsigned int nInsts;
+    unsigned INT nInsts;
     static struct inlineCache eq = _ILC1;
     OBJ myClass, e;
 
@@ -2187,7 +2196,7 @@
 		 */
 #ifdef __UNROLL_LOOPS__
 		{
-		    unsigned int i8;
+		    unsigned INT i8;
 
 		    while ((i8 = index + 8) < nIndex) {
 			if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __mkSmallInteger(index - nInsts + 1) ); }
@@ -2225,7 +2234,7 @@
 %{
     REGISTER INT index;
     unsigned INT lastIndex, nIndex;
-    unsigned int nInsts;
+    unsigned INT nInsts;
     static struct inlineCache eq = _ILC1;
     OBJ myClass, e;
 
@@ -2319,7 +2328,7 @@
 		 */
 #ifdef __UNROLL_LOOPS__
 		{
-		    unsigned int i8;
+		    unsigned INT i8;
 
 		    while ((i8 = index + 8) < lastIndex) {
 			if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __mkSmallInteger(index - nInsts + 1) ); }
@@ -2361,9 +2370,9 @@
      * this does not need a context or message send.
      * In many cases this will already find a match.
      */
-    REGISTER int index;
+    REGISTER INT index;
     REGISTER OBJ o;
-    unsigned int nIndex;
+    unsigned INT nIndex;
 
     nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
     index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
@@ -2414,7 +2423,7 @@
      */
 #  ifdef __UNROLL_LOOPS__
     {
-	unsigned int i8;
+	unsigned INT i8;
 	REGISTER OBJ slf = self;
 
 	while ((i8 = index + 8) < nIndex) {
@@ -2447,9 +2456,9 @@
 %}.
 
 %{
-    REGISTER int index;
+    REGISTER INT index;
     REGISTER OBJ o;
-    unsigned int nIndex;
+    unsigned INT nIndex;
     static struct inlineCache eq = _ILC1;
 
     /*
@@ -2559,9 +2568,9 @@
 !Array class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.155 2013-01-16 10:30:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.156 2013-01-23 17:57:32 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.155 2013-01-16 10:30:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.156 2013-01-23 17:57:32 cg Exp $'
 ! !