--- a/Array.st Fri Jan 17 00:56:38 1997 +0100
+++ b/Array.st Fri Jan 17 00:57:14 1997 +0100
@@ -535,69 +535,73 @@
static struct inlineCache val = _ILC1;
REGISTER OBJ rHome;
int actualSize;
+ OBJ myClass;
- index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
- actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- nIndex = index + __intVal(sz);
- if (nIndex <= actualSize) {
+ myClass = __qClass(self);
+ if (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY))) {
+ index = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ nIndex = index + __intVal(sz);
+ if (nIndex <= actualSize) {
- if (__isBlockLike(aBlock)
- && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
+ if (__isBlockLike(aBlock)
+ && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
#ifdef NEW_BLOCK_CALL
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
+ for (; index < nIndex; index++) {
+ if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(aBlock, __InstPtr(self)->i_instvars[index]);
- }
+ (*codeVal)(aBlock, __InstPtr(self)->i_instvars[index]);
+ }
#else
- home = __BlockInstPtr(aBlock)->b_home;
- rHome = home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
- /*
- * home will not move - keep in a fast register
- */
+ home = __BlockInstPtr(aBlock)->b_home;
+ rHome = home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
+ /*
+ * home will not move - keep in a fast register
+ */
# if defined(UNROLL_LOOPS)
- {
- int i4;
+ {
+ int i4;
- while ((i4 = index+4) < nIndex) {
- if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(rHome, __InstPtr(self)->i_instvars[index]);
- if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+1]);
+ while ((i4 = index+4) < nIndex) {
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(rHome, __InstPtr(self)->i_instvars[index]);
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+1]);
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+2]);
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+3]);
+ index = i4;
+ }
+ }
+# endif
+ for (; index < nIndex; index++) {
if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+2]);
+
+ (*codeVal)(rHome, __InstPtr(self)->i_instvars[index]);
+ }
+ } else {
+ for (; index < nIndex; index++) {
if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(rHome, __InstPtr(self)->i_instvars[index+3]);
- index = i4;
- }
- }
-# endif
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
-
- (*codeVal)(rHome, __InstPtr(self)->i_instvars[index]);
- }
- } else {
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(home, __InstPtr(self)->i_instvars[index]);
+ (*codeVal)(home, __InstPtr(self)->i_instvars[index]);
+ }
}
- }
#endif
- } else {
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
+ } else {
+ for (; index < nIndex; index++) {
+ if (InterruptPending != nil) __interruptL(@line);
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- __InstPtr(self)->i_instvars[index]);
- }
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ __InstPtr(self)->i_instvars[index]);
+ }
+ }
+ RETURN (self );
}
- RETURN (self );
}
%}.
^ super do:aBlock
@@ -617,15 +621,18 @@
int nIndex, nInsts;
static struct inlineCache val = _ILC1;
int indexLow, indexHigh;
+ OBJ myClass;
- if (__bothSmallInteger(start, stop)) {
+ slf = self;
+ myClass = __qClass(slf);
+ if (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY))
+ && __bothSmallInteger(start, stop)) {
indexLow = __intVal(start);
if (indexLow > 0) {
indexHigh = __intVal(stop);
- slf = self;
nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if (__qClass(slf) != @global(Array)) {
- nInsts = __intVal(__ClassInstPtr(__qClass(slf))->c_ninstvars);
+ if (myClass != @global(Array)) {
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
indexLow += nInsts;
indexHigh += nInsts;
}
@@ -768,60 +775,64 @@
static struct inlineCache val2 = _ILC2;
REGISTER OBJ rHome;
int actualSize;
+ OBJ myClass;
- index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+ myClass = __qClass(self);
+ if (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY))) {
+ index = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
- actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- nIndex = index + __intVal(sz);
+ actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ nIndex = index + __intVal(sz);
- if (nIndex <= actualSize) {
- if (__isBlockLike(aBlock)
- && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(2))) {
+ if (nIndex <= actualSize) {
+ if (__isBlockLike(aBlock)
+ && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(2))) {
#ifdef NEW_BLOCK_CALL
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
-
- (*codeVal)(aBlock, __MKSMALLINT(index+1),
- __InstPtr(self)->i_instvars[index]);
- }
-#else
- home = __BlockInstPtr(aBlock)->b_home;
- rHome = home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
- /*
- * home will not move - keep in a fast register
- */
- while (index < nIndex) {
- if (InterruptPending != nil) __interruptL(@line);
+ for (; index < nIndex; index++) {
+ if (InterruptPending != nil) __interruptL(@line);
- index++;
- (*codeVal)(rHome, __MKSMALLINT(index),
- __InstPtr(self)->i_instvars[index-1]);
+ (*codeVal)(aBlock, __MKSMALLINT(index+1),
+ __InstPtr(self)->i_instvars[index]);
}
- } else {
- while (index < nIndex) {
- if (InterruptPending != nil) __interruptL(@line);
+#else
+ home = __BlockInstPtr(aBlock)->b_home;
+ rHome = home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) {
+ /*
+ * home will not move - keep in a fast register
+ */
+ while (index < nIndex) {
+ if (InterruptPending != nil) __interruptL(@line);
- index++;
- (*codeVal)(home, __MKSMALLINT(index),
- __InstPtr(self)->i_instvars[index-1]);
+ index++;
+ (*codeVal)(rHome, __MKSMALLINT(index),
+ __InstPtr(self)->i_instvars[index-1]);
+ }
+ } else {
+ while (index < nIndex) {
+ if (InterruptPending != nil) __interruptL(@line);
+
+ index++;
+ (*codeVal)(home, __MKSMALLINT(index),
+ __InstPtr(self)->i_instvars[index-1]);
+ }
}
- }
#endif
- } else {
- while (index < nIndex) {
- if (InterruptPending != nil) __interruptL(@line);
+ } else {
+ while (index < nIndex) {
+ if (InterruptPending != nil) __interruptL(@line);
- index++;
- (*val2.ilc_func)(aBlock,
- @symbol(value:value:),
- nil, &val2,
- __MKSMALLINT(index),
- __InstPtr(self)->i_instvars[index-1]);
- }
- }
- RETURN (self);
+ index++;
+ (*val2.ilc_func)(aBlock,
+ @symbol(value:value:),
+ nil, &val2,
+ __MKSMALLINT(index),
+ __InstPtr(self)->i_instvars[index-1]);
+ }
+ }
+ RETURN (self);
+ }
}
%}.
^ super keysAndValuesDo:aBlock
@@ -841,37 +852,41 @@
int endIndex;
static struct inlineCache val = _ILC1;
int actualSize;
+ OBJ myClass;
- endIndex = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
- actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- nIndex = endIndex + __intVal(sz);
+ myClass = __qClass(self);
+ if (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY))) {
+ endIndex = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ nIndex = endIndex + __intVal(sz);
- if (nIndex <= actualSize) {
- if (__isBlockLike(aBlock)
- && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
+ if (nIndex <= actualSize) {
+ if (__isBlockLike(aBlock)
+ && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(1))) {
#ifdef NEW_BLOCK_CALL
- for (index=nIndex-1; index >= endIndex; index--) {
- if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(aBlock, __InstPtr(self)->i_instvars[index]);
- }
+ for (index=nIndex-1; index >= endIndex; index--) {
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(aBlock, __InstPtr(self)->i_instvars[index]);
+ }
#else
- home = __BlockInstPtr(aBlock)->b_home;
- for (index=nIndex-1; index >= endIndex; index--) {
- if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(home, __InstPtr(self)->i_instvars[index]);
- }
+ home = __BlockInstPtr(aBlock)->b_home;
+ for (index=nIndex-1; index >= endIndex; index--) {
+ if (InterruptPending != nil) __interruptL(@line);
+ (*codeVal)(home, __InstPtr(self)->i_instvars[index]);
+ }
#endif
- } else {
- for (index=nIndex-1; index >= endIndex; index--) {
- if (InterruptPending != nil) __interruptL(@line);
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- __InstPtr(self)->i_instvars[index]);
- }
+ } else {
+ for (index=nIndex-1; index >= endIndex; index--) {
+ if (InterruptPending != nil) __interruptL(@line);
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ __InstPtr(self)->i_instvars[index]);
+ }
+ }
+ RETURN (self);
}
- RETURN (self);
}
%}.
^ super reverseDo:aBlock
@@ -990,6 +1005,7 @@
if ((__ClassInstPtr((myClass = __qClass(self)))->c_ninstvars == __MKSMALLINT(0))
&& __isNonNilObject(aCollection)
&& (((t = __qClass(aCollection)) == Array) || (t == myClass))
+ && (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY)))
&& __bothSmallInteger(start, stop)
&& __isSmallInteger(repStart)) {
startIndex = __intVal(start) - 1;
@@ -1532,8 +1548,8 @@
if (o == nil) {
RETURN ( false );
}
-%}
-.
+%}.
+ self class ~~ Array ifTrue:[ ^ super includes:anObject].
%{
/*
* then do a slow(er) check using =
@@ -1572,11 +1588,14 @@
REGISTER int index;
unsigned int nIndex, nInsts;
static struct inlineCache eq = _ILC1;
+ OBJ myClass;
- if (__isSmallInteger(start)) {
+ myClass = __qClass(self);
+ if ( (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY)))
+ && __isSmallInteger(start)) {
index = __intVal(start) - 1;
if (index >= 0) {
- nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
index += nInsts;
nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
if (anElement != nil) {
@@ -1651,9 +1670,7 @@
RETURN (__MKSMALLINT(0));
}
%}.
- ^ self indexNotInteger
-
-
+ ^ super indexOf:anElement startingAt:start
!
indexOf:anElement startingAt:start endingAt:stop
@@ -1666,11 +1683,14 @@
REGISTER int index;
unsigned int lastIndex, nIndex, nInsts;
static struct inlineCache eq = _ILC1;
+ OBJ myClass;
- if (__bothSmallInteger(start, stop)) {
+ myClass = __qClass(self);
+ if ( (! ((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(WKPOINTERARRAY)))
+ && __bothSmallInteger(start, stop)) {
index = __intVal(start) - 1;
if (index >= 0) {
- nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
index += nInsts;
lastIndex = nInsts + __intVal(stop);
nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
@@ -1767,11 +1787,11 @@
RETURN (__MKSMALLINT(0));
}
%}.
- ^ self indexNotInteger
+ ^ super indexOf:anElement startingAt:start
! !
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.77 1997-01-11 12:14:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.78 1997-01-16 23:57:14 cg Exp $'
! !