gcrequiredmems[i] = 0;
gcfilledblocks[i] = 0;
gcstopblock[i] = 0;
- } // for(i = 0; i < NUMCORES4GC; ++i)
+ } // for(i = 0; i < NUMCORES4GC; ++i)
for(i = NUMCORES4GC; i < NUMCORESACTIVE; ++i) {
gccorestatus[i] = 1;
gcnumsendobjs[i] = 0;
gcheaptop = 0;
gctopcore = 0;
gctopblock = 0;
- } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE)
+ } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE)
gcself_numsendobjs = 0;
gcself_numreceiveobjs = 0;
gcmarkedptrbound = 0;
gcobj2map = 0;
gcmappedobj = 0;
- gcismapped = false;
+ //gcismapped = false;
gcnumlobjs = 0;
gcmovestartaddr = 0;
gctomove = false;
freeMGCHash(gcforwardobjtbl);
gcforwardobjtbl = allocateMGCHash(20, 3);
+ // initialize the mapping info related structures
+ freeRuntimeHash(gcrcoretbl);
+ gcrcoretbl = allocateRuntimeHash(20);
+ BAMBOO_MEMSET_WH(gcmappingtbl, 0,
+ sizeof(void *)*NUMCORESACTIVE*NUM_MAPPING);
#ifdef GC_PROFILE
// TODO
num_mapinforequest = 0;
tmpheaptop = gcbaseva;
} else {
tmpheaptop = gcbaseva+bamboo_smemtbl[i]+((i<NUMCORES4GC) ?
- (BAMBOO_SMEM_SIZE_L*i) :
- (BAMBOO_SMEM_SIZE*(i-NUMCORES4GC)+BAMBOO_LARGE_SMEM_BOUND));
+ (BAMBOO_SMEM_SIZE_L*i) :
+ (BAMBOO_SMEM_SIZE*(i-NUMCORES4GC)+BAMBOO_LARGE_SMEM_BOUND));
}
// move large objs from gcheaptop to tmpheaptop
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
//mgchashInsert_I(ptr, tmpheaptop);
RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop);
+ //struct nodemappinginfo * nodeinfo = NULL;
+ //RuntimeHashget(gcpointertbl, ptr, &nodeinfo);
+ //nodeinfo->ptr = tmpheaptop;
//MGCHashadd_I(gcpointertbl, ptr, tmpheaptop);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
//}
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
//mgchashInsert_I(ptr, tmpheaptop);
RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop);
+ //struct nodemappinginfo * nodeinfo = NULL;
+ //RuntimeHashget(gcpointertbl, ptr, &nodeinfo);
+ //nodeinfo->ptr = tmpheaptop;
//MGCHashadd_I(gcpointertbl, ptr, tmpheaptop);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
//}
// set the flag as DISCOVERED
((int *)objptr)[6] = DISCOVERED;
gc_enqueue_I(objptr);
- }
+ // insert the obj and request core info into mapping hashtable
+ /*struct nodemappinginfo * nodeinfo =
+ (struct nodemappinginfo *)RUNMALLOC_I(sizeof(struct nodemappinginfo));
+ nodeinfo->ptr = NULL;
+ nodeinfo->cores = NULL;
+ RuntimeHashadd_I(gcpointertbl, (int)objptr, (int)nodeinfo);*/
+ }
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
} else {
#ifdef DEBUG
// check if this obj has been forwarded
if(!MGCHashcontains(gcforwardobjtbl, (int)objptr)) {
#ifdef GC_PROFILE
- unsigned long long ttime = BAMBOO_GET_EXE_TIME();
+ // TODO unsigned long long ttime = BAMBOO_GET_EXE_TIME();
#endif
// send a msg to host informing that objptr is active
- send_msg_2(host, GCMARKEDOBJ, objptr, false);
+ send_msg_3(host, GCMARKEDOBJ, objptr, BAMBOO_NUM_OF_CORE, false);
#ifdef GC_PROFILE
+ // TODO
+ /*
marktime += BAMBOO_GET_EXE_TIME() - ttime;
- num_markrequest++;
+ num_markrequest++;*/
#endif
gcself_numsendobjs++;
MGCHashadd(gcforwardobjtbl, (int)objptr);
// ptr is not an active obj or has been marked
checkfield = false;
} // if(isLarge(ptr, &type, &size)) else ...
- } /* can never reach here
- else {
- #ifdef DEBUG
- if(BAMBOO_NUM_OF_CORE == 0) {
- BAMBOO_DEBUGPRINT(0xbbbb);
- BAMBOO_DEBUGPRINT_REG(host);
- BAMBOO_DEBUGPRINT_REG(ptr);
- }
- #endif
- // check if this obj has been forwarded
- if(!MGCHashcontains(gcforwardobjtbl, (int)ptr)) {
- // send a msg to host informing that ptr is active
- send_msg_2(host, GCMARKEDOBJ, ptr);
- gcself_numsendobjs++;
- MGCHashadd(gcforwardobjtbl, (int)ptr);
- }
- checkfield = false;
- }// if(isLocal(ptr)) else ...*/
+ } /* can never reach here
+ else {
+#ifdef DEBUG
+ if(BAMBOO_NUM_OF_CORE == 0) {
+ BAMBOO_DEBUGPRINT(0xbbbb);
+ BAMBOO_DEBUGPRINT_REG(host);
+ BAMBOO_DEBUGPRINT_REG(ptr);
+ }
+#endif
+ // check if this obj has been forwarded
+ if(!MGCHashcontains(gcforwardobjtbl, (int)ptr)) {
+ // send a msg to host informing that ptr is active
+ send_msg_3(host, GCMARKEDOBJ, ptr, BAMBOO_NUM_OF_CORE, false);
+ gcself_numsendobjs++;
+ MGCHashadd(gcforwardobjtbl, (int)ptr);
+ }
+ checkfield = false;
+ }// if(isLocal(ptr)) else ...*/
} // if(ISSHAREDOBJ(ptr))
#ifdef DEBUG
BAMBOO_DEBUGPRINT(0xed06);
return true;
} // if(stopblock == to->numblocks)
} // if(to->top + isize > to->bound)
- // set the mark field to 2, indicating that this obj has been moved
- // and need to be flushed
+ // set the mark field to 2, indicating that this obj has been moved
+ // and need to be flushed
((int *)(orig->ptr))[6] = COMPACTED;
if(to->ptr != orig->ptr) {
if((int)(orig->ptr) < (int)(to->ptr)+size) {
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
//mgchashInsert_I(orig->ptr, to->ptr);
RuntimeHashadd_I(gcpointertbl, orig->ptr, to->ptr);
+ /*struct nodemappinginfo * nodeinfo = NULL;
+ RuntimeHashget(gcpointertbl, orig->ptr, &nodeinfo);
+ nodeinfo->ptr = to->ptr;*/
//MGCHashadd_I(gcpointertbl, orig->ptr, to->ptr);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
//}
// 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();
+ // TODO unsigned long long ttime = BAMBOO_GET_EXE_TIME();
#endif
//dstptr = mgchashSearch(objptr);
RuntimeHashget(gcpointertbl, objptr, &dstptr);
+ /*struct nodemappinginfo * nodeinfo = NULL;
+ RuntimeHashget(gcpointertbl, objptr, &nodeinfo);
+ if(nodeinfo == NULL) {
+ // currenly the mapping info is not ready TODO
+ // busy waiting until we get the mapping info
+ while(true) {
+ BAMBOO_WAITING_FOR_LOCK(0);
+ RuntimeHashget(gcpointertbl, objptr, &nodeinfo);
+ if(nodeinfo != NULL) {
+ break;
+ }
+ }
+ }
+ dstptr = nodeinfo->ptr;*/
#ifdef GC_PROFILE
- flushstalltime += BAMBOO_GET_EXE_TIME()-ttime;
+ // TODO flushstalltime += BAMBOO_GET_EXE_TIME()-ttime;
#endif
//MGCHashget(gcpointertbl, objptr, &dstptr);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
#ifdef DEBUG
BAMBOO_DEBUGPRINT_REG(dstptr);
#endif
+
if(NULL == dstptr) {
// no mapping info
#ifdef DEBUG
gcmappedobj = NULL;
#ifdef GC_PROFILE
// TODO
- num_mapinforequest++;
+ //num_mapinforequest++;
//unsigned long long ttime = BAMBOO_GET_EXE_TIME();
#endif
#ifdef GC_PROFILE
- unsigned long long ttimet = BAMBOO_GET_EXE_TIME();
+ // TODO unsigned long long ttimet = BAMBOO_GET_EXE_TIME();
#endif
// the first time require the mapping, send msg to the hostcore
// for the mapping info
}
}
#ifdef GC_PROFILE
- flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimet;
+ // TODO flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimet;
#endif
#ifdef GC_PROFILE
// TODO
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
//dstptr = mgchashSearch(objptr);
RuntimeHashget(gcpointertbl, objptr, &dstptr);
+ /*struct nodemappinginfo * nodeinfo = NULL;
+ RuntimeHashget(gcpointertbl, objptr, &nodeinfo);
+ dstptr = nodeinfo->ptr;*/
//MGCHashget(gcpointertbl, objptr, &dstptr);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
- } // if(hostcore(objptr) == BAMBOO_NUM_OF_CORE) else ...
+ } // if(hostcore(objptr) == BAMBOO_NUM_OF_CORE) else ...
#ifdef DEBUG
BAMBOO_DEBUGPRINT_REG(dstptr);
#endif
- } // if(NULL == dstptr)
+ } // if(NULL == dstptr)
} // if(ISSHAREDOBJ(objptr))
// if not a shared obj, return NULL to indicate no need to flush
#ifdef DEBUG
} // void flushRuntimeObj(struct garbagelist * stackptr)
+inline void transmappinginfo() {
+ // inform the other cores the mapping info they need
+ /*struct RuntimeIterator* it_pointertbl =
+ RuntimeHashcreateiterator(gcpointertbl);
+ while(RunhasNext(it_pointertbl)) {
+ int obj = Runkey(it_pointertbl);
+ struct nodemappinginfo * info =
+ (struct nodemappinginfo *)Runnext(it_pointertbl);
+ int newptr = (int)info->ptr;
+ struct requestcoreinfo * coreinfo = info->cores;
+ info->cores = NULL;
+ // send the mapping info to all requested cores
+ while(coreinfo != NULL) {
+ struct requestcoreinfo * tmp = coreinfo;
+ coreinfo = coreinfo->next;
+ send_msg_3(tmp->core, GCMAPINFO, obj, newptr, false);
+ RUNFREE(tmp); // release the node
+ }
+ }*/
+ int core = (BAMBOO_NUM_OF_CORE + 1) % NUMCORESACTIVE;
+ for(int i = 0; i < NUMCORESACTIVE - 1; i++) {
+ for(int j = 1; j < gcmappingtbl[core][0]+1; j++) {
+ int obj = gcmappingtbl[core][j];
+ int newptr = 0;
+ RuntimeHashget(gcpointertbl, obj, &newptr);
+ send_msg_3(core, GCMAPINFO, obj, newptr, false);
+ // TODO
+ //tprintf("send mapping %x -> %x, %x \n", (int)obj, (int)newptr, i);
+ }
+ // TODO
+ //tprintf("send mapping to core %d \n", core);
+ core = (core + 1) % NUMCORESACTIVE;
+ }
+
+ // TODO
+ //BAMBOO_DEBUGPRINT(0xeeee);
+
+ if(STARTUPCORE != BAMBOO_NUM_OF_CORE) {
+ send_msg_2(STARTUPCORE, GCFINISHMAPINFO, BAMBOO_NUM_OF_CORE, false);
+ }
+}
+
inline void flush(struct garbagelist * stackptr) {
#ifdef GC_PROFILE
- if(BAMBOO_NUM_OF_CORE == 0) {
+ /* TODO if(BAMBOO_NUM_OF_CORE == 0) {
BAMBOO_DEBUGPRINT(0xcccc);
BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
- }
+ }*/
#endif
+
flushRuntimeObj(stackptr);
#ifdef GC_PROFILE
- if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
+ // TODO if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
#endif
while(true) {
BAMBOO_DEBUGPRINT(0xe308);
#endif
#ifdef GC_PROFILE
- if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
+ // TODO if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
#endif
// TODO bug here: the startup core contains all lobjs' info, thus all the
BAMBOO_DEBUGPRINT(0xe310);
#endif
#ifdef GC_PROFILE
- if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
+ // TODO if(BAMBOO_NUM_OF_CORE == 0) BAMBOO_DEBUGPRINT_REG(BAMBOO_GET_EXE_TIME());
#endif
// send flush finish message to core coordinator
send_msg_2(STARTUPCORE, GCFINISHFLUSH, BAMBOO_NUM_OF_CORE, false);
}
#ifdef GC_PROFILE
- if(BAMBOO_NUM_OF_CORE == 0) {
+ // TODO
+ /*if(BAMBOO_NUM_OF_CORE == 0) {
BAMBOO_DEBUGPRINT(0xffff);
//BAMBOO_DEBUGPRINT_REG(num_mapinforequest);
- BAMBOO_DEBUGPRINT_REG(flushstalltime);
+ //BAMBOO_DEBUGPRINT_REG(flushstalltime);
//BAMBOO_DEBUGPRINT_REG(num_mapinforequest_i);
- BAMBOO_DEBUGPRINT_REG(flushstalltime_i);
- }
+ //BAMBOO_DEBUGPRINT_REG(flushstalltime_i);
+ }*/
//BAMBOO_DEBUGPRINT_REG(flushstalltime);
#endif
#ifdef DEBUG
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) Finish compact phase\n", udn_tile_coord_x(),
udn_tile_coord_y());
+#endif
+ while(true) {
+ if(MAPPHASE == gcphase) {
+ break;
+ }
+ }
+#ifdef RAWPATH // TODO GC_DEBUG
+ printf("(%x,%x) Start map phase\n", udn_tile_coord_x(),
+ udn_tile_coord_y());
+#endif
+ transmappinginfo();
+#ifdef RAWPATH // TODO GC_DEBUG
+ printf("(%x,%x) Finish map phase\n", udn_tile_coord_x(),
+ udn_tile_coord_y());
#endif
while(true) {
if(FLUSHPHASE == gcphase) {
#ifdef GC_PROFILE
gc_profileItem();
// TODO
- if(BAMBOO_NUM_OF_CORE == 0) {
+ /*if(BAMBOO_NUM_OF_CORE == 0) {
BAMBOO_DEBUGPRINT(0xeeee);
BAMBOO_DEBUGPRINT_REG(num_markrequest);
BAMBOO_DEBUGPRINT_REG(marktime);
- }
+ }*/
#endif
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) prepare to cache large objs \n", udn_tile_coord_x(),
RUNFREE(to);
orig = to = NULL;
+ gcphase = MAPPHASE;
+ gccorestatus[BAMBOO_NUM_OF_CORE] = 1;
+ // Note: all cores should flush their runtime data including non-gc
+ // cores
+ for(i = 1; i < NUMCORES4GC; ++i) {
+ // send start flush messages to all cores
+ gccorestatus[i] = 1;
+ send_msg_1(i, GCSTARTMAPINFO, false);
+ }
+#ifdef GC_PROFILE
+ gc_profileItem();
+#endif
+#ifdef RAWPATH // TODO GC_DEBUG
+ printf("(%x,%x) Start map phase \n", udn_tile_coord_x(),
+ udn_tile_coord_y());
+#endif
+ // mapinto phase
+ transmappinginfo();
+#ifdef RAWPATH // TODO GC_DEBUG
+ printf("(%x,%x) Finish map phase \n", udn_tile_coord_x(),
+ udn_tile_coord_y());
+#endif
+ gccorestatus[BAMBOO_NUM_OF_CORE] = 0;
+ while(MAPPHASE == gcphase) {
+ // check the status of all cores
+ BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
+ if(gc_checkCoreStatus_I()) {
+ // all cores have finished sending mapping info
+ BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
+ break;
+ }
+ BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
+ } // while(MAPPHASE == gcphase)
+
gcphase = FLUSHPHASE;
gccorestatus[BAMBOO_NUM_OF_CORE] = 1;
// Note: all cores should flush their runtime data including non-gc
gcforwardobjtbl = allocateMGCHash_I(20, 3);
gcobj2map = 0;
gcmappedobj = 0;
- gcismapped = false;
+ //gcismapped = false;
gcnumlobjs = 0;
gcheaptop = 0;
gctopcore = 0;
gcblock2fill = 0;
gcsbstarttbl = BAMBOO_BASE_VA;
bamboo_smemtbl = (void *)gcsbstarttbl
- + (BAMBOO_SHARED_MEM_SIZE/BAMBOO_SMEM_SIZE)*sizeof(INTPTR);
+ + (BAMBOO_SHARED_MEM_SIZE/BAMBOO_SMEM_SIZE)*sizeof(INTPTR);
+ // for mapping info structures
+ gcrcoretbl = allocateRuntimeHash_I(20);
+ BAMBOO_MEMSET_WH(gcmappingtbl, 0,
+ sizeof(void *)*NUMCORESACTIVE*NUM_MAPPING);
#else
// create the lock table, lockresult table and obj queue
locktable.size = 20;
freeRuntimeHash(gcpointertbl);
//freeMGCHash(gcpointertbl);
freeMGCHash(gcforwardobjtbl);
+ // for mapping info structures
+ freeRuntimeHash(gcrcoretbl);
#else
freeRuntimeHash(lockRedirectTbl);
freeRuntimeHash(objRedirectLockTbl);
#ifdef MULTICORE_GC
case GCSTARTINIT:
case GCSTART:
+ case GCSTARTMAPINFO:
case GCSTARTFLUSH:
case GCFINISH:
case GCMARKCONFIRM:
#ifdef MULTICORE_GC
case GCSTARTCOMPACT:
case GCFINISHINIT:
+ case GCFINISHMAPINFO:
case GCFINISHFLUSH:
- case GCMARKEDOBJ:
#endif
{
msglength = 2;
case MEMREQUEST:
case MEMRESPONSE:
#ifdef MULTICORE_GC
+ case GCMARKEDOBJ:
case GCMAPREQUEST:
case GCMAPINFO:
case GCLOBJMAPPING:
gcphase = COMPACTPHASE;
}
+INLINE void processmsg_gcstartmapinfo_I() {
+ gcphase = MAPPHASE;
+}
+
INLINE void processmsg_gcstartflush_I() {
gcphase = FLUSHPHASE;
}
} // if(cnum < NUMCORES4GC)
}
+INLINE void processmsg_gcfinishmapinfo_I() {
+ int data1 = msgdata[msgdataindex];
+ MSG_INDEXINC_I();
+ // received a map phase finish msg
+ if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
+ // non startup core can not receive this msg
+ // return -1
+#ifndef CLOSE_PRINT
+ BAMBOO_DEBUGPRINT_REG(data1);
+#endif
+ BAMBOO_EXIT(0xb004);
+ }
+ // all cores should do flush
+ if(data1 < NUMCORES4GC) {
+ gccorestatus[data1] = 0;
+ }
+}
+
+
INLINE void processmsg_gcfinishflush_I() {
int data1 = msgdata[msgdataindex];
MSG_INDEXINC_I();
#ifndef CLOSE_PRINT
BAMBOO_DEBUGPRINT_REG(data1);
#endif
- BAMBOO_EXIT(0xb004);
+ BAMBOO_EXIT(0xb005);
}
// all cores should do flush
if(data1 < NUMCORESACTIVE) {
if((BAMBOO_NUM_OF_CORE == STARTUPCORE)
|| (BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1)) {
// wrong core to receive such msg
- BAMBOO_EXIT(0xb005);
+ BAMBOO_EXIT(0xb006);
} else {
// send response msg, cahce the msg first
if(BAMBOO_CHECK_SEND_MODE()) {
#ifndef CLOSE_PRINT
BAMBOO_DEBUGPRINT_REG(data2);
#endif
- BAMBOO_EXIT(0xb006);
+ BAMBOO_EXIT(0xb007);
} else {
if(waitconfirm) {
numconfirm--;
INLINE void processmsg_gcmarkedobj_I() {
int data1 = msgdata[msgdataindex];
MSG_INDEXINC_I();
+ int data2 = msgdata[msgdataindex];
+ MSG_INDEXINC_I();
// received a markedObj msg
if(((int *)data1)[6] == INIT) {
// this is the first time that this object is discovered,
// set the flag as DISCOVERED
((int *)data1)[6] = DISCOVERED;
gc_enqueue_I(data1);
+ // insert the obj and request core info into mapping hashtable
+ /*struct requestcoreinfo * coreinfo =
+ (struct requestcoreinfo *)RUNMALLOC_I(sizeof(struct requestcoreinfo));
+ coreinfo->core = data2;
+ coreinfo->next = NULL;
+ struct nodemappinginfo * nodeinfo =
+ (struct nodemappinginfo *)RUNMALLOC_I(sizeof(struct nodemappinginfo));
+ nodeinfo->ptr = NULL;
+ nodeinfo->cores = coreinfo;
+ RuntimeHashadd_I(gcpointertbl, data1, (int)nodeinfo);*/
+ struct rcoreinfo * coreinfo =
+ (struct rcoreinfo *)RUNMALLOC_I(sizeof(struct rcoreinfo));
+ coreinfo->high = coreinfo->low = 0;
+ if(data2 > 31) {
+ coreinfo->high |= 1<<(data2-32);
+ } else {
+ coreinfo->low |= 1<<data2;
+ }
+ RuntimeHashadd_I(gcrcoretbl, data1, (int)coreinfo);
+ if(gcmappingtbl[data2][0] < NUM_MAPPING-1) {
+ int pos = ++gcmappingtbl[data2][0];
+ gcmappingtbl[data2][pos] = data1;
+ }
+ } else {
+ // record the request core
+ /*struct nodemappinginfo * nodeinfo = NULL;
+ RuntimeHashget(gcpointertbl, data1, &nodeinfo);
+ if(nodeinfo == NULL) {
+ // did not mark the obj, error!
+ BAMBOO_DEBUGPRINT_REG(((int *)data1)[6]);
+ BAMBOO_EXIT(0xb008);
+ } else {
+ struct requestcoreinfo * coreinfo = nodeinfo->cores;
+ if(coreinfo == NULL) {
+ nodeinfo->cores =
+ (struct requestcoreinfo *)RUNMALLOC_I(
+ sizeof(struct requestcoreinfo));
+ nodeinfo->cores->core = data2;
+ nodeinfo->cores->next = NULL;
+ } else {
+ while(true) {
+ if(coreinfo->core == data2) {
+ break;
+ } else if ((coreinfo->core > data2) ||
+ (coreinfo->next == NULL)) {
+ // insert here
+ struct requestcoreinfo * toinsert =
+ (struct requestcoreinfo *)RUNMALLOC_I(
+ sizeof(struct requestcoreinfo));
+ if(coreinfo->core > data2) {
+ toinsert->next = coreinfo->next;
+ toinsert->core = coreinfo->core;
+ coreinfo->core = data2;
+ } else {
+ toinsert->core = data2;
+ }
+ coreinfo->next = toinsert;
+ break;
+ } else {
+ coreinfo = coreinfo->next;
+ }
+ }
+ }
+ }*/
+ struct rcoreinfo * coreinfo = NULL;
+ RuntimeHashget(gcrcoretbl, data1, &coreinfo);
+ if(coreinfo == NULL) {
+ coreinfo =
+ (struct rcoreinfo *)RUNMALLOC_I(sizeof(struct rcoreinfo));
+ coreinfo->high = coreinfo->low = 0;
+ if(data2 > 31) {
+ coreinfo->high |= 1<<(data2-32);
+ } else {
+ coreinfo->low |= 1<<data2;
+ }
+ RuntimeHashadd_I(gcrcoretbl, data1, (int)coreinfo);
+ if(gcmappingtbl[data2][0] < NUM_MAPPING-1) {
+ int pos = ++gcmappingtbl[data2][0];
+ gcmappingtbl[data2][pos] = data1;
+ }
+ } else {
+ bool toadd = false;
+ if(data2 > 31) {
+ if((coreinfo->high)&(1<<(data2-32))==0) {
+ toadd = true;
+ coreinfo->high |= 1<<(data2-32);
+ }
+ } else {
+ if((coreinfo->low)&(1<<data2)==0) {
+ toadd = true;
+ coreinfo->low |= 1<<data2;
+ }
+ }
+ if((toadd) && (gcmappingtbl[data2][0] < NUM_MAPPING-1)) {
+ int pos = ++gcmappingtbl[data2][0];
+ gcmappingtbl[data2][pos] = data1;
+ }
+ }
}
gcself_numreceiveobjs++;
gcbusystatus = true;
}
INLINE void processmsg_gcmaprequest_I() {
+ // should not have such msg any more
+ //BAMBOO_EXIT(0xb009);
#ifdef GC_PROFILE
//unsigned long long ttime = BAMBOO_GET_EXE_TIME();
#endif
MSG_INDEXINC_I();
//dstptr = mgchashSearch(msgdata[1]);
#ifdef GC_PROFILE
- unsigned long long ttime = BAMBOO_GET_EXE_TIME();
+ // TODO unsigned long long ttime = BAMBOO_GET_EXE_TIME();
#endif
RuntimeHashget(gcpointertbl, data1, &dstptr);
#ifdef GC_PROFILE
- flushstalltime += BAMBOO_GET_EXE_TIME() - ttime;
+ // TODO flushstalltime += BAMBOO_GET_EXE_TIME() - ttime;
#endif
int data2 = msgdata[msgdataindex];
MSG_INDEXINC_I();
//MGCHashget(gcpointertbl, msgdata[1], &dstptr);
#ifdef GC_PROFILE
- unsigned long long ttimei = BAMBOO_GET_EXE_TIME();
+ // TODO unsigned long long ttimei = BAMBOO_GET_EXE_TIME();
#endif
if(NULL == dstptr) {
// no such pointer in this core, something is wrong
BAMBOO_DEBUGPRINT_REG(data1);
BAMBOO_DEBUGPRINT_REG(data2);
#endif
- BAMBOO_EXIT(0xb007);
+ BAMBOO_EXIT(0xb009);
//assume that the object was not moved, use the original address
/*if(isMsgSending) {
cache_msg_3(msgdata[2], GCMAPINFO, msgdata[1], msgdata[1]);
}
}
#ifdef GC_PROFILE
- flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimei;
+ // TODO flushstalltime_i += BAMBOO_GET_EXE_TIME()-ttimei;
//num_mapinforequest_i++;
#endif
}
#endif
int data1 = msgdata[msgdataindex];
MSG_INDEXINC_I();
+#if 0
if(data1 != gcobj2map) {
// obj not matched, something is wrong
#ifdef DEBUG
BAMBOO_DEBUGPRINT_REG(gcobj2map);
BAMBOO_DEBUGPRINT_REG(msgdata[1]);
#endif
- BAMBOO_EXIT(0xb008);
+ BAMBOO_EXIT(0xb00a);
} else {
+#endif
gcmappedobj = msgdata[msgdataindex]; // [2]
MSG_INDEXINC_I();
//mgchashReplace_I(msgdata[1], msgdata[2]);
//mgchashInsert_I(gcobj2map, gcmappedobj);
RuntimeHashadd_I(gcpointertbl, gcobj2map, gcmappedobj);
+ /*struct nodemappinginfo * nodeinfo =
+ (struct nodemappinginfo *)RUNMALLOC_I(sizeof(struct nodemappinginfo));
+ nodeinfo->ptr = (void *)gcmappedobj;
+ nodeinfo->cores = NULL;
+ RuntimeHashadd_I(gcpointertbl, data1, (int)nodeinfo);*/
//MGCHashadd_I(gcpointertbl, gcobj2map, gcmappedobj);
+// }
+ if(data1 == gcobj2map) {
+ gcismapped = true;
}
- gcismapped = true;
#ifdef GC_PROFILE
//flushstalltime += BAMBOO_GET_EXE_TIME() - ttime;
#endif
#ifndef CLOSE_PRINT
BAMBOO_DEBUGPRINT_REG(data2);
#endif
- BAMBOO_EXIT(0xb009);
+ BAMBOO_EXIT(0xb00b);
}
// store the mark result info
int cnum = data2;
MSG_INDEXINC_I();
//mgchashInsert_I(msgdata[1], msgdata[2]);
RuntimeHashadd_I(gcpointertbl, data1, data2);
+ /*struct nodemappinginfo * nodeinfo =
+ (struct nodemappinginfo *)RUNMALLOC_I(sizeof(struct nodemappinginfo));
+ nodeinfo->ptr = (void *)data2;
+ nodeinfo->cores = NULL;
+ RuntimeHashadd_I(gcpointertbl, data1, (int)nodeinfo);*/
//MGCHashadd_I(gcpointertbl, msgdata[1], msgdata[2]);
}
#endif // #ifdef MULTICORE_GC
break;
} // case GCSTARTCOMPACT
+ case GCSTARTMAPINFO: {
+ // received a flush phase start msg
+ processmsg_gcstartmapinfo_I();
+ break;
+ } // case GCSTARTFLUSH
+
case GCSTARTFLUSH: {
// received a flush phase start msg
processmsg_gcstartflush_I();
break;
} // case GCFINISHCOMPACT
+ case GCFINISHMAPINFO: {
+ processmsg_gcfinishmapinfo_I();
+ break;
+ } // case GCFINISHMAPINFO
+
case GCFINISHFLUSH: {
processmsg_gcfinishflush_I();
break;
// reside on this core
if(!RuntimeHashcontainskey(locktbl, reallock)) {
// no locks for this object, something is wrong
- BAMBOO_EXIT(0xa011);
+ BAMBOO_EXIT(0xa00b);
} else {
int rwlock_obj = 0;
struct LockValue * lockvalue = NULL;