struct blockrecord * blockrecord=&allocationinfo.blocktable[blockindex];
blockrecord->status=BS_FREE;
- blockrecord->usedspace=(unsigned INTPTR)(heaptop-OFFSET2BASEVA(blockindex));
+ blockrecord->usedspace=(unsigned INTPTR)(heaptop-OFFSET2BASEVA(blockindex)-gcbaseva);
blockrecord->freespace=BLOCKSIZE(localblocknum)-blockrecord->usedspace;
/* Update the lowest free block */
if (blockindex < allocationinfo.lowestfreeblock) {
- blockindex=allocationinfo.lowestfreeblock;
+ allocationinfo.lowestfreeblock=blockindex;
}
/* This is our own block...means we should mark other blocks above us as free*/
GCPROFILE_ITEM();
//just in case we didn't get blocks back...
- if (allocationinfo.lowestfreeblock=NOFREEBLOCK)
+ if (allocationinfo.lowestfreeblock==NOFREEBLOCK)
allocationinfo.lowestfreeblock=numblockspercore*NUMCORES4GC;
GC_PRINTF("compact phase finished \n");
#define UPDATEOBJ(obj, tt) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) obj=updateObj(updatetmpptr);}
#define UPDATEOBJNONNULL(obj, tt) {void *updatetmpptr=obj; obj=updateObj(updatetmpptr);}
-#define dbpr() if (STARTUPCORE==BAMBOO_NUM_OF_CORE) tprintf("FL: %d\n", __LINE__);
-
INLINE void updategarbagelist(struct garbagelist *listptr) {
for(;listptr!=NULL; listptr=listptr->next) {
for(int i=0; i<listptr->size; i++) {
if (endtoptr>tobound||endtoptr<tobase) {
//get use the next block of memory
orig->ptr=origptr;
- if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
- tprintf("dstptr=%x\n",dstptr);
- tprintf("endtoptrptr=%x\n",endtoptr);
- tprintf("tobound=%x\n",tobound);
- tprintf("tobase=%x\n",tobase);
- tprintf("origptr=%x\n",origptr);
- tprintf("length=%d\n",length);
- }
return dstptr;
}
void updatehelper(struct moveHelper * orig,struct moveHelper * to) {
while(true) {
- dbpr();
void *dstptr=updateblocks(orig, to);
- dbpr();
if (dstptr) {
- dbpr();
- printf("M: %x\n", dstptr);
- //need more memory to compact into
+ //need more memory to compact into
block_t blockindex;
BLOCKINDEX(blockindex, dstptr);
unsigned int corenum;
;
}
}
- dbpr();
if (orig->ptr==orig->bound) {
- dbpr();
//inform others that we are done with previous block
updateOrigPtr(orig->bound);
break;
}
}
- dbpr();
}
}
// initialize structs for compacting
struct moveHelper orig={0,NULL,NULL,0,NULL,0,0,0,0};
struct moveHelper to={0,NULL,NULL,0,NULL,0,0,0,0};
- dbpr();
initOrig_Dst(&orig, &to);
- dbpr();
updatehelper(&orig, &to);
- dbpr();
}
void update(struct garbagelist * stackptr) {
- dbpr();
updateRuntimePtrs(stackptr);
- dbpr();
updateheap();
- dbpr();
// send update finish message to core coordinator
if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
gccorestatus[BAMBOO_NUM_OF_CORE] = 0;