allocationinfo.blocktable[i].corenum=0;
else
allocationinfo.blocktable[i].corenum=gc_block2core[(i%(NUMCORES4GC*2))];
+ allocationinfo.blocktable[i].status=BS_FREE;
+ allocationinfo.blocktable[i].usedspace=0;
+ allocationinfo.blocktable[i].freespace=GLOBALBLOCKSIZE(i);
}
buildCore2Test();
}
#define BLOCKSIZE(c) \
((c)?BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE)
+//This macro takes in a local block number and returns the size of the block
+#define GLOBALBLOCKSIZE(c) \
+ ((c<NUMCORES4GC)?BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE)
+
//Takes as input the core number c and the local block index n and
//returns the global block index
void * smemalloc(int coren, int isize, int * allocsize) {
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
- void *retval=smemalloc(coren, isize, allocsize);
+ void *retval=smemalloc_I(coren, isize, allocsize);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
return retval;
}
#elif defined(SMEMG)
void *mem = globalmalloc_I(coren, isize, allocsize);
#endif
-
if(mem == NULL) {
// no enough shared global memory
// trigger gc