From: bdemsky Date: Tue, 14 Jun 2011 06:15:32 +0000 (+0000) Subject: more changes... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ea351365f064d507597b3d5740c04bc7fdd0f819;p=IRC.git more changes... --- diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 6684d833..f5444441 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -107,7 +107,6 @@ int * gcsbstarttbl; #ifdef GC_TBL_DEBUG unsigned int gcsbstarttbl_len; #endif -unsigned int gcreservedsb; // number of reserved sblock for sbstarttbl unsigned int gcnumblock; // number of total blocks in the shared mem unsigned int gcbaseva; // base va for shared memory without reserved sblocks #ifdef GC_CACHE_ADAPT @@ -131,8 +130,10 @@ unsigned int size_cachepolicytbl; #define ISSHAREDOBJ(p) \ ((((unsigned int)p)>=gcbaseva)&&(((unsigned int)p)<(gcbaseva+(BAMBOO_SHARED_MEM_SIZE)))) -#define ALIGNSIZE(s, as) \ - (*((unsigned int*)as))=((((unsigned int)(s-1))&(~(BAMBOO_CACHE_LINE_MASK)))+(BAMBOO_CACHE_LINE_SIZE)) + +#define ALIGNMENTBYTES 32 +#define ALIGNMENTSHIFT 5 +#define ALIGNSIZE(x) (x>>ALIGNMENTSHIFT) // mapping of pointer to block # (start from 0), here the block # is // the global index diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 11df18ef..5b940a4f 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -28,7 +28,6 @@ extern struct lockvector bamboo_threadlocks; INLINE void gettype_size(void * ptr, int * ttype, unsigned int * tsize) { int type = ((int *)ptr)[0]; - unsigned int size; if(type < NUMCLASSES) { // a normal object *tsize = classsize[type]; @@ -43,16 +42,15 @@ INLINE void gettype_size(void * ptr, int * ttype, unsigned int * tsize) { } } +/* THIS FUNCTION IS BAD!!!!!!!!!!!!!! */ INLINE bool isLarge(void * ptr, int * ttype, unsigned int * tsize) { - // check if a pointer is referring to a large object + // check if a pointer refers to a large object gettype_size(ptr, ttype, tsize); - unsigned int bound = (BAMBOO_SMEM_SIZE); - if(((unsigned int)ptr-gcbaseva) < (BAMBOO_LARGE_SMEM_BOUND)) { - bound = (BAMBOO_SMEM_SIZE_L); - } - // ptr is a start of a block OR it acrosses the boundary of current block - return (((((unsigned int)ptr-gcbaseva)%(bound))==0)|| - ((bound-(((unsigned int)ptr-gcbaseva)%bound)) < (*tsize))); + unsigned int blocksize = (((unsigned int)ptr-gcbaseva) < (BAMBOO_LARGE_SMEM_BOUND))? BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE; + + // ptr is a start of a block OR it crosses the boundary of current block + return (((((unsigned int)ptr-gcbaseva)%blocksize)==0)|| + ((blocksize-(((unsigned int)ptr-gcbaseva)%blocksize)) < (*tsize))); } INLINE unsigned int hostcore(void * ptr) { @@ -61,17 +59,13 @@ INLINE unsigned int hostcore(void * ptr) { if(1 == (NUMCORES4GC)) { host = 0; } else { - unsigned int b; unsigned int t = (unsigned int)ptr - (unsigned int)gcbaseva; - if(t < (BAMBOO_LARGE_SMEM_BOUND)) { - b = t / (BAMBOO_SMEM_SIZE_L); - } else { - b = NUMCORES4GC+((t-(BAMBOO_LARGE_SMEM_BOUND))/(BAMBOO_SMEM_SIZE)); - } + unsigned int b = (t < BAMBOO_LARGE_SMEM_BOUND) ? t / (BAMBOO_SMEM_SIZE_L) : NUMCORES4GC+((t-(BAMBOO_LARGE_SMEM_BOUND))/(BAMBOO_SMEM_SIZE)); host = gc_block2core[(b%(NUMCORES4GC*2))]; } return host; } + //push the null check into the mark macro //#define MARKOBJ(objptr, ii) {void * marktmpptr=objptr; if (marktmpptr!=NULL) markObj(marktmpptr, __LINE__, ii);} @@ -94,9 +88,9 @@ INLINE void markObj(void * objptr) { gc_enqueue(objptr); } } else { - // check if this obj has been forwarded + // check if this obj has been forwarded already if(!MGCHashcontains(gcforwardobjtbl, (int)objptr)) { - // send a msg to host informing that objptr is active + // if not, send msg to host informing that objptr is active send_msg_2(host,GCMARKEDOBJ,objptr); GCPROFILE_RECORD_FORWARD_OBJ(); gcself_numsendobjs++;