INLINE int assignSpareMem_I(unsigned int sourcecore,unsigned int * requiredmem, void ** tomove, void ** startaddr) {
unsigned int b = 0;
BLOCKINDEX(gcloads[sourcecore], b);
- unsigned int boundptr = BOUNDPTR(b);
- unsigned int remain = boundptr - gcloads[sourcecore];
+ void * boundptr = BOUNDPTR(b);
+ unsigned INTPTR remain = (unsigned INTPTR) (boundptr - gcloads[sourcecore]);
unsigned int memneed = requiredmem + BAMBOO_CACHE_LINE_SIZE;
*startaddr = gcloads[sourcecore];
*tomove = gcfilledblocks[sourcecore] + 1;
} else {
// next available block
gcfilledblocks[sourcecore] += 1;
- unsigned int newbase = 0;
+ void * newbase = NULL;
BASEPTR(sourcecore, gcfilledblocks[sourcecore], &newbase);
gcloads[sourcecore] = newbase;
return requiredmem-remain;
// next available block
*p = *p + *remain;
gcfilledblocks[gctopcore] += 1;
- unsigned int newbase = 0;
+ void * newbase = NULL;
BASEPTR(gctopcore, gcfilledblocks[gctopcore], &newbase);
gcloads[gctopcore] = newbase;
gcrequiredmems[coren] -= *remain - BAMBOO_CACHE_LINE_SIZE;
INLINE void compact2Heaptop() {
// no cores with spare mem and some cores are blocked with pending move
// find the current heap top and make them move to the heap top
- unsigned int p = gcloads[gctopcore];
+ void * p = gcloads[gctopcore];
unsigned int numblocks = gcfilledblocks[gctopcore];
unsigned int b;
BLOCKINDEX(p, b);
to->offset += tobound - totop;
CLOSEBLOCK(to->base, to->offset);
#ifdef GC_CACHE_ADAPT
- unsigned int tmp_ptr = to->ptr;
+ void * tmp_ptr = to->ptr;
#endif
nextBlock(to);
if((to->top+isize)>(to->bound)) tprintf("%x, %x, %d, %d, %d, %d \n", to->ptr, orig->ptr, to->top, to->bound, isize, size);
BAMBOO_ASSERT((to->top+isize)<=(to->bound));
// set the mark field to 2, indicating that this obj has been moved
// and need to be flushed
- unsigned int toptr = (unsigned int)to->ptr;
+ void * toptr = to->ptr;
if(toptr != origptr) {
if((unsigned int)(origptr) < (unsigned int)(toptr+size)) {
memmove(toptr, origptr, size);
to->top += isize;
BAMBOO_ASSERT((to->top)<=(to->bound));
#ifdef GC_CACHE_ADAPT
- unsigned int tmp_ptr = to->ptr;
+ void * tmp_ptr = to->ptr;
#endif // GC_CACHE_ADAPT
if(to->top == to->bound) {
CLOSEBLOCK(to->base, to->offset);
return retval;
}
-bool compacthelper(struct moveHelper * orig,struct moveHelper * to,int * filledblocks,unsigned int * heaptopptr,bool * localcompact, bool lbmove) {
+bool compacthelper(struct moveHelper * orig,struct moveHelper * to,int * filledblocks, void ** heaptopptr,bool * localcompact, bool lbmove) {
bool loadbalancemove = lbmove;
// scan over all objs in this block, compact the marked objs
// loop stop when finishing either scanning all active objs or
CACHEADAPT_SAMPLING_DATA_REVISE_INIT(orig, to);
unsigned int filledblocks = 0;
- unsigned int heaptopptr = 0;
+ void * heaptopptr = NULL;
bool localcompact = true;
compacthelper(orig, to, &filledblocks, &heaptopptr, &localcompact, false);
RUNFREE(orig);
initOrig_Dst(orig, to);
CACHEADAPT_SAMPLING_DATA_REVISE_INIT(orig, to);
int filledblocks = 0;
- unsigned int heaptopptr = 0;
+ void * heaptopptr = NULL;
bool finishcompact = false;
bool iscontinue = true;
bool localcompact = true;