add enqueue to garbage.h
authorbdemsky <bdemsky>
Sat, 16 Apr 2011 00:10:35 +0000 (00:10 +0000)
committerbdemsky <bdemsky>
Sat, 16 Apr 2011 00:10:35 +0000 (00:10 +0000)
Robust/src/Runtime/garbage.h

index 8d82ea12391d1fc445d5b4775f8bac801e25ec94..a2a1f629d9d125aedbc1e79347888274ce104c1b 100644 (file)
@@ -14,6 +14,49 @@ struct pointerblock {
   struct pointerblock *next;
 };
 
+//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(copy);\
+      dst=copy; \
+    } \
+  }
+#elif defined(STM)
+#define ENQUEUE(orig, dst) \
+  if (orig>=curr_heapbase&&orig<curr_heaptop) { \
+    void *copy; \
+    if (gc_createcopy(orig,&copy)) \
+      enqueue(copy);\
+    dst=copy; \
+  }
+#define SENQUEUE(orig, dst) \
+  { \
+    void *copy; \
+    if (gc_createcopy(orig,&copy)) \
+      enqueue(copy);\
+    dst=copy; \
+  }
+#elif defined(FASTCHECK)
+#define ENQUEUE(orig, dst) \
+  if (((unsigned int)orig)!=1) { \
+    void *copy; \
+    if (gc_createcopy(orig,&copy)) \
+      enqueue(copy);\
+    dst=copy; }
+#else
+#define ENQUEUE(orig, dst) \
+  if (orig!=NULL) { \
+    void *copy; \
+    if (gc_createcopy(orig,&copy)) \
+      enqueue(copy); \
+    dst=copy; \
+  }
+#endif
 
 struct garbagelist {  
   int size;