From d7ef3d0ee3c32692e3f462de48747aad5e118d62 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 18 Jun 2011 04:50:11 +0000 Subject: [PATCH] bug fixes --- Robust/src/Runtime/bamboo/markbit.c | 3 ++ Robust/src/Runtime/bamboo/markbit.h | 3 +- Robust/src/Runtime/bamboo/multicorecache.h | 2 +- Robust/src/Runtime/bamboo/multicoregarbage.c | 8 ++--- Robust/src/Runtime/bamboo/multicoregarbage.h | 3 -- .../src/Runtime/bamboo/multicoregccompact.c | 29 ++++--------------- Robust/src/Runtime/bamboo/multicoregcmark.c | 7 ++--- Robust/src/Runtime/bamboo/multicoremem.h | 14 ++++----- Robust/src/Runtime/bamboo/multicoremsg.c | 7 +++-- 9 files changed, 28 insertions(+), 48 deletions(-) diff --git a/Robust/src/Runtime/bamboo/markbit.c b/Robust/src/Runtime/bamboo/markbit.c index c6ca5566..4c013a61 100644 --- a/Robust/src/Runtime/bamboo/markbit.c +++ b/Robust/src/Runtime/bamboo/markbit.c @@ -1,3 +1,6 @@ +#include "runtime.h" +#include "multicoremem.h" +#include "multicoregarbage.h" #include "markbit.h" unsigned int markmappingarray[]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/Robust/src/Runtime/bamboo/markbit.h b/Robust/src/Runtime/bamboo/markbit.h index 871ac8ba..fd40bf16 100644 --- a/Robust/src/Runtime/bamboo/markbit.h +++ b/Robust/src/Runtime/bamboo/markbit.h @@ -50,8 +50,7 @@ static inline unsigned int getMarkedLength(void *ptr) { val=gcmarktbl[hibits]; else { unsigned INTPTR revlobits=32-lobits; - unsigned INTPTR val=(gcmarktbl[hibits]<>(revlobits)); + val=(gcmarktbl[hibits]<>(revlobits)); } unsigned int index=val>>26; if (index>48) diff --git a/Robust/src/Runtime/bamboo/multicorecache.h b/Robust/src/Runtime/bamboo/multicorecache.h index 65d1ef7b..8c30d4ee 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.h +++ b/Robust/src/Runtime/bamboo/multicorecache.h @@ -72,7 +72,7 @@ INLINE static void samplingDataConvert(void * current_ptr) { } } -INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelper * to,unsigned int current_ptr,bool closeToPage) { +INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelper * to, void * current_ptr,bool closeToPage) { void *ptr; void *tocompare; if(closeToPage) { diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 95caaa30..9dfc6a01 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -119,7 +119,6 @@ void initmulticoregcdata() { gcself_numreceiveobjs = 0; gcmarkedptrbound = 0; gcforwardobjtbl = allocateMGCHash_I(128); - gcnumlobjs = 0; gcheaptop = 0; gctopcore = 0; gctopblock = 0; @@ -170,7 +169,6 @@ void initGC() { gcself_numsendobjs = 0; gcself_numreceiveobjs = 0; gcmarkedptrbound = 0; - gcnumlobjs = 0; gcmovestartaddr = 0; gctomove = false; gcblock2fill = 0; @@ -367,7 +365,7 @@ void gc_collect(struct garbagelist * stackptr) { GC_PRINTF("Start flush phase\n"); GCPROFILE_INFO_2_MASTER(); - flush(stackptr); + update(stackptr); GC_PRINTF("Finish flush phase\n"); CACHEADAPT_PHASE_CLIENT(); @@ -408,7 +406,7 @@ void gc_nocollect(struct garbagelist * stackptr) { GC_PRINTF("Start flush phase\n"); GCPROFILE_INFO_2_MASTER(); - flush(stackptr); + update(stackptr); GC_PRINTF("Finish flush phase\n"); CACHEADAPT_PHASE_CLIENT(); @@ -467,7 +465,7 @@ void master_updaterefs(struct garbagelist * stackptr) { GCPROFILE_ITEM(); GC_PRINTF("Start flush phase \n"); // flush phase - flush(stackptr); + update(stackptr); GC_CHECK_ALL_CORE_STATUS(UPDATEPHASE==gc_status_info.gcphase); GC_PRINTF("Finish flush phase \n"); } diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 8ba9bebb..e300676d 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -132,9 +132,6 @@ unsigned int size_cachepolicytbl; /* Number of bits used for each alignment unit */ -//Takes in size and converts into alignment units -#define ALIGNOBJSIZE(x) (x>>ALIGNMENTSHIFT) - //Takes in pointer to heap object and converts to offset in alignment units #define OBJMAPPINGINDEX(p) ALIGNOBJSIZE((unsigned INTPTR)(p-gcbaseva)) diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index 7589129a..a9011b57 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -93,30 +93,13 @@ void compacthelper(struct moveHelper * orig,struct moveHelper * to) { /* Should be invoked with interrupt turned off. */ -unsigned int assignSpareMem_I(unsigned int sourcecore, unsigned int requiredmem, void ** tomove, void ** startaddr) { - unsigned int blockindex; - BLOCKINDEX(blockindex, topptrs[sourcecore]); - void * boundptr = BOUNDPTR(blockindex); - unsigned INTPTR remain = (unsigned INTPTR) (boundptr - topptrs[sourcecore]); - unsigned int memneed = requiredmem + BAMBOO_CACHE_LINE_SIZE; - *startaddr = topptrs[sourcecore]; - *tomove = gcfilledblocks[sourcecore] + 1; - if(memneed < remain) { - topptrs[sourcecore] += memneed; - return 0; - } else { - // next available block - gcfilledblocks[sourcecore]++; - void * newbase = NULL; - BASEPTR(newbase, sourcecore, gcfilledblocks[sourcecore]); - topptrs[sourcecore] = newbase; - return requiredmem-remain; - } +void * assignSpareMem_I(unsigned int sourcecore, unsigned int requiredmem) { + return NULL; } -unsigned int assignSpareMem(unsigned int sourcecore,unsigned int requiredmem,unsigned int * tomove, void ** startaddr) { +void * assignSpareMem(unsigned int sourcecore,unsigned int requiredmem) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); - int retval=assignSpareMem_I(sourcecore, requiredmem, tomove, startaddr); + void * retval=assignSpareMem_I(sourcecore, requiredmem); BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); return retval; } @@ -128,7 +111,7 @@ void * gcfindSpareMem_I(unsigned int requiredmem,unsigned int requiredcore) { for(int k = 0; k < NUMCORES4GC; k++) { if((gccorestatus[k] == 0) && (gcfilledblocks[k] < gcstopblock[k])) { // check if this stopped core has enough mem - assignSpareMem_I(k, requiredmem, tomove, &startaddr); + startaddr=assignSpareMem_I(k, requiredmem); return startaddr; } } @@ -203,7 +186,7 @@ void compact() { struct moveHelper to={0,NULL,NULL,0,NULL,0,0,0,0}; initOrig_Dst(&orig, &to); - CACHEADAPT_SAMPLING_DATA_REVISE_INIT(orig, to); + CACHEADAPT_SAMPLING_DATA_REVISE_INIT(&orig, &to); compacthelper(&orig, &to); } diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 847789c0..0ccb476f 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -262,10 +262,10 @@ void mark(bool isfirst, struct garbagelist * stackptr) { while(MARKPHASE == gc_status_info.gcphase) { int counter = 0; - while(gc_moreItems2()) { + while(gc_moreItems()) { sendStall = false; gc_status_info.gcbusystatus = true; - void * ptr = gc_dequeue2(); + void * ptr = gc_dequeue(); unsigned int size = 0; unsigned int type = 0; @@ -276,8 +276,7 @@ void mark(bool isfirst, struct garbagelist * stackptr) { if(islarge) { // ptr is a large object and not marked or enqueued - gc_lobjenqueue(ptr, size, BAMBOO_NUM_OF_CORE); - gcnumlobjs++; + printf("NEED TO SUPPORT LARGE OBJECTS!\n"); } else { // ptr is an unmarked active object on this core unsigned int isize=iunits<0)) { \ - *((int *)bamboo_cur_msp) = 0; \ - } \ +#define BAMBOO_CLOSE_CUR_MSP() \ + { \ + if((bamboo_cur_msp!=NULL)&&(bamboo_smem_zero_top==bamboo_cur_msp) \ + &&(bamboo_smem_size>0)) { \ + *bamboo_cur_msp = NULL; \ + } \ } // table recording the number of allocated bytes on each block @@ -161,7 +161,7 @@ unsigned int bamboo_free_smemp; int bamboo_free_smem_size; #endif // MULTICORE_GC volatile bool smemflag; -volatile unsigned int bamboo_cur_msp; +volatile unsigned int * bamboo_cur_msp; volatile int bamboo_smem_size; #endif // BAMBOO_MULTICORE_MEM_H diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index e975e8a0..ed4b73e5 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -6,6 +6,7 @@ #include "multicoretaskprofile.h" #include "gcqueue.h" #include "runtime_arch.h" +#include "markbit.h" int msgsizearray[] = { 0, //MSGSTART, @@ -393,10 +394,10 @@ INLINE void processmsg_memresponse_I() { bamboo_smem_zero_top = NULL; #endif bamboo_smem_size = 0; - bamboo_cur_msp = 0; + bamboo_cur_msp = NULL; } else { #ifdef MULTICORE_GC - CLOSEBLOCK(data1, data2); + //CLOSEBLOCK(data1, data2); bamboo_smem_size = data2 - BAMBOO_CACHE_LINE_SIZE; bamboo_cur_msp = data1 + BAMBOO_CACHE_LINE_SIZE; bamboo_smem_zero_top = bamboo_cur_msp; @@ -549,7 +550,7 @@ INLINE void processmsg_gcfinish_I() { INLINE void processmsg_gcmarkconfirm_I() { BAMBOO_ASSERT(((BAMBOO_NUM_OF_CORE!=STARTUPCORE)&&(BAMBOO_NUM_OF_CORE<=NUMCORESACTIVE-1))); - gc_status_info.gcbusystatus = gc_moreItems2_I(); + gc_status_info.gcbusystatus = gc_moreItems_I(); // send response msg, cahce the msg first if(BAMBOO_CHECK_SEND_MODE()) { cache_msg_5_I(STARTUPCORE,GCMARKREPORT,BAMBOO_NUM_OF_CORE,gc_status_info.gcbusystatus,gcself_numsendobjs,gcself_numreceiveobjs); -- 2.34.1