changes.
[IRC.git] / Robust / src / Runtime / garbage.h
index a5f7cd83486cceec7f1ace21fea98a37b0b43269..3390a10901a82d6f96248d733a2dadb1a82cefed 100644 (file)
@@ -3,11 +3,65 @@
 #ifdef STM
 #include "stmlookup.h"
 #endif
+#ifdef JNI
+#include "jni-private.h"
+#endif
+
+#define NUMPTRS 100
+
+struct pointerblock {
+  void * ptrs[NUMPTRS];
+  struct pointerblock *next;
+};
 
-struct garbagelist {  
+//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;
-  struct garbagelist *next;  
-  void * array[]; 
+  struct garbagelist *next;
+  void * array[];
 };
 
 extern void * curr_heapbase;
@@ -22,10 +76,13 @@ extern void * to_heaptop;
 struct listitem {
   struct listitem * prev;
   struct listitem * next;
-  struct garbagelist * stackptr;  
+  struct garbagelist * stackptr;
 #ifdef THREADS
   struct lockvector * lvector;
 #endif
+#ifdef JNI
+  struct jnireferences ** jnirefs;
+#endif
 #ifdef STM
   unsigned int tc_size;
   cliststruct_t **tc_structs;
@@ -46,6 +103,8 @@ struct listitem {
 
 #ifdef TASK
 void fixtags();
+extern struct pointerblock *taghead;
+extern int tagindex;
 #endif
 
 #if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)