From 9575622ad607697873e5e1a9e463e752b81f441c Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 14 Jun 2011 23:08:04 +0000 Subject: [PATCH] clean up typing mistakes --- Robust/src/Runtime/bamboo/MGCHash.c | 6 ++--- Robust/src/Runtime/bamboo/multicorecache.c | 6 ++--- Robust/src/Runtime/bamboo/multicorecache.h | 20 +++++++-------- Robust/src/Runtime/bamboo/multicoregarbage.c | 24 +++++++++--------- Robust/src/Runtime/bamboo/multicoregarbage.h | 25 +++++++++++-------- .../src/Runtime/bamboo/multicoregccompact.c | 12 ++++----- .../src/Runtime/bamboo/multicoregccompact.h | 6 ++--- Robust/src/Runtime/bamboo/multicoregcflush.c | 7 +++--- Robust/src/Runtime/bamboo/multicoregcmark.c | 2 +- Robust/src/Runtime/bamboo/multicoremsg.c | 2 +- 10 files changed, 56 insertions(+), 54 deletions(-) diff --git a/Robust/src/Runtime/bamboo/MGCHash.c b/Robust/src/Runtime/bamboo/MGCHash.c index 979636a6..146c0103 100644 --- a/Robust/src/Runtime/bamboo/MGCHash.c +++ b/Robust/src/Runtime/bamboo/MGCHash.c @@ -359,7 +359,6 @@ struct MGCHash * allocateMGCHash(int size) { thisvar->mask = ((size>>1)-1)<<1; thisvar->bucket=(int *) RUNCALLOC(sizeof(unsigned int)*size); //Set data counts - thisvar->num4conflicts = conflicts; return thisvar; } @@ -397,14 +396,13 @@ int MGCHashadd(struct MGCHash * thisvar, unsigned INTPTR data) { #ifdef MULTICORE -struct MGCHash * allocateMGCHash_I(int size,int conflicts) { +struct MGCHash * allocateMGCHash_I(int size) { struct MGCHash *thisvar; thisvar=(struct MGCHash *)RUNMALLOC_I(sizeof(struct MGCHash)); thisvar->mask = ((size>>1)-1)<<1; + thisvar->size = size; thisvar->bucket=(int *) RUNCALLOC_I(sizeof(int)*size); - //Set data counts - thisvar->num4conflicts = conflicts; return thisvar; } diff --git a/Robust/src/Runtime/bamboo/multicorecache.c b/Robust/src/Runtime/bamboo/multicorecache.c index 828ff643..b00b9be6 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.c +++ b/Robust/src/Runtime/bamboo/multicorecache.c @@ -92,7 +92,7 @@ void cacheAdapt_policy_local(int coren){ for(; page_index < page_index_end; page_index++) { bamboo_cache_policy_t policy = {0}; unsigned int block = 0; - BLOCKINDEX(page_sva, &block); + BLOCKINDEX(page_sva, block); unsigned int coren = gc_block2core[block%(NUMCORES4GC*2)]; CACHEADAPT_POLICY_SET_HOST_CORE(policy, coren); CACHEADAPT_CHANGE_POLICY_4_PAGE(tmp_p,page_index,policy); @@ -464,7 +464,7 @@ void gc_output_cache_sampling() { for(page_index = 0; page_index < page_num; page_index++) { page_sva = gcbaseva + (BAMBOO_PAGE_SIZE) * page_index; unsigned int block = 0; - BLOCKINDEX(page_sva, &block); + BLOCKINDEX(page_sva, block); unsigned int coren = gc_block2core[block%(NUMCORES4GC*2)]; printf("%x, %d, %d, ",(int)page_sva,page_index,coren); for(int i = 0; i < NUMCORESACTIVE; i++) { @@ -494,7 +494,7 @@ void gc_output_cache_sampling_r() { for(page_index = 0; page_index < page_num; page_index++) { page_sva = gcbaseva + (BAMBOO_PAGE_SIZE) * page_index; unsigned int block = 0; - BLOCKINDEX(page_sva, &block); + BLOCKINDEX(page_sva, block); unsigned int coren = gc_block2core[block%(NUMCORES4GC*2)]; printf(" %x, %d, %d, ",(int)page_sva,page_index,coren); int accesscore = 0; // TODO diff --git a/Robust/src/Runtime/bamboo/multicorecache.h b/Robust/src/Runtime/bamboo/multicorecache.h index f4f66d8d..d0bb5cfb 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.h +++ b/Robust/src/Runtime/bamboo/multicorecache.h @@ -49,13 +49,13 @@ typedef struct gc_cache_revise_info { extern gc_cache_revise_info_t gc_cache_revise_information; INLINE static void samplingDataReviseInit(struct moveHelper * orig,struct moveHelper * to) { - gc_cache_revise_information.to_page_start_va=(unsigned int)to->ptr; - unsigned int toindex=(unsigned int)(to->base-gcbaseva)/(BAMBOO_PAGE_SIZE); - gc_cache_revise_information.to_page_end_va=gcbaseva+(BAMBOO_PAGE_SIZE)*(toindex+1); + gc_cache_revise_information.to_page_start_va=to->ptr; + unsigned int toindex=(unsigned INTPTR)(to->base-gcbaseva)/BAMBOO_PAGE_SIZE; + gc_cache_revise_information.to_page_end_va=gcbaseva+BAMBOO_PAGE_SIZE*(toindex+1); gc_cache_revise_information.to_page_index=toindex; - gc_cache_revise_information.orig_page_start_va=(unsigned int)orig->ptr; - gc_cache_revise_information.orig_page_end_va=gcbaseva+(BAMBOO_PAGE_SIZE)*(((unsigned int)(orig->ptr)-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); - gc_cache_revise_information.orig_page_index=((unsigned int)(orig->blockbase)-gcbaseva)/(BAMBOO_PAGE_SIZE); + gc_cache_revise_information.orig_page_start_va=orig->ptr; + gc_cache_revise_information.orig_page_end_va=gcbaseva+BAMBOO_PAGE_SIZE*(((unsigned INTPTR)(orig->ptr-gcbaseva))/BAMBOO_PAGE_SIZE+1); + gc_cache_revise_information.orig_page_index=((unsigned INTPTR)(orig->blockbase-gcbaseva))/BAMBOO_PAGE_SIZE; } INLINE static void samplingDataConvert(unsigned int current_ptr) { @@ -87,14 +87,14 @@ INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelpe // compute the impact of this page for the new page samplingDataConvert(current_ptr); // prepare for an new orig page - unsigned int tmp_index=(unsigned int)((unsigned int)orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); + unsigned INTPTR tmp_index=((unsigned INTPTR)(orig->ptr-gcbaseva))/BAMBOO_PAGE_SIZE; gc_cache_revise_information.orig_page_start_va=orig->ptr; - gc_cache_revise_information.orig_page_end_va=gcbaseva+(BAMBOO_PAGE_SIZE)*(unsigned int)(tmp_index+1); + gc_cache_revise_information.orig_page_end_va=gcbaseva+BAMBOO_PAGE_SIZE*(unsigned int)(tmp_index+1); gc_cache_revise_information.orig_page_index=tmp_index; gc_cache_revise_information.to_page_start_va=to->ptr; if(closeToPage) { - gc_cache_revise_information.to_page_end_va=gcbaseva+(BAMBOO_PAGE_SIZE)*(((unsigned int)(to->ptr)-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); - gc_cache_revise_information.to_page_index=((unsigned int)(to->ptr)-gcbaseva)/(BAMBOO_PAGE_SIZE); + gc_cache_revise_information.to_page_end_va=gcbaseva+BAMBOO_PAGE_SIZE*(((unsigned INTPTR)(to->ptr-gcbaseva))/BAMBOO_PAGE_SIZE+1); + gc_cache_revise_information.to_page_index=((unsigned INTPTR)(to->ptr-gcbaseva))/BAMBOO_PAGE_SIZE; } } } diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 1e8e3a87..6f539f8e 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -287,7 +287,7 @@ INLINE void checkMarkStatus() { } // compute load balance for all cores -INLINE int loadbalance(unsigned int * heaptop) { +INLINE int loadbalance(void ** heaptop) { // compute load balance // get the total loads unsigned int tloads = gcloads[STARTUPCORE]; @@ -297,11 +297,11 @@ INLINE int loadbalance(unsigned int * heaptop) { *heaptop = gcbaseva + tloads; unsigned int b = 0; - BLOCKINDEX(*heaptop, &b); + BLOCKINDEX(*heaptop, b); // num of blocks per core unsigned int numbpc = (unsigned int)b/(unsigned int)(NUMCORES4GC); gctopblock = b; - RESIDECORE(heaptop, &gctopcore); + RESIDECORE(heaptop, gctopcore); return numbpc; } @@ -398,7 +398,7 @@ INLINE bool cacheLObjs() { void updateSmemTbl(unsigned int coren, unsigned int localtop) { unsigned int ltopcore = 0; unsigned int bound = BAMBOO_SMEM_SIZE_L; - BLOCKINDEX(localtop, <opcore); + BLOCKINDEX(localtop, ltopcore); if((unsigned int)localtop>=(unsigned int)(gcbaseva+BAMBOO_LARGE_SMEM_BOUND)){ bound = BAMBOO_SMEM_SIZE; } @@ -482,7 +482,7 @@ INLINE void moveLObjs() { #endif unsigned int size = 0; unsigned int bound = 0; - unsigned int tmpheaptop = checkCurrHeapTop(); + void * tmpheaptop = checkCurrHeapTop(); // move large objs from gcheaptop to tmpheaptop // write the header first @@ -496,11 +496,11 @@ INLINE void moveLObjs() { gcheaptop = tmpheaptop; } else { // check how many blocks it acrosses - unsigned int remain = tmpheaptop-gcbaseva; + unsigned INTPTR remain = (unsigned INTPTR) (tmpheaptop-gcbaseva); //number of the sblock unsigned int sb = remain/BAMBOO_SMEM_SIZE+(unsigned int)gcreservedsb; unsigned int b = 0; // number of the block - BLOCKINDEX(tmpheaptop, &b); + BLOCKINDEX(tmpheaptop, b); // check the remaining space in this block bound = (BAMBOO_SMEM_SIZE); if(remain < (BAMBOO_LARGE_SMEM_BOUND)) { @@ -539,7 +539,7 @@ INLINE void moveLObjs() { } remain -= BAMBOO_CACHE_LINE_SIZE; tmpheaptop += BAMBOO_CACHE_LINE_SIZE; - BLOCKINDEX(tmpheaptop, &b); + BLOCKINDEX(tmpheaptop, b); sb = (unsigned int)(tmpheaptop-gcbaseva)/(BAMBOO_SMEM_SIZE)+gcreservedsb; } // move the obj @@ -552,7 +552,7 @@ INLINE void moveLObjs() { } sb += tmpsbs; bound = BLOCKSIZE(b>ALIGNMENTSHIFT) //There are two bits per object @@ -140,15 +143,15 @@ unsigned int size_cachepolicytbl; #define MARKEDLATER 2 //sets y to the marked status of x -#define GETMARKED(y,x) { unsigned int offset=ALIGNOBJSIZE(x-gcbaseva); \ +#define GETMARKED(y,x) { unsigned INTPTR offset=ALIGNOBJSIZE((unsigned INTPTR)(x-gcbaseva)); \ y=(gcmarktbl[offset>>4]>>((offset&15)<<1))&3; } //sets the marked status of x to y (assumes zero'd) -#define SETMARKED(y,x) { unsigned int offset=ALIGNOBJSIZE(x-gcbaseva); \ +#define SETMARKED(y,x) { unsigned INTPTR offset=ALIGNOBJSIZE((unsigned INTPTR)(x-gcbaseva)); \ gcmarktbl[offset>>4]|=y<<((offset&15)<<1); } //sets the marked status of x to y (assumes zero'd) -#define RESETMARKED(x) { unsigned int offset=ALIGNOBJSIZE(x-gcbaseva); \ +#define RESETMARKED(x) { unsigned INTPTR offset=ALIGNOBJSIZE((unsigned INTPTR)(x-gcbaseva)); \ gcmarktbl[offset>>4]&=~(3<<((offset&15)<<1)); } #define ALIGNSIZE(s, as) (*((unsigned int*)as))=((((unsigned int)(s-1))&(~(BAMBOO_CACHE_LINE_MASK)))+(BAMBOO_CACHE_LINE_SIZE)) @@ -158,11 +161,11 @@ unsigned int size_cachepolicytbl; // the global index #define BLOCKINDEX(p, b) \ { \ - unsigned int t = (p) - gcbaseva; \ - if(t < (BAMBOO_LARGE_SMEM_BOUND)) { \ - (*((unsigned int*)b)) = t / (BAMBOO_SMEM_SIZE_L); \ + unsigned INTPTR t = (unsigned INTPTR)(p - gcbaseva); \ + if(t < BAMBOO_LARGE_SMEM_BOUND) { \ + b = t / BAMBOO_SMEM_SIZE_L; \ } else { \ - (*((unsigned int*)b)) = NUMCORES4GC+((t-(BAMBOO_LARGE_SMEM_BOUND))/(BAMBOO_SMEM_SIZE)); \ + b = NUMCORES4GC+((t-BAMBOO_LARGE_SMEM_BOUND)/BAMBOO_SMEM_SIZE); \ } \ } @@ -172,16 +175,16 @@ unsigned int size_cachepolicytbl; if(1 == (NUMCORES4GC)) { \ (*((unsigned int*)c)) = 0; \ } else { \ - unsigned int b; \ - BLOCKINDEX((p), &b); \ - (*((unsigned int*)c)) = gc_block2core[(b%(NUMCORES4GC*2))]; \ + unsigned INTPTR b; \ + BLOCKINDEX(p, b); \ + c = gc_block2core[(b%(NUMCORES4GC*2))]; \ } \ } INLINE static unsigned int hostcore(void * ptr) { // check the host core of ptr unsigned int host = 0; - RESIDECORE(ptr, &host); + RESIDECORE(ptr, host); return host; } diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index 20d06004..65d04309 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -27,7 +27,7 @@ INLINE void gc_resetCoreStatus() { // should be invoked with interrupt closed INLINE int assignSpareMem_I(unsigned int sourcecore,unsigned int * requiredmem,unsigned int * tomove,unsigned int * startaddr) { unsigned int b = 0; - BLOCKINDEX(gcloads[sourcecore], &b); + BLOCKINDEX(gcloads[sourcecore], b); unsigned int boundptr = BOUNDPTR(b); unsigned int remain = boundptr - gcloads[sourcecore]; unsigned int memneed = requiredmem + BAMBOO_CACHE_LINE_SIZE; @@ -86,7 +86,7 @@ INLINE void compact2Heaptophelper_I(unsigned int coren,unsigned int* p,unsigned gctopblock++; *numblocks = gcstopblock[gctopcore]; *p = gcloads[gctopcore]; - BLOCKINDEX(*p, &b); + BLOCKINDEX(*p, b); *remain=GC_BLOCK_REMAIN_SIZE(b, (*p)); } gcmovepending--; @@ -99,7 +99,7 @@ INLINE void compact2Heaptop() { unsigned int numblocks = gcfilledblocks[gctopcore]; p = gcloads[gctopcore]; unsigned int b; - BLOCKINDEX(p, &b); + BLOCKINDEX(p, b); unsigned int remain=GC_BLOCK_REMAIN_SIZE(b, p); // check if the top core finishes BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); @@ -212,7 +212,7 @@ outernextSBlock: orig->sblockindex=(unsigned int)(orig->blockbase-gcbaseva)/BAMBOO_SMEM_SIZE; sbchanged = true; unsigned int blocknum = 0; - BLOCKINDEX(orig->base, &blocknum); + BLOCKINDEX(orig->base, blocknum); if(bamboo_smemtbl[blocknum] == 0) { // goto next block goto innernextSBlock; @@ -264,7 +264,7 @@ INLINE bool initOrig_Dst(struct moveHelper * orig,struct moveHelper * to) { orig->numblocks = 0; orig->base = tobase; unsigned int blocknum = 0; - BLOCKINDEX(orig->base, &blocknum); + BLOCKINDEX(orig->base, blocknum); unsigned int origbase = orig->base; // check the bamboo_smemtbl to decide the real bound orig->bound = origbase + (unsigned int)bamboo_smemtbl[blocknum]; @@ -349,7 +349,7 @@ INLINE bool moveobj(struct moveHelper * orig, struct moveHelper * to, unsigned i } ALIGNSIZE(size, &isize); // no matter is the obj marked or not // should be able to across - unsigned int origptr = (unsigned int)(orig->ptr); + void * origptr = orig->ptr; int markedstatus; GETMARKED(markedstatus, origptr); diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.h b/Robust/src/Runtime/bamboo/multicoregccompact.h index 4032d538..bb0ab127 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.h +++ b/Robust/src/Runtime/bamboo/multicoregccompact.h @@ -6,10 +6,10 @@ struct moveHelper { unsigned int numblocks; // block num for heap - unsigned int base; // base virtual address of current heap block - unsigned int ptr; // virtual address of current heap top + void * base; // base virtual address of current heap block + void * ptr; // virtual address of current heap top unsigned int offset; // offset in current heap block - unsigned int blockbase; // virtual address of current small block to check + void * blockbase; // virtual address of current small block to check unsigned int blockbound; // bound virtual address of current small blcok unsigned int sblockindex; // index of the small blocks unsigned int top; // real size of current heap block to check diff --git a/Robust/src/Runtime/bamboo/multicoregcflush.c b/Robust/src/Runtime/bamboo/multicoregcflush.c index a43f5cda..89542016 100644 --- a/Robust/src/Runtime/bamboo/multicoregcflush.c +++ b/Robust/src/Runtime/bamboo/multicoregcflush.c @@ -179,7 +179,7 @@ void flush(struct garbagelist * stackptr) { flushRuntimeObj(stackptr); while(gc_moreItems()) { - unsigned int ptr = gc_dequeue(); + void * ptr = (void *) gc_dequeue(); // should be a local shared obj and should have mapping info FLUSHOBJNONNULL(ptr, 0); BAMBOO_ASSERT(ptr != NULL); @@ -197,14 +197,15 @@ void flush(struct garbagelist * stackptr) { // lobjs are flushed in sequence. // flush lobjs while(gc_lobjmoreItems_I()) { - unsigned int ptr = gc_lobjdequeue_I(NULL, NULL); + void * ptr = (void *) gc_lobjdequeue_I(NULL, NULL); FLUSHOBJ(ptr, 0); BAMBOO_ASSERT(ptr!=NULL); + int markedstatus; GETMARKED(markedstatus, ptr); if(markedstatus==MARKEDFIRST) { - flushPtrsInObj((void *)ptr); + flushPtrsInObj(ptr); // restore the mark field, indicating that this obj has been flushed RESETMARKED(ptr); } diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 8b3e248f..a24ff69d 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -45,7 +45,7 @@ INLINE void gettype_size(void * ptr, int * ttype, unsigned int * tsize) { INLINE bool isLarge(void * ptr, int * ttype, unsigned int * tsize) { // check if a pointer refers to a large object gettype_size(ptr, ttype, tsize); - unsigned int blocksize = (((unsigned int)ptr-gcbaseva) < (BAMBOO_LARGE_SMEM_BOUND))? BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE; + unsigned INTPTR blocksize = (((unsigned INTPTR)(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 *tsize > blocksize; diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 2b80c6bf..a0c632df 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -592,7 +592,7 @@ INLINE void processmsg_gcmarkreport_I() { } INLINE void processmsg_gcmarkedobj_I() { - int data1 = msgdata[msgdataindex]; + void * data1 = (void *) msgdata[msgdataindex]; MSG_INDEXINC_I(); BAMBOO_ASSERT(ISSHAREDOBJ(data1)); -- 2.34.1