From b1fe27bcb598bec0d6b497c9a86d4c806caa5402 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 28 Jun 2011 00:35:50 +0000 Subject: [PATCH] various small changes --- Robust/src/Runtime/bamboo/markbit.h | 31 ++++++++++++++----- Robust/src/Runtime/bamboo/multicoregarbage.h | 10 +++--- .../src/Runtime/bamboo/multicoregccompact.c | 9 +++--- Robust/src/Runtime/bamboo/multicoregcflush.c | 2 +- Robust/src/Runtime/bamboo/multicoregcmark.c | 6 ++++ Robust/src/Runtime/bamboo/multicoremsg.c | 3 +- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/Robust/src/Runtime/bamboo/markbit.h b/Robust/src/Runtime/bamboo/markbit.h index 6eba7ba9..acec1ae1 100644 --- a/Robust/src/Runtime/bamboo/markbit.h +++ b/Robust/src/Runtime/bamboo/markbit.h @@ -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) { diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 6c0dd8c0..77d0bbb2 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -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 diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index be964cd5..9354523f 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -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); diff --git a/Robust/src/Runtime/bamboo/multicoregcflush.c b/Robust/src/Runtime/bamboo/multicoregcflush.c index 762d1d0f..2ae416cf 100644 --- a/Robust/src/Runtime/bamboo/multicoregcflush.c +++ b/Robust/src/Runtime/bamboo/multicoregcflush.c @@ -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); diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 804c1cad..0c9aa791 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -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) { diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 676c5948..a8464edb 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -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++; -- 2.34.1