add native method for clearing prefetch cache to System.java
[IRC.git] / Robust / src / Runtime / DSTM / interface / objstr.c
index 20004396c34c7814cb04e835fce9e5b9d5e469e7..991bd239f7d68fbe198021b979dad508d85ddade 100644 (file)
@@ -1,12 +1,12 @@
 #include "dstm.h"
+extern objstr_t *prefetchcache;
 
-objstr_t *objstrCreate(unsigned int size)
-{
-       objstr_t *tmp = calloc(1, (sizeof(objstr_t) + size));
-       tmp->size = size;
-       tmp->next = NULL;
-       tmp->top = tmp + 1; //points to end of objstr_t structure!
-       return tmp;
+objstr_t *objstrCreate(unsigned int size) {
+  objstr_t *tmp = calloc(1, (sizeof(objstr_t) + size));
+  tmp->size = size;
+  tmp->next = NULL;
+  tmp->top = tmp + 1; //points to end of objstr_t structure!
+  return tmp;
 }
 
 //free entire list, starting at store
@@ -61,3 +61,10 @@ void *objstrAlloc(objstr_t *store, unsigned int size)
        }
 }
 
+void clearObjStore() {
+  objstr_t *tmp = prefetchcache;
+  while(tmp != NULL) {
+    bzero(tmp+1, tmp->size);
+    tmp = tmp->next;
+  }
+}