minor changes
authoradash <adash>
Thu, 20 Dec 2007 00:07:04 +0000 (00:07 +0000)
committeradash <adash>
Thu, 20 Dec 2007 00:07:04 +0000 (00:07 +0000)
Robust/src/Analysis/Prefetch/PrefetchAnalysis.java
Robust/src/Runtime/DSTM/interface/dstm.h
Robust/src/Runtime/DSTM/interface/trans.c
Robust/src/Tests/Atomic4.java

index 4b649a8e06552432b799326cda4c87d9626d1373..6296abdc8d01fde738cc550cbc4353d12d8623c0 100644 (file)
@@ -1235,6 +1235,9 @@ public class PrefetchAnalysis {
                }
        }
 
+       /** This function deletes the smaller prefetch pair subset from a list of prefetch pairs 
+        * for e.g. if there are 2 prefetch pairs a.b.c.d and a.b.c for a given flatnode
+        * then this function drops a.b.c from the prefetch set of the flatnode */
        private void delSubsetPPairs() {
                Enumeration e = prefetch_hash.keys();
                while(e.hasMoreElements()) {
@@ -1278,6 +1281,8 @@ public class PrefetchAnalysis {
                }
        }
 
+       /** This function returns: true if the shorter prefetch pair is a subset of the longer prefetch
+        * pair else it returns: false */
        private boolean isSubSet(PrefetchPair shrt, PrefetchPair lng) {
                if (shrt.base != lng.base) {
                        return false;
@@ -1323,6 +1328,11 @@ public class PrefetchAnalysis {
                return hasChanged;
        }
 
+       /** This function creates a set called pset1 that contains prefetch pairs that have already
+        * been prefetched. While traversing the graph of a flat representation in a top down fashion,
+        * this function creates pset1 such that it contains prefetch pairs that have been prefetched at
+        * the previous nodes */
+
        private void applyPrefetchInsertRules(FlatNode fn) {
                HashSet<PrefetchPair> pset1 = new HashSet<PrefetchPair>();
                HashSet<PrefetchPair> pset2 = new HashSet<PrefetchPair>();
@@ -1431,9 +1441,10 @@ public class PrefetchAnalysis {
                        }
                        pset1_hash.put(fn, pset1);
 
-                       /* To insert prefetch apply rule */
+
+                       /* To insert prefetch apply rule: if the newpset intersection pset2 is nonempty
+                        * then insert a new prefetch node here*/
                        HashSet<PrefetchPair> s = new HashSet<PrefetchPair>();
-                       //if(!newpset.isEmpty() && !pset2.isEmpty()) {
                        if(!newpset.isEmpty()) {
                                if(!pset2.isEmpty()) {
                                        for(Iterator it = newpset.iterator(); it.hasNext();) {
index 99a21fbd347aa643363a901748cd7de8d1141b31..917e546e1c5380304f278719923bf4627a0a97ed 100644 (file)
@@ -142,7 +142,7 @@ typedef struct trans_req_data {
   unsigned int *listmid;       /* Pointer to array holding list of participants */
   char *objread;               /* Pointer to array holding oid and version number of objects that are only read */ 
   unsigned int *oidmod;                /* Pointer to array holding oids of objects that are modified */
-  unsigned int *oidcreated;            /* Pointer to array holding oids of objects that are newly created */
+  unsigned int *oidcreated;    /* Pointer to array holding oids of objects that are newly created */
 } trans_req_data_t;            
 
 /* Structure that holds information of objects that are not found in the participant
index c65127f59eae94ed1459ad885d48717add9df7df..26facf03161c68e526b5a9003f97f2a9b5fb1aa6 100644 (file)
@@ -216,13 +216,12 @@ void transExit() {
  * Mostly used when transaction commits retry*/
 void randomdelay(void)
 {
-       struct timespec req, rem;
+       struct timespec req;
        time_t t;
 
        t = time(NULL);
        req.tv_sec = 0;
        req.tv_nsec = (long)(1000000 + (t%10000000)); //1-11 msec
-       //nanosleep(&req, &rem);
        nanosleep(&req, NULL);
        return;
 }
@@ -249,6 +248,10 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) {
        void *buf;
        struct timespec ts;
        struct timeval tp;
+
+       if(oid == 0) {
+               return NULL;
+       }
         
        rc = gettimeofday(&tp, NULL);
 
@@ -346,6 +349,7 @@ objheader_t *transCreateObj(transrecord_t *record, unsigned int size)
   tmp->rcount = 1;
   STATUS(tmp) = NEW;
   chashInsert(record->lookupTable, OID(tmp), tmp);
+
 #ifdef COMPILER
   return &tmp[1]; //want space after object header
 #else
@@ -423,6 +427,7 @@ int transCommit(transrecord_t *record) {
        do {
                trecvcount = 0;
                threadnum = 0;
+               treplyretry = 0;
 
                /* Look through all the objects in the transaction record and make piles 
                 * for each machine involved in the transaction*/
@@ -519,9 +524,9 @@ int transCommit(transrecord_t *record) {
                        thread_data_array[threadnum].rec = record;
                        /* If local do not create any extra connection */
                        if(pile->mid != myIpAddr) { /* Not local */
-                         do {
-                               rc = pthread_create(&thread[threadnum], &attr, transRequest, (void *) &thread_data_array[threadnum]);  
-                         } while(rc!=0);
+                               do {
+                                       rc = pthread_create(&thread[threadnum], &attr, transRequest, (void *) &thread_data_array[threadnum]);  
+                               } while(rc!=0);
                                if(rc) {
                                        perror("Error in pthread create\n");
                                        pthread_cond_destroy(&tcond);
@@ -581,7 +586,6 @@ int transCommit(transrecord_t *record) {
                        }
                        free(thread_data_array[i].buffer);
                }
-       
 
                /* Free resources */    
                pthread_cond_destroy(&tcond);
@@ -591,11 +595,11 @@ int transCommit(transrecord_t *record) {
                free(thread_data_array);
                free(ltdata);
 
-               /* wait a random amount of time */
-               if (treplyretry == 1) {
+               /* wait a random amount of time before retrying to commit transaction*/
+               if(treplyretry == 1) {
                        randomdelay();
                }
-
+               
        /* Retry trans commit procedure if not sucessful in the first try */
        } while (treplyretry == 1);
        
@@ -712,7 +716,7 @@ void *transRequest(void *threadarg) {
 
        /* Close connection */
        close(sd);
-       pthread_exit(NULL);
+       //pthread_exit(NULL);
 }
 
 /* This function decides the reponse that needs to be sent to 
@@ -993,7 +997,7 @@ void *handleLocalReq(void *threadarg) {
                free(localtdata->transinfo->objnotfound);
        }
 
-       pthread_exit(NULL);
+       //pthread_exit(NULL);
 }
 
 /* This function completes the ABORT process if the transaction is aborting */
index e180164c7cbf9f8cb0d20287e32a4b56b732dc2c..563acbf95901afdc78b93609f64334d681ce82c0 100644 (file)
@@ -1,17 +1,17 @@
 public class Atomic4 extends Thread {
-       People[] team;
+       public People[] team;
        public Atomic4() {
-               People[] team = new People[2];
        }
        public static void main(String[] st) {
                int mid = (128<<24)|(195<<16)|(175<<8)|70;
-               int b,c;
+               int b = 0,c = 0;
                
                Integer age;
                String name;
                Atomic4 at4 = null;
                atomic {
                        at4 = global new Atomic4();
+                       at4.team = global new People[2];
                        at4.team[0] = global new People();
                        at4.team[1] = global new People();
                        age = global new Integer(35);