From 294b93eb0bbededab500424b66ae68e4f6b0d378 Mon Sep 17 00:00:00 2001 From: jzhou Date: Fri, 24 Sep 2010 22:59:23 +0000 Subject: [PATCH] Clean up the code: remove commented code --- .../Scheduling/GC/RayTracer/RayTracer.java | 6 +- Robust/src/Runtime/bamboo/GCSharedHash.c | 11 +- Robust/src/Runtime/bamboo/GCSharedHash.h | 3 - Robust/src/Runtime/bamboo/MGCHash.c | 30 -- Robust/src/Runtime/bamboo/MGCHash.h | 3 - Robust/src/Runtime/bamboo/multicoregarbage.c | 320 +++--------------- Robust/src/Runtime/bamboo/multicoregarbage.h | 19 +- Robust/src/Runtime/bamboo/multicoreruntime.c | 5 - Robust/src/Runtime/bamboo/multicoreruntime.h | 38 +-- Robust/src/Runtime/bamboo/multicoretask.c | 179 +--------- 10 files changed, 73 insertions(+), 541 deletions(-) diff --git a/Robust/src/Benchmarks/Scheduling/GC/RayTracer/RayTracer.java b/Robust/src/Benchmarks/Scheduling/GC/RayTracer/RayTracer.java index 99f94bc1..9383a901 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/RayTracer/RayTracer.java +++ b/Robust/src/Benchmarks/Scheduling/GC/RayTracer/RayTracer.java @@ -108,9 +108,9 @@ public class RayTracer { /* create spheres */ Primitive p; - int nx = 4; - int ny = 4; - int nz = 4; + int nx = 4; // 6 + int ny = 4; // 6 + int nz = 4; // 6 for (int i = 0; i < nx; i++) { for (int j = 0; j < ny; j++) { for (int k = 0; k < nz; k++) { diff --git a/Robust/src/Runtime/bamboo/GCSharedHash.c b/Robust/src/Runtime/bamboo/GCSharedHash.c index 04e92ffb..08c92ea1 100755 --- a/Robust/src/Runtime/bamboo/GCSharedHash.c +++ b/Robust/src/Runtime/bamboo/GCSharedHash.c @@ -305,7 +305,7 @@ mgcsharedhashtbl_t * mgcsharedhashCreate(unsigned int size, ctable->mask = (size << (GC_SHIFT_BITS))-1; - ctable->structs = NULL ; //FREEMALLOC_NGC(1*sizeof(mgcliststruct_t)); + ctable->structs = NULL ; ctable->numelements = 0; // Initial number of elements in the hash ctable->list = NULL; @@ -337,7 +337,7 @@ mgcsharedhashtbl_t * mgcsharedhashCreate_I(unsigned int size, ctable->mask = (size << (GC_SHIFT_BITS))-1; - ctable->structs = NULL ; //FREEMALLOC_NGC(1*sizeof(mgcliststruct_t)); + ctable->structs = NULL ; ctable->numelements = 0; // Initial number of elements in the hash ctable->list = NULL; @@ -385,8 +385,6 @@ int mgcsharedhashInsert(mgcsharedhashtbl_t * tbl, void * key, void * val) { return -1; } - //int keyto = ((unsigned INTPTR)key) % (tbl->size); - //ptr=&tbl->table[keyto]; ptr=&tbl->table[(((unsigned INTPTR)key)&tbl->mask)>>(GC_SHIFT_BITS)]; if(ptr->key==0) { @@ -419,8 +417,6 @@ int mgcsharedhashInsert_I(mgcsharedhashtbl_t * tbl, void * key, void * val) { return -1; } - //int keyto = ((unsigned INTPTR)key) % (tbl->size); - //ptr=&tbl->table[keyto]; ptr=&tbl->table[(((unsigned INTPTR)key)&tbl->mask)>>(GC_SHIFT_BITS)]; if(ptr->key==0) { @@ -452,14 +448,11 @@ int mgcsharedhashInsert_I(mgcsharedhashtbl_t * tbl, void * key, void * val) { // Search for an address for a given oid INLINE void * mgcsharedhashSearch(mgcsharedhashtbl_t * tbl, void * key) { //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE] - //int keyto = ((unsigned INTPTR)key) % (tbl->size); - //mgcsharedhashlistnode_t * node=&tbl->table[keyto]; mgcsharedhashlistnode_t * node = &tbl->table[(((unsigned INTPTR)key)&tbl->mask)>>(GC_SHIFT_BITS)]; mgcsharedhashlistnode_t *top = &tbl->table[tbl->size]; do { - //i++; if(node->key == key) { return node->val; } diff --git a/Robust/src/Runtime/bamboo/GCSharedHash.h b/Robust/src/Runtime/bamboo/GCSharedHash.h index 94725fbf..bfcd6204 100755 --- a/Robust/src/Runtime/bamboo/GCSharedHash.h +++ b/Robust/src/Runtime/bamboo/GCSharedHash.h @@ -83,10 +83,7 @@ mgcsharedhashtbl_t * mgcsharedhashCreate(unsigned int size, double loadfactor); mgcsharedhashtbl_t * mgcsharedhashCreate_I(unsigned int size,double loadfactor); int mgcsharedhashInsert(mgcsharedhashtbl_t * tbl, void * key, void * val); void * mgcsharedhashSearch(mgcsharedhashtbl_t * tbl, void * key); -//unsigned int mgchashResize(unsigned int newsize); int mgcsharedhashInsert_I(mgcsharedhashtbl_t * tbl, void * key, void * val); -//unsigned int mgchashResize_I(unsigned int newsize); -//void mgcsharedhashDelete(mgcsharedhashtbl_t * tbl); void mgcsharedhashReset(mgcsharedhashtbl_t * tbl); #endif diff --git a/Robust/src/Runtime/bamboo/MGCHash.c b/Robust/src/Runtime/bamboo/MGCHash.c index dabe7e29..998ec5a9 100644 --- a/Robust/src/Runtime/bamboo/MGCHash.c +++ b/Robust/src/Runtime/bamboo/MGCHash.c @@ -51,7 +51,6 @@ mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor) { ctable->threshold=size*loadfactor; ctable->mask = (size << (GC_SHIFT_BITS))-1; - //ctable->list = NULL; ctable->structs = (mgcliststruct_t*)RUNMALLOC(1*sizeof(mgcliststruct_t)); ctable->numelements = 0; // Initial number of elements in the hash @@ -78,13 +77,10 @@ void mgchashreset(mgchashtable_t * tbl) { BAMBOO_MEMSET_WH(tbl->table, '\0', sizeof(mgchashlistnode_t)*tbl->size); //} // TODO now never release any allocated memory, may need to be changed - //mgcliststruct_t * next = tbl->structs; while(tbl->structs->next!=NULL) { mgcliststruct_t * next = tbl->structs->next; RUNFREE(tbl->structs); tbl->structs=next; - /*next->num = 0; - next = next->next;*/ } tbl->structs->num = 0; tbl->numelements = 0; @@ -107,8 +103,6 @@ void mgchashInsert(mgchashtable_t * tbl, void * key, void *val) { // the first time insert a value for the key ptr->key=key; ptr->val=val; - /*ptr->lnext = tbl->list; - tbl->list = ptr;*/ } else { // Insert in the beginning of linked list mgchashlistnode_t * node; if (tbl->structs->numval = val; node->next = ptr->next; ptr->next = node; - /*node->lnext = tbl->list; - tbl->list = node;*/ } } @@ -162,7 +154,6 @@ mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor) { ctable->threshold=size*loadfactor; ctable->mask = (size << (GC_SHIFT_BITS))-1; - //ctable->list = NULL; ctable->structs = (mgcliststruct_t*)RUNMALLOC_I(1*sizeof(mgcliststruct_t)); ctable->numelements = 0; // Initial number of elements in the hash @@ -184,8 +175,6 @@ void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val) { if(ptr->key==0) { ptr->key=key; ptr->val=val; - /*ptr->lnext = tbl->list; - tbl->list = ptr;*/ return; } else { // Insert in the beginning of linked list mgchashlistnode_t * node; @@ -204,8 +193,6 @@ void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val) { node->val = val; node->next = ptr->next; ptr->next = node; - /*node->lnext = tbl->list; - tbl->list = node;*/ } } #endif @@ -248,7 +235,6 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) { tbl->size = newsize; tbl->threshold = newsize * tbl->loadfactor; mask = tbl->mask = (newsize << (GC_SHIFT_BITS)) - 1; - //tbl->list = NULL; for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table curr = &ptr[i]; @@ -269,8 +255,6 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) { if(tmp->key == 0) { tmp->key = key; tmp->val = curr->val; - /*tmp->lnext = tbl->list; - tbl->list = tmp;*/ } /* NOTE: Add this case if you change this... This case currently never happens because of the way things rehash....*/ @@ -280,14 +264,10 @@ unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize) { newnode->val = curr->val; newnode->next = tmp->next; tmp->next=newnode; - /*newnode->lnext = tbl->list; - tbl->list = newnode;*/ } else { curr->next=tmp->next; tmp->next=curr; - /*curr->lnext = tbl->list; - tbl->list = curr;*/ } isfirst = 0; @@ -323,7 +303,6 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) { tbl->size = newsize; tbl->threshold = newsize * tbl->loadfactor; mask = tbl->mask = (newsize << (GC_SHIFT_BITS))-1; - //tbl->list = NULL; for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table curr = &ptr[i]; @@ -344,8 +323,6 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) { if(tmp->key == 0) { tmp->key = key; tmp->val = curr->val; - /*tmp->lnext = tbl->list; - tbl->list = tmp;*/ } /* NOTE: Add this case if you change this... This case currently never happens because of the way things rehash....*/ @@ -355,13 +332,9 @@ unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize) { newnode->val = curr->val; newnode->next = tmp->next; tmp->next=newnode; - /*newnode->lnext = tbl->list; - tbl->list = newnode;*/ } else { curr->next=tmp->next; tmp->next=curr; - /*curr->lnext = tbl->list; - tbl->list = curr;*/ } isfirst = 0; @@ -430,7 +403,6 @@ int MGCHashadd(struct MGCHash * thisvar, int data) { int mask = (thisvar->size << (GC_SHIFT_BITS))-1; hashkey = (((unsigned INTPTR)data)&mask)>>(GC_SHIFT_BITS); - //hashkey = (unsigned int)data % thisvar->size; ptr = &thisvar->bucket[hashkey]; struct MGCNode * prev = NULL; @@ -482,7 +454,6 @@ int MGCHashadd_I(struct MGCHash * thisvar, int data) { int mask = (thisvar->size << (GC_SHIFT_BITS))-1; hashkey = (((unsigned INTPTR)data)&mask)>>(GC_SHIFT_BITS); - //hashkey = (unsigned int)data % thisvar->size; ptr = &thisvar->bucket[hashkey]; struct MGCNode * prev = NULL; @@ -510,7 +481,6 @@ int MGCHashadd_I(struct MGCHash * thisvar, int data) { int MGCHashcontains(struct MGCHash *thisvar, int data) { int mask = (thisvar->size << (GC_SHIFT_BITS))-1; unsigned int hashkey = (((unsigned INTPTR)data)&mask)>>(GC_SHIFT_BITS); - //unsigned int hashkey = (unsigned int)data % thisvar->size; struct MGCNode *ptr = thisvar->bucket[hashkey].next; struct MGCNode *prev = NULL; diff --git a/Robust/src/Runtime/bamboo/MGCHash.h b/Robust/src/Runtime/bamboo/MGCHash.h index 03844ebc..65a03ec3 100644 --- a/Robust/src/Runtime/bamboo/MGCHash.h +++ b/Robust/src/Runtime/bamboo/MGCHash.h @@ -25,7 +25,6 @@ typedef struct mgchashlistnode { void * val; //this can be cast to another type or used to point to a //larger structure struct mgchashlistnode *next; - //struct mgchashlistnode *lnext; } mgchashlistnode_t; #define NUMMGCLIST 250 @@ -37,7 +36,6 @@ typedef struct mgclist { typedef struct mgchashtable { mgchashlistnode_t * table; // points to beginning of hash table - //mgchashlistnode_t * list; mgcliststruct_t * structs; unsigned int size; unsigned int mask; @@ -63,7 +61,6 @@ void mgchashreset(mgchashtable_t * tbl); struct MGCHash * allocateMGCHash(int size, int conflicts); void freeMGCHash(struct MGCHash *); -//void MGCHashrehash(struct MGCHash * thisvar); int MGCHashadd(struct MGCHash *, int data); #ifdef MULTICORE struct MGCHash * allocateMGCHash_I(int size, int conflicts); diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 7d4dbb95..626b0880 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -41,9 +41,7 @@ struct pointerblock *gcspare=NULL; struct lobjpointerblock { void * lobjs[NUMLOBJPTRS]; - //void * dsts[NUMLOBJPTRS]; int lengths[NUMLOBJPTRS]; - //void * origs[NUMLOBJPTRS]; int hosts[NUMLOBJPTRS]; struct lobjpointerblock *next; struct lobjpointerblock *prev; @@ -156,7 +154,7 @@ inline void gc_enqueue_I(void *ptr) { gcspare=NULL; } else { tmp=RUNMALLOC_I(sizeof(struct pointerblock)); - } // if (gcspare!=NULL) + } // if (gcspare!=NULL) gchead->next=tmp; gchead=tmp; gcheadindex=0; @@ -177,7 +175,7 @@ inline void * gc_dequeue_I() { RUNFREE(tmp); } else { gcspare=tmp; - } // if (gcspare!=NULL) + } // if (gcspare!=NULL) } // if (gctailindex==NUMPTRS) return gctail->ptrs[gctailindex++]; } // void * gc_dequeue() @@ -219,7 +217,7 @@ inline void gc_lobjenqueue_I(void *ptr, gclobjspare=NULL; } else { tmp=RUNMALLOC_I(sizeof(struct lobjpointerblock)); - } // if (gclobjspare!=NULL) + } // if (gclobjspare!=NULL) gclobjhead->next=tmp; tmp->prev = gclobjhead; gclobjhead=tmp; @@ -273,7 +271,7 @@ inline void gc_lobjdequeue2_I() { gclobjtailindex2=1; } else { gclobjtailindex2++; - } // if (gclobjtailindex2==NUMLOBJPTRS) + } // if (gclobjtailindex2==NUMLOBJPTRS) } // void * gc_lobjdequeue2() inline int gc_lobjmoreItems2_I() { @@ -289,7 +287,7 @@ inline void gc_lobjdequeue3_I() { gclobjtailindex2=NUMLOBJPTRS-1; } else { gclobjtailindex2--; - } // if (gclobjtailindex2==NUMLOBJPTRS) + } // if (gclobjtailindex2==NUMLOBJPTRS) } // void * gc_lobjdequeue3() inline int gc_lobjmoreItems3_I() { @@ -340,7 +338,7 @@ inline void gettype_size(void * ptr, int elementsize=classsize[type]; int length=ao->___length___; size=sizeof(struct ArrayObject)+length*elementsize; - } // if(type < NUMCLASSES) + } // if(type < NUMCLASSES) *ttype = type; *tsize = size; } @@ -413,8 +411,8 @@ inline bool gc_checkCoreStatus_I() { if(gccorestatus[i] != 0) { allStall = false; break; - } // if(gccorestatus[i] != 0) - } // for(i = 0; i < NUMCORES4GC; ++i) + } // if(gccorestatus[i] != 0) + } // for(i = 0; i < NUMCORES4GC; ++i) return allStall; } @@ -424,8 +422,8 @@ inline bool gc_checkAllCoreStatus_I() { if(gccorestatus[i] != 0) { allStall = false; break; - } // if(gccorestatus[i] != 0) - } // for(i = 0; i < NUMCORESACTIVE; ++i) + } // if(gccorestatus[i] != 0) + } // for(i = 0; i < NUMCORESACTIVE; ++i) return allStall; } @@ -543,80 +541,6 @@ inline void checkMarkStatue() { BAMBOO_DEBUGPRINT(0xee0a); #endif } // void checkMarkStatue() -/* -inline bool preGC() { - // preparation for gc - // make sure to clear all incoming msgs espacially transfer obj msgs -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec01); -#endif - int i; - if((!waitconfirm) || - (waitconfirm && (numconfirm == 0))) { - // send out status confirm msgs to all cores to check if there are - // transfer obj msgs on-the-fly - waitconfirm = true; - numconfirm = NUMCORESACTIVE - 1; - for(i = 1; i < NUMCORESACTIVE; ++i) { - corestatus[i] = 1; - // send status confirm msg to core i - send_msg_1(i, STATUSCONFIRM, false); - } // for(i = 1; i < NUMCORESACTIVE; ++i) - -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec02); -#endif - while(true) { - if(numconfirm == 0) { - break; - } - } // wait for confirmations - waitconfirm = false; - numconfirm = 0; -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec03); -#endif - numsendobjs[BAMBOO_NUM_OF_CORE] = self_numsendobjs; - numreceiveobjs[BAMBOO_NUM_OF_CORE] = self_numreceiveobjs; - int sumsendobj = 0; -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec04); -#endif - for(i = 0; i < NUMCORESACTIVE; ++i) { - sumsendobj += numsendobjs[i]; -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xf000 + numsendobjs[i]); -#endif - } // for(i = 1; i < NUMCORESACTIVE; ++i) -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec05); - BAMBOO_DEBUGPRINT_REG(sumsendobj); -#endif - for(i = 0; i < NUMCORESACTIVE; ++i) { - sumsendobj -= numreceiveobjs[i]; -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xf000 + numreceiveobjs[i]); -#endif - } // for(i = 1; i < NUMCORESACTIVE; ++i) -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec06); - BAMBOO_DEBUGPRINT_REG(sumsendobj); -#endif - if(0 == sumsendobj) { - return true; - } else { - // still have some transfer obj msgs on-the-fly, can not start gc - return false; - } // if(0 == sumsendobj) - } else { -#ifdef DEBUG - BAMBOO_DEBUGPRINT(0xec07); -#endif - // previously asked for status confirmation and do not have all the - // confirmations yet, can not start gc - return false; - } // if((!waitconfirm) || -} // bool preGC()*/ inline void initGC() { int i; @@ -644,7 +568,6 @@ inline void initGC() { gcmarkedptrbound = 0; gcobj2map = 0; gcmappedobj = 0; - //gcismapped = false; gcnumlobjs = 0; gcmovestartaddr = 0; gctomove = false; @@ -681,7 +604,6 @@ inline void initGC() { #else mgchashreset(gcpointertbl); #endif - //gcpointertbl = allocateMGCHash(20); freeMGCHash(gcforwardobjtbl); gcforwardobjtbl = allocateMGCHash(20, 3); @@ -689,17 +611,8 @@ inline void initGC() { // initialize the mapping info related structures if((BAMBOO_NUM_OF_CORE < NUMCORES4GC) && (gcsharedptbl != NULL)) { // Never free the shared hash table, just reset it - /*freeGCSharedHash(gcsharedptbl); - gcsharedptbl = allocateGCSharedHash(20);*/ mgcsharedhashReset(gcsharedptbl); } - // Zero out the remaining bamboo_cur_msp - // Only zero out the first 4 bytes of the remaining memory - /*if((bamboo_cur_msp != 0) - && (bamboo_smem_zero_top == bamboo_cur_msp) - && (bamboo_smem_size > 0)) { - *((int *)bamboo_cur_msp) = 0; - }*/ #ifdef GC_PROFILE gc_num_livespace = 0; gc_num_freespace = 0; @@ -829,8 +742,6 @@ inline bool cacheLObjs() { gcheaptop = dst; // Note: record the start of cached lobjs with gcheaptop // cache the largeObjs to the top of the shared heap - //gclobjtail2 = gclobjtail; - //gclobjtailindex2 = gclobjtailindex; dst = gcbaseva + (BAMBOO_SHARED_MEM_SIZE); while(gc_lobjmoreItems3_I()) { gc_lobjdequeue3_I(); @@ -842,7 +753,6 @@ inline bool cacheLObjs() { if((int)dst < (int)(gclobjtail2->lobjs[gclobjtailindex2])+size) { memmove(dst, gclobjtail2->lobjs[gclobjtailindex2], size); } else { - //BAMBOO_WRITE_HINT_CACHE(dst, size); memcpy(dst, gclobjtail2->lobjs[gclobjtailindex2], size); } #ifdef DEBUG @@ -1046,16 +956,13 @@ inline void moveLObjs() { #endif gcheaptop += size; // cache the mapping info anyway - //if(ptr != tmpheaptop) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); #ifdef LOCALHASHTBL_TEST RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop); #else mgchashInsert_I(gcpointertbl, ptr, tmpheaptop); #endif - //MGCHashadd_I(gcpointertbl, ptr, tmpheaptop); BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - //} #ifdef DEBUG BAMBOO_DEBUGPRINT(0xcdca); BAMBOO_DEBUGPRINT_REG(ptr); @@ -1115,7 +1022,6 @@ inline void moveLObjs() { if((int)gcheaptop < (int)(tmpheaptop)+size) { memmove(tmpheaptop, gcheaptop, size); } else { - //BAMBOO_WRITE_HINT_CACHE(tmpheaptop, size); memcpy(tmpheaptop, gcheaptop, size); } // fill the remaining space with -2 padding @@ -1131,16 +1037,13 @@ inline void moveLObjs() { gcheaptop += size; cpysize += isize; // cache the mapping info anyway - //if(ptr != tmpheaptop) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); #ifdef LOCALHASHTBL_TEST RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop); #else mgchashInsert_I(gcpointertbl, ptr, tmpheaptop); #endif - //MGCHashadd_I(gcpointertbl, ptr, tmpheaptop); BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - //} #ifdef DEBUG BAMBOO_DEBUGPRINT(0xcdcc); BAMBOO_DEBUGPRINT_REG(ptr); @@ -1155,7 +1058,7 @@ inline void moveLObjs() { BAMBOO_DEBUGPRINT_REG(ptr); BAMBOO_DEBUGPRINT_REG(tmpheaptop); #endif - } // if(host != BAMBOO_NUM_OF_CORE) + } // if(host != BAMBOO_NUM_OF_CORE) tmpheaptop += isize; // update bamboo_smemtbl @@ -1232,7 +1135,7 @@ inline void markObj(void * objptr) { // check if this obj has been forwarded if(!MGCHashcontains(gcforwardobjtbl, (int)objptr)) { // send a msg to host informing that objptr is active - send_msg_2(host, GCMARKEDOBJ, objptr, /*BAMBOO_NUM_OF_CORE,*/ false); + send_msg_2(host, GCMARKEDOBJ, objptr, false); #ifdef GC_PROFILE gc_num_forwardobj++; #endif // GC_PROFILE @@ -1244,7 +1147,7 @@ inline void markObj(void * objptr) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); gc_enqueue_I(objptr); BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - } // if(ISSHAREDOBJ(objptr)) + } // if(ISSHAREDOBJ(objptr)) } // void markObj(void * objptr) // enqueue root objs @@ -1344,7 +1247,7 @@ inline void tomark(struct garbagelist * stackptr) { (struct transObjInfo *)(item->objectptr); markObj(totransobj->objptr); item = getNextQueueItem(item); - } // while(item != NULL) + } // while(item != NULL) #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe508); @@ -1522,7 +1425,7 @@ inline void mark(bool isfirst, gcself_numsendobjs, gcself_numreceiveobjs, false); sendStall = true; } - } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE) ... + } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE) ... #ifdef DEBUG BAMBOO_DEBUGPRINT(0xed0a); #endif @@ -1593,7 +1496,7 @@ inline void compact2Heaptophelper_I(int coren, BAMBOO_DEBUGPRINT_REG(b); BAMBOO_DEBUGPRINT_REG(*remain); #endif - } // if(memneed < remain) + } // if(memneed < remain) gcmovepending--; } // void compact2Heaptophelper_I(int, int*, int*, int*) @@ -1602,7 +1505,6 @@ inline void compact2Heaptop() { // find the current heap top and make them move to the heap top int p; int numblocks = gcfilledblocks[gctopcore]; - //BASEPTR(gctopcore, numblocks, &p); p = gcloads[gctopcore]; int b; BLOCKINDEX(p, &b); @@ -1646,9 +1548,9 @@ inline void compact2Heaptop() { // the top core is not free now return; } - } // if((gccorestatus[i] != 0) && (gcrequiredmems[i] > 0)) + } // if((gccorestatus[i] != 0) && (gcrequiredmems[i] > 0)) BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - } // for(i = 0; i < NUMCORES4GC; i++) + } // for(i = 0; i < NUMCORES4GC; i++) #ifdef DEBUG BAMBOO_DEBUGPRINT(0xd106); #endif @@ -1689,7 +1591,7 @@ inline void resolvePendingMoveRequest() { } // if(gcfilledblocks[i] < gcstopblock[i]) else ... } i++; - } // if(nosparemem) + } // if(nosparemem) if(!haspending) { if(gccorestatus[j] != 0) { // not finished, check if it has pending move requests @@ -1739,7 +1641,7 @@ inline void resolvePendingMoveRequest() { haspending = false; noblock = true; } - } // for(i = 0; i < NUMCORES4GC; i++) + } // for(i = 0; i < NUMCORES4GC; i++) #ifdef DEBUG BAMBOO_DEBUGPRINT(0xcccc); BAMBOO_DEBUGPRINT_REG(hasrunning); @@ -1800,7 +1702,6 @@ innernextSBlock: orig->ptr = orig->base; // set current ptr to out of boundary too return false; } - //orig->bound = orig->base + BAMBOO_SMEM_SIZE; orig->blockbase = orig->base; orig->sblockindex = (orig->blockbase-gcbaseva)/BAMBOO_SMEM_SIZE; sbchanged = true; @@ -2086,7 +1987,6 @@ innermoveobj: if((int)(orig->ptr) < (int)(to->ptr)+size) { memmove(to->ptr, orig->ptr, size); } else { - //BAMBOO_WRITE_HINT_CACHE(to->ptr, size); memcpy(to->ptr, orig->ptr, size); } // fill the remaining space with -2 @@ -2099,16 +1999,13 @@ innermoveobj: #else mgchashInsert_I(gcpointertbl, orig->ptr, to->ptr); #endif - //MGCHashadd_I(gcpointertbl, orig->ptr, to->ptr); if(isremote) { // add to the sharedptbl if(gcsharedptbl != NULL) { - //GCSharedHashadd_I(gcsharedptbl, orig->ptr, to->ptr); mgcsharedhashInsert_I(gcsharedptbl, orig->ptr, to->ptr); } } BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - //} #ifdef DEBUG BAMBOO_DEBUGPRINT(0xcdce); BAMBOO_DEBUGPRINT_REG(orig->ptr); @@ -2373,7 +2270,7 @@ innercompact: (to->offset) : (to->bound-BAMBOO_SMEM_SIZE+to->offset); to->base = to->ptr; to->offset = BAMBOO_CACHE_LINE_SIZE; - to->ptr += to->offset; // for header + to->ptr += to->offset; // for header to->top += to->offset; if(gcdstcore == BAMBOO_NUM_OF_CORE) { *localcompact = true; @@ -2461,17 +2358,10 @@ inline void * flushObj(void * objptr) { #endif // a shared obj ptr, change to new address BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); -#ifdef GC_PROFILE - //unsigned long long ttime = BAMBOO_GET_EXE_TIME(); -#endif #ifdef LOCALHASHTBL_TEST RuntimeHashget(gcpointertbl, objptr, &dstptr); #else dstptr = mgchashSearch(gcpointertbl, objptr); -#endif - //MGCHashget(gcpointertbl, objptr, &dstptr); -#ifdef GC_PROFILE - //flushstalltime += BAMBOO_GET_EXE_TIME()-ttime; #endif BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); #ifdef DEBUG @@ -2487,22 +2377,14 @@ inline void * flushObj(void * objptr) { #endif if(hostcore(objptr) == BAMBOO_NUM_OF_CORE) { // error! the obj is right on this core, but cannot find it - //BAMBOO_DEBUGPRINT(0xecec); BAMBOO_DEBUGPRINT_REG(objptr); BAMBOO_EXIT(0xb103); - // assume that the obj has not been moved, use the original address - //dstptr = objptr; } else { int hostc = hostcore(objptr); -#ifdef GC_PROFILE - //unsigned long long ttimet = BAMBOO_GET_EXE_TIME(); -#endif // check the corresponsing sharedptbl BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); - //struct GCSharedHash * sptbl = gcrpointertbls[hostcore(objptr)]; mgcsharedhashtbl_t * sptbl = gcrpointertbls[hostc]; if(sptbl != NULL) { - //GCSharedHashget(sptbl, (int)objptr, &dstptr); dstptr = mgcsharedhashSearch(sptbl, (int)objptr); if(dstptr != NULL) { #ifdef LOCALHASHTBL_TEST @@ -2513,9 +2395,6 @@ inline void * flushObj(void * objptr) { } } BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); -#ifdef GC_PROFILE - //flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimet; -#endif if(dstptr == NULL) { // still can not get the mapping info, @@ -2532,25 +2411,21 @@ inline void * flushObj(void * objptr) { break; } } -#ifdef GC_PROFILE - //flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimet; -#endif BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); #ifdef LOCALHASHTBL_TEST RuntimeHashget(gcpointertbl, objptr, &dstptr); #else dstptr = mgchashSearch(gcpointertbl, objptr); #endif - //MGCHashget(gcpointertbl, objptr, &dstptr); BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); } // if(dstptr == NULL) } // if(hostcore(objptr) == BAMBOO_NUM_OF_CORE) else ... #ifdef DEBUG BAMBOO_DEBUGPRINT_REG(dstptr); #endif - } // if(NULL == dstptr) - } // if(ISSHAREDOBJ(objptr)) - // if not a shared obj, return NULL to indicate no need to flush + } // if(NULL == dstptr) + } // if(ISSHAREDOBJ(objptr)) + // if not a shared obj, return NULL to indicate no need to flush #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe404); #endif @@ -2643,7 +2518,7 @@ inline void flushRuntimeObj(struct garbagelist * stackptr) { totransobj->objptr = dst; } item = getNextQueueItem(item); - } // while(item != NULL) + } // while(item != NULL) // enqueue lock related info for(i = 0; i < runtime_locklen; ++i) { @@ -2764,7 +2639,7 @@ inline void flush(struct garbagelist * stackptr) { } } // for(i=1; i<=size; i++) } // if (pointer==0) else if (((INTPTR)pointer)==1) else () - // restore the mark field, indicating that this obj has been flushed + // restore the mark field, indicating that this obj has been flushed if(ISSHAREDOBJ(ptr)) { ((int *)(ptr))[6] = INIT; } @@ -2852,7 +2727,7 @@ inline void flush(struct garbagelist * stackptr) { } } // for(i=1; i<=size; i++) } // if (pointer==0) else if (((INTPTR)pointer)==1) else () - // restore the mark field, indicating that this obj has been flushed + // restore the mark field, indicating that this obj has been flushed ((int *)(ptr))[6] = INIT; } // if(((int *)(ptr))[6] == COMPACTED) } // while(gc_lobjmoreItems()) @@ -3012,7 +2887,6 @@ int cacheAdapt_policy_dominate(){ local_tbl=(unsigned int *)( ((char *)local_tbl)+size_cachesamplingtbl_local_r); totalfreq += freq; - // TODO // check the freqency, decide if this page is hot for the core if(hotfreq < freq) { hotfreq = freq; @@ -3120,18 +2994,12 @@ int cacheAdapt_policy_overload(){ local_tbl=(unsigned int *)( ((char *)local_tbl)+size_cachesamplingtbl_local_r); totalfreq += freq; - // TODO // check the freqency, decide if this page is hot for the core if(hotfreq < freq) { hotfreq = freq; hotestcore = i; } - // TODO - /*if(page_sva == 0x10e90000) { - if(freq != 0) tprintf("0x10e90000 core %d, %d\n", i, freq); - }*/ } - // TODO // Decide the cache strategy for this page // If decide to adapt a new cache strategy, write into the shared block of // the gcsharedsamplingtbl. The mem recording information that has been @@ -3163,15 +3031,6 @@ int cacheAdapt_policy_overload(){ core2heavypages[hotestcore][3*index+2] = totalfreq; core2heavypages[hotestcore][3*index+1] = (unsigned long long)(tmp_p-1); core2heavypages[hotestcore][0]++; - // TODO - /*if(page_sva == 0x10f10000) { - int block = 0; - BLOCKINDEX(page_sva, &block); - int coren = gc_block2core[block%(NUMCORES4GC*2)]; - int coord_x = bamboo_cpu2coords[2*coren]+1; - int coord_y = bamboo_cpu2coords[2*coren+1]+1; - tprintf("+++ %x(%d-%d,%d) hotcore %d, total %d, hot %d, remote %d, index %d p %x\n", (int)page_sva, coren, coord_x, coord_y, hotestcore, totalfreq, hotfreq, remoteaccess, index, (int)(tmp_p-1)); - }*/ } unsigned long long workload_threshold = @@ -3180,10 +3039,10 @@ int cacheAdapt_policy_overload(){ for(int i = 0; i < NUMCORESACTIVE; i++) { int j = 1; int index = (int)core2heavypages[i][0]; - if(workload[i] > workload_threshold/*GC_CACHE_ADAPT_OVERLOAD_THRESHOLD*/) { + if(workload[i] > workload_threshold) { // sort according to the remoteaccess gc_quicksort(&core2heavypages[i][0], 1, index, 0); - while((workload[i] > workload_threshold/*GC_CACHE_ADAPT_OVERLOAD_THRESHOLD*/) && (j workload_threshold) && (j workload_threshold/*GC_CACHE_ADAPT_OVERLOAD_THRESHOLD*/) { + if(workload[i] > workload_threshold) { // sort according to the remoteaccess gc_quicksort(&core2heavypages[i][0], 1, index, 0); - while((workload[i] > workload_threshold/*GC_CACHE_ADAPT_OVERLOAD_THRESHOLD*/) && (j workload_threshold) && (j GC_CACHE_ADAPT_CROWD_THRESHOLD) { -//inner_crowd: // need to hfh these pages // sort the pages according to remote access gc_quicksort(&core2heavypages[i][0], j/3+1, j/3+num_crowded, 0); - //while((num_crowded--) && (j < index*3)) { - // h4h those pages with more remote accesses - bamboo_cache_policy_t policy = {0}; - policy.cache_mode = BAMBOO_CACHE_MODE_HASH; - *((int*)core2heavypages[i][j]) = policy.word; - workload[i] -= core2heavypages[i][j+1]; - t_workload -= core2heavypages[i][j+1]; - /*if((j/3+GC_CACHE_ADAPT_CROWD_THRESHOLD) < index) { - t_workload += - core2heavypages[i][j+GC_CACHE_ADAPT_CROWD_THRESHOLD*3+1]; - }*/ - j += 3; - threshold = GC_CACHE_ADAPT_ACCESS_THRESHOLD*workload[i]/100; - /*if(t_workload <= threshold) { - break; - } - } - if((j < index*3) && (t_workload > threshold)) { - num_crowded = ((index-j/3) > GC_CACHE_ADAPT_CROWD_THRESHOLD) ? - (GC_CACHE_ADAPT_CROWD_THRESHOLD) : (index-j/3);*/ - goto inner_crowd; -// } + // h4h those pages with more remote accesses + bamboo_cache_policy_t policy = {0}; + policy.cache_mode = BAMBOO_CACHE_MODE_HASH; + *((int*)core2heavypages[i][j]) = policy.word; + workload[i] -= core2heavypages[i][j+1]; + t_workload -= core2heavypages[i][j+1]; + j += 3; + threshold = GC_CACHE_ADAPT_ACCESS_THRESHOLD*workload[i]/100; + goto inner_crowd; } } @@ -3355,9 +3185,9 @@ inner_crowd: } // int cacheAdapt_policy_overload() void cacheAdapt_master() { -#ifdef GC_CACHE_ADAPT - //gc_output_cache_sampling_r(); -#endif // GC_CACHE_ADAPT +#ifdef GC_CACHE_ADAPT_SAMPLING_OUTPUT + gc_output_cache_sampling_r(); +#endif // GC_CACHE_ADAPT_SAMPLING_OUTPUT int numchanged = 0; // check the statistic data // for each page, decide the new cache strategy @@ -3375,8 +3205,6 @@ void cacheAdapt_master() { numchanged = cacheAdapt_policy_crowd(); #endif *gccachepolicytbl = numchanged; - // TODO - //if(numchanged > 0) tprintf("=================\n"); } // adapt the cache strategy for the mutator @@ -3388,19 +3216,12 @@ void cacheAdapt_mutator() { // read out the policy int page_index = *tmp_p; bamboo_cache_policy_t policy = (bamboo_cache_policy_t)(*(tmp_p+1)); - // TODO - /*if(BAMBOO_NUM_OF_CORE == 0) { - tprintf("va: %x, policy: %d (%d,%d) \n", - (int)(page_index*(BAMBOO_PAGE_SIZE)+gcbaseva), policy.cache_mode, - policy.lotar_x, policy.lotar_y); - }*/ // adapt the policy bamboo_adapt_cache_policy(page_index*(BAMBOO_PAGE_SIZE)+gcbaseva, policy, BAMBOO_PAGE_SIZE); tmp_p += 2; } - //if(BAMBOO_NUM_OF_CORE == 0) tprintf("=================\n"); // TODO } void gc_output_cache_sampling() { @@ -3689,8 +3510,8 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef GC_PROFILE gc_profileItem(); #endif -#ifdef GC_CACHE_ADAPT - //gc_output_cache_sampling(); +#ifdef GC_CACHE_ADAPT_POLICY_OUTPUT + gc_output_cache_sampling(); #endif // GC_CACHE_ADAPT #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) Start mark phase \n", udn_tile_coord_x(), @@ -3700,7 +3521,7 @@ inline void gc_master(struct garbagelist * stackptr) { // restore the gcstatus of all cores // Note: all cores have to do mark including non-gc cores gccorestatus[BAMBOO_NUM_OF_CORE] = 1; - for(i = 1; i < NUMCORESACTIVE /*NUMCORES4GC*/; ++i) { + for(i = 1; i < NUMCORESACTIVE; ++i) { gccorestatus[i] = 1; // send GC start messages to all cores send_msg_1(i, GCSTART, false); @@ -3739,7 +3560,6 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) prepare to cache large objs \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif // cache all large objs if(!cacheLObjs()) { @@ -3754,7 +3574,6 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) mark phase finished \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif //int tmptopptr = 0; //BASEPTR(gctopcore, 0, &tmptopptr); @@ -3770,13 +3589,13 @@ inline void gc_master(struct garbagelist * stackptr) { BASEPTR(i, numpbc, &tmpcoreptr); //send start compact messages to all cores //TODO bug here, do not know if the direction is positive or negtive? - if (tmpcoreptr < tmpheaptop /*tmptopptr*/) { + if (tmpcoreptr < tmpheaptop) { gcstopblock[i] = numpbc + 1; if(i != STARTUPCORE) { send_msg_2(i, GCSTARTCOMPACT, numpbc+1, false); } else { gcblock2fill = numpbc+1; - } // if(i != STARTUPCORE) + } // if(i != STARTUPCORE) } else { gcstopblock[i] = numpbc; if(i != STARTUPCORE) { @@ -3900,14 +3719,12 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) prepare to move large objs \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif // move largeObjs moveLObjs(); #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) compact phase finished \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif RUNFREE(orig); RUNFREE(to); @@ -3951,7 +3768,7 @@ inline void gc_master(struct garbagelist * stackptr) { gccorestatus[BAMBOO_NUM_OF_CORE] = 1; // Note: all cores should flush their runtime data including non-gc // cores - for(i = 1; i < NUMCORESACTIVE /*NUMCORES4GC*/; ++i) { + for(i = 1; i < NUMCORESACTIVE; ++i) { // send start flush messages to all cores gccorestatus[i] = 1; send_msg_1(i, GCSTARTFLUSH, false); @@ -3965,6 +3782,7 @@ inline void gc_master(struct garbagelist * stackptr) { #endif // flush phase flush(stackptr); + #ifdef GC_CACHE_ADAPT // now the master core need to decide the new cache strategy cacheAdapt_master(); @@ -3993,7 +3811,7 @@ inline void gc_master(struct garbagelist * stackptr) { gccorestatus[BAMBOO_NUM_OF_CORE] = 1; // Note: all cores should flush their runtime data including non-gc // cores - for(i = 1; i < NUMCORESACTIVE /*NUMCORES4GC*/; ++i) { + for(i = 1; i < NUMCORESACTIVE; ++i) { // send start flush messages to all cores gccorestatus[i] = 1; send_msg_1(i, GCSTARTPREF, false); @@ -4036,7 +3854,7 @@ inline void gc_master(struct garbagelist * stackptr) { gc_profileEnd(); #endif gccorestatus[BAMBOO_NUM_OF_CORE] = 1; - for(i = 1; i < NUMCORESACTIVE /*NUMCORES4GC*/; ++i) { + for(i = 1; i < NUMCORESACTIVE; ++i) { // send gc finish messages to all cores send_msg_1(i, GCFINISH, false); gccorestatus[i] = 1; @@ -4044,7 +3862,6 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) gc finished \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif } // void gc_master(struct garbagelist * stackptr) @@ -4091,7 +3908,6 @@ inline bool gc(struct garbagelist * stackptr) { gc_profileStart(); #endif pregccheck: - //BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); gcnumsendobjs[0][BAMBOO_NUM_OF_CORE] = self_numsendobjs; gcnumreceiveobjs[0][BAMBOO_NUM_OF_CORE] = self_numreceiveobjs; int sumsendobj = 0; @@ -4135,7 +3951,6 @@ pregccheck: } #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) start gc! \n", udn_tile_coord_x(), udn_tile_coord_y()); - //dumpSMem(); #endif // Zero out the remaining bamboo_cur_msp // Only zero out the first 4 bytes of the remaining memory @@ -4156,8 +3971,6 @@ pregccheck: #endif #ifdef GC_CACHE_ADAPT #ifdef GC_CACHE_SAMPLING - // disable the timer interrupt - //bamboo_mask_timer_intr(); // get the sampling data bamboo_output_dtlb_sampling(); #endif // GC_CACHE_SAMPLING @@ -4184,8 +3997,6 @@ pregccheck: #endif #ifdef GC_CACHE_ADAPT #ifdef GC_CACHE_SAMPLING - // disable the timer interrupt - //bamboo_mask_timer_intr(); if(BAMBOO_NUM_OF_CORE < NUMCORESACTIVE) { // get the sampling data bamboo_output_dtlb_sampling(); @@ -4221,8 +4032,6 @@ pregccheck: #endif #ifdef GC_CACHE_ADAPT #ifdef GC_CACHE_SAMPLING - // disable the timer interrupt - //bamboo_mask_timer_intr(); if(BAMBOO_NUM_OF_CORE < NUMCORESACTIVE) { // get the sampling data bamboo_output_dtlb_sampling(); @@ -4301,30 +4110,6 @@ inline void gc_profileEnd(void) { // output the profiling data void gc_outputProfileData() { -/*#ifdef USEIO - int i,j; - unsigned long long totalgc = 0; - - //printf("Start Time, End Time, Duration\n"); - // output task related info - for(i = 0; i < gc_infoIndex; i++) { - GCInfo * gcInfo = gc_infoArray[i]; - unsigned long long tmp = 0; - for(j = 0; j < gcInfo->index; j++) { - printf("%lld(%lld), ", gcInfo->time[j], (gcInfo->time[j]-tmp)); - tmp = gcInfo->time[j]; - } - tmp = (tmp-gcInfo->time[0]); - printf(" ++ %lld \n", tmp); - totalgc += tmp; - } - - if(gc_infoOverflow) { - printf("Caution: gc info overflow!\n"); - } - - printf("\n\n total gc time: %lld \n", totalgc); -#else*/ int i = 0; int j = 0; unsigned long long totalgc = 0; @@ -4372,7 +4157,6 @@ void gc_outputProfileData() { #ifndef BAMBOO_MEMPROF BAMBOO_DEBUGPRINT(0xeeee); #endif -//#endif } #endif // #ifdef GC_PROFILE diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 2b049282..2cb3cebe 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -53,10 +53,6 @@ unsigned long long gc_num_freespace; unsigned long long gc_num_lobjspace; unsigned int gc_num_lobj; -// TODO -/*unsigned long long flushstalltime; -unsigned long long flushstalltime_i; -int num_mapinforequest_i;*/ unsigned int gc_num_liveobj; unsigned int gc_num_obj; unsigned int gc_num_forwardobj; @@ -131,16 +127,6 @@ volatile bool gctomove; int gcrequiredmems[NUMCORES4GC]; //record pending mem requests volatile int gcmovepending; -// data structures to record remote cores that transferred the marked -// objs in the mark phase -/*struct rcoreinfo{ - int high; - int low; -}; -struct RuntimeHash * gcrcoretbl; -#define NUM_MAPPING 40 -void * gcmappingtbl[NUMCORESACTIVE][NUM_MAPPING];*/ - // shared memory pointer for shared pointer mapping tbls // In GC version, this block of memory is located at the bottom of the // shared memory, right on the top of the smem tbl. @@ -151,14 +137,12 @@ void * gcmappingtbl[NUMCORESACTIVE][NUM_MAPPING];*/ #ifdef GC_SMALLPAGESIZE #define BAMBOO_RMSP_SIZE (1024 * 1024) #else -#define BAMBOO_RMSP_SIZE (BAMBOO_SMEM_SIZE*2) // (45 * 16 * 1024) +#define BAMBOO_RMSP_SIZE (BAMBOO_SMEM_SIZE) // (45 * 16 * 1024) #endif mspace bamboo_rmsp; // shared pointer mapping tbl -//volatile struct GCSharedHash * gcsharedptbl; mgcsharedhashtbl_t * gcsharedptbl; // remote shared pointer tbls -//struct GCSharedHash * gcrpointertbls[NUMCORES4GC]; mgcsharedhashtbl_t * gcrpointertbls[NUMCORES4GC]; #ifdef LOCALHASHTBL_TEST @@ -166,7 +150,6 @@ struct RuntimeHash * gcpointertbl; #else mgchashtable_t * gcpointertbl; #endif -//struct MGCHash * gcpointertbl; int gcobj2map; int gcmappedobj; volatile bool gcismapped; diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index 140d68f5..9141b067 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -12,7 +12,6 @@ #ifdef MULTICORE #include "runtime_arch.h" #endif -//#include "option.h" extern int classsize[]; extern int typearray[]; @@ -160,12 +159,10 @@ void CALL11(___System______exit____I,int ___status___, int ___status___) { #endif } -//#ifdef D___Vector______removeElement_____AR_L___Object____I_I void CALL23(___Vector______removeElement_____AR_L___Object____I_I, int ___index___, int ___size___, struct ArrayObject * ___array___, int ___index___, int ___size___) { char* offset=((char *)(&VAR(___array___)->___length___))+sizeof(unsigned int)+sizeof(void *)*___index___; memmove(offset, offset+sizeof(void *),(___size___-___index___-1)*sizeof(void *)); } -//#endif void CALL11(___System______printI____I,int ___status___, int ___status___) { #ifdef MULTICORE @@ -256,7 +253,6 @@ void * allocate_new(int type) { struct ___Object___ * v=FREEMALLOC(classsize[type]); v->type=type; v->version = 0; - //v->numlocks = 0; v->lock = NULL; initlock(v); return v; @@ -268,7 +264,6 @@ struct ArrayObject * allocate_newarray(int type, int length) { struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); v->type=type; v->version = 0; - //v->numlocks = 0; v->lock = NULL; v->___length___=length; initlock(v); diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.h b/Robust/src/Runtime/bamboo/multicoreruntime.h index e4e6615f..8c12074b 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.h +++ b/Robust/src/Runtime/bamboo/multicoreruntime.h @@ -33,13 +33,12 @@ int outmsgindex; int outmsglast; int outmsgleft; volatile bool isMsgHanging; -//volatile bool isMsgSending; #define MSG_INDEXINC_I() \ - msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK) //% (BAMBOO_MSG_BUF_LENGTH) + msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK) #define MSG_LASTINDEXINC_I() \ - msgdatalast = (msgdatalast + 1) & (BAMBOO_MSG_BUF_MASK) // % (BAMBOO_MSG_BUF_LENGTH) + msgdatalast = (msgdatalast + 1) & (BAMBOO_MSG_BUF_MASK) #define MSG_CACHE_I(n) \ msgdata[msgdatalast] = (n); \ @@ -58,10 +57,10 @@ volatile bool isMsgHanging; } #define OUTMSG_INDEXINC() \ - outmsgindex = (outmsgindex + 1) & (BAMBOO_OUT_BUF_MASK) //% (BAMBOO_OUT_BUF_LENGTH) + outmsgindex = (outmsgindex + 1) & (BAMBOO_OUT_BUF_MASK) #define OUTMSG_LASTINDEXINC() \ - outmsglast = (outmsglast + 1) & (BAMBOO_OUT_BUF_MASK) //% (BAMBOO_OUT_BUF_LENGTH); \ + outmsglast = (outmsglast + 1) & (BAMBOO_OUT_BUF_MASK); \ if(outmsglast == outmsgindex) { \ BAMBOO_EXIT(0xdd01); \ } @@ -342,8 +341,7 @@ struct Queue * totransobjqueue; // queue to hold objs to be transferred #define BAMBOO_PAGE_SIZE (1024 * 1024) // (4096) #define BAMBOO_SMEM_SIZE (BAMBOO_PAGE_SIZE) #endif // GC_LARGEPAGESIZE -#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_SMEM_SIZE) * (BAMBOO_NUM_BLOCKS)) //(1024 * 1024 * 240) -//((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G +#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_SMEM_SIZE) * (BAMBOO_NUM_BLOCKS)) //(1024 * 1024 * 240) //((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G #endif // GC_DEBUG #ifdef MULTICORE_GC @@ -384,35 +382,11 @@ struct freeMemList { // to access volatile int * bamboo_smemtbl; volatile int bamboo_free_block; -//bool bamboo_smem_flushed; -//struct freeMemList * bamboo_free_mem_list; int bamboo_reserved_smem; // reserved blocks on the top of the shared heap // e.g. 20% of the heap and should not be allocated // otherwise gc is invoked volatile INTPTR bamboo_smem_zero_top; #define BAMBOO_SMEM_ZERO_UNIT_SIZE (4 * 1024) // 4KB - -#ifdef GC_CACHE_ADAPT -typedef union -{ - unsigned int word; - struct - { - // policy type - unsigned int cache_mode : 2; - // Reserved. - unsigned int __reserved_0 : 6; - // Location Override Target Y - unsigned int lotar_y : 4; - // Reserved. - unsigned int __reserved_1 : 4; - // Location Override Target X - unsigned int lotar_x : 4; - // Reserved. - unsigned int __reserved_2 : 12; - }; -} bamboo_cache_policy_t; -#endif // GC_CACHE_ADAPT #else //volatile mspace bamboo_free_msp; INTPTR bamboo_free_smemp; @@ -434,9 +408,7 @@ int total_num_t6; #endif // PROFILE_INTERRUPT bool stall; -//bool isInterrupt; int totalexetime; -//unsigned long long interrupttime; typedef struct task_info { char* taskName; diff --git a/Robust/src/Runtime/bamboo/multicoretask.c b/Robust/src/Runtime/bamboo/multicoretask.c index c56bf727..6432c1dd 100644 --- a/Robust/src/Runtime/bamboo/multicoretask.c +++ b/Robust/src/Runtime/bamboo/multicoretask.c @@ -239,8 +239,6 @@ void setupsmemmode(void) { #else // defaultly using local mode bamboo_smem_mode = SMEMLOCAL; - //bamboo_smem_mode = SMEMGLOBAL; - //bamboo_smem_mode = SMEMFIXED; #endif } // void setupsmemmode(void) #endif @@ -304,7 +302,6 @@ void initruntimedata() { outmsglast = 0; outmsgleft = 0; isMsgHanging = false; - //isMsgSending = false; smemflag = true; bamboo_cur_msp = NULL; @@ -316,7 +313,6 @@ void initruntimedata() { gcflag = false; gcprocessing = false; gcphase = FINISHPHASE; - //gcnumpre = 0; gcprecheck = true; gccurr_heaptop = 0; gcself_numsendobjs = 0; @@ -327,11 +323,9 @@ void initruntimedata() { #else gcpointertbl = mgchashCreate_I(2000, 0.75); #endif - //gcpointertbl = allocateMGCHash_I(20); gcforwardobjtbl = allocateMGCHash_I(20, 3); gcobj2map = 0; gcmappedobj = 0; - //gcismapped = false; gcnumlobjs = 0; gcheaptop = 0; gctopcore = 0; @@ -353,13 +347,12 @@ void initruntimedata() { kk++; } t_size = tmp_k >> kk; - gcsharedptbl = mgcsharedhashCreate_I(t_size,0.30);//allocateGCSharedHash_I(20); + gcsharedptbl = mgcsharedhashCreate_I(t_size,0.30); } else { gcsharedptbl = NULL; } BAMBOO_MEMSET_WH(gcrpointertbls, 0, sizeof(mgcsharedhashtbl_t *)*NUMCORES4GC); - //sizeof(struct RuntimeHash *)*NUMCORES4GC); #ifdef SMEMM gcmem_mixed_threshold = (unsigned int)((BAMBOO_SHARED_MEM_SIZE -bamboo_reserved_smem*BAMBOO_SMEM_SIZE)*0.8); @@ -405,9 +398,7 @@ void initruntimedata() { #ifdef PROFILE stall = false; - //isInterrupt = true; totalexetime = -1; - //interrupttime = 0; taskInfoIndex = 0; taskInfoOverflow = false; #ifdef PROFILE_INTERRUPT @@ -431,10 +422,7 @@ void disruntimedata() { #else mgchashDelete(gcpointertbl); #endif - //freeMGCHash(gcpointertbl); freeMGCHash(gcforwardobjtbl); - // for mapping info structures - //freeRuntimeHash(gcrcoretbl); #else freeRuntimeHash(lockRedirectTbl); freeRuntimeHash(objRedirectLockTbl); @@ -464,7 +452,7 @@ bool checkObjQueue() { if(!isEmpty(&objqueue)) { profileTaskStart("objqueue checking"); isChecking = true; - } // if(!isEmpty(&objqueue)) + } // if(!isEmpty(&objqueue)) #endif #endif @@ -474,9 +462,6 @@ bool checkObjQueue() { #ifdef DEBUG BAMBOO_DEBUGPRINT(0xf001); #endif -#ifdef PROFILE - //isInterrupt = false; -#endif #ifdef DEBUG BAMBOO_DEBUGPRINT(0xeee1); #endif @@ -556,9 +541,6 @@ bool checkObjQueue() { } // while(qitem != NULL) // try to execute active tasks already enqueued first addNewItem_I(&objqueue, objInfo); -#ifdef PROFILE - //isInterrupt = true; -#endif objqueuebreak: BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); #ifdef DEBUG @@ -663,9 +645,6 @@ void checkCoreStatus() { #ifdef USEIO totalexetime = BAMBOO_GET_EXE_TIME() - bamboo_start_time; #else -#ifdef PROFILE - //BAMBOO_DEBUGPRINT_REG(interrupttime); -#endif BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME() - bamboo_start_time); //BAMBOO_DEBUGPRINT_REG(total_num_t6); // TODO for test @@ -778,7 +757,6 @@ inline void run(void * arg) { BAMBOO_DEBUGPRINT_REG(corenum); BAMBOO_DEBUGPRINT(STARTUPCORE); #endif - //BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME()); // TODO // initialize runtime data structures initruntimedata(); @@ -802,9 +780,6 @@ inline void run(void * arg) { if(BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1) { // non-executing cores, only processing communications activetasks = NULL; -#ifdef PROFILE - //isInterrupt = false; -#endif fakeExecution(); } else { /* Create queue of active tasks */ @@ -1179,8 +1154,6 @@ struct ___TagDescriptor___ * allocate_tag(int index) { return v; } - - /* This function updates the flag for object ptr. It or's the flag with the or mask and and's it with the andmask. */ @@ -1271,7 +1244,6 @@ void enqueueObject(void * vptr, struct ___Object___ *ptr = (struct ___Object___ *)vptr; { - //struct QueueItem *tmpptr; struct parameterwrapper * parameter=NULL; int j; int i; @@ -1298,15 +1270,13 @@ void enqueueObject(void * vptr, goto nextloop; //that means the object has no tag //but that param needs tag else if(tagptr->type==TAGTYPE) { //one tag - //struct ___TagDescriptor___ * tag= - //(struct ___TagDescriptor___*) tagptr; for(i=0; inumbertags; i++) { //slotid is parameter->tagarray[2*i]; int tagid=parameter->tagarray[2*i+1]; if (tagid!=tagptr->flag) goto nextloop; /*We don't have this tag */ } - } else { //multiple tags + } else { //multiple tags struct ArrayObject * ao=(struct ArrayObject *) tagptr; for(i=0; inumbertags; i++) { //slotid is parameter->tagarray[2*i]; @@ -1345,7 +1315,6 @@ void enqueueObject_I(void * vptr, struct ___Object___ *ptr = (struct ___Object___ *)vptr; { - //struct QueueItem *tmpptr; struct parameterwrapper * parameter=NULL; int j; int i; @@ -1372,7 +1341,6 @@ void enqueueObject_I(void * vptr, goto nextloop; //that means the object has no tag //but that param needs tag else if(tagptr->type==TAGTYPE) { //one tag - //struct ___TagDescriptor___*tag=(struct ___TagDescriptor___*)tagptr; for(i=0; inumbertags; i++) { //slotid is parameter->tagarray[2*i]; int tagid=parameter->tagarray[2*i+1]; @@ -2067,7 +2035,7 @@ INLINE int checkMsgLength_I(int size) { #endif { // nonfixed size if(size > 1) { - msglength = msgdata[(msgdataindex+1)&(BAMBOO_MSG_BUF_MASK)/*%(BAMBOO_MSG_BUF_LENGTH)*/]; + msglength = msgdata[(msgdataindex+1)&(BAMBOO_MSG_BUF_MASK)]; } else { return -1; } @@ -2103,14 +2071,6 @@ INLINE int checkMsgLength_I(int size) { } INLINE void processmsg_transobj_I() { -#ifdef PROFILE_INTERRUPT - /*if(!interruptInfoOverflow) { - InterruptInfo* intInfo = RUNMALLOC_I(sizeof(struct interrupt_info)); - interruptInfoArray[interruptInfoIndex] = intInfo; - intInfo->startTime = BAMBOO_GET_EXE_TIME(); - intInfo->endTime = -1; - }*/ -#endif MSG_INDEXINC_I(); struct transObjInfo * transObj=RUNMALLOC_I(sizeof(struct transObjInfo)); int k = 0; @@ -2133,18 +2093,8 @@ INLINE void processmsg_transobj_I() { for(k = 0; k < transObj->length; ++k) { transObj->queues[2*k] = msgdata[msgdataindex]; //[3+2*k]; MSG_INDEXINC_I(); -#ifdef DEBUG -#ifndef CLOSE_PRINT - //BAMBOO_DEBUGPRINT_REG(transObj->queues[2*k]); -#endif -#endif transObj->queues[2*k+1] = msgdata[msgdataindex]; //[3+2*k+1]; MSG_INDEXINC_I(); -#ifdef DEBUG -#ifndef CLOSE_PRINT - //BAMBOO_DEBUGPRINT_REG(transObj->queues[2*k+1]); -#endif -#endif } // check if there is an existing duplicate item { @@ -2188,15 +2138,6 @@ INLINE void processmsg_transobj_I() { } } #endif -#ifdef PROFILE_INTERRUPT - /*if(!interruptInfoOverflow) { - interruptInfoArray[interruptInfoIndex]->endTime=BAMBOO_GET_EXE_TIME(); - interruptInfoIndex++; - if(interruptInfoIndex == INTERRUPTINFOLENGTH) { - interruptInfoOverflow = true; - } - }*/ -#endif } INLINE void processmsg_transtall_I() { @@ -2552,14 +2493,6 @@ INLINE void processmsg_terminate_I() { } INLINE void processmsg_memrequest_I() { -#ifdef PROFILE_INTERRUPT - /*if(!interruptInfoOverflow) { - InterruptInfo* intInfo = RUNMALLOC_I(sizeof(struct interrupt_info)); - interruptInfoArray[interruptInfoIndex] = intInfo; - intInfo->startTime = BAMBOO_GET_EXE_TIME(); - intInfo->endTime = -1; - }*/ -#endif int data1 = msgdata[msgdataindex]; MSG_INDEXINC_I(); int data2 = msgdata[msgdataindex]; @@ -2608,15 +2541,6 @@ INLINE void processmsg_memrequest_I() { } #endif } -#ifdef PROFILE_INTERRUPT - /*if(!interruptInfoOverflow) { - interruptInfoArray[interruptInfoIndex]->endTime=BAMBOO_GET_EXE_TIME(); - interruptInfoIndex++; - if(interruptInfoIndex == INTERRUPTINFOLENGTH) { - interruptInfoOverflow = true; - } - }*/ -#endif } INLINE void processmsg_memresponse_I() { @@ -2644,7 +2568,6 @@ INLINE void processmsg_memresponse_I() { #ifdef MULTICORE_GC // fill header to store the size of this mem block BAMBOO_MEMSET_WH(data1, '\0', BAMBOO_CACHE_LINE_SIZE); - //memset(data1, 0, BAMBOO_CACHE_LINE_SIZE); (*((int*)data1)) = data2; bamboo_smem_size = data2 - BAMBOO_CACHE_LINE_SIZE; bamboo_cur_msp = data1 + BAMBOO_CACHE_LINE_SIZE; @@ -2946,28 +2869,15 @@ INLINE void processmsg_gcmovestart_I() { } INLINE void processmsg_gcmaprequest_I() { -#ifdef GC_PROFILE - //unsigned long long ttime = BAMBOO_GET_EXE_TIME(); -#endif void * dstptr = NULL; int data1 = msgdata[msgdataindex]; MSG_INDEXINC_I(); int data2 = msgdata[msgdataindex]; MSG_INDEXINC_I(); -#ifdef GC_PROFILE - // TODO unsigned long long ttime = BAMBOO_GET_EXE_TIME(); -#endif #ifdef LOCALHASHTBL_TEST RuntimeHashget(gcpointertbl, data1, &dstptr); #else dstptr = mgchashSearch(gcpointertbl, data1); -#endif - //MGCHashget(gcpointertbl, data1, &dstptr); -#ifdef GC_PROFILE - // TODO flushstalltime += BAMBOO_GET_EXE_TIME() - ttime; -#endif -#ifdef GC_PROFILE - // TODO unsigned long long ttimei = BAMBOO_GET_EXE_TIME(); #endif if(NULL == dstptr) { // no such pointer in this core, something is wrong @@ -2976,12 +2886,6 @@ INLINE void processmsg_gcmaprequest_I() { BAMBOO_DEBUGPRINT_REG(data2); #endif BAMBOO_EXIT(0xe01c); - //assume that the object was not moved, use the original address - /*if(isMsgSending) { - cache_msg_3(msgdata[2], GCMAPINFO, msgdata[1], msgdata[1]); - } else { - send_msg_3(msgdata[2], GCMAPINFO, msgdata[1], msgdata[1]); - }*/ } else { // send back the mapping info, cache the msg first if(BAMBOO_CHECK_SEND_MODE()) { @@ -2990,16 +2894,9 @@ INLINE void processmsg_gcmaprequest_I() { send_msg_3(data2, GCMAPINFO, data1, (int)dstptr, true); } } -#ifdef GC_PROFILE - // TODO flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimei; - //num_mapinforequest_i++; -#endif } INLINE void processmsg_gcmapinfo_I() { -#ifdef GC_PROFILE - //unsigned long long ttime = BAMBOO_GET_EXE_TIME(); -#endif int data1 = msgdata[msgdataindex]; MSG_INDEXINC_I(); gcmappedobj = msgdata[msgdataindex]; // [2] @@ -3009,13 +2906,9 @@ INLINE void processmsg_gcmapinfo_I() { #else mgchashInsert_I(gcpointertbl, data1, gcmappedobj); #endif - //MGCHashadd_I(gcpointertbl, data1, gcmappedobj); if(data1 == gcobj2map) { gcismapped = true; } -#ifdef GC_PROFILE - //flushstalltime += BAMBOO_GET_EXE_TIME() - ttime; -#endif } INLINE void processmsg_gcmaptbl_I() { @@ -3023,7 +2916,7 @@ INLINE void processmsg_gcmaptbl_I() { MSG_INDEXINC_I(); int data2 = msgdata[msgdataindex]; MSG_INDEXINC_I(); - gcrpointertbls[data2] = (mgcsharedhashtbl_t *)data1; //(struct GCSharedHash *)data1; + gcrpointertbls[data2] = (mgcsharedhashtbl_t *)data1; } INLINE void processmsg_gclobjinfo_I() { @@ -3069,7 +2962,6 @@ INLINE void processmsg_gclobjmapping_I() { #else mgchashInsert_I(gcpointertbl, data1, data2); #endif - //MGCHashadd_I(gcpointertbl, data1, data2); mgcsharedhashInsert_I(gcsharedptbl, data1, data2); } @@ -3160,8 +3052,6 @@ processmsg: type = msgdata[msgdataindex]; //[0] MSG_INDEXINC_I(); msgdatafull = false; - // TODO - //tprintf("msg type: %x\n", type); switch(type) { case TRANSOBJ: { // receive a object transfer msg @@ -3428,8 +3318,6 @@ processmsg: break; } // switch(type) msglength = BAMBOO_MSG_BUF_LENGTH; - // TODO - //printf("++ msg: %x \n", type); if((msgdataindex != msgdatalast) || (msgdatafull)) { // still have available msg @@ -3474,7 +3362,6 @@ int enqueuetasks(struct parameterwrapper *parameter, int numenterflags) { void * taskpointerarray[MAXTASKPARAMS]; int j; - //int numparams=parameter->task->numParameters; int numiterators=parameter->task->numTotal-1; int retval=1; @@ -3522,8 +3409,7 @@ backtrackinit: tpd->parameterArray[j]=taskpointerarray[j]; } /* Enqueue task */ - if (( /*!gencontains(failedtasks, tpd)&&*/ - !gencontains(activetasks,tpd))) { + if (!gencontains(activetasks,tpd)) { genputtable(activetasks, tpd, tpd); } else { RUNFREE(tpd->parameterArray); @@ -3560,11 +3446,8 @@ int enqueuetasks_I(struct parameterwrapper *parameter, int numenterflags) { void * taskpointerarray[MAXTASKPARAMS]; int j; - //int numparams=parameter->task->numParameters; int numiterators=parameter->task->numTotal-1; int retval=1; - //int addnormal=1; - //int adderror=1; struct taskdescriptor * task=parameter->task; @@ -3610,8 +3493,7 @@ backtrackinit: tpd->parameterArray[j]=taskpointerarray[j]; } /* Enqueue task */ - if (( /*!gencontains(failedtasks, tpd)&&*/ - !gencontains(activetasks,tpd))) { + if (!gencontains(activetasks,tpd)) { genputtable_I(activetasks, tpd, tpd); } else { RUNFREE(tpd->parameterArray); @@ -3728,15 +3610,12 @@ newtask: #endif /* See if there are any active tasks */ - //if (hashsize(activetasks)>0) { int i; #ifdef PROFILE #ifdef ACCURATEPROFILE profileTaskStart("tpd checking"); #endif #endif - //long clock1; - //clock1 = BAMBOO_GET_EXE_TIME(); busystatus = true; currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks); @@ -3745,13 +3624,8 @@ newtask: numparams=currtpd->task->numParameters; numtotal=currtpd->task->numTotal; - // clear the lockRedirectTbl // (TODO, this table should be empty after all locks are released) // reset all locks - /*for(j = 0; j < MAXTASKPARAMS; j++) { - runtime_locks[j].redirectlock = 0; - runtime_locks[j].value = 0; - }*/ // get all required locks runtime_locklen = 0; // check which locks are needed @@ -3790,12 +3664,10 @@ newtask: runtime_locklen++; } } // line 2713: for(i = 0; i < numparams; i++) - // grab these required locks + // grab these required locks #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe991); #endif - //long clock2; - //clock2 = BAMBOO_GET_EXE_TIME(); for(i = 0; i < runtime_locklen; i++) { int * lock = (int *)(runtime_locks[i].redirectlock); @@ -3809,9 +3681,6 @@ newtask: BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); #ifdef DEBUG BAMBOO_DEBUGPRINT(0xf001); -#endif -#ifdef PROFILE - //isInterrupt = false; #endif while(!lockflag) { BAMBOO_WAITING_FOR_LOCK(0); @@ -3830,9 +3699,6 @@ newtask: lockflag = false; #ifndef INTERRUPT reside = false; -#endif -#ifdef PROFILE - //isInterrupt = true; #endif BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); #ifdef DEBUG @@ -3865,14 +3731,9 @@ newtask: #endif #endif goto newtask; - //} } } // line 2752: for(i = 0; i < runtime_locklen; i++) - /*long clock3; - clock3 = BAMBOO_GET_EXE_TIME(); - //tprintf("sort: %d, grab: %d \n", clock2-clock1, clock3-clock2);*/ - #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe993); #endif @@ -3906,7 +3767,7 @@ newtask: goto newtask; } } // line2865 - /* Check if the object's flags still meets requirements */ + /* Check if the object's flags still meets requirements */ { int tmpi = 0; bool ismet = false; @@ -3977,7 +3838,7 @@ parameterpresent: taskpointerarray[i+OFFSET]=parameter; } // line 2824: for(i=0; iparameterArray[i]; } @@ -3996,19 +3857,11 @@ execute: #endif profileTaskStart(currtpd->task->name); #endif - // TODO - //long clock4; - //clock4 = BAMBOO_GET_EXE_TIME(); - //tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3)); #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe997); #endif ((void (*)(void **))currtpd->task->taskptr)(taskpointerarray); - // TODO - //long clock5; - //clock5 = BAMBOO_GET_EXE_TIME(); - // tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3)); #ifdef PROFILE #ifdef ACCURATEPROFILE @@ -4050,10 +3903,6 @@ execute: } } // line 3015: if(islock) - //long clock6; - //clock6 = BAMBOO_GET_EXE_TIME(); - //tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3)); - #ifdef PROFILE // post task execution finish, set the end of the postTaskInfo profileTaskEnd(); @@ -4066,10 +3915,6 @@ execute: #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe99a); #endif - //long clock7; - //clock7 = BAMBOO_GET_EXE_TIME(); - //tprintf("sort: %d, grab: %d, check: %d, release: %d, other %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3), (int)(clock6-clock5), (int)(clock7-clock6)); - } // //} // if (hashsize(activetasks)>0) } // while(hashsize(activetasks)>0) @@ -4121,7 +3966,6 @@ void processobject(struct parameterwrapper *parameter, for(i=0; inumbertags; i++) { int slotid=pd->tagarray[2*i]; - //int tagid=pd->tagarray[2*i+1]; if (statusarray[slotid+numparams]!=0) { /* This tag has already been enqueued, use it to narrow search */ parameter->iterators[*iteratorcount].tagbindings[tagcount]= @@ -4434,7 +4278,6 @@ inline void profileTaskEnd() { taskInfoIndex++; if(taskInfoIndex == TASKINFOLENGTH) { taskInfoOverflow = true; - //taskInfoIndex = 0; } } } @@ -4447,7 +4290,6 @@ void outputProfileData() { unsigned long long preprocessingtime = 0; unsigned long long objqueuecheckingtime = 0; unsigned long long postprocessingtime = 0; - //int interruptiontime = 0; unsigned long long other = 0; unsigned long long averagetasktime = 0; int tasknum = 0; @@ -4523,7 +4365,6 @@ void outputProfileData() { printf("\nAverage task execution time: %lld\n", averagetasktime); - //printf("\nTotal time spent for interruptions: %lld\n", interrupttime); #else int i = 0; int j = 0; -- 2.34.1