get rid of compile errors
authorbdemsky <bdemsky>
Mon, 6 Apr 2009 20:35:53 +0000 (20:35 +0000)
committerbdemsky <bdemsky>
Mon, 6 Apr 2009 20:35:53 +0000 (20:35 +0000)
Robust/src/ClassLibrary/JavaSTM/Object.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/STM/stm.c
Robust/src/Runtime/STM/tm.h

index 4968cfa3233b24e69e253dba3cf53f1ed70ede88..fecc4cd199dab04e99917f281b093a39cc0a3857 100644 (file)
@@ -1,7 +1,8 @@
 public class Object {
   public int cachedCode;   //first field has to be a primitive
   public boolean cachedHash;
-
+  public Object objlocation;  
+  public int objstatus;
   public native int nativehashCode();
 
   public int hashCode() {
index 141a899d13accd8d8b53f987c0ad5e650bc3b16e..362187905afd6a185144197ce30b998707d4b70e 100644 (file)
@@ -31,7 +31,7 @@ public class BuildCode {
   String localsprefix="___locals___";
   String fcrevert="___fcrevert___";
   String paramsprefix="___params___";
-  String oidstr="___nextobject___";
+  String oidstr=state.DSM?"___nextobject___":"___objlocation___";
   String nextobjstr="___nextobject___";
   String localcopystr="___localcopy___";
   public static boolean GENERATEPRECISEGC=false;
@@ -2152,7 +2152,7 @@ public class BuildCode {
        output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);");
       }
       if (wb.needBarrier(fsfn))
-       output.println("*((unsigned int *)&("+dst+"->___localcopy___))|=DIRTY;");
+       output.println("*((unsigned int *)&("+dst+"->___objstatus___))|=DIRTY;");
       if (srcptr) {
        output.println("*((unsigned int *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;");
        output.println("}");
@@ -2296,7 +2296,7 @@ public class BuildCode {
     if (state.SINGLETM && locality.getAtomic(lb).get(fsen).intValue()>0) {
       //Transaction set element case
       if (wb.needBarrier(fsen))
-       output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___localcopy___))|=DIRTY;");
+       output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___objstatus___))|=DIRTY;");
       if (fsen.getSrc().getType().isPtr()) {
        output.println("{");
        String src=generateTemp(fm, fsen.getSrc(), lb);
index 75e84dfa07b8de6504905b113155f6f8a6245664..79f15a9369876c4a3589dac80ffc7279c8afd103 100644 (file)
@@ -61,7 +61,6 @@ objheader_t *transCreateObj(unsigned int size) {
   objheader_t *tmp = (objheader_t *) objstrAlloc(&t_cache, (sizeof(objheader_t) + size));
   OID(tmp) = getNewOID();
   tmp->version = 1;
-  tmp->rcount = 1;
   STATUS(tmp) = NEW;
   t_chashInsert(OID(tmp), tmp);
 
index 60d21cad008edff3ae28edfb8677933dbb73febc..86f80d797708c945e93e3616b4f9f1b6bb09302b 100644 (file)
 #define NEW   0x02
 #define LOCK  0x04
 
+#ifdef COMPILER
+#include "structdefs.h"
+typedef struct objheader {
+  threadlist_t *notifylist;
+  unsigned int version;
+} objheader_t;
+
+#define OID(x) \
+  (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objlocation___))
+
+#define COMPOID(x) \
+  ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___objlocation___)) : 0))
+
+#define STATUS(x) \
+  *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objstatus___))
+
+#define STATUSPTR(x) \
+  ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objstatus___))
+
+#define TYPE(x) \
+  ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type
+
+#define GETSIZE(size, x) { \
+    int type=TYPE(x); \
+    if (type<NUMCLASSES) { \
+      size=classsize[type]; \
+    } else { \
+      size=classsize[type]*((struct ArrayObject *)&((objheader_t *)x)[1])->___length___+sizeof(struct ArrayObject); \
+    } \
+}
+
+#else
+#define OID(x) x->oid
+#define TYPE(x) x->type
+#define STATUS(x) x->status
+#define STATUSPTR(x) &x->status
+#define GETSIZE(size, x) size=classsize[TYPE(x)]
+#endif
+
+
 /* ================================
  * Constants
  * ================================
@@ -73,44 +113,6 @@ typedef struct newObjCreated {
   unsigned int *oidcreated;
 } newObjCreated_t;
 
-#ifdef COMPILER
-typedef struct objheader {
-  threadlist_t *notifylist;
-  unsigned short version;
-  unsigned short rcount;
-} objheader_t;
-
-#define OID(x) \
-  (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___))
-
-#define COMPOID(x) \
-  ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___nextobject___)) : 0))
-
-#define STATUS(x) \
-  *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))
-
-#define STATUSPTR(x) \
-  ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))
-
-#define TYPE(x) \
-  ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type
-
-#define GETSIZE(size, x) { \
-    int type=TYPE(x); \
-    if (type<NUMCLASSES) { \
-      size=classsize[type]; \
-    } else { \
-      size=classsize[type]*((struct ArrayObject *)&((objheader_t *)x)[1])->___length___+sizeof(struct ArrayObject); \
-    } \
-}
-
-#else
-#define OID(x) x->oid
-#define TYPE(x) x->type
-#define STATUS(x) x->status
-#define STATUSPTR(x) &x->status
-#define GETSIZE(size, x) size=classsize[TYPE(x)]
-#endif
 
 /* ================================
  * Functions used