--- a/Array.st Sat Feb 01 15:36:28 1997 +0100
+++ b/Array.st Sat Feb 01 15:46:26 1997 +0100
@@ -532,36 +532,38 @@
static struct inlineCache val = _ILC1;
REGISTER OBJ rHome;
int actualSize;
- OBJ myClass;
+
+ {
+ OBJ mySelf = self;
- myClass = __qClass(self);
- if (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
- index = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
- actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- nIndex = index + __intVal(sz);
- if (nIndex <= actualSize) {
+ index = __intVal(__ClassInstPtr(__qClass(mySelf))->c_ninstvars);
+ actualSize = __BYTES2OBJS__(__qSize(mySelf) - OHDR_SIZE);
+ }
+
+ nIndex = index + __intVal(sz);
+ if (nIndex <= actualSize) {
- 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)
- && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
+ if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
#ifdef NEW_BLOCK_CALL
-# define BLOCK_ARG aBlock
+# define BLOCK_ARG aBlock
#else
-# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+# define BLOCK_ARG 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
- {
+ {
# if defined(UNROLL_LOOPS2)
{
@@ -635,71 +637,70 @@
# endif /* UNROLL_LOOPS2 */
}
- }
}
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
-# undef BLOCK_ARG
+ /*
+ * 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
-# define IBLOCK_ARG nil
+# define BLOCK_ARG aBlock
+# define IBLOCK_ARG nil
#else
-# define BLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
-# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
+# define BLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
+# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- for (; index < nIndex; index++) {
- REGISTER OBJFUNC codeVal;
+ for (; index < nIndex; index++) {
+ REGISTER OBJFUNC codeVal;
+
+ if (InterruptPending != nil) __interruptL(@line);
- if (InterruptPending != nil) __interruptL(@line);
-
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, __InstPtr(self)->i_instvars[index]);
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, __InstPtr(self)->i_instvars[index]);
+ } 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, &(__InstPtr(self)->i_instvars[index]));
+#else
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, __InstPtr(self)->i_instvars[index]);
+#endif
} 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, &(__InstPtr(self)->i_instvars[index]));
-#else
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, __InstPtr(self)->i_instvars[index]);
-#endif
- } else {
- (*val.ilc_func)(aBlock,
+ (*val.ilc_func)(aBlock,
@symbol(value:),
nil, &val,
__InstPtr(self)->i_instvars[index]);
- }
}
}
-
-# undef BLOCK_ARG
-# undef IBLOCK_ARG
-
- RETURN (self );
}
- /*
- * not a block - send it #value:
- */
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
+# undef BLOCK_ARG
+# undef IBLOCK_ARG
+
+ RETURN (self );
+ }
- (*val.ilc_func)(aBlock,
+ /*
+ * not a block - send it #value:
+ */
+ for (; index < nIndex; index++) {
+ if (InterruptPending != nil) __interruptL(@line);
+
+ (*val.ilc_func)(aBlock,
@symbol(value:),
nil, &val,
__InstPtr(self)->i_instvars[index]);
- }
- RETURN ( self );
}
+ RETURN ( self );
}
/*
- * I am something, not handle here
+ * I am something, not handled here
*/
%}.
^ super do:aBlock
@@ -722,11 +723,7 @@
slf = self;
myClass = __qClass(slf);
- if (
- (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY))
- && __bothSmallInteger(start, stop)
- && ((indexLow = __intVal(start)) > 0)
- ) {
+ if ( __bothSmallInteger(start, stop) && ((indexLow = __intVal(start)) > 0) ) {
indexHigh = __intVal(stop);
nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
if (myClass != @global(Array)) {
@@ -1015,115 +1012,113 @@
OBJ myClass;
myClass = __qClass(self);
- if (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
- index = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ 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)
- && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(2))) {
- {
- /*
- * the most common case: a static compiled block, with home on the stack ...
- */
- REGISTER OBJFUNC codeVal;
+ if (nIndex <= actualSize) {
+ if (__isBlockLike(aBlock)
+ && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(2))) {
+ {
+ /*
+ * the most common case: a static compiled block, with home on the stack ...
+ */
+ REGISTER OBJFUNC codeVal;
- if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
+ if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
#ifdef NEW_BLOCK_CALL
-# define BLOCK_ARG aBlock
+# define BLOCK_ARG aBlock
#else
-# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+# define BLOCK_ARG 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
- {
- while (index < nIndex) {
- index++;
- if (InterruptPending != nil) __interruptL(@line);
+ {
+ while (index < nIndex) {
+ index++;
+ if (InterruptPending != nil) __interruptL(@line);
- (*codeVal)(BLOCK_ARG, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
- }
- RETURN (self);
+ (*codeVal)(BLOCK_ARG, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
}
+ RETURN (self);
}
}
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
-# undef BLOCK_ARG
+ /*
+ * 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
-# define IBLOCK_ARG nil
+# define BLOCK_ARG aBlock
+# define IBLOCK_ARG nil
#else
-# define BLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
-# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
+# define BLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
+# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- while (index < nIndex) {
- REGISTER OBJFUNC codeVal;
+ while (index < nIndex) {
+ REGISTER OBJFUNC codeVal;
+
+ if (InterruptPending != nil) __interruptL(@line);
- if (InterruptPending != nil) __interruptL(@line);
+ index++;
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
+ } 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
+ {
+ OBJ t[2];
- index++;
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
+ t[0] = __MKSMALLINT(index);
+ t[1] = __InstPtr(self)->i_instvars[index-1];
+
+ __interpret(aBlock, 2, nil, IBLOCK_ARG, nil, nil, t);
+ }
+#else
+ __interpret(aBlock, 2, nil, IBLOCK_ARG, nil, nil, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
+#endif
} 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
- {
- OBJ t[2];
-
- t[0] = __MKSMALLINT(index);
- t[1] = __InstPtr(self)->i_instvars[index-1];
-
- __interpret(aBlock, 2, nil, IBLOCK_ARG, nil, nil, t);
- }
-#else
- __interpret(aBlock, 2, nil, IBLOCK_ARG, nil, nil, __MKSMALLINT(index), __InstPtr(self)->i_instvars[index-1]);
-#endif
- } else {
- (*val2.ilc_func)(aBlock,
+ (*val2.ilc_func)(aBlock,
@symbol(value:value:),
nil, &val2,
__MKSMALLINT(index),
__InstPtr(self)->i_instvars[index-1]);
- }
}
}
-
-# undef BLOCK_ARG
-# undef IBLOCK_ARG
-
- RETURN (self );
}
- /*
- * not a block - send it #value:
- */
- while (index < nIndex) {
- if (InterruptPending != nil) __interruptL(@line);
+# undef BLOCK_ARG
+# undef IBLOCK_ARG
+
+ RETURN (self );
+ }
- index++;
- (*val2.ilc_func)(aBlock,
+ /*
+ * not a block - send it #value:
+ */
+ 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 );
}
+ RETURN ( self );
}
%}.
^ super keysAndValuesDo:aBlock
@@ -1146,7 +1141,7 @@
OBJ myClass;
myClass = __qClass(self);
- if (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
+ {
endIndex = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
actualSize = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
nIndex = endIndex + __intVal(sz);
@@ -1329,7 +1324,6 @@
(__ClassInstPtr((myClass = __qClass(self)))->c_ninstvars == __MKSMALLINT(0))
&& __isNonNilObject(aCollection)
&& (((t = __qClass(aCollection)) == Array) || (t == myClass))
- && (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY))
&& __bothSmallInteger(start, stop)
&& __isSmallInteger(repStart)
) {
@@ -1838,6 +1832,7 @@
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);
@@ -1915,15 +1910,10 @@
if (o == nil) {
RETURN ( false );
}
-%}.
- self class ~~ Array ifTrue:[ ^ super includes:anObject].
-%{
+
/*
* then do a slow(er) check using =
*/
- REGISTER int index;
- unsigned int nIndex;
- static struct inlineCache eq = _ILC1;
/*
* sorry: cannot access the stuff from above ...
@@ -1958,9 +1948,7 @@
OBJ myClass;
myClass = __qClass(self);
- if ( (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY))
- && __isSmallInteger(start)
- ) {
+ if ( __isSmallInteger(start) ) {
index = __intVal(start) - 1;
if (index >= 0) {
nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
@@ -2054,10 +2042,7 @@
OBJ myClass;
myClass = __qClass(self);
- if (
- (((INT)( __ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY))
- && __bothSmallInteger(start, stop)
- ) {
+ if ( __bothSmallInteger(start, stop) ) {
index = __intVal(start) - 1;
if (index >= 0) {
nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
@@ -2163,5 +2148,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.87 1997-01-29 21:17:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.88 1997-02-01 14:46:26 cg Exp $'
! !