From c8190680d9d14453b30bb559e60d600ebc2080dd Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 15 Jun 2011 08:50:39 +0000 Subject: [PATCH] changes to get rid of all type errors... --- Robust/src/Runtime/bamboo/gcqueue.h | 30 +++++++++---------- Robust/src/Runtime/bamboo/multicorecache.h | 22 +++++++------- Robust/src/Runtime/bamboo/multicoregarbage.c | 4 +-- .../src/Runtime/bamboo/multicoregccompact.c | 4 +-- .../src/Runtime/bamboo/multicoregccompact.h | 5 ++-- Robust/src/Runtime/bamboo/multicoremem.c | 9 ------ Robust/src/Runtime/bamboo/multicoremsg.c | 5 ++-- Robust/src/Runtime/bamboo/multicoreruntime.c | 1 - 8 files changed, 35 insertions(+), 45 deletions(-) diff --git a/Robust/src/Runtime/bamboo/gcqueue.h b/Robust/src/Runtime/bamboo/gcqueue.h index 83ff136e..f0761c7f 100644 --- a/Robust/src/Runtime/bamboo/gcqueue.h +++ b/Robust/src/Runtime/bamboo/gcqueue.h @@ -9,14 +9,14 @@ #define NUMPTRS 120 struct pointerblock { - unsigned int ptrs[NUMPTRS]; + void * ptrs[NUMPTRS]; struct pointerblock *next; }; #define NUMLOBJPTRS 20 struct lobjpointerblock { - unsigned int lobjs[NUMLOBJPTRS]; + void * lobjs[NUMLOBJPTRS]; int lengths[NUMLOBJPTRS]; int hosts[NUMLOBJPTRS]; struct lobjpointerblock *next; @@ -65,7 +65,7 @@ static void gc_queueinit() { //////////////////////////////////////////////////////////////////// // functions that should be invoked with interrupts off //////////////////////////////////////////////////////////////////// -static void gc_enqueue_I(unsigned int ptr) { +static void gc_enqueue_I(void * ptr) { if (gcheadindex==NUMPTRS) { struct pointerblock * tmp; if (gcspare!=NULL) { @@ -83,7 +83,7 @@ static void gc_enqueue_I(unsigned int ptr) { } // dequeue and destroy the queue -static unsigned int gc_dequeue_I() { +static void * gc_dequeue_I() { if (gctailindex==NUMPTRS) { struct pointerblock *tmp=gctail; gctail=gctail->next; @@ -99,9 +99,8 @@ static unsigned int gc_dequeue_I() { } // dequeue and do not destroy the queue -static unsigned int gc_dequeue2_I() { +static void * gc_dequeue2_I() { if (gctailindex2==NUMPTRS) { - struct pointerblock *tmp=gctail2; gctail2=gctail2->next; gctailindex2=0; } @@ -118,7 +117,7 @@ static int gc_moreItems2_I() { // should be invoked with interruption closed // enqueue a large obj: start addr & length -static void gc_lobjenqueue_I(unsigned int ptr, +static void gc_lobjenqueue_I(void * ptr, unsigned int length, unsigned int host) { if (gclobjheadindex==NUMLOBJPTRS) { @@ -142,7 +141,7 @@ static void gc_lobjenqueue_I(unsigned int ptr, } // dequeue and destroy the queue -static unsigned int gc_lobjdequeue_I(unsigned int * length, +static void * gc_lobjdequeue_I(unsigned int * length, unsigned int * host) { if (gclobjtailindex==NUMLOBJPTRS) { struct lobjpointerblock *tmp=gclobjtail; @@ -203,7 +202,7 @@ static void gc_lobjqueueinit4_I() { gclobjtailindex2 = gclobjtailindex; } -static unsigned int gc_lobjdequeue4_I(unsigned int * length, +static void * gc_lobjdequeue4_I(unsigned int * length, unsigned int * host) { if (gclobjtailindex2==NUMLOBJPTRS) { gclobjtail2=gclobjtail2->next; @@ -225,7 +224,7 @@ static int gc_lobjmoreItems4_I() { //////////////////////////////////////////////////////////////////// // functions that can be invoked in normal places //////////////////////////////////////////////////////////////////// -static void gc_enqueue(unsigned int ptr) { +static void gc_enqueue(void * ptr) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); if (gcheadindex==NUMPTRS) { struct pointerblock * tmp; @@ -244,7 +243,7 @@ static void gc_enqueue(unsigned int ptr) { BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); } -static unsigned int gc_dequeue() { +static void * gc_dequeue() { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); if (gctailindex==NUMPTRS) { struct pointerblock *tmp=gctail; @@ -257,7 +256,7 @@ static unsigned int gc_dequeue() { gcspare->next = NULL; } } - unsigned int r = gctail->ptrs[gctailindex++]; + void * r = gctail->ptrs[gctailindex++]; BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); return r; } @@ -270,14 +269,13 @@ static int gc_moreItems() { } // dequeue and do not destroy the queue -static unsigned int gc_dequeue2() { +static void * gc_dequeue2() { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); if (gctailindex2==NUMPTRS) { - struct pointerblock *tmp=gctail2; gctail2=gctail2->next; gctailindex2=0; } - unsigned int r = gctail2->ptrs[gctailindex2++]; + void * r = gctail2->ptrs[gctailindex2++]; BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); return r; } @@ -289,7 +287,7 @@ static int gc_moreItems2() { return r; } -static void gc_lobjenqueue(unsigned int ptr, +static void gc_lobjenqueue(void * ptr, unsigned int length, unsigned int host) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); diff --git a/Robust/src/Runtime/bamboo/multicorecache.h b/Robust/src/Runtime/bamboo/multicorecache.h index d0bb5cfb..ad86f5e9 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.h +++ b/Robust/src/Runtime/bamboo/multicorecache.h @@ -37,11 +37,11 @@ typedef union #define BAMBOO_CACHE_MODE_COORDS 4 typedef struct gc_cache_revise_info { - unsigned int orig_page_start_va; - unsigned int orig_page_end_va; + void * orig_page_start_va; + void * orig_page_end_va; unsigned int orig_page_index; - unsigned int to_page_start_va; - unsigned int to_page_end_va; + void * to_page_start_va; + void * to_page_end_va; unsigned int to_page_index; unsigned int revised_sampling[NUMCORESACTIVE]; } gc_cache_revise_info_t; @@ -58,10 +58,10 @@ INLINE static void samplingDataReviseInit(struct moveHelper * orig,struct moveHe gc_cache_revise_information.orig_page_index=((unsigned INTPTR)(orig->blockbase-gcbaseva))/BAMBOO_PAGE_SIZE; } -INLINE static void samplingDataConvert(unsigned int current_ptr) { - unsigned int tmp_factor=current_ptr-gc_cache_revise_information.to_page_start_va; - unsigned int topage=gc_cache_revise_information.to_page_index; - unsigned int oldpage=gc_cache_revise_information.orig_page_index; +INLINE static void samplingDataConvert(void * current_ptr) { + unsigned INTPTR tmp_factor=(unsigned INTPTR)(current_ptr-gc_cache_revise_information.to_page_start_va); + unsigned INTPTR topage=gc_cache_revise_information.to_page_index; + unsigned INTPTR oldpage=gc_cache_revise_information.orig_page_index; int * newtable=&gccachesamplingtbl_r[topage]; int * oldtable=&gccachesamplingtbl[oldpage]; @@ -73,8 +73,8 @@ INLINE static void samplingDataConvert(unsigned int current_ptr) { } INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelper * to,unsigned int current_ptr,bool closeToPage) { - unsigned int ptr=0; - unsigned int tocompare=0; + void *ptr; + void *tocompare; if(closeToPage) { ptr=to->ptr; tocompare=gc_cache_revise_information.to_page_end_va; @@ -89,7 +89,7 @@ INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelpe // prepare for an new orig page 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*(tmp_index+1); gc_cache_revise_information.orig_page_index=tmp_index; gc_cache_revise_information.to_page_start_va=to->ptr; if(closeToPage) { diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index d92dc6fd..98123fef 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -152,7 +152,7 @@ void initGC() { gccorestatus[i] = 1; gcnumsendobjs[0][i] = gcnumsendobjs[1][i] = 0; gcnumreceiveobjs[0][i] = gcnumreceiveobjs[1][i] = 0; - gcloads[i] = 0; + gcloads[i] = NULL; gcrequiredmems[i] = 0; gcfilledblocks[i] = 0; gcstopblock[i] = 0; @@ -744,7 +744,7 @@ void master_compact() { unsigned int tmpcoreptr = 0; BASEPTR(i, numpbc, &tmpcoreptr); // init some data strutures for compact phase - gcloads[i] = 0; + gcloads[i] = NULL; gcfilledblocks[i] = 0; gcrequiredmems[i] = 0; gccorestatus[i] = 1; diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index b08eb129..d5783af9 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -53,7 +53,7 @@ INLINE int assignSpareMem(unsigned int sourcecore,unsigned int * requiredmem,uns return retval; } -INLINE void compact2Heaptophelper_I(unsigned int coren,unsigned int* p,unsigned int* numblocks,unsigned int* remain) { +INLINE void compact2Heaptophelper_I(unsigned int coren, void ** p,unsigned int* numblocks,unsigned int* remain) { unsigned int b; unsigned int memneed = gcrequiredmems[coren] + BAMBOO_CACHE_LINE_SIZE; if(STARTUPCORE == coren) { @@ -393,7 +393,7 @@ INLINE bool moveobj(struct moveHelper * orig, struct moveHelper * to, unsigned i BAMBOO_MEMSET_WH((unsigned int)(toptr+size), -2, isize-size); } // store mapping info - gcmappingtbl[OBJMAPPINGINDEX((unsigned int)origptr)]=(unsigned int)toptr; + gcmappingtbl[OBJMAPPINGINDEX(origptr)]=(unsigned int)toptr; gccurr_heaptop -= isize; to->ptr += isize; to->offset += isize; diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.h b/Robust/src/Runtime/bamboo/multicoregccompact.h index bb0ab127..73f9f863 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.h +++ b/Robust/src/Runtime/bamboo/multicoregccompact.h @@ -17,9 +17,10 @@ struct moveHelper { }; // compute the remaining size of block #b -// p--relative position to the bottom of the shared heap +// p--ptr + #define GC_BLOCK_REMAIN_SIZE(b, p) \ - ((b)= isize) { // have enough space in the block, malloc return mallocmem(*tofindb, *totest, size, allocsize); - break; } else { // no enough space yet, try to append next continuous block *totest = *totest + 1; @@ -106,8 +105,6 @@ INLINE void * searchBlock4Mem_global(int* tofindb, int* totest, int isize, int * allocsize) { - int i=0; - int j=0; int size = 0; int bound = BAMBOO_SMEM_SIZE_L; while(*totest<(gcnumblock-bamboo_reserved_smem)) { @@ -131,7 +128,6 @@ INLINE void * searchBlock4Mem_global(int* tofindb, if(size >= isize) { // have enough space in the block, malloc return mallocmem(*tofindb, *totest, size, allocsize); - break; } else { // no enough space yet, try to append next continuous block *totest = *totest + 1; @@ -205,8 +201,6 @@ void * mixedmalloc_I(int coren, int k; int gccorenum=(coren gcnumblock-1-bamboo_reserved_smem) { // Out of shared memory *allocsize = 0; diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 183b0f02..8bdddcb1 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -5,6 +5,7 @@ #include "multicoregarbage.h" #include "multicoretaskprofile.h" #include "gcqueue.h" +#include "runtime_arch.h" int msgsizearray[] = { 0, //MSGSTART, @@ -510,7 +511,7 @@ INLINE void processmsg_gcfinishcompact_I() { MSG_INDEXINC_I(); int filledblocks = msgdata[msgdataindex]; MSG_INDEXINC_I(); - int heaptop = msgdata[msgdataindex]; + void * heaptop = (void *) msgdata[msgdataindex]; MSG_INDEXINC_I(); int data4 = msgdata[msgdataindex]; MSG_INDEXINC_I(); @@ -522,7 +523,7 @@ INLINE void processmsg_gcfinishcompact_I() { } if(data4 > 0) { // ask for more mem - int startaddr = 0; + void * startaddr = NULL; int tomove = 0; int dstcore = 0; if(gcfindSpareMem_I(&startaddr, &tomove, &dstcore, data4, cnum)) { diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index 47a68cf8..036bb827 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -747,7 +747,6 @@ INLINE void checkCoreStatus() { // main function for each core inline void run(int argc, char** argv) { - int i = 0; bool sendStall = false; bool isfirst = true; bool tocontinue = false; -- 2.34.1