runs the memory benchmark now...
authorbdemsky <bdemsky>
Mon, 27 Jun 2011 06:18:57 +0000 (06:18 +0000)
committerbdemsky <bdemsky>
Mon, 27 Jun 2011 06:18:57 +0000 (06:18 +0000)
Robust/src/Runtime/bamboo/multicoregarbage.c
Robust/src/Runtime/bamboo/multicoregccompact.c
Robust/src/Runtime/bamboo/multicoregcflush.c
Robust/src/Runtime/bamboo/multicoregcmark.c
Robust/src/Runtime/bamboo/multicoremem.c
Robust/src/Runtime/bamboo/multicoremem.h

index d85eb29922b12d7e0c188904c2e2937d357a4a4b..320bf91e0e0a2a3adb3b0890a5f521052657f411 100644 (file)
@@ -8,6 +8,7 @@
 #include "multicoregcprofile.h"
 #include "gcqueue.h"
 #include "multicoremem_helper.h"
+#include "bambooalign.h"
 
 volatile bool gcflag;
 gc_status_t gc_status_info;
index 0efbbbf828e8fd70bb1e5ea32602eb76b3fff01f..be964cd5335d5670aaf4fd330e94adc1ca6866b5 100644 (file)
@@ -78,7 +78,7 @@ void handleReturnMem_I(unsigned int cnum, void *heaptop) {
     handleMemoryRequests_I();
   } else {
     //see if returned memory blocks let us resolve requests
-    useReturnedMem();
+    useReturnedMem(cnum, allocationinfo.lowestfreeblock);
   }
 }
 
@@ -92,24 +92,24 @@ void useReturnedMem(unsigned int corenum, block_t localblockindex) {
 
 
       for(block_t nextlocalblocknum=localblockindex;nextlocalblocknum<numblockspercore;nextlocalblocknum++) {
-       unsigned INTPTR blocknum=BLOCKINDEX2(cnum, nextlocalblocknum);
-       struct blockrecord * nextblockrecord=&allocationinfo.blocktable[blockindex];
+       unsigned INTPTR blocknum=BLOCKINDEX2(corenum, nextlocalblocknum);
+       struct blockrecord * nextblockrecord=&allocationinfo.blocktable[blocknum];
        if (nextblockrecord->status==BS_FREE) {
-         unsigned INTPTR freespace=block->freespace&~BAMBOO_CACHE_LINE_MASK;
+         unsigned INTPTR freespace=nextblockrecord->freespace&~BAMBOO_CACHE_LINE_MASK;
+
          if (freespace>=memcheck) {
-           block->status=BS_USED;
-           void *blockptr=OFFSET2BASEVA(searchblock)+gcbaseva;
-           unsigned INTPTR usedspace=((block->usedspace-1)&~BAMBOO_CACHE_LINE_MASK)+BAMBOO_CACHE_LINE_SIZE;
-           allocationinfo.lowestfreeblock=firstfree;
+           nextblockrecord->status=BS_USED;
+           void *blockptr=OFFSET2BASEVA(blocknum)+gcbaseva;
+           unsigned INTPTR usedspace=((nextblockrecord->usedspace-1)&~BAMBOO_CACHE_LINE_MASK)+BAMBOO_CACHE_LINE_SIZE;
            //taken care of one block
            gcmovepending--;
            void *startaddr=blockptr+usedspace;
            gcrequiredmems[i]=0;
            maxusefulmems[i]=0;
            if(BAMBOO_CHECK_SEND_MODE()) {
-             cache_msg_2_I(core,GCMOVESTART,startaddr);
+             cache_msg_2_I(corenum,GCMOVESTART,startaddr);
            } else {
-             send_msg_2_I(core,GCMOVESTART,startaddr);
+             send_msg_2_I(corenum,GCMOVESTART,startaddr);
            }
          }
        }
@@ -374,6 +374,16 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) {
 
     if (objlength!=NOTMARKED) {
       unsigned int length=ALIGNSIZETOBYTES(objlength);
+
+      /*      unsigned int size;
+      unsigned int type;
+      gettype_size(origptr, &type, &size);
+      size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
+
+      if (size!=length) {
+       tprintf("BAD SIZE IN BITMAP: type=%u object=%x size=%u length=%u\n", type, origptr, size, length);
+       }*/
+
       void *endtoptr=toptr+length;
       if (endtoptr>tobound) {
        gccurr_heaptop-=(unsigned INTPTR)(toptr-toptrinit);
@@ -382,6 +392,7 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) {
        return length;
       }
       //good to move objects and update pointers
+      //tprintf("Decided to compact obj %x to %x\n", origptr, toptr);
 
       gcmappingtbl[OBJMAPPINGINDEX(origptr)]=toptr;
       origptr+=length;
index 4706c6a6d7015a5100faa2fe8e9cdea518d96a2c..6d79bc7f38f655c870c6b88248d75ba70294bbc2 100644 (file)
@@ -221,6 +221,8 @@ void * updateblocks(struct moveHelper * orig, struct moveHelper * to) {
         memcpy(dstptr, origptr, length);
       }
 
+      //tprintf("Moving object %x to %x with lenght %u\n", origptr, dstptr, length);
+
       /* Update the pointers in the object */
       updatePtrsInObj(dstptr);
 
index 336d83f0e918fb08427e5c720b493b328836bd2c..804c1cad52e6afa9431d55a0a156361877a4c08f 100644 (file)
@@ -248,6 +248,7 @@ void mark(struct garbagelist * stackptr) {
       bool islarge=isLarge(ptr, &type, &size);
       unsigned int iunits = ALIGNUNITS(size);
       setLengthMarked(ptr,iunits);
+      //tprintf("Marking object %x, type %u, length %u, units %u\n", ptr, type, size, iunits);
 
       if(islarge) {
         // ptr is a large object and not marked or enqueued
index f84ac4506ed3b6fc67d347c86db1cddbcd59aea8..aeb9353c5d298c6c9b15f6218637ced7a630f950 100644 (file)
@@ -98,6 +98,7 @@ void * smemalloc_I(int coren, int isize, int * allocsize) {
 #elif defined(SMEMG)
   void *mem = globalmalloc_I(coren, isize, allocsize);
 #endif
+  //  tprintf("Handing core %u memory block %x of size %u\n", coren, mem, *allocsize);
   if(mem == NULL) {
     // no enough shared global memory
     // trigger gc
index 6297a687e1ec4bded1396083707473875529165a..a307c24d46f260d952354a9c99c8415a33458f2a 100644 (file)
 #endif // GC_SMALLPAGESIZE
 
 //keeps track of the top address that has been zero'd by the allocator
-volatile unsigned int bamboo_smem_zero_top;
+volatile void * bamboo_smem_zero_top;
+volatile unsigned int totalbytestozero;
 
 //BAMBOO_SMEM_ZERO_UNIT_SIZE must evenly divide the page size and be a
 //power of two(we rely on both in the allocation function)