From ee9de78abddb169b0c843be739d3f2784bd869e4 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 21 Jun 2011 22:59:36 +0000 Subject: [PATCH] try to make update phase work...need to ask for permission to write into memory blocks --- Robust/src/Runtime/bamboo/multicoregarbage.c | 12 +++-- Robust/src/Runtime/bamboo/multicoregarbage.h | 23 ++++++++-- Robust/src/Runtime/bamboo/multicoregcflush.c | 48 +++++++++++++++++--- Robust/src/Runtime/bamboo/multicoregcmark.c | 13 ------ Robust/src/Runtime/bamboo/multicoregcmark.h | 1 - Robust/src/Runtime/bamboo/multicoremsg.c | 40 +++++++++++++++- Robust/src/Runtime/bamboo/multicoremsg.h | 2 + 7 files changed, 110 insertions(+), 29 deletions(-) diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index c23a78dd..3f7d1fb0 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -20,7 +20,7 @@ void dumpSMem() { int block = 0; int sblock = 0; unsigned int j = 0; - void * i = 0; + unsigned int i = 0; int coren = 0; int x = 0; int y = 0; @@ -28,7 +28,7 @@ void dumpSMem() { // reserved blocks for sblocktbl printf("(%x,%x) ++++ reserved sblocks ++++ \n", udn_tile_coord_x(), udn_tile_coord_y()); - for(i=BAMBOO_BASE_VA; (unsinged int)i<(unsigned int)gcbaseva; i+= 4*16) { + for(i=BAMBOO_BASE_VA; iptr=origptr; - return 0; + return NULL; } } while(!gcmarktbl[arrayoffset]); origptr=CONVERTTABLEINDEXTOPTR(arrayoffset); @@ -211,7 +211,6 @@ void * updateblocks(struct moveHelper * orig, struct moveHelper * to) { if (endtoptr>tobound||endtoptrptr=tobound; orig->ptr=origptr; return dstptr; } @@ -236,22 +235,59 @@ void * updateblocks(struct moveHelper * orig, struct moveHelper * to) { } } +void updateOrigPtr(void *currtop) { + //Ordering is important... + //Update heap top first... + update_origblockptr=currtop; + + //Then check for waiting cores + if (origarraycount>0) { + for(int i=0;ibase=OFFSET2BASEVA(blockindex)+gcbaseva; + to->bound=BOUNDPTR(blockindex)+gcbaseva; + if (corenum!=BAMBOO_NUM_OF_CORE) { + //we have someone elses memory...need to ask to use it + //first set flag to false + blockgranted=false; + send_msg_3(corenum,GCREQBLOCK, BAMBOO_NUM_OF_CORE, to->bound); + //wait for permission + while(!blockgranted) + ; + } + } if (orig->ptr==orig->bound) { + //inform others that we are done with previous block + updateOrigPtr(orig->bound); + //need more data to compact //increment the core orig->localblocknum++; BASEPTR(orig->base,BAMBOO_NUM_OF_CORE, orig->localblocknum); + update_origblockptr=orig->base; orig->ptr=orig->base; orig->bound = orig->base + BLOCKSIZE(orig->localblocknum); if (orig->base >= gcbaseva+BAMBOO_SHARED_MEM_SIZE) break; } - if (minimumbytes!=0) { - getSpace(to, minimumbytes); - } } } diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 72ff2ec9..0dfa1a78 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -47,19 +47,6 @@ INLINE bool isLarge(void * ptr, int * ttype, unsigned int * tsize) { return (*tsize) > blocksize; } -INLINE unsigned int hostcore(void * ptr) { - // check the host core of ptr - unsigned int host = 0; - if(1 == (NUMCORES4GC)) { - host = 0; - } else { - unsigned int t = (unsigned int)ptr - (unsigned int)gcbaseva; - 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);} //#define MARKOBJNONNULL(objptr, ii) {markObj(objptr, __LINE__, ii);} diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.h b/Robust/src/Runtime/bamboo/multicoregcmark.h index 2d91b93e..3bed08a5 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.h +++ b/Robust/src/Runtime/bamboo/multicoregcmark.h @@ -5,7 +5,6 @@ INLINE void gettype_size(void * ptr, int * ttype, unsigned int * tsize); INLINE bool isLarge(void * ptr, int * ttype, unsigned int * tsize); -INLINE unsigned int hostcore(void * ptr); INLINE void markgarbagelist(struct garbagelist * listptr); INLINE void tomark(struct garbagelist * stackptr); INLINE void scanPtrsInObj(void * ptr, int type); diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 202fcdbe..1a6d596f 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -44,8 +44,10 @@ int msgsizearray[] = { 5, //GCMARKREPORT, // 0xEe 2, //GCMARKEDOBJ, // 0xEf 2, //GCMOVESTART, // 0xF0 - 1, //GCLOBJREQUEST, // 0xF1 - -1, //GCLOBJINFO, // 0xF2 + 1, //GCLOBJREQUEST, // 0xF1 + 3, //GCREQBLOCK, + 1, //GCGRANTBLOCK, + -1, //GCLOBJINFO, // 0xF2 #ifdef GC_PROFILE 4, //GCPROFILES, // 0xF3 #endif // GC_PROFILE @@ -470,6 +472,30 @@ INLINE void processmsg_gcfinishinit_I() { } } +INLINE void processmsg_reqblock_I() { + int cnum=msgdata[msgdataindex]; + MSG_INDEXINC_I(); + void * topptr=msgdata[msgdataindex]; + MSG_INDEXINC_I(); + if (topptr<=update_origblockptr) { + //send message + if(BAMBOO_CHECK_SEND_MODE()) { + cache_msg_1_I(cnum,GCGRANTBLOCK); + } else { + send_msg_1_I(cnum,GCGRANTBLOCK); + } + } else { + //store message + origblockarray[cnum]=topptr; + origarraycount++; + } +} + +INLINE void processmsg_grantblock_I() { + blockgranted=true; +} + + INLINE void processmsg_gcfinishmark_I() { int data1 = msgdata[msgdataindex]; MSG_INDEXINC_I(); @@ -965,6 +991,16 @@ processmsg: break; } + case GCREQBLOCK: { + processmsg_reqblock_I(); + break; + } + + case GCGRANTBLOCK: { + processmsg_grantblock_I(); + break; + } + case GCLOBJINFO: { // received a large objs info response msg processmsg_gclobjinfo_I(msglength); diff --git a/Robust/src/Runtime/bamboo/multicoremsg.h b/Robust/src/Runtime/bamboo/multicoremsg.h index b18708a7..03fa5c55 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.h +++ b/Robust/src/Runtime/bamboo/multicoremsg.h @@ -188,6 +188,8 @@ typedef enum { GCMARKEDOBJ, // 0xEf GCMOVESTART, // 0xF0 GCLOBJREQUEST, // 0xF1 + GCREQBLOCK, + GCGRANTBLOCK, GCLOBJINFO, // 0xF2 #ifdef GC_PROFILE GCPROFILES, // 0xF3 -- 2.34.1