Skip to content

Commit 428e7cf

Browse files
authored
Merge pull request #539 from Interlisp/nhb-gc-cleanup
Minor cleanup of code style in gcfinal.c and additional array free list debugging from URaid
2 parents fc90838 + 01d21b0 commit 428e7cf

File tree

4 files changed

+310
-183
lines changed

4 files changed

+310
-183
lines changed

inc/gcfinaldefs.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
#define GCFINALDEFS_H 1
33
#include "lispemul.h" /* for LispPTR, DLword */
44
void printarrayblock(LispPTR base);
5-
int integerlength(unsigned int n);
6-
LispPTR findptrsbuffer(LispPTR ptr);
5+
void printfreeblockchainn(int arlen);
76
LispPTR releasingvmempage(LispPTR ptr);
87
LispPTR checkarrayblock(LispPTR base, LispPTR free, LispPTR onfreelist);
9-
LispPTR deleteblock(LispPTR base);
10-
LispPTR linkblock(LispPTR base);
118
LispPTR makefreearrayblock(LispPTR block, DLword length);
12-
LispPTR arrayblockmerger(LispPTR base, LispPTR nbase);
139
LispPTR mergebackward(LispPTR base);
1410
LispPTR mergeforward(LispPTR base);
1511
LispPTR reclaimarrayblock(LispPTR ptr);

src/gcarray.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,35 +99,35 @@ struct hashtable {
9999
LispPTR aref1(LispPTR array, int index) {
100100
LispPTR retval = 0;
101101
LispPTR base;
102-
short typenumber;
103-
struct arrayheader *actarray;
102+
struct arrayheader *array_np;
104103

105-
actarray = (struct arrayheader *)NativeAligned4FromLAddr(array);
106-
if (index >= actarray->totalsize) {
104+
array_np = (struct arrayheader *)NativeAligned4FromLAddr(array);
105+
if (index >= array_np->totalsize) {
107106
printf("Invalid index in GC's AREF1: 0x%x\n", index);
108-
printf(" Array size limit: 0x%x\n", actarray->totalsize);
107+
printf(" Array size limit: 0x%x\n", array_np->totalsize);
109108
printf(" Array ptr: 0x%x\n", array);
110-
printf(" Array 68K ptr: %p\n", (void *)actarray);
111-
printf("base: 0x%x\n", actarray->base);
112-
printf("offset: 0x%x\n", actarray->offset);
113-
printf("type #: 0x%x\n", actarray->typenumber);
114-
printf("fill ptr: 0x%x\n", actarray->fillpointer);
109+
printf(" Array native ptr: %p\n", (void *)array_np);
110+
printf("base: 0x%x\n", array_np->base);
111+
printf("offset: 0x%x\n", array_np->offset);
112+
printf("type #: 0x%x\n", array_np->typenumber);
113+
printf("fill ptr: 0x%x\n", array_np->fillpointer);
115114
error("index out of range in GC's AREF1.");
116115
}
117-
index += actarray->offset;
118-
typenumber = actarray->typenumber;
119-
base = actarray->base;
120-
switch (typenumber) {
121-
case 3: /* unsigned 8bits */
122-
retval = (GETBYTE(((char *)NativeAligned2FromLAddr(base)) + index)) & 0x0ff;
123-
retval |= S_POSITIVE;
124-
break;
125-
case 4: /* unsigned 16bits */
126-
retval = (GETWORD(((DLword *)NativeAligned2FromLAddr(base)) + index)) & 0x0ffff;
127-
retval |= S_POSITIVE;
128-
break;
129-
case 38: retval = (*(((LispPTR *)NativeAligned4FromLAddr(base)) + index)); break;
130-
default: error("Not Implemented in gc's aref1 (other types)");
116+
index += array_np->offset;
117+
base = array_np->base;
118+
switch (array_np->typenumber) {
119+
case 3: /* unsigned 8 bits */
120+
retval = (GETBYTE(((char *)NativeAligned2FromLAddr(base)) + index)) & 0x0ff;
121+
retval |= S_POSITIVE;
122+
break;
123+
case 4: /* unsigned 16 bits */
124+
retval = (GETWORD(((DLword *)NativeAligned2FromLAddr(base)) + index)) & 0x0ffff;
125+
retval |= S_POSITIVE;
126+
break;
127+
case 38: /* pointer 32 bits */
128+
retval = (*(((LispPTR *)NativeAligned4FromLAddr(base)) + index));
129+
break;
130+
default: error("Not Implemented in gc's aref1 (other types)");
131131
}
132132
return (retval);
133133
}

0 commit comments

Comments
 (0)