-#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.
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;
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) {
#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__)
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
}
}
//this is bad...ran out of memory
+ printf("Out of memory. Was trying for %u bytes\n", threshold);
BAMBOO_EXIT();
}
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);
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);
#include "GenericHashtable.h"
#include "gcqueue.h"
#include "multicoregcmark.h"
+#include "multicoregarbage.h"
#include "markbit.h"
#ifdef TASK
if(!checkMark(objptr)) {
// this is the first time that this object is discovered,
// set the flag as DISCOVERED
+
setMark(objptr);
gc_enqueue(objptr);
}
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) {
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++;