--- a/Array.st Thu Apr 11 11:44:20 2002 +0200
+++ b/Array.st Thu Apr 11 11:44:43 2002 +0200
@@ -422,7 +422,7 @@
"could be an instance of a subclass..."
self class == Array ifTrue:[
- ^ self
+ ^ self
].
^ super asArray
@@ -466,8 +466,8 @@
* but: copyWith is not heavily used by real programmers ...
*/
spc = __qSpace(nObj);
- srcP = __ArrayInstPtr(self)->a_element;
- dstP = __ArrayInstPtr(nObj)->a_element;
+ srcP = __arrayVal(self);
+ dstP = __arrayVal(nObj);
#ifdef UNROLL_LOOPS
while (nIndex >= 4) {
@@ -761,196 +761,196 @@
if ( __bothSmallInteger(start, stop)
&& ((index = __intVal(start)) > 0) ) {
- indexHigh = __intVal(stop);
- nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if (myClass != @global(Array)) {
- nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
- index += nInsts;
- indexHigh += nInsts;
- }
- if (indexHigh <= nIndex) {
- OBJ __aBlock = aBlock;
- int n;
+ indexHigh = __intVal(stop);
+ nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
+ if (myClass != @global(Array)) {
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ index += nInsts;
+ indexHigh += nInsts;
+ }
+ if (indexHigh <= nIndex) {
+ OBJ __aBlock = aBlock;
+ int n;
- index--; /* 0-based */
- n = indexHigh - index;
+ index--; /* 0-based */
+ n = indexHigh - index;
- if (__isBlockLike(__aBlock)
- && (__BlockInstPtr(__aBlock)->b_nargs == __MKSMALLINT(1))) {
- {
- /*
- * the most common case: a static compiled block, with home on the stack ...
- */
- REGISTER OBJFUNC codeVal;
+ if (__isBlockLike(__aBlock)
+ && (__BlockInstPtr(__aBlock)->b_nargs == __MKSMALLINT(1))) {
+ {
+ /*
+ * the most common case: a static compiled block, with home on the stack ...
+ */
+ REGISTER OBJFUNC codeVal;
- if (((codeVal = __BlockInstPtr(__aBlock)->b_code) != (OBJFUNC)nil)
+ if (((codeVal = __BlockInstPtr(__aBlock)->b_code) != (OBJFUNC)nil)
#ifdef PARANOIA
- && (! ((INT)(__BlockInstPtr(__aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
+ && (! ((INT)(__BlockInstPtr(__aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
#endif
- ) {
+ ) {
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
#else
# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+ REGISTER OBJ rHome;
- rHome = __BlockInstPtr(__aBlock)->b_home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
+ rHome = __BlockInstPtr(__aBlock)->b_home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
#endif
- {
- REGISTER OBJ el;
+ {
+ REGISTER OBJ el;
#if defined(UNROLL_LOOPS)
- /*
- * boy; what an ugly looking piece of code ...
- * however, this software pipelined thing has no taken conditional
- * branches in the normal case and is almost twice as fast to even
- * what an unrolling optimizing compiler produces from the loop below ...
- * notice, that those gotos expand to forward branches (which are predicted
- * as NOT taken by most machines ... which is exactly what we want)
- */
- {
- while ( n >= 8) {
- el = __InstPtr(self)->i_instvars[index];
- if (InterruptPending != nil) goto interrupt0;
- continue0:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+1];
- if (InterruptPending != nil) goto interrupt1;
- continue1:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+2];
- if (InterruptPending != nil) goto interrupt2;
- continue2:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+3];
- if (InterruptPending != nil) goto interrupt3;
- continue3:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+4];
- if (InterruptPending != nil) goto interrupt4;
- continue4:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+5];
- if (InterruptPending != nil) goto interrupt5;
- continue5:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+6];
- if (InterruptPending != nil) goto interrupt6;
- continue6:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+7];
- if (InterruptPending != nil) goto interrupt7;
- continue7:
- (*codeVal)(BLOCK_ARG, el);
- n -= 8;
- index += 8;
- }
+ /*
+ * boy; what an ugly looking piece of code ...
+ * however, this software pipelined thing has no taken conditional
+ * branches in the normal case and is almost twice as fast to even
+ * what an unrolling optimizing compiler produces from the loop below ...
+ * notice, that those gotos expand to forward branches (which are predicted
+ * as NOT taken by most machines ... which is exactly what we want)
+ */
+ {
+ while ( n >= 8) {
+ el = __InstPtr(self)->i_instvars[index];
+ if (InterruptPending != nil) goto interrupt0;
+ continue0:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+1];
+ if (InterruptPending != nil) goto interrupt1;
+ continue1:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+2];
+ if (InterruptPending != nil) goto interrupt2;
+ continue2:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+3];
+ if (InterruptPending != nil) goto interrupt3;
+ continue3:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+4];
+ if (InterruptPending != nil) goto interrupt4;
+ continue4:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+5];
+ if (InterruptPending != nil) goto interrupt5;
+ continue5:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+6];
+ if (InterruptPending != nil) goto interrupt6;
+ continue6:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+7];
+ if (InterruptPending != nil) goto interrupt7;
+ continue7:
+ (*codeVal)(BLOCK_ARG, el);
+ n -= 8;
+ index += 8;
+ }
# ifdef UNROLL_LOOPS2 /* this makes small loops slower */
- if (n >= 4) {
- el = __InstPtr(self)->i_instvars[index];
- if (InterruptPending != nil) goto interrupt0b;
- continue0b:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+1];
- if (InterruptPending != nil) goto interrupt1b;
- continue1b:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+2];
- if (InterruptPending != nil) goto interrupt2b;
- continue2b:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+3];
- if (InterruptPending != nil) goto interrupt3b;
- continue3b:
- (*codeVal)(BLOCK_ARG, el);
- n -= 4;
- index += 4;
- }
- if (n >= 2) {
- el = __InstPtr(self)->i_instvars[index];
- if (InterruptPending != nil) goto interrupt0c;
- continue0c:
- (*codeVal)(BLOCK_ARG, el);
- el = __InstPtr(self)->i_instvars[index+1];
- if (InterruptPending != nil) goto interrupt1c;
- continue1c:
- (*codeVal)(BLOCK_ARG, el);
- n -= 2;
- index += 2;
- }
+ if (n >= 4) {
+ el = __InstPtr(self)->i_instvars[index];
+ if (InterruptPending != nil) goto interrupt0b;
+ continue0b:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+1];
+ if (InterruptPending != nil) goto interrupt1b;
+ continue1b:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+2];
+ if (InterruptPending != nil) goto interrupt2b;
+ continue2b:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+3];
+ if (InterruptPending != nil) goto interrupt3b;
+ continue3b:
+ (*codeVal)(BLOCK_ARG, el);
+ n -= 4;
+ index += 4;
+ }
+ if (n >= 2) {
+ el = __InstPtr(self)->i_instvars[index];
+ if (InterruptPending != nil) goto interrupt0c;
+ continue0c:
+ (*codeVal)(BLOCK_ARG, el);
+ el = __InstPtr(self)->i_instvars[index+1];
+ if (InterruptPending != nil) goto interrupt1c;
+ continue1c:
+ (*codeVal)(BLOCK_ARG, el);
+ n -= 2;
+ index += 2;
+ }
# endif /* UNROLL_LOOPS2 */
- }
+ }
#endif /* UNROLL_LOOPS */
- while (n > 0) {
- el = __InstPtr(self)->i_instvars[index];
- if (InterruptPending != nil) goto interruptX;
- continueX:
- (*codeVal)(BLOCK_ARG, el);
- n--;
- index++;
- }
- RETURN (self);
+ while (n > 0) {
+ el = __InstPtr(self)->i_instvars[index];
+ if (InterruptPending != nil) goto interruptX;
+ continueX:
+ (*codeVal)(BLOCK_ARG, el);
+ n--;
+ index++;
+ }
+ RETURN (self);
#if defined(UNROLL_LOOPS)
- interrupt0:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
- goto continue0;
- interrupt1:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
- goto continue1;
- interrupt2:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+2];
- goto continue2;
- interrupt3:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+3];
- goto continue3;
- interrupt4:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+4];
- goto continue4;
- interrupt5:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+5];
- goto continue5;
- interrupt6:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+6];
- goto continue6;
- interrupt7:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+7];
- goto continue7;
+ interrupt0:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
+ goto continue0;
+ interrupt1:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
+ goto continue1;
+ interrupt2:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+2];
+ goto continue2;
+ interrupt3:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+3];
+ goto continue3;
+ interrupt4:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+4];
+ goto continue4;
+ interrupt5:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+5];
+ goto continue5;
+ interrupt6:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+6];
+ goto continue6;
+ interrupt7:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+7];
+ goto continue7;
# ifdef UNROLL_LOOPS2
- interrupt0b:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
- goto continue0b;
- interrupt1b:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
- goto continue1b;
- interrupt2b:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+2];
- goto continue2b;
- interrupt3b:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+3];
- goto continue3b;
+ interrupt0b:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
+ goto continue0b;
+ interrupt1b:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
+ goto continue1b;
+ interrupt2b:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+2];
+ goto continue2b;
+ interrupt3b:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+3];
+ goto continue3b;
- interrupt0c:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
- goto continue0c;
- interrupt1c:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
- goto continue1c;
+ interrupt0c:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
+ goto continue0c;
+ interrupt1c:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index+1];
+ goto continue1c;
# endif /* UNROLL_LOOPS2 */
#endif /* UNROLL_LOOPS */
- interruptX:
- __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
- goto continueX;
- }
- }
- }
+ interruptX:
+ __interruptL(@line); el = __InstPtr(self)->i_instvars[index];
+ goto continueX;
+ }
+ }
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
+ /*
+ * sorry, must check code-pointer in the loop
+ * it could be recompiled or flushed
+ */
# undef BLOCK_ARG
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
@@ -960,61 +960,61 @@
# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- while (n > 0) {
- REGISTER OBJFUNC codeVal;
- OBJ el;
+ while (n > 0) {
+ REGISTER OBJFUNC codeVal;
+ OBJ el;
- el = __InstPtr(self)->i_instvars[index];
- if (InterruptPending != nil) {
- __interruptL(@line);
- el = __InstPtr(self)->i_instvars[index];
- }
+ el = __InstPtr(self)->i_instvars[index];
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ el = __InstPtr(self)->i_instvars[index];
+ }
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, el);
- } else {
- if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
- /*
- * arg is a compiled block with bytecode -
- * directly call interpreter without going through Block>>value
- */
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, el);
+ } else {
+ if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
+ /*
+ * arg is a compiled block with bytecode -
+ * directly call interpreter without going through Block>>value
+ */
#ifdef PASS_ARG_POINTER
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &el);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &el);
#else
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, el);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, el);
#endif
- } else {
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- el);
- }
- }
- n--;
- index++;
- }
+ } else {
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ el);
+ }
+ }
+ n--;
+ index++;
+ }
# undef BLOCK_ARG
# undef IBLOCK_ARG
- RETURN (self );
- }
+ RETURN (self );
+ }
- /*
- * not a block - send it #value:
- */
- while (n > 0) {
- if (InterruptPending != nil) __interruptL(@line);
+ /*
+ * not a block - send it #value:
+ */
+ while (n > 0) {
+ if (InterruptPending != nil) __interruptL(@line);
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- __InstPtr(self)->i_instvars[index]);
- n--;
- index++;
- }
- RETURN ( self );
- }
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ __InstPtr(self)->i_instvars[index]);
+ n--;
+ index++;
+ }
+ RETURN ( self );
+ }
}
%}.
^ super from:start to:stop do:aBlock
@@ -1663,10 +1663,10 @@
receiver referes to aLiteral (i.e. a deep search)"
self do: [ :el |
- el == aLiteral ifTrue:[^true].
- el class == Array ifTrue:[
- (el refersToLiteral: aLiteral) ifTrue: [^true]
- ]
+ el == aLiteral ifTrue:[^true].
+ el class == Array ifTrue:[
+ (el refersToLiteral: aLiteral) ifTrue: [^true]
+ ]
].
^ false
@@ -1720,14 +1720,14 @@
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) );
%}.
@@ -1758,93 +1758,93 @@
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) );
}
%}.
^ super identityIndexOf:anElement startingAt:start
@@ -1865,79 +1865,79 @@
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) );
}
%}.
^ super identityIndexOf:anElement startingAt:start endingAt:stop
@@ -2084,117 +2084,117 @@
myClass = __qClass(self);
if ( __bothSmallInteger(start, stop) ) {
- index = __intVal(start) - 1;
- if (index >= 0) {
- nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
- index += nInsts;
- lastIndex = nInsts + __intVal(stop);
- nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- if (nIndex < lastIndex) {
- lastIndex = nIndex;
- }
+ index = __intVal(start) - 1;
+ if (index >= 0) {
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ index += nInsts;
+ lastIndex = nInsts + __intVal(stop);
+ nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ if (nIndex < lastIndex) {
+ lastIndex = nIndex;
+ }
- e = anElement;
+ e = anElement;
- if (e != nil) {
- /*
- * special kludge to search for a string;
- * this is so common, that its worth a special case
- */
+ if (e != nil) {
+ /*
+ * special kludge to search for a string;
+ * this is so common, that its worth a special case
+ */
#define SPECIAL_STRING_OPT
#ifdef SPECIAL_STRING_OPT
- if (__isString(e)) {
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (__isNonNilObject(element)) {
- if (element == e) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- if (__qClass(element) == @global(String)) {
- if (strcmp(__stringVal(e), __stringVal(element)) == 0) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- } else {
- if ((*eq.ilc_func)(e, @symbol(=), nil,&eq, element) == true) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- /*
- * send of #= could have lead to a GC - refetch e
- */
- e = anElement;
- }
- }
- }
- RETURN (__MKSMALLINT(0));
- }
+ if (__isString(e)) {
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (__isNonNilObject(element)) {
+ if (element == e) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ if (__qClass(element) == @global(String)) {
+ if (strcmp(__stringVal(e), __stringVal(element)) == 0) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ } else {
+ if ((*eq.ilc_func)(e, @symbol(=), nil,&eq, element) == true) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ /*
+ * send of #= could have lead to a GC - refetch e
+ */
+ e = anElement;
+ }
+ }
+ }
+ RETURN (__MKSMALLINT(0));
+ }
#endif
- if (__isSmallInteger(e)) {
- /* search for a small number */
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (element == e) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- if (!__isSmallInteger(element)) {
- if ((*eq.ilc_func)(e,
- @symbol(=),
- nil,&eq,
- element) == true) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- /*
- * send of #= could have lead to a GC - refetch e
- */
- e = anElement;
- }
- }
- RETURN (__MKSMALLINT(0));
- }
+ if (__isSmallInteger(e)) {
+ /* search for a small number */
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (element == e) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ if (!__isSmallInteger(element)) {
+ if ((*eq.ilc_func)(e,
+ @symbol(=),
+ nil,&eq,
+ element) == true) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ /*
+ * send of #= could have lead to a GC - refetch e
+ */
+ e = anElement;
+ }
+ }
+ RETURN (__MKSMALLINT(0));
+ }
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (element != nil) {
- e = anElement;
- if ((element == e)
- || ((*eq.ilc_func)(e,
- @symbol(=),
- nil,&eq,
- element) == true)) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- }
- }
- } else {
- OBJ slf = self;
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (element != nil) {
+ e = anElement;
+ if ((element == e)
+ || ((*eq.ilc_func)(e,
+ @symbol(=),
+ nil,&eq,
+ element) == true)) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ }
+ }
+ } else {
+ OBJ slf = self;
- /*
- * search for nil - do an identity-search
- */
+ /*
+ * search for nil - do an identity-search
+ */
#if defined(UNROLL_LOOPS)
- {
- unsigned int i8;
+ {
+ unsigned int i8;
- while ((i8 = index + 8) < lastIndex) {
- if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 1) ); }
- if (__InstPtr(slf)->i_instvars[index+1] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 2) ); }
- if (__InstPtr(slf)->i_instvars[index+2] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 3) ); }
- if (__InstPtr(slf)->i_instvars[index+3] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 4) ); }
- if (__InstPtr(slf)->i_instvars[index+4] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 5) ); }
- if (__InstPtr(slf)->i_instvars[index+5] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 6) ); }
- if (__InstPtr(slf)->i_instvars[index+6] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 7) ); }
- if (__InstPtr(slf)->i_instvars[index+7] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 8) ); }
- index = i8;
- }
- }
+ while ((i8 = index + 8) < lastIndex) {
+ if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 1) ); }
+ if (__InstPtr(slf)->i_instvars[index+1] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 2) ); }
+ if (__InstPtr(slf)->i_instvars[index+2] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 3) ); }
+ if (__InstPtr(slf)->i_instvars[index+3] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 4) ); }
+ if (__InstPtr(slf)->i_instvars[index+4] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 5) ); }
+ if (__InstPtr(slf)->i_instvars[index+5] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 6) ); }
+ if (__InstPtr(slf)->i_instvars[index+6] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 7) ); }
+ if (__InstPtr(slf)->i_instvars[index+7] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 8) ); }
+ index = i8;
+ }
+ }
#endif
- while (index < lastIndex) {
- if (__InstPtr(slf)->i_instvars[index++] == nil) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- }
- }
- }
- RETURN (__MKSMALLINT(0));
+ while (index < lastIndex) {
+ if (__InstPtr(slf)->i_instvars[index++] == nil) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ }
+ }
+ }
+ RETURN (__MKSMALLINT(0));
}
%}.
^ super indexOf:anElement startingAt:start endingAt:stop
@@ -2230,18 +2230,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
@@ -2267,35 +2267,35 @@
*/
# 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 );
}
%}.
@@ -2316,15 +2316,15 @@
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);
%}.
@@ -2381,7 +2381,7 @@
"/
thisContext isRecursive ifTrue:[^ false].
self do:[:element |
- element isLiteral ifFalse:[^ false]
+ element isLiteral ifFalse:[^ false]
].
^ true
@@ -2415,5 +2415,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.129 2000-09-01 10:11:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.130 2002-04-11 09:44:43 cg Exp $'
! !