struct blockrecord * blockrecord=&allocationinfo.blocktable[blockindex];
- blockrecord->status=BS_FREE;
- blockrecord->usedspace=(unsigned INTPTR)(heaptop-OFFSET2BASEVA(blockindex)-gcbaseva);
- blockrecord->freespace=BLOCKSIZE(localblocknum)-blockrecord->usedspace;
- /* Update the lowest free block */
- if (blockindex < allocationinfo.lowestfreeblock) {
- allocationinfo.lowestfreeblock=blockindex;
- }
+ unsigned INTPTR newusedspace=(unsigned INTPTR)(heaptop-OFFSET2BASEVA(blockindex)-gcbaseva);
+ if(blockrecord->usedspace < newusedspace) {
+ blockrecord->status=BS_FREE;
+ blockrecord->usedspace=newusedspace;
+ blockrecord->freespace=BLOCKSIZE(localblocknum)-blockrecord->usedspace;
+ /* Update the lowest free block */
+ if (blockindex < allocationinfo.lowestfreeblock) {
+ allocationinfo.lowestfreeblock=blockindex;
+ }
- /* This is our own block...means we should mark other blocks above us as free*/
-
- if (cnum==blockrecord->corenum) {
- unsigned INTPTR nextlocalblocknum=localblocknum+1;
- for(;nextlocalblocknum<numblockspercore;nextlocalblocknum++) {
- unsigned INTPTR blocknum=BLOCKINDEX2(cnum, nextlocalblocknum);
- struct blockrecord * nextblockrecord=&allocationinfo.blocktable[blocknum];
- nextblockrecord->status=BS_FREE;
- nextblockrecord->usedspace=0;
- //this is true because this cannot be the lowest block
- nextblockrecord->freespace=BLOCKSIZE(1);
+ /* This is our own block...means we should mark other blocks above us as free*/
+
+ if (cnum==blockrecord->corenum) {
+ unsigned INTPTR nextlocalblocknum=localblocknum+1;
+ for(;nextlocalblocknum<numblockspercore;nextlocalblocknum++) {
+ unsigned INTPTR blocknum=BLOCKINDEX2(cnum, nextlocalblocknum);
+ struct blockrecord * nextblockrecord=&allocationinfo.blocktable[blocknum];
+ nextblockrecord->status=BS_FREE;
+ nextblockrecord->usedspace=0;
+ //this is true because this cannot be the lowest block
+ nextblockrecord->freespace=BLOCKSIZE(1);
+ }
}
}
while(!gc_checkCoreStatus())
;
+// GC_CACHE_COHERENT_ON should be true for gcmappingtbl, and the gcmappingtbl should be zeroed out before starting gc
#ifdef GC_DEBUG
void *nextvalid=gcbaseva;
for(void *tmp=gcbaseva; tmp<gcbaseva+BAMBOO_SHARED_MEM_SIZE;tmp+=ALIGNMENTSIZE) {
//push the null check into the mark macro
-//#define MARKOBJ(objptr) {void * marktmpptr=objptr; if (marktmpptr!=NULL) {markObj(marktmpptr);if ((marktmpptr<gcbaseva)||(marktmpptr>(gcbaseva+BAMBOO_SHARED_MEM_SIZE))) tprintf("Bad pointer %x in line %u\n",marktmpptr, __LINE__); }}
+//#define MARKOBJ(objptr) {void * marktmpptr=objptr; if (marktmpptr!=NULL) {markObj(marktmpptr);if ((marktmpptr<gcbaseva)||(marktmpptr>(gcbaseva+BAMBOO_SHARED_MEM_SIZE))) tprintf("Bad pointer %x in line %u\n",marktmpptr, __LINE__); }}
#define MARKOBJ(objptr) {void * marktmpptr=objptr; if (marktmpptr!=NULL) {markObj(marktmpptr);}}
if (unit!=iunits) {
tprintf("Bad mark on %x %u!=%u\n", ptr, unit, iunits);
tprintf("hibits=%x lobits=%x\n", hibits, lobits);
- tprintf("ohigh=%x olow=%x", ohigh, olow);
+ tprintf("ohigh=%x olow=%x\n", ohigh, olow);
unsigned INTPTR nhigh=gcmarktbl[hibits];
unsigned INTPTR nlow=gcmarktbl[hibits+1];
- tprintf("nhigh=%x nlow=%x", nhigh, nlow);
+ tprintf("nhigh=%x nlow=%x\n", nhigh, nlow);
}
#endif
if(islarge) {