memory stuff
authorbdemsky <bdemsky>
Tue, 7 Apr 2009 06:39:06 +0000 (06:39 +0000)
committerbdemsky <bdemsky>
Tue, 7 Apr 2009 06:39:06 +0000 (06:39 +0000)
Robust/src/Runtime/garbage.c
Robust/src/Runtime/garbage.h

index 96335d00eceac4a3ca265a6629d45ebc9dd17866..539119e21d3ba9717c9ca3f966ac03d240b15e22 100644 (file)
@@ -48,6 +48,16 @@ int listcount=0;
 //Need to check if pointers are transaction pointers
 //this also catches the special flag value of 1 for local copies
 #ifdef DSTM
+#define ENQUEUE(orig, dst) \
+  if ((!(((unsigned int)orig)&0x1))) { \
+    if (orig>=curr_heapbase&&orig<curr_heaptop) { \
+      void *copy; \
+      if (gc_createcopy(orig,&copy)) \
+       enqueue(orig);\
+      dst=copy; \
+    } \
+  }
+#elif STM
 #define ENQUEUE(orig, dst) \
   if ((!(((unsigned int)orig)&0x1))) { \
     if (orig>=curr_heapbase&&orig<curr_heaptop) { \
@@ -144,7 +154,7 @@ void enqueuetag(struct ___TagDescriptor___ *ptr) {
 
 
 void collect(struct garbagelist * stackptr) {
-#if defined(THREADS)||defined(DSTM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)
   needtocollect=1;
   pthread_mutex_lock(&gclistlock);
   while(1) {
@@ -170,7 +180,7 @@ void collect(struct garbagelist * stackptr) {
 #endif
 
   /* Check current stack */
-#if defined(THREADS)||defined(DSTM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)
   {
     struct listitem *listptr=list;
     while(1) {
@@ -184,7 +194,7 @@ void collect(struct garbagelist * stackptr) {
     }
     stackptr=stackptr->next;
   }
-#if defined(THREADS)||defined(DSTM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)
   /* Go to next thread */
   if (listptr!=NULL) {
     void * orig=listptr->locklist;
@@ -206,8 +216,7 @@ void collect(struct garbagelist * stackptr) {
     /* Update objectsets */
     int i;
     for(i=0; i<NUMCLASSES; i++) {
-#ifdef MULTICORE
-#else
+#if !defined(MULTICORE)
       struct parameterwrapper * p=objectqueues[i];
       while(p!=NULL) {
        struct ObjectHash * set=p->objectset;
@@ -443,7 +452,14 @@ void checkcollect2(void * ptr) {
 struct listitem * stopforgc(struct garbagelist * ptr) {
   struct listitem * litem=malloc(sizeof(struct listitem));
   litem->stackptr=ptr;
+#ifdef THREADS
   litem->locklist=pthread_getspecific(threadlocks);
+#endif
+#ifdef STM
+  litem->tc_size=c_size;
+  litem->tc_mask=c_mask;
+  litem->tc_table=&c_table;
+#endif
   litem->prev=NULL;
   pthread_mutex_lock(&gclistlock);
   litem->next=list;
index b9c533f58a149c3c89594b1440b4d31b1c14394c..41ec5ea1db2125d0c7efe8eb467592fcb5fe8b77 100644 (file)
@@ -10,7 +10,14 @@ struct listitem {
   struct listitem * prev;
   struct listitem * next;
   struct garbagelist * stackptr;
+#ifdef THREADS
   struct ___Object___ * locklist;
+#endif
+#ifdef STM
+  unsigned int tc_size;
+  unsigned int tc_mask;
+  chashlistnode_t **tc_table;
+#endif
 };
 
 #ifdef TASK