various small changes
authorbdemsky <bdemsky>
Tue, 28 Jun 2011 00:35:50 +0000 (00:35 +0000)
committerbdemsky <bdemsky>
Tue, 28 Jun 2011 00:35:50 +0000 (00:35 +0000)
Robust/src/Runtime/bamboo/markbit.h
Robust/src/Runtime/bamboo/multicoregarbage.h
Robust/src/Runtime/bamboo/multicoregccompact.c
Robust/src/Runtime/bamboo/multicoregcflush.c
Robust/src/Runtime/bamboo/multicoregcmark.c
Robust/src/Runtime/bamboo/multicoremsg.c

index 6eba7ba9805e6177a93bf55da1639ea7fcc51896..acec1ae1393c4535aca778ae87d09dbd151c2bdc 100644 (file)
@@ -11,8 +11,8 @@ extern unsigned int revmarkmappingarray[];
 
 
 
-#define OBJMASK 0x40000000  //set towhatever smallest object mark is
-#define MARKMASK 0xc0000000  //set towhatever smallest object mark is
+#define OBJMASK 0x40000000UL  //set towhatever smallest object mark is
+#define MARKMASK 0xc0000000UL  //set towhatever smallest object mark is
 
 /* 
    The bitmap mark array uses 2 mark bits per alignment unit.
@@ -69,13 +69,15 @@ static inline void setLength(void *ptr, unsigned int length) {
     gcmarktbl[hibits]|=ormask;
   } else {
     gcmarktbl[hibits]|=ormask>>lobits;
-    gcmarktbl[hibits+1]|=ormask<<(32-lobits);
+    unsigned INTPTR lowormask=ormask<<(32-lobits);
+    if (lowormask)
+      gcmarktbl[hibits+1]|=lowormask;
   }
 }
 
 /* Set length for premarked object */
 
-static inline void setLengthMarked(void *ptr, unsigned int length) {
+static inline void setLengthMarked_I(void *ptr, unsigned int length) {
   unsigned INTPTR alignsize=ALIGNOBJSIZE((unsigned INTPTR)(ptr-gcbaseva));
   unsigned INTPTR hibits=alignsize>>4;
   unsigned INTPTR lobits=(alignsize&15)<<1;
@@ -84,16 +86,31 @@ static inline void setLengthMarked(void *ptr, unsigned int length) {
     gcmarktbl[hibits]=(gcmarktbl[hibits]^(OBJMASK))|ormask;
   } else {
     gcmarktbl[hibits]=(gcmarktbl[hibits]^(OBJMASK>>lobits))|(ormask>>lobits);
-    gcmarktbl[hibits+1]|=ormask<<(32-lobits);
+    unsigned INTPTR lowormask=ormask<<(32-lobits);
+    if (lowormask)
+      gcmarktbl[hibits+1]|=lowormask;
   }
 }
+
+static inline void setLengthMarked(void *ptr, unsigned int length) {
+  BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
+  setLengthMarked_I(ptr, length);
+  BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
+}
+
 /* Set length in units of ALIGNSIZE */
 
-static inline void setMark(void *ptr) {
+static inline void setMark_I(void *ptr) {
   unsigned INTPTR alignsize=ALIGNOBJSIZE((unsigned INTPTR)(ptr-gcbaseva));
   unsigned INTPTR hibits=alignsize>>4;
   unsigned INTPTR lobits=(alignsize&15)<<1;
-  gcmarktbl[hibits]|=OBJMASK>>lobits;
+  gcmarktbl[hibits]|=(OBJMASK>>lobits);
+}
+
+static inline void setMark(void *ptr) {
+  BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
+  setMark_I(ptr);
+  BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
 }
 
 static inline void clearMark(void *ptr) {
index 6c0dd8c0ee1d882b683661dee58aba9a4b9a694d..77d0bbb256cffa3ab2a72b463ebd9686641b70b2 100644 (file)
@@ -7,11 +7,11 @@
 #include "structdefs.h"
 #include "multicoregcprofile.h"
 
-#ifdef GC_DEBUG
+//#ifdef GC_DEBUG
 #define GC_PRINTF tprintf
-#else
-#define GC_PRINTF if(0) tprintf
-#endif 
+//#else
+//#define GC_PRINTF if(0) tprintf
+//#endif 
 
 #define TR() tprintf("%u\n",__LINE__)
 
@@ -107,7 +107,7 @@ void ** gcmappingtbl;
 unsigned int bamboo_rmsp_size;
 
 //mark table....keep track of mark bits
-unsigned int * gcmarktbl;
+volatile unsigned int * gcmarktbl;
 
 void * gcbaseva; // base va for shared memory without reserved sblocks
 
index be964cd5335d5670aaf4fd330e94adc1ca6866b5..9354523fc06f282a0cea97128f71c779239fe336 100644 (file)
@@ -294,6 +294,7 @@ void handleOneMemoryRequest(int core, unsigned int lowestblock) {
     }
   }
   //this is bad...ran out of memory
+  printf("Out of memory.  Was trying for %u bytes\n", threshold);
   BAMBOO_EXIT();
 }
 
@@ -375,15 +376,15 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) {
     if (objlength!=NOTMARKED) {
       unsigned int length=ALIGNSIZETOBYTES(objlength);
 
-      /*      unsigned int size;
+      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);
index 762d1d0f8ffb152f6541fca2620289552686e1e8..2ae416cf66a450a7137ca6dd61c0131df41bc71e 100644 (file)
@@ -222,7 +222,7 @@ 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);
+      //      tprintf("Moving object %x to %x with length %u\n", origptr, dstptr, length);
 
       /* Update the pointers in the object */
       updatePtrsInObj(dstptr);
index 804c1cad52e6afa9431d55a0a156361877a4c08f..0c9aa7914c2a76316dd0ecdf28427c2a07a87f3a 100644 (file)
@@ -4,6 +4,7 @@
 #include "GenericHashtable.h"
 #include "gcqueue.h"
 #include "multicoregcmark.h"
+#include "multicoregarbage.h"
 #include "markbit.h"
 
 #ifdef TASK
@@ -63,6 +64,7 @@ void markObj(void * objptr) {
     if(!checkMark(objptr)) {
       // this is the first time that this object is discovered,
       // set the flag as DISCOVERED
+
       setMark(objptr);
       gc_enqueue(objptr);
     }
@@ -247,7 +249,11 @@ void mark(struct garbagelist * stackptr) {
       unsigned int type = 0;
       bool islarge=isLarge(ptr, &type, &size);
       unsigned int iunits = ALIGNUNITS(size);
+
+      //debugging for the next five lines
+
       setLengthMarked(ptr,iunits);
+
       //tprintf("Marking object %x, type %u, length %u, units %u\n", ptr, type, size, iunits);
 
       if(islarge) {
index 676c5948417cd1aeff3779e128874b30de0b5ebf..a8464edb4a6449c7ffb683469b4cfe070911e60c 100644 (file)
@@ -618,7 +618,8 @@ INLINE void processmsg_gcmarkedobj_I() {
   if(!checkMark(objptr)) {
     // this is the first time that this object is discovered,
     // set the flag as DISCOVERED
-    setMark(objptr);
+
+    setMark_I(objptr);
     gc_enqueue_I(objptr);
   }
   gcself_numreceiveobjs++;