From: bdemsky <bdemsky>
Date: Fri, 9 Oct 2009 18:02:50 +0000 (+0000)
Subject: change
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a8eec19965660421a00fa41c9cfd713a45a56d46;p=IRC.git

change
---

diff --git a/Robust/src/Runtime/STM/commit.c b/Robust/src/Runtime/STM/commit.c
index a9d545e8..b4500520 100644
--- a/Robust/src/Runtime/STM/commit.c
+++ b/Robust/src/Runtime/STM/commit.c
@@ -123,29 +123,33 @@ int transCommit() {
 }
 
 #ifdef STMSTATS
-  You need to add free statements for oidrdage in a way that they will not appear if this option is not defined.
+#define STATFREE free(oidrdage);
+#define STATALLOC oidrdage=malloc(size);
+#define STATASSIGN oidrdage=rdage;
+#else
+  #define STATFREE
+  #define STATALLOC
+  #define STATASSIGN
 #endif
 
 #ifdef DELAYCOMP
 #define freearrays if (c_numelements>=200) { \
-    free(oidrdlocked); \
-    free(oidrdversion); \
+    STATFREE				     \
+    free(oidrdlocked);		     \
+    free(oidrdversion);			     \
   } \
   if (t_numelements>=200) { \
     free(oidwrlocked); \
   }
 #else
 #define freearrays   if (c_numelements>=200) { \
+    STATFREE \
     free(oidrdlocked); \
     free(oidrdversion); \
     free(oidwrlocked); \
   }
 #endif
 
-#ifdef STMSTATS
-    you need to set oidrdage in a way that does not appear if this macro is not defined.
-#endif
-
 #ifdef DELAYCOMP
 #define allocarrays int t_numelements=c_numelements+dc_c_numelements; \
   if (t_numelements<200) { \
@@ -156,10 +160,12 @@ int transCommit() {
   if (c_numelements<200) { \
     oidrdlocked=rdlocked; \
     oidrdversion=rdversion; \
+    STATASSIGN		    \
   } else { \
     int size=c_numelements*sizeof(void*); \
     oidrdlocked=malloc(size); \
     oidrdversion=malloc(size); \
+    STATALLOC		       \
   }
 #else
 #define allocarrays if (c_numelements<200) { \
@@ -171,6 +177,7 @@ int transCommit() {
     oidrdlocked=malloc(size); \
     oidrdversion=malloc(size); \
     oidwrlocked=malloc(size); \
+    STATALLOC		      \
   }
 #endif
 
diff --git a/Robust/src/Runtime/STM/sandbox.c b/Robust/src/Runtime/STM/sandbox.c
index ac020d9d..3c07025e 100644
--- a/Robust/src/Runtime/STM/sandbox.c
+++ b/Robust/src/Runtime/STM/sandbox.c
@@ -1,7 +1,6 @@
 #include "sandbox.h"
 #include "tm.h"
 #include <stdio.h>
-#define likely(x) x
 __thread int transaction_check_counter;
 __thread jmp_buf aborttrans;
 __thread int abortenabled;
diff --git a/Robust/src/Runtime/STM/stats.c b/Robust/src/Runtime/STM/stats.c
index c22f7c4f..be3fb60e 100644
--- a/Robust/src/Runtime/STM/stats.c
+++ b/Robust/src/Runtime/STM/stats.c
@@ -1,6 +1,7 @@
 #include "tm.h"
 #include "garbage.h"
 
+#define PERCENT_ALLOWED_ABORT 0.7
 #ifdef STMSTATS
 /* Thread variable for locking/unlocking */
 __thread threadrec_t *trec;
diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c
index fb5b6c66..0b35efc7 100644
--- a/Robust/src/Runtime/STM/stm.c
+++ b/Robust/src/Runtime/STM/stm.c
@@ -13,7 +13,6 @@
 #include "tm.h"
 #include "garbage.h"
 
-#define likely(x) x
 /* Per thread transaction variables */
 __thread objstr_t *t_cache;
 __thread objstr_t *t_reserve;
diff --git a/Robust/src/Runtime/STM/tm.h b/Robust/src/Runtime/STM/tm.h
index 1a71dc2c..864de75e 100644
--- a/Robust/src/Runtime/STM/tm.h
+++ b/Robust/src/Runtime/STM/tm.h
@@ -245,11 +245,10 @@ objheader_t * needLock(objheader_t *, void *);
 extern __thread threadrec_t *trec;
 extern __thread struct objlist * lockedobjs;
 extern __thread int t_objnumcount;
-
-/* Collect stats for object classes causing abort */
-extern objtypestat_t typesCausingAbort[TOTALNUMCLASSANDARRAY];
 #endif
 
+#define likely(x) x
+
 extern void * curr_heapbase;
 extern void * curr_heapptr;
 extern void * curr_heaptop;