|
51 | 51 | #include "gccodedefs.h" // for reclaimcodeblock |
52 | 52 | #include "gcdata.h" // for DELREF, REC_GCLOOKUP |
53 | 53 | #include "gchtfinddefs.h" // for htfind, rec_htfind |
54 | | -#include "gcfinaldefs.h" // for arrayblockmerger, checkarrayblock, deleteblock |
| 54 | +#include "gcfinaldefs.h" // for arrayblockmerger, checkarrayblock |
55 | 55 | #include "lispemul.h" // for LispPTR, NIL, T, POINTERMASK, DLword, ATOM_T |
56 | 56 | #include "llstkdefs.h" // for decusecount68k |
57 | 57 | #include "lspglob.h" // for FreeBlockBuckets_word, ArrayMerging_word |
@@ -243,32 +243,38 @@ LispPTR checkarrayblock(LispPTR base, LispPTR free, LispPTR onfreelist) { |
243 | 243 | /* */ |
244 | 244 | /* */ |
245 | 245 | /************************************************************************/ |
246 | | - |
247 | | -LispPTR deleteblock(LispPTR base) { |
248 | | - struct arrayblock *bbase, *fbbase, *bbbase; |
249 | | - LispPTR fwd, bkwd, fbl, freeblocklsp; |
250 | | - LispPTR *freeblock; |
251 | | - bbase = (struct arrayblock *)NativeAligned4FromLAddr(base); |
252 | | - if ((bbase->arlen >= MINARRAYBLOCKSIZE) && (bbase->fwd != NIL)) { |
253 | | - fwd = bbase->fwd; |
254 | | - fbbase = (struct arrayblock *)NativeAligned4FromLAddr(fwd); |
255 | | - bkwd = bbase->bkwd; |
256 | | - bbbase = (struct arrayblock *)NativeAligned4FromLAddr(bkwd); |
257 | | - fbl = FreeBlockChainN(bbase->arlen); |
258 | | - freeblock = (LispPTR *)NativeAligned4FromLAddr(fbl); |
259 | | - freeblocklsp = POINTERMASK & *freeblock; |
260 | | - if (base == fwd) { |
261 | | - if (base == freeblocklsp) |
262 | | - *freeblock = NIL; |
| 246 | +/* |
| 247 | + * Removes "base", a block from the free list and |
| 248 | + * adjusts the forward and backward pointers of the blocks behind and |
| 249 | + * ahead of the deleted block. |
| 250 | + * The forward and backward pointers of this deleted block are left |
| 251 | + * dangling - as in the Lisp implementation. Also does not affect the |
| 252 | + * inuse bit in header and trailer. |
| 253 | + */ |
| 254 | +static void deleteblock(LispPTR base) { |
| 255 | + struct arrayblock *base_np, *f_np, *b_np; |
| 256 | + LispPTR f, b, fbl, freeblock; |
| 257 | + LispPTR *fbl_np; |
| 258 | + base_np = (struct arrayblock *)NativeAligned4FromLAddr(base); |
| 259 | + if ((base_np->arlen >= MINARRAYBLOCKSIZE) && (base_np->fwd != NIL)) { |
| 260 | + f = base_np->fwd; |
| 261 | + f_np = (struct arrayblock *)NativeAligned4FromLAddr(f); |
| 262 | + b = base_np->bkwd; |
| 263 | + b_np = (struct arrayblock *)NativeAligned4FromLAddr(b); |
| 264 | + fbl = FreeBlockChainN(base_np->arlen); |
| 265 | + fbl_np = (LispPTR *)NativeAligned4FromLAddr(fbl); |
| 266 | + freeblock = POINTERMASK & *fbl_np; |
| 267 | + if (base == f) { |
| 268 | + if (base == freeblock) |
| 269 | + *fbl_np = NIL; |
263 | 270 | else |
264 | 271 | error("GC error:deleting last list # FREEBLOCKLIST\n"); |
265 | | - return (NIL); |
266 | | - } else if (base == freeblocklsp) |
267 | | - *freeblock = fwd; |
268 | | - fbbase->bkwd = bkwd; |
269 | | - bbbase->fwd = fwd; |
| 272 | + return; |
| 273 | + } else if (base == freeblock) |
| 274 | + *fbl_np = f; |
| 275 | + f_np->bkwd = b; |
| 276 | + b_np->fwd = f; |
270 | 277 | } |
271 | | - return (NIL); |
272 | 278 | } |
273 | 279 |
|
274 | 280 | /************************************************************************/ |
|
0 commit comments