more bug fixes
authorbdemsky <bdemsky>
Wed, 22 Jun 2011 22:18:01 +0000 (22:18 +0000)
committerbdemsky <bdemsky>
Wed, 22 Jun 2011 22:18:01 +0000 (22:18 +0000)
Robust/src/Runtime/bamboo/multicoregarbage.h
Robust/src/Runtime/bamboo/multicoregccompact.c
Robust/src/Runtime/bamboo/multicoremsg.c
Robust/src/Runtime/mem.c

index b50f91c0d3619317b393c5b71e6a2df0207eb4b8..53503cd6009c252b529a5eb143868f469892c339 100644 (file)
@@ -246,7 +246,7 @@ INLINE static unsigned int hostcore(void * ptr) {
 
 //This macro takes in a local block number and returns the size of the block
 #define BLOCKSIZE(c) \
-  ((c)?BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE)
+  ((c)?BAMBOO_SMEM_SIZE:BAMBOO_SMEM_SIZE_L)
 
 //This macro takes in a local block number and returns the size of the block
 #define GLOBALBLOCKSIZE(c) \
index 8084f83c5401a8263a7072e8db3dba422cf6f2dd..6487b1d767728bb6ca39748d4b7e23886e10f032 100644 (file)
@@ -44,7 +44,6 @@ void handleReturnMem_I(unsigned int cnum, void *heaptop) {
   unsigned int blockindex;
   BLOCKINDEX(blockindex, heaptop);
   unsigned INTPTR localblocknum=GLOBALBLOCK2LOCAL(blockindex);
-  tprintf("Returned mem for core %d\n", cnum);
 
   //this core is done as far as memory usage is concerned
   returnedmem[cnum]=0;
@@ -83,8 +82,6 @@ void getSpaceRemotely(struct moveHelper *to, unsigned int minimumbytes) {
   //need to get another block from elsewhere
   //set flag to wait for memory
   if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
-    printf("A: %d\n", BAMBOO_NUM_OF_CORE);
-
     gctomove=false;
     BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
     void *startaddr=handlegcfinishcompact_I(BAMBOO_NUM_OF_CORE, minimumbytes, gccurr_heaptop);
@@ -94,21 +91,14 @@ void getSpaceRemotely(struct moveHelper *to, unsigned int minimumbytes) {
     } else {
       while(!gctomove) ;
     }
-    printf("BX: %d\n", BAMBOO_NUM_OF_CORE);
   } else {
-    printf("CX: %d\n", BAMBOO_NUM_OF_CORE);
     gctomove=false;
     //send request for memory
     send_msg_4(STARTUPCORE,GCFINISHCOMPACT,BAMBOO_NUM_OF_CORE, minimumbytes, gccurr_heaptop);
     //wait for flag to be set that we received message
-    printf("XD: %d\n", BAMBOO_NUM_OF_CORE);
     int cc=0;
-    while(!gctomove) {
-      cc++;
-      if ((cc%100000)==0)
-       printf("Z");
-    }
-    printf("DD: %d\n", BAMBOO_NUM_OF_CORE);
+    while(!gctomove)
+      ;
   }
 
   //store pointer
@@ -136,8 +126,6 @@ void compacthelper(struct moveHelper * orig,struct moveHelper * to) {
   while(true) {
     if ((gccurr_heaptop < ((unsigned INTPTR)(to->bound-to->ptr)))&&!senttopmessage) {
       //This block is the last for this core...let the startup know
-      printf("gchtp=%u tobound=%x toptr=%x\n", gccurr_heaptop, to->bound, to->ptr);
-      printf("Sending return %d\n", BAMBOO_NUM_OF_CORE);
       if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
        handleReturnMem(BAMBOO_NUM_OF_CORE, to->ptr+gccurr_heaptop);
       } else {
@@ -147,7 +135,6 @@ void compacthelper(struct moveHelper * orig,struct moveHelper * to) {
       senttopmessage=true;
     }
     unsigned int minimumbytes=compactblocks(orig, to);
-    printf("optr=%x obound=%x\n",orig->ptr, orig->bound);
     if (orig->ptr==orig->bound) {
       //need more data to compact
       //increment the core
@@ -159,7 +146,6 @@ void compacthelper(struct moveHelper * orig,struct moveHelper * to) {
        break;
     }
     if (minimumbytes!=0) {
-      printf("%d needs %u bytes.\n",BAMBOO_NUM_OF_CORE,minimumbytes);
       getSpace(to, minimumbytes);
     }
   }
@@ -325,7 +311,7 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) {
     if (!gcmarktbl[arrayoffset]) {
       do {
        arrayoffset++;
-       if (arrayoffset<origendoffset) {
+       if (arrayoffset>=origendoffset) {
          //finished with block...
          origptr=origbound;
          to->ptr=toptr;
@@ -340,6 +326,7 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) {
     //Scan more carefully next
     objlength=getMarkedLength(origptr);
 
+
     if (objlength!=NOTMARKED) {
       unsigned int length=ALIGNSIZETOBYTES(objlength);
       void *endtoptr=toptr+length;
index c38bb04aab433a9ac0ef2e7b982cf44a0b230ded..676c5948417cd1aeff3779e128874b30de0b5ebf 100644 (file)
@@ -412,16 +412,14 @@ INLINE void processmsg_memresponse_I() {
 INLINE void processmsg_gcstartpre_I() {
   // the first time to be informed to start gc
   gcflag = true;
-  if(!smemflag) {
-    // Zero out the remaining memory here because for the GC_CACHE_ADAPT 
-    // version, we need to make sure during the gcinit phase the shared heap 
-    // is not touched. Otherwise, there would be problem when adapt the cache 
-    // strategy.
-    bamboo_smem_size = 0;
-    bamboo_cur_msp = NULL;
-    smemflag = true;
-    bamboo_smem_zero_top = NULL;
-  }
+  // Zero out the remaining memory here because for the GC_CACHE_ADAPT 
+  // version, we need to make sure during the gcinit phase the shared heap 
+  // is not touched. Otherwise, there would be problem when adapt the cache 
+  // strategy.
+  bamboo_smem_size = 0;
+  bamboo_cur_msp = NULL;
+  smemflag = true;
+  bamboo_smem_zero_top = NULL;
 }
 
 INLINE void processmsg_gcstartinit_I() {
index bc5216fa9f7056e9ff3dfdd81cd10e6f5fef902d..1e2e1a5f64985143f516344a0c99f94878881382 100644 (file)
@@ -6,6 +6,9 @@
 
 #ifdef MULTICORE_GC
 #include "bambooalign.h"
+#include "multicoremem.h"
+#include "multicoregarbage.h"
+
 
 extern volatile bool gcflag;
 void * mycalloc_share(struct garbagelist * stackptr, int size) {