From: bdemsky <bdemsky>
Date: Tue, 21 Jun 2011 01:36:18 +0000 (+0000)
Subject: bug fixes...still doesn't work
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d173ebfb9312b9f268c03af1c5b499b0b3cd8a9;p=IRC.git

bug fixes...still doesn't work
---

diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c
index 474033e8..c23a78dd 100644
--- a/Robust/src/Runtime/bamboo/multicoregarbage.c
+++ b/Robust/src/Runtime/bamboo/multicoregarbage.c
@@ -108,6 +108,9 @@ void initmulticoregcdata() {
 	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();
   }
diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h
index d66261d7..94f8c183 100644
--- a/Robust/src/Runtime/bamboo/multicoregarbage.h
+++ b/Robust/src/Runtime/bamboo/multicoregarbage.h
@@ -233,6 +233,10 @@ INLINE static unsigned int hostcore(void * ptr) {
 #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
 
diff --git a/Robust/src/Runtime/bamboo/multicoremem.c b/Robust/src/Runtime/bamboo/multicoremem.c
index d0ca1a3f..145398bb 100644
--- a/Robust/src/Runtime/bamboo/multicoremem.c
+++ b/Robust/src/Runtime/bamboo/multicoremem.c
@@ -81,7 +81,7 @@ void * globalmalloc_I(int coren, unsigned INTPTR memcheck, int * allocsize) {
 
 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;
 }
@@ -97,7 +97,6 @@ void * smemalloc_I(int coren, int isize, int * allocsize) {
 #elif defined(SMEMG)
   void *mem = globalmalloc_I(coren, isize, allocsize);
 #endif
-
   if(mem == NULL) {
     // no enough shared global memory
     // trigger gc