bug fixes
authorbdemsky <bdemsky>
Mon, 24 Mar 2008 22:19:18 +0000 (22:19 +0000)
committerbdemsky <bdemsky>
Mon, 24 Mar 2008 22:19:18 +0000 (22:19 +0000)
12 files changed:
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java
Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/DSTM/interface/clookup.c
Robust/src/Runtime/DSTM/interface/clookup.h
Robust/src/Runtime/DSTM/interface/llookup.h
Robust/src/Runtime/DSTM/interface/localobjects.c
Robust/src/Runtime/DSTM/interface/mlookup.h
Robust/src/Runtime/DSTM/interface/prelookup.h
Robust/src/Runtime/DSTM/interface/threadnotify.h
Robust/src/Runtime/DSTM/interface/trans.c
Robust/src/Runtime/runtime.h

index 93dda9361425ceb66f517743a1965def4481f274..1687dd77307f35a5e2f7882765d74fc24a6b9357 100644 (file)
@@ -44,7 +44,7 @@ public class MatrixMultiply extends Thread{
        }
 
        public static void main(String[] args) {
-               int mid1 = (128<<24)|(195<<16)|(175<<8)|70;
+               int mid1 = (128<<24)|(195<<16)|(175<<8)|73;
                int mid2 = (128<<24)|(195<<16)|(175<<8)|69;
                int mid3 = (128<<24)|(195<<16)|(175<<8)|71;
                int NUM_THREADS = 1;
@@ -54,7 +54,7 @@ public class MatrixMultiply extends Thread{
                MMul matrix;
 
                atomic {
-                       matrix = global new MMul(800, 800, 800);
+                       matrix = global new MMul(200, 200, 200);
                        matrix.setValues();
                        matrix.transpose();
                }
@@ -64,7 +64,7 @@ public class MatrixMultiply extends Thread{
                }
 
                atomic {
-                       mm[0] = global new MatrixMultiply(matrix,0,0,799,799);
+                       mm[0] = global new MatrixMultiply(matrix,0,0,199,199);
                }
 
                atomic {
index 2767c1ee51e6690b911b08aced11822c0ecc78c2..f8bbf4a9b98fd990ba6675029d920fea4db57e81 100644 (file)
@@ -1,6 +1,6 @@
 MAINCLASS=MatrixMultiply
 SRC=${MAINCLASS}.java
-FLAGS=-dsm -prefetch -nooptimize -printflat -profile -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -o ${MAINCLASS}
+FLAGS=-dsm -prefetch -nooptimize -printflat -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -o ${MAINCLASS}
 default:
        ../../../buildscript ${FLAGS} ${SRC}
 clean:
index 6f82f3184cefcc5d3a3b44e12ef0b69143518a1c..352a648d76d29073dc4e9d25c821f155edd4ca03 100644 (file)
@@ -924,10 +924,14 @@ public class BuildCode {
        if (!fieldorder.containsKey(cn)) {
            Vector fields=new Vector();
            fieldorder.put(cn,fields);
+           if (sp==null) {
+               fields.add(cn.getFieldTable().get("cachedCode"));
+           }
            Iterator fieldit=cn.getFields();
            while(fieldit.hasNext()) {
                FieldDescriptor fd=(FieldDescriptor)fieldit.next();
-               if (sp==null||!sp.getFieldTable().contains(fd.getSymbol()))
+               if ((sp==null||!sp.getFieldTable().contains(fd.getSymbol()))&&
+                   (!fd.getSymbol().equals("cachedCode")))
                    fields.add(fd);
            }
        }
@@ -2156,7 +2160,6 @@ public class BuildCode {
                else
                    output.println("COPY_OBJ("+dst+");");
                output.println(dst+"->"+nextobjstr+"="+revertptr+";");
-
                output.println("trans->revertlist=(struct ___Object___ *)"+dst+";");
                output.println("}");
            } else throw new Error("Unknown array type");
index a38d22e14db9f7176ca11b1c597565109eefbb26..e7bb74e84485554313c2564fb852e5f0eed94100 100644 (file)
@@ -66,12 +66,10 @@ unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val) {
 
 // Search for an address for a given oid
 void *chashSearch(chashtable_t *table, unsigned int key) {
-       int index;
-       chashlistnode_t *ptr, *node;
+       int index = chashFunction(table, key);
+       chashlistnode_t *ptr =table -> table;
+       chashlistnode_t *node = &ptr[index];
 
-       ptr = table->table;
-       index = chashFunction(table, key);
-       node = &ptr[index];
        while(node != NULL) {
                if(node->key == key) {
                        return node->val;
index b71abfd5f443c1275be6290beed8dbd0a751fc46..494a7b9a7747eba47f98b45218318fcfee953b11 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#define LOADFACTOR 0.75
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
 typedef struct chashlistnode {
index 20dbac7251694ea8d0d1b5c9d77914c70f03a877..29c0d30471cd62db251756dcca87e3bb620a417e 100644 (file)
@@ -7,7 +7,7 @@
 
 #define SIMPLE_LLOOKUP
 
-#define LOADFACTOR 0.75
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
 typedef struct lhashlistnode {
index 0fdf0fd127c5455c3ccff40252cb3725c2c663bc..1c2ee0067f4f7e1220be68700ae478990fa407c0 100644 (file)
@@ -33,8 +33,13 @@ void COPY_OBJ(struct ___Object___ *obj) {
 #else
     struct ___Object___ * newobj=FREEMALLOC(size);
 #endif
+#ifdef PRECISE_GC
     memcpy(newobj, (struct ___Object___ *) ptrarray[2], size);
     ((struct ___Object___*)ptrarray[2])->___localcopy___=newobj;
+#else
+    memcpy(newobj, obj, size);
+    obj->___localcopy___=newobj;
+#endif
   } else {
     /* We have an array */
     struct ArrayObject *ao=(struct ArrayObject *)obj;
@@ -47,7 +52,12 @@ void COPY_OBJ(struct ___Object___ *obj) {
 #else
     struct ___Object___ * newobj=FREEMALLOC(size);
 #endif
+#ifdef PRECISE_GC
     memcpy(newobj, (struct ___Object___ *) ptrarray[2], size);
     ((struct ___Object___*)ptrarray[2])->___localcopy___=newobj;
+#else
+    memcpy(newobj, obj, size);
+    obj->___localcopy___=newobj;
+#endif
   }
 }
index 85396c524fc05086f6c7a2dcd6e797b169720329..aec887981fdc6b923c9aea8e8f336e37aafbbcf2 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <pthread.h>
 
-#define LOADFACTOR 0.75
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
 typedef struct mhashlistnode {
index acb540d94051fd29abaae3443b7e0ee2cae62265..df020b3b6d64771193ba9ba476e73419f5dcdfb8 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <pthread.h>
 
-#define LOADFACTOR 0.75
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
 typedef struct prehashlistnode {
index 05bddb48fc8368bbc22c1d260d542d1e0e7bdd1c..7ed1c7a0f676e5b0796155cb3dcf3f74731c9576 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 
-#define N_LOADFACTOR 0.75
+#define N_LOADFACTOR 0.5
 #define N_HASH_SIZE 20
 
 //Structure to notify object of which other objects/threads are waiting on it
index 49f7da64fdd998242fe6ddb3baa72a8f6b97054c..da01610c871620a89e3e8c8494bdee502697bf9a 100644 (file)
@@ -309,111 +309,69 @@ transrecord_t *transStart()
 /* This function finds the location of the objects involved in a transaction
  * and returns the pointer to the object if found in a remote location */
 objheader_t *transRead(transrecord_t *record, unsigned int oid) {
-       unsigned int machinenumber;
-       objheader_t *tmp, *objheader;
-       objheader_t *objcopy;
-       int size, rc, found = 0;
-       void *buf;
-       struct timespec ts;
-       struct timeval tp;
-
-       if(oid == 0) {
-               printf("Error: %s, %d oid is NULL \n", __FILE__, __LINE__);
-               return NULL;
-       }
-        
-       rc = gettimeofday(&tp, NULL);
-
-       /* 1ms delay */
-       tp.tv_usec += 1000;
-       if (tp.tv_usec >= 1000000)
-       {
-               tp.tv_usec -= 1000000;
-               tp.tv_sec += 1;
-       }
-       /* Convert from timeval to timespec */
-       ts.tv_sec = tp.tv_sec;
-       ts.tv_nsec = tp.tv_usec * 1000;
-
-       /* Search local transaction cache */
-       if((objheader = (objheader_t *)chashSearch(record->lookupTable, oid)) != NULL){
-
-#ifdef COMPILER
-         return &objheader[1];
-#else
-         return objheader;
-#endif
-       } else if ((objheader = (objheader_t *) mhashSearch(oid)) != NULL) {
-               /* Look up in machine lookup table  and copy  into cache*/
-               GETSIZE(size, objheader);
-               size += sizeof(objheader_t);
-               objcopy = (objheader_t *) objstrAlloc(record->cache, size);
-               memcpy(objcopy, objheader, size);
-               /* Insert into cache's lookup table */
-               chashInsert(record->lookupTable, OID(objheader), objcopy); 
+  unsigned int machinenumber;
+  objheader_t *tmp, *objheader;
+  objheader_t *objcopy;
+  int size, found = 0;
+  void *buf;
+  
+  if(oid == 0) {
+    printf("Error: %s, %d oid is NULL \n", __FILE__, __LINE__);
+    return NULL;
+  }
+  
+  /* Search local transaction cache */
+  if((objheader = (objheader_t *)chashSearch(record->lookupTable, oid)) != NULL){
 #ifdef COMPILER
-               return &objcopy[1];
+    return &objheader[1];
 #else
-               return objcopy;
+    return objheader;
 #endif
-       } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */
-               GETSIZE(size, tmp);
-               size+=sizeof(objheader_t);
-               objcopy = (objheader_t *) objstrAlloc(record->cache, size);
-               memcpy(objcopy, tmp, size);
-               /* Insert into cache's lookup table */
-               chashInsert(record->lookupTable, OID(tmp), objcopy); 
+  } else if ((objheader = (objheader_t *) mhashSearch(oid)) != NULL) {
+    /* Look up in machine lookup table  and copy  into cache*/
+    GETSIZE(size, objheader);
+    size += sizeof(objheader_t);
+    objcopy = (objheader_t *) objstrAlloc(record->cache, size);
+    memcpy(objcopy, objheader, size);
+    /* Insert into cache's lookup table */
+    chashInsert(record->lookupTable, OID(objheader), objcopy); 
 #ifdef COMPILER
-               return &objcopy[1];
+    return &objcopy[1];
 #else
-               return objcopy;
+    return objcopy;
 #endif
-       } else {
-               /*If object not found in prefetch cache then block until object appears in the prefetch cache */
-               /*
-               pthread_mutex_lock(&pflookup.lock);
-               while(!found) {
-                       rc = pthread_cond_timedwait(&pflookup.cond, &pflookup.lock, &ts);
-                       // Check Prefetch cache again 
-                       if((tmp =(objheader_t *) prehashSearch(oid)) != NULL) {
-                               found = 1;
-                               GETSIZE(size,tmp);
-                               size+=sizeof(objheader_t);
-                               objcopy = (objheader_t *) objstrAlloc(record->cache, size);
-                               memcpy(objcopy, tmp, size);
-                               chashInsert(record->lookupTable, OID(tmp), objcopy); 
-                               pthread_mutex_unlock(&pflookup.lock);
+  } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */
+    GETSIZE(size, tmp);
+    size+=sizeof(objheader_t);
+    objcopy = (objheader_t *) objstrAlloc(record->cache, size);
+    memcpy(objcopy, tmp, size);
+    /* Insert into cache's lookup table */
+    chashInsert(record->lookupTable, OID(tmp), objcopy); 
 #ifdef COMPILER
-                               return &objcopy[1];
+    return &objcopy[1];
 #else
-                               return objcopy;
+    return objcopy;
 #endif
-                       } else if (rc == ETIMEDOUT) {
-                               pthread_mutex_unlock(&pflookup.lock);
-                               break;
-                       }
-               }
-               */
-
-               /* Get the object from the remote location */
-               if((machinenumber = lhashSearch(oid)) == 0) {
-                       printf("Error: %s() No machine found for oid =% %s,%dx\n",__func__, machinenumber, __FILE__, __LINE__);
-                       return NULL;
-               }
-               objcopy = getRemoteObj(record, machinenumber, oid);
-               
-               if(objcopy == NULL) {
-                       printf("Error: Object not found in Remote location %s, %d\n", __FILE__, __LINE__);
-                       return NULL;
-               } else {
-
+  } else {
+    /* Get the object from the remote location */
+    if((machinenumber = lhashSearch(oid)) == 0) {
+      printf("Error: %s() No machine found for oid =% %s,%dx\n",__func__, machinenumber, __FILE__, __LINE__);
+      return NULL;
+    }
+    objcopy = getRemoteObj(record, machinenumber, oid);
+    
+    if(objcopy == NULL) {
+      printf("Error: Object not found in Remote location %s, %d\n", __FILE__, __LINE__);
+      return NULL;
+    } else {
+      
 #ifdef COMPILER
-                       return &objcopy[1];
+      return &objcopy[1];
 #else
-                       return objcopy;
+      return objcopy;
 #endif
-               }
-       }
+    }
+  }
 }
 
 /* This function creates objects in the transaction record */
index 7158c14ff1c9ad960104b00d7a4202541668decf..6c1ac82bbc5216a8d83dc228018e40acb03a729f 100644 (file)
@@ -8,6 +8,9 @@ extern int failurecount;
 #include "dstm.h"
 #endif
 
+extern void * curr_heapbase;
+extern void * curr_heaptop;
+
 #define TAGARRAYINTERVAL 10
 #define OBJECTARRAYINTERVAL 10