Skip to content

Commit 812e296

Browse files
committed
Cleans up reclaimarrayblock implementation
Uses consistent naming (_np) for native pointer equivalents of Lisp addresses Adds comments regarding the parameter passed to reclaimarrayblock
1 parent 7c7da4c commit 812e296

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/gcfinal.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,13 @@ LispPTR mergeforward(LispPTR base) {
485485
/* Reclaim a block of storage in the array-space heap. */
486486
/* */
487487
/************************************************************************/
488-
488+
/*
489+
* The pointer passed is to the data of the block, not the array block
490+
* header.
491+
*/
489492
LispPTR reclaimarrayblock(LispPTR ptr) {
490493
LispPTR tmpptr, btrailer;
491-
struct arrayblock *base;
494+
struct arrayblock *base_np;
492495
LispPTR *tmpp;
493496
int reclaim_p;
494497

@@ -497,19 +500,19 @@ LispPTR reclaimarrayblock(LispPTR ptr) {
497500
checkarrayblock(ptr - ARRAYBLOCKHEADERWORDS, NIL, NIL);
498501
#endif /* ARRAYCHECK */
499502

500-
base = (struct arrayblock *)NativeAligned4FromLAddr(ptr - ARRAYBLOCKHEADERWORDS);
503+
base_np = (struct arrayblock *)NativeAligned4FromLAddr(ptr - ARRAYBLOCKHEADERWORDS);
501504
#ifdef ARRAYCHECK
502505
if (HILOC(ptr) < FIRSTARRAYSEGMENT) {
503506
printarrayblock(ptr - ARRAYBLOCKHEADERWORDS);
504507
error(
505508
"Bad array block reclaimed [not in array space].\nContinue with 'q' but save state ASAP. "
506509
"\n");
507510
return (T);
508-
} else if (ARRAYBLOCKPASSWORD != base->password) {
511+
} else if (ARRAYBLOCKPASSWORD != base_np->password) {
509512
printarrayblock(ptr - ARRAYBLOCKHEADERWORDS);
510513
error("Bad array block reclaimed [password wrong].\nContinue with 'q' but save state ASAP. \n");
511514
return (T);
512-
} else if (base->inuse == NIL) {
515+
} else if (base_np->inuse == NIL) {
513516
printarrayblock(ptr - ARRAYBLOCKHEADERWORDS);
514517
error(
515518
"Bad array block reclaimed [block not in use].\nContinue with 'q' but save state ASAP. \n");
@@ -518,15 +521,15 @@ LispPTR reclaimarrayblock(LispPTR ptr) {
518521
#else
519522
/* Normal case, just tell the guy something's wrong: */
520523
if ((HILOC(ptr) < FIRSTARRAYSEGMENT) ||
521-
((ARRAYBLOCKPASSWORD != base->password) || (base->inuse == NIL))) {
524+
((ARRAYBLOCKPASSWORD != base_np->password) || (base_np->inuse == NIL))) {
522525
error("Bad array block reclaimed--continue with 'q' but save state ASAP. \n");
523526
return (T);
524527
}
525528
#endif /* ARRAYCHECK */
526529

527-
switch (base->gctype) {
530+
switch (base_np->gctype) {
528531
case PTRBLOCK_GCT: {
529-
btrailer = (ptr - 2) + DLWORDSPER_CELL * (base->arlen - ARRAYBLOCKTRAILERCELLS);
532+
btrailer = (ptr - 2) + DLWORDSPER_CELL * (base_np->arlen - ARRAYBLOCKTRAILERCELLS);
530533
tmpptr = ptr;
531534
do {
532535
tmpp = (LispPTR *)NativeAligned4FromLAddr(tmpptr);
@@ -543,7 +546,7 @@ LispPTR reclaimarrayblock(LispPTR ptr) {
543546
/* default: No Action */
544547
}
545548
if (reclaim_p == T)
546-
mergeforward(mergebackward(makefreearrayblock(ptr - ARRAYBLOCKHEADERWORDS, base->arlen)));
549+
mergeforward(mergebackward(makefreearrayblock(ptr - ARRAYBLOCKHEADERWORDS, base_np->arlen)));
547550
return (T);
548551
}
549552

0 commit comments

Comments
 (0)