bug fixes
authorbdemsky <bdemsky>
Mon, 9 Nov 2009 08:25:25 +0000 (08:25 +0000)
committerbdemsky <bdemsky>
Mon, 9 Nov 2009 08:25:25 +0000 (08:25 +0000)
remove assertions from benchmarks
code generation improvements
get rid of some annoying C compiler warnings

37 files changed:
Robust/src/Analysis/Locality/DCWrapper.java
Robust/src/Analysis/Locality/DiscoverConflicts.java
Robust/src/Benchmarks/SingleTM/Bayes/Adtree.java
Robust/src/Benchmarks/SingleTM/Bayes/Bayes.java
Robust/src/Benchmarks/SingleTM/Bayes/Data.java
Robust/src/Benchmarks/SingleTM/Bayes/IntList.java
Robust/src/Benchmarks/SingleTM/Bayes/IntVector.java
Robust/src/Benchmarks/SingleTM/Bayes/Learner.java
Robust/src/Benchmarks/SingleTM/Bayes/List.java
Robust/src/Benchmarks/SingleTM/Bayes/Net.java
Robust/src/Benchmarks/SingleTM/Bayes/Queue.java
Robust/src/Benchmarks/SingleTM/Bayes/Vector_t.java
Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java
Robust/src/Benchmarks/SingleTM/Intruder/Detector.java
Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java
Robust/src/Benchmarks/SingleTM/Intruder/List_t.java
Robust/src/Benchmarks/SingleTM/Intruder/Queue_t.java
Robust/src/Benchmarks/SingleTM/Intruder/RBTree.java
Robust/src/Benchmarks/SingleTM/Intruder/Stream.java
Robust/src/Benchmarks/SingleTM/Intruder/Vector_t.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Grid.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/List_t.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Maze.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Queue_Int.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Queue_t.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Router.java
Robust/src/Benchmarks/SingleTM/Labyrinth3D/Vector_t.java
Robust/src/Benchmarks/SingleTM/Vacation/Customer.java
Robust/src/Benchmarks/SingleTM/Vacation/Manager.java
Robust/src/Benchmarks/SingleTM/Vacation/Reservation.java
Robust/src/Benchmarks/SingleTM/Vacation/Vacation.java
Robust/src/Benchmarks/SingleTM/common/BitMap.java
Robust/src/Benchmarks/SingleTM/common/Pair.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/STM/commit.c
Robust/src/Runtime/garbage.c
Robust/src/buildscript

index b28a14e05574a9bcb9159c91d32b4a3a4265e2d4..508b44a605cc0a27dc59328a6d1e176b9b7255c4 100644 (file)
@@ -20,12 +20,16 @@ public class DCWrapper {
   DelayComputation delaycomp;
   State state;
   LocalityAnalysis locality;
+  TypeAnalysis typeanalysis;
+  GlobalFieldType gft;
 
   public DCWrapper(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, GlobalFieldType gft) {
     delaycomp=new DelayComputation(locality, state, typeanalysis, gft);
     delaycomp.doAnalysis();
     this.state=state;
     this.locality=locality;
+    this.typeanalysis=typeanalysis;
+    this.gft=gft;
     Set<LocalityBinding> localityset=locality.getLocalityBindings();
     for(Iterator<LocalityBinding> lbit=localityset.iterator();lbit.hasNext();) {
       processlb(lbit.next());
@@ -40,7 +44,9 @@ public class DCWrapper {
   Hashtable<LocalityBinding, Set<FlatNode>> derefmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
   
   public DiscoverConflicts getConflicts() {
-    return delaycomp.getConflicts();
+    DiscoverConflicts dc=new DiscoverConflicts(locality, state, typeanalysis, cannotdelaymap, false, false, state.READSET?gft:null);
+    dc.doAnalysis();
+    return dc;
   }
   
   public Hashtable<LocalityBinding, HashSet<FlatNode>> getCannotDelayMap() {
index 22d55e90d04d7d22ce64a822eed8154bd851ba79..40a88c6be6e646d2c399001c9ed9d7c467bea70e 100644 (file)
@@ -124,6 +124,13 @@ public class DiscoverConflicts {
   
   private void computeneedsarrayget(LocalityBinding lb, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>> fnmap) {
     //    Set<FlatNode> gwriteset=(state.READSET&&gft!=null)?twritemap.get(lb):treadmap.get(lb);
+    if (state.READSET&&gft!=null) {
+      if (twritemap.get(lb).size()==0) {
+       getmap.put(lb, new HashSet<FlatNode>());
+        return;
+      }
+    }
+
     Set<FlatNode> gwriteset=treadmap.get(lb);
     FlatMethod fm=state.getMethodFlat(lb.getMethod());
     HashSet<FlatNode> needsget=new HashSet<FlatNode>();
@@ -143,7 +150,6 @@ public class DiscoverConflicts {
          }
        }
       }
-      
     }
     getmap.put(lb, needsget);
   }
index f70fca103ba4d77b29034035a7ef2b54e82d3c3d..7d5eb1168012ea4c37eca275816df04abbd5de8e 100644 (file)
@@ -189,10 +189,6 @@ public class Adtree {
         return nodePtr.count;
       }
       int queryIndex = queryPtr.index;
-      if(queryIndex > lastQueryIndex) {
-        System.out.println("Assert failed: queryIndex > lastQueryIndex in getCount()");
-        System.exit(0);
-      }
 
       AdtreeVary varyPtr = nodePtr.varyVectorPtr[queryIndex - nodeIndex - 1];
 
@@ -252,9 +248,6 @@ public class Adtree {
               (q + 1),
               queryVectorPtr,
               lastQueryIndex);
-        } else { /* QUERY_VALUE_WILDCARD */
-          System.out.println("Adtree_getCount Program shouldn't get here"); // catch bugs in learner
-          System.exit(0);
         }
 
       }
index 460e118792b39995842d840caa03cea4addf2c3f..419432b95e880d5df06373032223585c27f74122 100644 (file)
@@ -348,10 +348,6 @@ public class Bayes extends Thread {
      */
 
     boolean status = learnerPtr.netPtr.net_isCycle();
-    if(status) {
-      System.out.println("Assert failed: system has an incorrect result");
-      System.exit(0);
-    }
 
 #ifndef SIMULATOR
     float learnScore = learnerPtr.learner_score();
index a376db2518b00722721ffb270fe3b60be004fbf4..79f87f86d8a866f224bcc15b4683ca81713dd737 100644 (file)
@@ -153,22 +153,13 @@ public class Data {
          */
 
         workQueuePtr.queue_clear();
-        if((status = workQueuePtr.queue_push(v)) != true) {
-          System.out.println("Assert failed: status= "+ status + "should be true");
-          System.exit(0);
-        }
+       status = workQueuePtr.queue_push(v);
 
         while (!(workQueuePtr.queue_isEmpty())) {
           int id = workQueuePtr.queue_pop();
-          if((status = doneBitmapPtr.bitmap_set(id)) != true) {
-            System.out.println("Assert failed: status= "+ status + "should be true");
-            System.exit(0);
-          }
+         status = doneBitmapPtr.bitmap_set(id);
 
-          if((status = dependencyVectorPtr.vector_pushBack(id)) == false) {
-            System.out.println("Assert failed: status= "+ status + "should be true");
-            System.exit(0);
-          }
+         status = dependencyVectorPtr.vector_pushBack(id);
 
           IntList parentIdListPtr = netPtr.net_getParentIdListPtr(id);
           IntListNode it = parentIdListPtr.head;
@@ -176,10 +167,7 @@ public class Data {
           while (it.nextPtr!=null) {
             it = it.nextPtr;
             int parentId = it.dataPtr;
-            if((status = workQueuePtr.queue_push(parentId)) == false) {
-              System.out.println("Assert failed: status= "+ status + "should be true");
-              System.exit(0);
-            }
+           status = workQueuePtr.queue_push(parentId);
           }
         }
 
@@ -198,10 +186,6 @@ public class Data {
       }
     }
 
-    if(numOrder != numVar) {
-      System.out.println("Assert failed: numVar should be equal to numOrder");
-      System.exit(0);
-    }
 
     /*
      * Create records
@@ -219,11 +203,6 @@ public class Data {
           it = it.nextPtr;
           int parentId = it.dataPtr;
           int value = records[startindex + parentId];
-          if(value == DATA_INIT) {
-            System.out.println("Assert failed value should be != DATA_INIT");
-            System.exit(0);
-          }
-
           index = (index << 1) + value;
         }
         int rnd = (int) (randomPtr.random_generate() % DATA_PRECISION);
@@ -231,10 +210,6 @@ public class Data {
         records[startindex + v] = (byte) ((rnd < threshold) ? 1 : 0);
       }
       startindex += numVar;
-      if(startindex > numRecord * numVar) {
-        System.out.println("Assert failed: value should be != DATA_INIT in data_generate()");
-        System.exit(0);
-      }
     }
 
     return netPtr;
@@ -273,19 +248,6 @@ public class Data {
         int num,
         int offset)
     {
-      if((start < 0) || (start > numRecord)) {
-        System.out.println("start: Assert failed in data_sort");
-        System.exit(0);
-      }
-      if((num < 0) || (num > numRecord)) {
-        System.out.println("num: Assert failed in data_sort");
-        System.exit(0);
-      }
-      if((start + num < 0) || (start + num > numRecord)) {
-        System.out.println("start + num: Assert failed in data_sort");
-        System.exit(0);
-      }
-
       sort.sort(records, 
           start * numVar,
           num,
index 907d23d4538486fbddf7be358b09137a99107020..414a7b8db7c0f9c4e9e3658a3635aa2d13c237ca 100644 (file)
@@ -104,9 +104,6 @@ public class IntList {
     allocNode (int dataPtr)
     {
       IntListNode nodePtr = new IntListNode();
-      if (nodePtr == null) {
-        return null;
-      }
 
       nodePtr.dataPtr = dataPtr;
       nodePtr.nextPtr = null;
@@ -123,10 +120,6 @@ public class IntList {
   public static IntList list_alloc ()
     {
       IntList listPtr = new IntList();
-      if (listPtr == null) {
-        System.out.println("Cannot allocate IntList");
-        return null;
-      }
 
       listPtr.head = new IntListNode();
       listPtr.head.dataPtr = 0;
@@ -238,9 +231,6 @@ public class IntList {
 #endif
 
       nodePtr = allocNode(dataPtr);
-      if (nodePtr == null) {
-        return false;
-      }
 
       nodePtr.nextPtr = currPtr;
       prevPtr.nextPtr = nodePtr;
@@ -279,10 +269,6 @@ public class IntList {
         nodePtr.nextPtr = null;
         freeNode(nodePtr);
         size--;
-        if(size < 0) {
-          System.out.println("Assert failed: size cannot be negative in list_remove()");
-          System.exit(0);
-        }
 
         return true;
       }
index 25c624655c63c5920a6ecec17c6bbd82f7757e37..1d5bc42e96af4463fc93e258eb235633ab2f5867 100644 (file)
@@ -23,13 +23,9 @@ public class IntVector {
   public static IntVector vector_alloc (int initCapacity) {
     int capacity = Math.imax(initCapacity, 1);
     IntVector vectorPtr = new IntVector();
-    if(vectorPtr != null) {
-      vectorPtr.size = 0;
-      vectorPtr.capacity = capacity;
-      vectorPtr.elements = new int[capacity];
-      if(vectorPtr.elements == null) 
-        return null;
-    }
+    vectorPtr.size = 0;
+    vectorPtr.capacity = capacity;
+    vectorPtr.elements = new int[capacity];
     return vectorPtr;
   }
 
@@ -67,9 +63,6 @@ public class IntVector {
       int newCapacity = capacity * 2;
       int[] newElements = new int[newCapacity];
 
-      if (newElements == null) {
-        return false;
-      }
       capacity = newCapacity;
       for (int i = 0; i < size; i++) {
         newElements[i] = elements[i];
@@ -131,9 +124,6 @@ public class IntVector {
         int srcCapacity = srcVectorPtr.capacity;
         int[] elements = new int[srcCapacity];
 
-        if (elements == null) {
-          return false;
-        }
         dstVectorPtr.elements = null;
         dstVectorPtr.elements = elements;
         dstVectorPtr.capacity = srcCapacity;
index f10105d40711b1fb8a51dbf75562bdc698535c5c..e3fd9e6f3c2a993e8fbd3c044fef0b66152c35e0 100644 (file)
@@ -179,9 +179,6 @@ public class Learner {
       double probability = (double)count / (double)adtreePtr.numRecord;
       int parentCount = adtreePtr.adtree_getCount(parentQueryVectorPtr);
 
-      if(parentCount < count || parentCount <= 0) {
-        System.exit(0);
-      }
 
       float fval = (float)(probability * (Math.log((double)count/ (double)parentCount)));
 
@@ -226,10 +223,7 @@ public class Learner {
 
       Vector_t queryVectorPtr = new Vector_t(2);
 
-      if((status = queryVectorPtr.vector_pushBack(queries[0])) == false) {
-        System.out.println("Assert failed: status = "+ status + "vector_pushBack failed in createTaskList()");
-        System.exit(0);
-      }
+      status = queryVectorPtr.vector_pushBack(queries[0]);
 
       Query parentQuery = new Query();
       Vector_t parentQueryVectorPtr = new Vector_t(1); 
@@ -278,10 +272,7 @@ public class Learner {
        * For each variable, find if the addition of any edge _to_ it is better
        */
 
-      if((status = parentQueryVectorPtr.vector_pushBack(parentQuery)) == false) {
-        System.out.println("Assert failed: status = "+ status + " vector_pushBack failed in createPartition()");
-        System.exit(0);
-      }
+      status = parentQueryVectorPtr.vector_pushBack(parentQuery);
 
       for (int v = lss.i_start; v < lss.i_stop; v++) {
 
@@ -291,10 +282,7 @@ public class Learner {
         int bestLocalIndex = v;
         float bestLocalLogLikelihood = learnerPtr.localBaseLogLikelihoods[v];
 
-        if((status = queryVectorPtr.vector_pushBack(queries[1])) == false) {
-          System.out.println("Assert failed: status = "+ status + " vector_pushBack failed in createPartition()");
-          System.exit(0);
-        }
+       status = queryVectorPtr.vector_pushBack(queries[1]);
 
         for (int vv = 0; vv < numVar; vv++) {
 
@@ -369,10 +357,6 @@ public class Learner {
             status = learnerPtr.taskListPtr.list_insert(taskPtr);
           }
 
-          if(status == false) {
-            System.out.println("Assert failed: atomic list insert failed at createTaskList()");
-            System.exit(0);
-          }
         }
 
       } // for each variable 
@@ -408,10 +392,6 @@ public class Learner {
         it = it.nextPtr;
         taskPtr = it.dataPtr;
         boolean status = taskListPtr.list_remove(taskPtr);
-        if(status == false) {
-          System.out.println("Assert failed: when removing from a list in TMpopTask()");
-          System.exit(0);
-        }
       }
 
       return taskPtr;
@@ -437,10 +417,6 @@ public class Learner {
         it = it.nextPtr;
         int parentId = it.dataPtr;
         boolean status = parentQueryVectorPtr.vector_pushBack(queries[parentId]);
-        if(status == false) {
-          System.out.println("Assert failed: unable to pushBack in queue");
-          System.exit(0);
-        }
       }
     }
 
@@ -465,10 +441,6 @@ public class Learner {
         it = it.nextPtr;
         int parentId = it.dataPtr;
         boolean status = parentQueryVectorPtr.vector_pushBack(queries[parentId]);
-        if(status == false) {
-          System.out.println("Assert failed: unable to pushBack in queue in TMpopulateParentQueryVector()");
-          System.exit(0);
-        }
       }
     }
 
@@ -489,16 +461,8 @@ public class Learner {
 
       boolean status;
       status = Vector_t.vector_copy(queryVectorPtr, parentQueryVectorPtr);
-      if(status == false ) {
-        System.out.println("Assert failed: while vector copy in populateQueryVectors()");
-        System.exit(0);
-      }
-      
       status = queryVectorPtr.vector_pushBack(queries[id]);
-      if(status == false ) {
-        System.out.println("Assert failed: while vector pushBack in populateQueryVectors()");
-        System.exit(0);
-      }
+
 
       queryVectorPtr.vector_sort();
     }
@@ -520,15 +484,7 @@ public class Learner {
 
       boolean status;
       status = Vector_t.vector_copy(queryVectorPtr, parentQueryVectorPtr);
-      if(status == false ) {
-        System.out.println("Assert failed: while vector copy in TMpopulateQueryVectors()");
-        System.exit(0);
-      }
       status = queryVectorPtr.vector_pushBack(queries[id]);
-      if(status == false ) {
-        System.out.println("Assert failed: while vector pushBack in TMpopulateQueryVectors()");
-        System.exit(0);
-      }
 
       queryVectorPtr.vector_sort();
     }
@@ -648,22 +604,10 @@ public class Learner {
        */
 
       status = Vector_t.vector_copy(baseParentQueryVectorPtr, parentQueryVectorPtr);
-      if(status == false) {
-        System.out.println("Assert failed: copying baseParentQuery vector in TMfindBestInsertTask");
-        System.exit(0);
-      }
 
       status = Vector_t.vector_copy(baseQueryVectorPtr, baseParentQueryVectorPtr);
-      if(status == false) {
-        System.out.println("Assert failed: copying baseQuery vector in TMfindBestInsertTask");
-        System.exit(0);
-      }
 
       status = baseQueryVectorPtr.vector_pushBack(queries[toId]);
-      if(status == false ) {
-        System.out.println("Assert failed: while vector pushBack in TMfindBestInsertTask()");
-        System.exit(0);
-      }
 
       queryVectorPtr.vector_sort();
 
@@ -676,10 +620,6 @@ public class Learner {
       float bestLocalLogLikelihood = oldLocalLogLikelihood;
 
       status = netPtr.net_findDescendants(toId, invalidBitmapPtr, workQueuePtr);
-      if(status == false) {
-        System.out.println("Assert failed: while net_findDescendants in TMfindBestInsertTask()");
-        System.exit(0);
-      }
 
       int fromId = -1;
 
@@ -706,30 +646,13 @@ public class Learner {
           }
 
           status = Vector_t.vector_copy(queryVectorPtr, baseQueryVectorPtr);
-          if(status == false) {
-            System.out.println("Assert failed: copying query vector in TMfindBestInsertTask");
-            System.exit(0);
-          }
 
           status = queryVectorPtr.vector_pushBack(queries[fromId]);
-          if(status == false) {
-            System.out.println("Assert failed: vector pushback for query in TMfindBestInsertTask");
-            System.exit(0);
-          }
 
           queryVectorPtr.vector_sort();
 
           status = Vector_t.vector_copy(parentQueryVectorPtr, baseParentQueryVectorPtr);
-          if(status == false) {
-            System.out.println("Assert failed: copying parentQuery vector in TMfindBestInsertTask");
-            System.exit(0);
-          }
-
           status = parentQueryVectorPtr.vector_pushBack(queries[fromId]);
-          if(status == false) {
-            System.out.println("Assert failed: vector pushBack for parentQuery in TMfindBestInsertTask");
-            System.exit(0);
-          }
 
           parentQueryVectorPtr.vector_sort();
 
@@ -825,10 +748,6 @@ public class Learner {
           if (p != fromId) {
             Query tmpqueryPtr = (Query) (origParentQueryVectorPtr.vector_at(p));
             status = parentQueryVectorPtr.vector_pushBack(queries[tmpqueryPtr.index]);
-            if(status == false) {
-              System.out.println("Assert failed: vector_pushBack to parentQuery in TMfindBestRemoveTask()");
-              System.exit(0);
-            }
           }
         } // create new parent query 
 
@@ -837,17 +756,7 @@ public class Learner {
          */
 
         status = Vector_t.vector_copy(queryVectorPtr, parentQueryVectorPtr);
-        if(status == false) {
-          System.out.println("Assert failed: while vector copy to query in TMfindBestRemoveTask()");
-          System.exit(0);
-        }
-
         status = queryVectorPtr.vector_pushBack(queries[toId]);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_pushBack to query in TMfindBestRemoveTask()");
-          System.exit(0);
-        }
-
         queryVectorPtr.vector_sort();
 
         /*
@@ -955,10 +864,6 @@ public class Learner {
           if (p != fromId) {
             Query tmpqueryPtr = (Query) (toOrigParentQueryVectorPtr.vector_at(p));
             status = parentQueryVectorPtr.vector_pushBack(queries[tmpqueryPtr.index]);
-            if(status == false) {
-              System.out.println("Assert failed: while vector_pushBack parentQueryVectorPtr");
-              System.exit(0);
-            }
           }
         } // create new parent query 
 
@@ -967,16 +872,7 @@ public class Learner {
          */
 
         status = Vector_t.vector_copy(queryVectorPtr, parentQueryVectorPtr);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_copy in TMfindBestReverseTask()");
-          System.exit(0);
-        }
-
         status = queryVectorPtr.vector_pushBack(queries[toId]);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_pushBack in TMfindBestReverseTask()");
-          System.exit(0);
-        }
 
         queryVectorPtr.vector_sort();
 
@@ -997,30 +893,13 @@ public class Learner {
          */
 
         status = Vector_t.vector_copy(parentQueryVectorPtr, fromOrigParentQueryVectorPtr);
-        if(status == false) {
-          System.out.println("Assert failed: while parentQuery vector_copy in TMfindBestReverseTask()");
-          System.exit(0);
-        }
-
         status = parentQueryVectorPtr.vector_pushBack(queries[toId]);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_pushBack into parentQuery on TMfindBestReverseTask()");
-          System.exit(0);
-        }
 
         parentQueryVectorPtr.vector_sort();
 
         status = Vector_t.vector_copy(queryVectorPtr, parentQueryVectorPtr);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_copy on TMfindBestReverseTask()");
-          System.exit(0);
-        }
 
         status = queryVectorPtr.vector_pushBack(queries[fromId]);
-        if(status == false) {
-          System.out.println("Assert failed: while vector_pushBack on TMfindBestReverseTask()");
-          System.exit(0);
-        }
 
         queryVectorPtr.vector_sort();
 
@@ -1108,10 +987,6 @@ public class Learner {
       float operationQualityFactor = learnerPtr.global_operationQualityFactor;
 
       BitMap visitedBitmapPtr = BitMap.bitmap_alloc(learnerPtr.adtreePtr.numVar);
-      if(visitedBitmapPtr == null) {
-        System.out.println("Assert failed: for bitmap alloc in learnStructure()");
-        System.exit(0);
-      }
 
       Queue workQueuePtr = Queue.queue_alloc(-1);
 
@@ -1188,9 +1063,6 @@ public class Learner {
               isTaskValid = false;
             }
             learnerPtr.netPtr.net_applyOperation(OPERATION_INSERT, fromId, toId);
-          } else {
-            System.out.println("Assert failed: We shouldn't get here in learnStructure()");
-            System.exit(0);
           }
 
 
@@ -1309,10 +1181,7 @@ public class Learner {
             }
 
 #endif // LEARNER_TRY_REVERSE 
-          } else {
-            System.out.println("Assert failed: We should not reach here in learnerPtr()");
-            System.exit(0);
-          } //switch op
+          }
 
         } //if isTaskValid
 
index 1e102826197f494dd06525aa8c077868b064ed7f..2ce2bcab47e23e207fca4ade233b5b22aeaf4d76 100644 (file)
@@ -126,9 +126,6 @@ public class List {
     allocNode (LearnerTask dataPtr)
     {
       ListNode nodePtr = new ListNode();
-      if (nodePtr == null) {
-        return null;
-      }
 
       nodePtr.dataPtr = dataPtr;
       nodePtr.nextPtr = null;
@@ -145,10 +142,6 @@ public class List {
   public static List list_alloc ()
     {
       List listPtr = new List();
-      if (listPtr == null) {
-        System.out.println("Cannot create new object List");
-        return null;
-      }
 
       listPtr.head = new ListNode();
       listPtr.head.dataPtr = null;
@@ -280,9 +273,6 @@ public class List {
 #endif
 
       nodePtr = allocNode(dataPtr);
-      if (nodePtr == null) {
-        return false;
-      }
 
       nodePtr.nextPtr = currPtr;
       prevPtr.nextPtr = nodePtr;
@@ -312,10 +302,6 @@ public class List {
         nodePtr.nextPtr = null;
         freeNode(nodePtr);
         size--;
-        if(size < 0) {
-          System.out.println("Assert failed: size cannot be negative in list_remove()");
-          System.exit(0);
-        }
 
         return true;
       }
index dfbd7859483e680e43fcc7fa565d4baec77c2baa..ea99e41fa76a6f37724537bf973641bfa8c505d3 100644 (file)
@@ -78,21 +78,10 @@ public class Net {
   public static NetNode allocNode (int id) {
     NetNode nodePtr = new NetNode();
 
-    if (nodePtr != null) {
-      nodePtr.parentIdListPtr = IntList.list_alloc(); 
-      if (nodePtr.parentIdListPtr == null) {
-        nodePtr = null;
-        return null;
-      }
-      nodePtr.childIdListPtr = IntList.list_alloc();
-      if (nodePtr.childIdListPtr == null) {
-        nodePtr.parentIdListPtr.list_free();
-        nodePtr = null;
-        return null;
-      }
-      nodePtr.id = id;
-    }
-
+    nodePtr.parentIdListPtr = IntList.list_alloc(); 
+    nodePtr.childIdListPtr = IntList.list_alloc();
+    nodePtr.id = id;
+    
     return nodePtr;
   }
 
@@ -133,18 +122,12 @@ public class Net {
       NetNode childNodePtr = (NetNode)(nodeVectorPtr.vector_at(toId));
       IntList parentIdListPtr = childNodePtr.parentIdListPtr;
 
-      if((status = parentIdListPtr.list_insert(fromId)) != true) {
-        System.out.println("Assert failed for parentIdListPtr.list_insert in insertEdge()");
-        System.exit(0);
-      }
+      status = parentIdListPtr.list_insert(fromId);
 
       NetNode parentNodePtr = (NetNode)(nodeVectorPtr.vector_at(fromId));
       IntList childIdListPtr = parentNodePtr.childIdListPtr;
 
-      if((status = childIdListPtr.list_insert(toId)) != true) {
-        System.out.println("Assert failed for childIdListPtr.list_insert in insertEdge()");
-        System.exit(0);
-      }
+      status = childIdListPtr.list_insert(toId);
     }
 
 
@@ -160,18 +143,10 @@ public class Net {
       NetNode childNodePtr = (NetNode)(nodeVectorPtr.vector_at(toId));
       IntList parentIdListPtr = childNodePtr.parentIdListPtr;
       status = parentIdListPtr.list_remove(fromId);
-      if(status == false) {
-        System.out.println("Assert failed: when removing from list");
-        System.exit(0);
-      }
 
       NetNode parentNodePtr = (NetNode)(nodeVectorPtr.vector_at(fromId));
       IntList childIdListPtr = parentNodePtr.childIdListPtr;
       status = childIdListPtr.list_remove(toId);
-      if(status == false) {
-        System.out.println("Assert failed: when removing from list");
-        System.exit(0);
-      }
     }
 
   /* =============================================================================
@@ -199,9 +174,6 @@ public class Net {
         removeEdge(fromId, toId);
       } else if(op == OPERATION_REVERSE) {
         reverseEdge(fromId, toId);
-      } else {
-        System.out.println("Assert failed: We shouldn't get here in net_applyOperation()");
-        System.exit(0);
       }
     }
 
@@ -266,18 +238,10 @@ public class Net {
     {
       boolean status;
 
-      if(visitedBitmapPtr.numBit != nodeVectorPtr.vector_getSize()) {
-        System.out.println("Assert failed for numbit == vector size in net_isPath()");
-        System.exit(0);
-      }
-
       visitedBitmapPtr.bitmap_clearAll();
       workQueuePtr.queue_clear();
 
-      if((status = workQueuePtr.queue_push(fromId)) != true) {
-        System.out.println("Assert failed while inserting into Queue in net_isPath()");
-        System.exit(0);
-      }
+      status = workQueuePtr.queue_push(fromId);
 
       while (!workQueuePtr.queue_isEmpty()) {
         int id = workQueuePtr.queue_pop();
@@ -286,10 +250,7 @@ public class Net {
           return true;
         }
 
-        if((status = visitedBitmapPtr.bitmap_set(id)) != true) {
-          System.out.println("Assert failed while checking bitmap_set in net_isPath()");
-          System.exit(0);
-        }
+       status = visitedBitmapPtr.bitmap_set(id);
 
         NetNode nodePtr = (NetNode) (nodeVectorPtr.vector_at(id));
         IntList childIdListPtr = nodePtr.childIdListPtr;
@@ -300,10 +261,6 @@ public class Net {
           int childId = it.dataPtr;
           if (!visitedBitmapPtr.bitmap_isSet(childId)) {
             status = workQueuePtr.queue_push(childId);
-            if(status == false) {
-              System.out.println("Assert failed: queue_push failed in net_isPath()");
-              System.exit(0);
-            }
           }
         }
       }
@@ -337,9 +294,6 @@ public class Net {
         return true;
       } else if(nodePtr.mark == NET_NODE_MARK_DONE) {
         return false;
-      } else {
-        System.out.println("We should have never come here in isCycle()");
-        System.exit(0);
       }
 
       nodePtr.mark = NET_NODE_MARK_DONE;
@@ -368,16 +322,6 @@ public class Net {
         } else if(nodePtr.mark == NET_NODE_MARK_DONE) {
           /* do nothing */
           ;
-        } else if(nodePtr.mark == NET_NODE_MARK_TEST) {
-          /* Assert 0 */
-          System.out.println("We should have never come here in net_isCycle()");
-          System.exit(0);
-          break;
-        } else {
-          /* Assert 0 */
-          System.out.println("We should have never come here in net_isCycle()");
-          System.exit(0);
-          break;
         }
       }
 
@@ -393,10 +337,6 @@ public class Net {
     net_getParentIdListPtr (int id)
     {
       NetNode nodePtr = (NetNode) (nodeVectorPtr.vector_at(id));
-      if(nodePtr == null) {
-        System.out.println("Assert failed for nodePtr");
-        System.exit(0);
-      }
 
       return nodePtr.parentIdListPtr;
     }
@@ -410,10 +350,6 @@ public class Net {
     net_getChildIdListPtr (int id)
     {
       NetNode nodePtr = (NetNode) (nodeVectorPtr.vector_at(id));
-      if(nodePtr == null) {
-        System.out.println("Assert failed for nodePtr");
-        System.exit(0);
-      }
 
       return nodePtr.childIdListPtr;
     }
@@ -432,11 +368,6 @@ public class Net {
     {
       boolean status;
 
-      if(ancestorBitmapPtr.numBit != nodeVectorPtr.vector_getSize()) {
-        System.out.println("Assert failed for numbit == vector size in net_findAncestors()");
-        System.exit(0);
-      }
-
       ancestorBitmapPtr.bitmap_clearAll();
       workQueuePtr.queue_clear();
 
@@ -449,14 +380,7 @@ public class Net {
           it = it.nextPtr;
           int parentId = it.dataPtr;
           status = ancestorBitmapPtr.bitmap_set(parentId);
-          if(status == false) {
-            System.out.println("Assert failed: for bitmap_set in net_findAncestors()");
-            System.exit(0);
-          }
-          if((status = workQueuePtr.queue_push(parentId)) == false) {
-            System.out.println("Assert failed: for workQueuePtr.queue_push in net_findAncestors()");
-            System.exit(0);
-          }
+         status = workQueuePtr.queue_push(parentId);
         }
 
       }
@@ -475,15 +399,9 @@ public class Net {
           it = it.nextPtr;
           int grandParentId = it.dataPtr;
           if (!ancestorBitmapPtr.bitmap_isSet(grandParentId)) {
-            if((status = ancestorBitmapPtr.bitmap_set(grandParentId)) == false) {
-              System.out.println("Assert failed: for ancestorBitmapPtr bitmap_set in net_findAncestors()");
-              System.exit(0);
-            }
+           status = ancestorBitmapPtr.bitmap_set(grandParentId);
 
-            if((status = workQueuePtr.queue_push(grandParentId)) == false) {
-              System.out.println("Assert failed: for workQueuePtr.queue_push in net_findAncestors()");
-              System.exit(0);
-            }
+           status = workQueuePtr.queue_push(grandParentId);
           }
         }
       }
@@ -505,11 +423,6 @@ public class Net {
     {
       boolean status;
 
-      if(descendantBitmapPtr.numBit != nodeVectorPtr.vector_getSize()) {
-        System.out.println("Assert failed: for descendantBitmapPtr.numbit in net_findDescendants()");
-        System.exit(0);
-      }
-
       descendantBitmapPtr.bitmap_clearAll();
       workQueuePtr.queue_clear();
 
@@ -521,15 +434,9 @@ public class Net {
         while (it.nextPtr!=null) {
           it = it.nextPtr;
           int childId = it.dataPtr;
-          if((status = descendantBitmapPtr.bitmap_set(childId)) == false) {
-            System.out.println("Assert failed: for descendantBitmapPtr.bitmap_set in net_findDescendants()");
-            System.exit(0);
-          }
+         status = descendantBitmapPtr.bitmap_set(childId);
 
-          if((status = workQueuePtr.queue_push(childId)) == false) {
-            System.out.println("Assert failed: for workQueuePtr.queue_push in net_findDescendants()");
-            System.exit(0);
-          }
+         status = workQueuePtr.queue_push(childId);
 
         }
       }
@@ -549,15 +456,8 @@ public class Net {
           it = it.nextPtr;
           int grandChildId = it.dataPtr;
           if (!descendantBitmapPtr.bitmap_isSet(grandChildId)) {
-            if((status = descendantBitmapPtr.bitmap_set(grandChildId)) == false) {
-              System.out.println("Assert failed: for descendantBitmapPtr.bitmap_set in net_findDescendants()");
-              System.exit(0);
-            }
-
-            if((status = workQueuePtr.queue_push(grandChildId)) == false) {
-              System.out.println("Assert failed: for workQueuePtr.queue_push in net_findDescendants()");
-              System.exit(0);
-            }
+           status = descendantBitmapPtr.bitmap_set(grandChildId);
+           status = workQueuePtr.queue_push(grandChildId);
           }
         }
       }
@@ -577,10 +477,6 @@ public class Net {
     {
       int numNode = nodeVectorPtr.vector_getSize();
       BitMap visitedBitmapPtr = BitMap.bitmap_alloc(numNode);
-      if(visitedBitmapPtr == null) {
-        System.out.println("Assert failed: during bitmap_alloc in net_generateRandomEdges()");
-        System.exit(0);
-      }
 
       Queue workQueuePtr = Queue.queue_alloc(-1);
 
@@ -599,11 +495,6 @@ public class Net {
         }
       }
 
-      if(net_isCycle()) {
-        System.out.println("Assert failed: Cycle detected in net_generateRandomEdges()");
-        System.exit(0);
-      }
-
       visitedBitmapPtr.bitmap_free();
       workQueuePtr.queue_free();
     }
index 9ee50a1900cebe0f187c8d8070adeb1289c469a7..e2015045f581cbaabb9100298d90cf29787216cd 100644 (file)
@@ -70,10 +70,6 @@ public class Queue {
 
     int capacity = ((initCapacity < 2) ? 2 : initCapacity);
     queuePtr.elements = new int[capacity];
-    if (queuePtr.elements == null) {
-      queuePtr = null;
-      return null;
-    }
     queuePtr.pop      = capacity - 1;
     queuePtr.push     = 0;
     queuePtr.capacity = capacity;
@@ -93,10 +89,6 @@ public class Queue {
 
       int capacity = ((initCapacity < 2) ? 2 : initCapacity);
       queuePtr.elements = new int[capacity];
-      if (queuePtr.elements == null) {
-        queuePtr = null;
-        return null;
-      }
       queuePtr.pop      = capacity - 1;
       queuePtr.push     = 0;
       queuePtr.capacity = capacity;
@@ -115,10 +107,6 @@ public class Queue {
 
     int capacity = ((initCapacity < 2) ? 2 : initCapacity);
     queuePtr.elements = new int[capacity];
-    if (queuePtr.elements == null) {
-      queuePtr = null;
-      return null;
-    }
     queuePtr.pop      = capacity - 1;
     queuePtr.push     = 0;
     queuePtr.capacity = capacity;
@@ -238,10 +226,6 @@ public class Queue {
   public boolean
     queue_push (int dataPtr)
     {
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -249,9 +233,6 @@ public class Queue {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] tmpelements = elements;
@@ -295,10 +276,6 @@ public class Queue {
       int push     = queuePtr.push;
       int capacity = queuePtr.capacity;
 
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -306,9 +283,6 @@ public class Queue {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] elements = queuePtr.elements;
@@ -354,19 +328,12 @@ public class Queue {
       int push     = (queuePtr.push);
       int capacity = (queuePtr.capacity);
 
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
       if (newPush == pop) {
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] elements = queuePtr.elements;
index b134600f498f4a05bef1f120c7495acc778d0d92..a6bbf5659f46363a97ce82cbb788e2f6a2aa4835 100644 (file)
@@ -32,10 +32,6 @@ public class Vector_t {
    * =============================================================================
    */
   public Object vector_at (int i) {
-    if ((i < 0) || (i >= size)) {
-      System.out.println("Illegal Vector.element\n");
-      return null;
-    }
     return (elements[i]);
   }
 
@@ -50,9 +46,6 @@ public class Vector_t {
       int newCapacity = capacity * 2;
       Object[] newElements = new Object[newCapacity];
 
-      if (newElements == null) {
-        return false;
-      }
       capacity = newCapacity;
       for (int i = 0; i < size; i++) {
         newElements[i] = elements[i];
@@ -122,9 +115,6 @@ public class Vector_t {
         int srcCapacity = srcVectorPtr.capacity;
         Object[] elements = new Object[srcCapacity];
 
-        if (elements == null) {
-          return false;
-        }
         dstVectorPtr.elements = null;
         dstVectorPtr.elements = elements;
         dstVectorPtr.capacity = srcCapacity;
index d8df63e95ce0820ce3e9ee812aa18a61000bed87..9ce94802cc961a8b4a1f5a41481e5890a15aaaa4 100644 (file)
@@ -123,33 +123,18 @@ public class Decoder {
       if (fragmentListPtr == null) {
        fragmentListPtr = new List_t(1); // packet_compareFragmentId
        status = fragmentListPtr.insert(packetPtr);
-       if(!status) {
-         System.out.println("Assertion Decoer.process");
-       }
        status = fragmentedMapPtr.insert(flowId, fragmentListPtr);
-       if(!status) {
-         System.out.println("Assertion Decoder!!!!.process");
-       }
       } else {
        List_Iter it = new List_Iter();
        it.reset(fragmentListPtr);
-       if(!it.hasNext(fragmentListPtr)) {
-         System.out.println("Assertion in Decoder2.process");
-       }
        System.out.print("");
        Packet firstFragmentPtr = (Packet)it.next(fragmentListPtr);
        int expectedNumFragment = firstFragmentPtr.numFragment;
        if (numFragment != expectedNumFragment) {
          status = fragmentedMapPtr.deleteNode(flowId);
-         if(!status) {
-           System.out.println("Assertion in process1");
-         }
          return er.NUMFRAGMENT;
        }
        status = fragmentListPtr.insert(packetPtr);
-       if(!status) {
-         System.out.println("Assertion in process2");
-       }
        /*
         * If we have all thefragments we can reassemble them
         */
@@ -161,9 +146,6 @@ public class Decoder {
            Packet fragmentPtr = (Packet)it.next(fragmentListPtr);
            if(fragmentPtr.fragmentId != i) {
              status = fragmentedMapPtr.deleteNode(flowId);
-             if(!status) {
-               System.out.println("Assertion in process3");
-             }
              return er.INCOMPLETE; /* should be sequential */
            }
            numBytes = numBytes + fragmentPtr.length;
@@ -183,13 +165,7 @@ public class Decoder {
          decodedPtr.flowId = flowId;
          decodedPtr.data = data;
          status = decodedQueuePtr.queue_push(decodedPtr);
-         if(!status) {
-           System.out.println("Assertion in process7");
-         }
          status = fragmentedMapPtr.deleteNode(flowId);
-         if(!status) {
-           System.out.println("Assertion in process8");
-         }
        }
       }
     } else {
@@ -200,17 +176,11 @@ public class Decoder {
        return er.FRAGMENTID;
       }
       byte[] data = packetPtr.data;
-      if(data == null) {
-       System.out.println("Assertion in proces9");
-      }
       Decoded decodedPtr = new Decoded();
 
       decodedPtr.flowId = flowId;
       decodedPtr.data = data;
       status = decodedQueuePtr.queue_push(decodedPtr);
-      if(!status) {
-       System.out.println("Assertion in process10");
-      }
     }
     return er.NONE;
   }
index 3a42ad5f122d9fc4bae6921005b8732ecd6ffaec..943fe1b4906ef9233ac54220b3b74faf636b580c 100644 (file)
@@ -91,10 +91,6 @@ public class Detector {
  */
     public void addPreprocessor(int p) {
         boolean status = preprocessorVectorPtr.vector_pushBack(new Integer(p));
-        if(!status) {
-            System.out.println("Assertion in Detector.addPreprocessor");
-            System.exit(1);
-        }
     }
 
 
@@ -111,15 +107,12 @@ public class Detector {
     for(int p = 0; p < numPreprocessor; p++) {
       Integer preprocessor = (Integer)preprocessorVectorPtr.vector_at(p);
       if(preprocessor.intValue() == 1) {
-       System.out.println("NOOOOOOOOOOOOO");
       } else if(preprocessor.intValue() == 2) {
        for(int i=0;i<str.length;i++) {
          if(str[i] >'A' && str[i] < 'Z') {
            str[i] +=(byte)32;
          }
        }
-      } else {
-       System.out.println("NOOOOOOOOOOOOO");
       }
     }
     
index 2186fe2977b81f8bcbdb89725e506807a08302f4..44e07886d67cf1188a1de5417bda684a046058bb 100644 (file)
@@ -208,12 +208,6 @@ public class Intruder extends Thread {
                 error = decoderPtr.process(packetPtr,(packetPtr.length));
             }
 
-            if (error != 0) {
-                /*
-                 * Currently, stream_generate() does not create these errors.
-                 */
-             System.out.println("Here?"+error);
-            }
             byte[] data;
             int[] decodedFlowId = new int[1];
             
@@ -226,9 +220,6 @@ public class Intruder extends Thread {
               
              if(err != 0) {
                boolean status = errorVectorPtr.vector_pushBack(new Integer(decodedFlowId[0]));
-               if(!status) {
-                 System.out.println("Assertion in Intruder.processPacket");
-               }
              }
             }
         }
index 619bf290d7ad0424c2476eea62b99f6000c060eb..3ac8b05fa7a083d5dcac0d2536bf4ba1219cb6f8 100644 (file)
@@ -205,9 +205,6 @@ public class List_t {
         currPtr = prevPtr.nextPtr;
 
         nodePtr = allocNode(dataPtr);
-        if (nodePtr == null) {
-            return false;
-        }
 
         nodePtr.nextPtr = currPtr;
         prevPtr.nextPtr = nodePtr;
index fbf9d5da41eed3f5ec21194e3fd41a2e26b03749..3fc05b9c79dcc69a8886571843673aee61524a2f 100644 (file)
@@ -142,9 +142,6 @@ public class Queue_t {
     if (newPush == pop) {
       int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
       Object[] newElements = new Object[newCapacity];
-      if (newElements == null) {
-       return false;
-      }
       
       int dst = 0;
       Object[] tmpelements = elements;
@@ -200,9 +197,6 @@ public class Queue_t {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         Object[] newElements = new Object[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         Object[] elements = queuePtr.elements;
index 6b3f4272cbe39b9abfe51aa877bcf593dceb361d..307f1e6a6dd5aee7030cb589b158f430d6dd5316 100644 (file)
@@ -588,7 +588,7 @@ public class RBTree {
         if ( ex != null) {
             node = null;
         }
-        return ((ex == null) ? true : false);
+        return ex == null;
     }
 
 
@@ -607,8 +607,7 @@ public class RBTree {
         }
         if(node != null) {
         }
-        return ((node != null) ? true : false);
-
+        return node != null;
     }
 
 
index 04c2cba643dd9c7382141284dc9b5de4acddd858..18ece4148bf0d2463fd363dff9b81a6419d3d0a8 100644 (file)
@@ -6,10 +6,6 @@ public class Stream {
   RBTree attackMapPtr;
 
   public Stream(int percentAttack) {
-    if (percentAttack < 0 || percentAttack > 100) {
-      System.out.print("Error: Invalid percentAttack value\n");
-      System.exit(0);
-    }
     this.percentAttack = percentAttack;
     randomPtr = new Random();
     allocVectorPtr = new Vector_t(1);
@@ -34,10 +30,6 @@ public class Stream {
     for (p = 0; p < (numPacket - 1); p++) {
       Packet bytes = new Packet(numDataByte);
       status = allocVectorPtr.vector_pushBack(bytes);
-      if (status == false) {
-        System.out.printString("Error: Vector pushBack failed\n");
-        System.exit(-1);
-      }
       bytes.flowId = flowId;
       bytes.fragmentId = p;
       bytes.numFragment = numPacket;
@@ -47,10 +39,6 @@ public class Stream {
             bytes.data[z] = str[i];
       }
       status = packetQueuePtr.queue_push(bytes);
-      if (status == false) {
-        System.out.printString("Error: Queue push failed\n");
-        System.exit(0);
-      }
       beginIndex = endIndex;
     }
     int lastNumDataByte = numDataByte + numByte % numPacket;
@@ -64,10 +52,6 @@ public class Stream {
         bytes.data[z] = str[i];
     }
     status = packetQueuePtr.queue_push(bytes);
-    if (status == false) {
-      System.out.printString("Error: Queue push failed\n");
-      System.exit(0);
-    }
   }
   /*==================================================
   /* stream_generate 
@@ -81,10 +65,6 @@ public class Stream {
     randomPtr.random_seed(seed);
     packetQueuePtr.queue_clear();
     int range = '~' - ' ' + 1;
-    if (range <= 0) {
-      System.out.printString("Assert failed range <= 0\n");
-      System.exit(0);
-    }
     int f;
     boolean status;
     for (f = 1; f <= numFlow; f++) {
@@ -94,10 +74,6 @@ public class Stream {
         String str = dictionaryPtr.get(s);
         c = str.getBytes();
         status = attackMapPtr.insert(f, c);
-        if (status == false) {
-          System.out.printString("Assert failed: status is false\n");
-          System.exit(0);
-        }
         numAttack++;
       } else {
         /* Create random string */
@@ -108,18 +84,10 @@ public class Stream {
           c[l] =(byte) (' ' + (byte) (randomPtr.random_generate() % range));
         }
         status = allocVectorPtr.vector_pushBack(c);
-        if(!status) {
-            System.out.println("Assert faiiled status is null.");
-            System.exit(0);
-        }
         int err = detectorPtr.process(c);
         if (err == error.SIGNATURE) {
           status = attackMapPtr.insert(f, c);
           System.out.println("Never here");
-          if (!status) {
-            System.out.printString("Assert failed status is null\n");
-            System.exit(0);
-          }
           numAttack++;
         }
       }
index cf6e3a3c40a5d592c952737f21d9f6f421aafeab..b90422f59904bf11c3703bb70ace36422b64117b 100644 (file)
@@ -31,10 +31,6 @@ public class Vector_t {
    * =============================================================================
    */
   public Object vector_at (int i) {
-    if ((i < 0) || (i >= size)) {
-      System.out.println("Illegal Vector.element\n");
-      return null;
-    }
     return (elements[i]);
   }
 
@@ -50,9 +46,7 @@ public class Vector_t {
       Object[] newElements = new Object[newCapacity];
 
       //void** newElements = (void**)malloc(newCapacity * sizeof(void*));
-      if (newElements == null) {
-        return false;
-      }
+
       capacity = newCapacity;
       for (int i = 0; i < size; i++) {
         newElements[i] = elements[i];
@@ -126,9 +120,6 @@ public class Vector_t {
         int srcCapacity = srcVectorPtr.capacity;
         Object[] elements = new Object[srcCapacity];
 
-        if (elements == null) {
-          return false;
-        }
         dstVectorPtr.elements = null;
         dstVectorPtr.elements = elements;
         dstVectorPtr.capacity = srcCapacity;
index 7c2831af11b199270a9d7acd84e42bf32e6b4596..760b7e96ca3ec002b04e39bbd70bd75173fe2b0e 100644 (file)
@@ -93,21 +93,19 @@ public class Grid {
   public static Grid alloc(int width,int height,int depth) {
     Grid grid = new Grid();
     
-    if(grid != null) {
-      grid.width = width;
-      grid.height = height;
-      grid.depth = depth;
-      
-      int[][][] points_unaligned = new int[width][height][depth];
-
-      
-      for(int i=0;i<width;i++)
-       for(int j=0;j<height;j++)
-         for(int k=0;k<depth;k++)
-           points_unaligned[i][j][k]= GRID_POINT_EMPTY;
-      
-      grid.points_unaligned = points_unaligned;
-    }
+    grid.width = width;
+    grid.height = height;
+    grid.depth = depth;
+    
+    int[][][] points_unaligned = new int[width][height][depth];
+    
+    
+    for(int i=0;i<width;i++)
+      for(int j=0;j<height;j++)
+       for(int k=0;k<depth;k++)
+         points_unaligned[i][j][k]= GRID_POINT_EMPTY;
+    
+    grid.points_unaligned = points_unaligned;
     
     return grid;         
   }
index 935939660c58a9f8ff886b779c9bd523b357b4ca..699f1a47dc075cfa06fb17e9bb644bd23f48b462 100644 (file)
@@ -92,9 +92,6 @@ public class List_t {
     {
         List_Node nodePtr = new List_Node();
 
-        if(nodePtr == null) {
-            return null;
-        }
 
         nodePtr.dataPtr = dataPtr;
         nodePtr.nextPtr = null;
@@ -117,9 +114,6 @@ public class List_t {
     {
         List_t listPtr = new List_t();
 
-        if(listPtr  == null) {
-            return null;
-        }
 
         listPtr.head.dataPtr = null;
         listPtr.head.nextPtr = null;
index e83e0233e6cce3077ab78d5766d6396ee1e93d95..97dee1ac6e6eedaf8a1e64ff8607187d251113e1 100644 (file)
@@ -90,14 +90,12 @@ public class Maze {
    {
        Maze mazePtr = new Maze();
 
-       if(mazePtr != null) {
-           mazePtr.gridPtr = null;
-           mazePtr.workQueuePtr = Queue_t.queue_alloc(1024);
-           mazePtr.wallVectorPtr = Vector_t.vector_alloc(1);
-           mazePtr.srcVectorPtr = Vector_t.vector_alloc(1);
-           mazePtr.dstVectorPtr = Vector_t.vector_alloc(1);
+       mazePtr.gridPtr = null;
+       mazePtr.workQueuePtr = Queue_t.queue_alloc(1024);
+       mazePtr.wallVectorPtr = Vector_t.vector_alloc(1);
+       mazePtr.srcVectorPtr = Vector_t.vector_alloc(1);
+       mazePtr.dstVectorPtr = Vector_t.vector_alloc(1);
 
-       }
 
        return mazePtr;
    }
@@ -201,10 +199,6 @@ public class Maze {
                         else { 
                             Pair coordinatePairPtr = Pair.alloc(srcPtr,dstPtr);
                             boolean status = workListPtr.insert(coordinatePairPtr);
-                            if(!status) {
-                                System.out.println("LIST_INSERT????");
-                                System.exit(1);
-                            }
                             srcVectorPtr.vector_pushBack(srcPtr);
                             dstVectorPtr.vector_pushBack(dstPtr);
                             
index 49e3ad42909ad0410318eb7f541d1d5eb6390252..ee98d15a0820ce5fb8182c0ff811b6493ecb27f4 100644 (file)
@@ -70,10 +70,6 @@ public class Queue_Int {
 
     int capacity = ((initCapacity < 2) ? 2 : initCapacity);
     queuePtr.elements = new int[capacity];
-    if (queuePtr.elements == null) {
-      queuePtr = null;
-      return null;
-    }
     queuePtr.pop      = capacity - 1;
     queuePtr.push     = 0;
     queuePtr.capacity = capacity;
@@ -93,10 +89,6 @@ public class Queue_Int {
 
       int capacity = ((initCapacity < 2) ? 2 : initCapacity);
       queuePtr.elements = new int[capacity];
-      if (queuePtr.elements == null) {
-        queuePtr = null;
-        return null;
-      }
       queuePtr.pop      = capacity - 1;
       queuePtr.push     = 0;
       queuePtr.capacity = capacity;
@@ -115,10 +107,6 @@ public class Queue_Int {
 
     int capacity = ((initCapacity < 2) ? 2 : initCapacity);
     queuePtr.elements = new int[capacity];
-    if (queuePtr.elements == null) {
-      queuePtr = null;
-      return null;
-    }
     queuePtr.pop      = capacity - 1;
     queuePtr.push     = 0;
     queuePtr.capacity = capacity;
@@ -205,10 +193,6 @@ public class Queue_Int {
   public boolean
     queue_push (int dataPtr)
     {
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -216,9 +200,6 @@ public class Queue_Int {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] tmpelements = elements;
@@ -262,10 +243,6 @@ public class Queue_Int {
       int push     = queuePtr.push;
       int capacity = queuePtr.capacity;
 
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -273,9 +250,6 @@ public class Queue_Int {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] elements = queuePtr.elements;
@@ -321,19 +295,12 @@ public class Queue_Int {
       int push     = (queuePtr.push);
       int capacity = (queuePtr.capacity);
 
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
       if (newPush == pop) {
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         int[] newElements = new int[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         int[] elements = queuePtr.elements;
index 0f30d35ae454df58896d5517bd33c975bec82dbb..f959bd7f76d0cf127515930864a42840381e0c9a 100644 (file)
@@ -70,10 +70,6 @@ public class Queue_t {
 
     int capacity = ((initCapacity < 2) ? 2 : initCapacity);
     queuePtr.elements = new Object[capacity];
-    if (queuePtr.elements == null) {
-      queuePtr = null;
-      return null;
-    }
     queuePtr.pop      = capacity - 1;
     queuePtr.push     = 0;
     queuePtr.capacity = capacity;
@@ -93,10 +89,6 @@ public class Queue_t {
 
       int capacity = ((initCapacity < 2) ? 2 : initCapacity);
       queuePtr.elements = new Object[capacity];
-      if (queuePtr.elements == null) {
-        queuePtr = null;
-        return null;
-      }
       queuePtr.pop      = capacity - 1;
       queuePtr.push     = 0;
       queuePtr.capacity = capacity;
@@ -182,12 +174,6 @@ public class Queue_t {
     queue_push (Object dataPtr)
     {
     
-      if(pop == push) {
-
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
-
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -195,9 +181,6 @@ public class Queue_t {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         Object[] newElements = new Object[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
 
         int dst = 0;
         Object[] tmpelements = elements;
@@ -242,10 +225,6 @@ public class Queue_t {
       int push     = queuePtr.push;
       int capacity = queuePtr.capacity;
 
-      if(pop == push) {
-        System.out.println("push == pop in Queue.java");
-        return false;
-      }
 
       /* Need to resize */
       int newPush = (push + 1) % capacity;
@@ -253,10 +232,6 @@ public class Queue_t {
 
         int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
         Object[] newElements = new Object[newCapacity];
-        if (newElements == null) {
-          return false;
-        }
-
         int dst = 0;
         Object[] elements = queuePtr.elements;
         if (pop < push) {
index 45b5eabe7209fe9a6902f3f8b2f948af05b95b61..f5c752cd4d5ef4fac146300ff316f7ad80a8eb37 100644 (file)
@@ -112,12 +112,10 @@ public class Router {
     routerPtr.MOVE_NEGY = new Point(0,-1,0,0,MOMENTUM_NEGY);
     routerPtr.MOVE_NEGZ = new Point(0,0,-1,0,MOMENTUM_NEGZ);
 
-    if(routerPtr != null) {
-      routerPtr.xCost = xCost;
-      routerPtr.yCost = yCost;
-      routerPtr.zCost = zCost;
-      routerPtr.bendCost = bendCost;
-    }
+    routerPtr.xCost = xCost;
+    routerPtr.yCost = yCost;
+    routerPtr.zCost = zCost;
+    routerPtr.bendCost = bendCost;
     
     return routerPtr;    
   }
@@ -384,10 +382,6 @@ public class Router {
             if(success) {
                 boolean status = myPathVectorPtr.vector_pushBack(pointVectorPtr);
                 
-                if(!status) {
-                    System.out.println("Assert in Router_Solve");
-                    System.exit(1);
-                }
             }
         }
 
index 91138e7375a09d2e6e31092f5fb0d542f1cd3b15..5132241a3e18fe3642d745bfbbefdc95ebf58528 100644 (file)
@@ -16,13 +16,8 @@ public class Vector_t {
   public static Vector_t vector_alloc (int initCapacity) {
     int capacity = Math.imax(initCapacity, 1);
     Vector_t vectorPtr = new Vector_t();
-    if(vectorPtr != null) {
-      vectorPtr.size = 0;
-      vectorPtr.capacity = capacity;
-      vectorPtr.elements = new Object[capacity];
-      if(vectorPtr.elements == null) 
-        return null;
-    }
+    vectorPtr.capacity = capacity;
+    vectorPtr.elements = new Object[capacity];
     return vectorPtr;
   }
 
@@ -42,10 +37,6 @@ public class Vector_t {
    * =============================================================================
    */
   public Object vector_at (int i) {
-    if ((i < 0) || (i >= size)) {
-      System.out.println("Illegal Vector.element\n");
-      return null;
-    }
     return (elements[i]);
   }
 
@@ -61,9 +52,6 @@ public class Vector_t {
       Object[] newElements = new Object[newCapacity];
 
       //void** newElements = (void**)malloc(newCapacity * sizeof(void*));
-      if (newElements == null) {
-        return false;
-      }
       capacity = newCapacity;
       for (int i = 0; i < size; i++) {
         newElements[i] = elements[i];
@@ -136,10 +124,6 @@ public class Vector_t {
       if (dstCapacity < srcSize) {
         int srcCapacity = srcVectorPtr.capacity;
         Object[] elements = new Object[srcCapacity];
-
-        if (elements == null) {
-          return false;
-        }
         dstVectorPtr.elements = null;
         dstVectorPtr.elements = elements;
         dstVectorPtr.capacity = srcCapacity;
index e55499e5a307107d70cd36192fdec7933fa1ff04..2e91858540f9fbc213efd15f156e89dcf19af864 100644 (file)
@@ -128,11 +128,6 @@ public class Customer {
     }
 
     boolean status = reservationInfoListPtr.remove(findReservationInfo);
-    if (!status) {
-       System.out.println("TMRESTART15");
-       System.exit(-1);
-    }
-
     return true;
   }
 
index 409a853146bd15d5666d04a1f9f9c9f6aca7597a..8596526c476d75657c63cf5fdf288fd3ce500e6f 100644 (file)
@@ -117,10 +117,6 @@ public class Manager {
       }
       if (reservationPtr.numTotal == 0) {
        boolean status = tablePtr.remove(id);
-       if (!status) {
-         System.out.println("TMRESTART7");
-         System.exit(-1);
-       }
       } else {
        reservationPtr.reservation_updatePrice(price);
       }
@@ -240,10 +236,6 @@ public class Manager {
     customerPtr = new Customer(customerId);
     //  assert(customerPtr != null);
     status = customerTablePtr.insert(customerId, customerPtr);
-    if (!status) {
-      System.out.println("TMRESTART8");
-      System.exit(-1);
-    }
     
     return true;
   }
@@ -281,23 +273,10 @@ public class Manager {
       it=it.nextPtr;
       reservationInfoPtr =(Reservation_Info)it.dataPtr;
       reservationPtr = (Reservation)reservationTables[reservationInfoPtr.type].find(reservationInfoPtr.id);
-      if (reservationPtr == null) {
-       System.out.println("TMRESTART9");
-       System.exit(-1);
-      }
       status = reservationPtr.reservation_cancel();
-
-      if (!status) {
-       System.out.println("TMRESTART10");
-       System.exit(-1);
-      }
     }
     
     status = customerTablePtr.remove(customerId);
-    if (!status) {
-      System.out.println("TMRESTART11");
-      System.exit(-1);
-    }
     return true;
   }
   
@@ -463,10 +442,6 @@ public class Manager {
             reservationPtr.price)) {
       /* Undo previous successful reservation */
       boolean status = reservationPtr.reservation_cancel();
-      if (!status) {
-       System.out.println("TMRESTART12");
-       System.exit(-1);
-      }
       return false;
     }
     
@@ -547,10 +522,6 @@ public class Manager {
     if (!customerPtr.customer_removeReservationInfo(type, id)) {
         /* Undo previous successful cancellation */
       boolean status = reservationPtr.reservation_make();
-      if (!status) {
-       System.out.println("TMRESTART13");
-       System.exit(-1);
-      }
       return false;
     }
     
index a2098e1cab579d12faeeca0611d20096fe0a2eca..4b5513c9c3b554fe20327d185985428b1a475b7f 100644 (file)
@@ -92,33 +92,9 @@ public class Reservation {
  */
   public void checkReservation() {
     int numUsed = this.numUsed;
-    if (numUsed < 0) {
-       System.out.println("TMRESTART1");
-       System.exit(-1);
-    }
-    
     int numFree = this.numFree;
-    if (numFree < 0) {
-       System.out.println("TMRESTART2");
-       System.exit(-1);
-    }
-
     int numTotal = this.numTotal;
-    if (numTotal < 0) {
-       System.out.println("TMRESTART3");
-       System.exit(-1);
-    }
-
-    if ((numUsed + numFree) != numTotal) {
-       System.out.println("TMRESTART4");
-       System.exit(-1);
-    }
-
     int price = this.price;
-    if (price < 0) {
-       System.out.println("TMRESTART5");
-       System.exit(-1);
-    }
   }
   
   
index af363ab2badf4054357f4b18e1e1fdb020ab5b0b..da995b150963e750b116d76d0a7b0a4a3f9bab40 100644 (file)
@@ -331,12 +331,7 @@ public class Vacation {
     int maxCustomerId = queryRange + 1;
     for (i = 1; i <= maxCustomerId; i++) {
       if (customerTablePtr.find(i)!=null) {
-       if (customerTablePtr.remove(i)) {
-         if (customerTablePtr.find(i)!=null) {
-           System.out.println("ERROR");
-           System.exit(-1);
-         }
-       }
+       customerTablePtr.remove(i);
       }
     }
 
@@ -346,32 +341,17 @@ public class Vacation {
       for (i = 1; i <= numRelation; i++) {
        if (tablePtr.find(i)!=null) {
          if (t==0) {
-           if (!managerPtr.manager_addCar(i,0,0)) {
-             System.out.println("ERROR3");
-             System.exit(-1);
-           }
+           managerPtr.manager_addCar(i,0,0);
          } else if (t==1) {
-           if (!managerPtr.manager_addFlight(i, 0, 0)) {
-             System.out.println("ERROR3");
-             System.exit(-1);
-           }
+           managerPtr.manager_addFlight(i, 0, 0);
          } else if (t==2) {
-           if (!managerPtr.manager_addRoom(i,0,0)) {
-             System.out.println("ERROR3");
-             System.exit(-1);
-           }
-         }
-
-         if (tablePtr.remove(i)) {
-           if (tablePtr.remove(i)) {
-             System.out.println("ERROR2");
-             System.exit(-1);
-           }
+           managerPtr.manager_addRoom(i,0,0);
          }
+         tablePtr.remove(i);
        }
       }
     }
-
+    
     System.out.println("done.");
   }
 
index 44708e2b65c6ce6167460789e850dfe7a3177bc8..b67006b5ce72c0a29e0bb06063822dc2d6065819 100644 (file)
@@ -82,18 +82,10 @@ public class BitMap {
   public static BitMap bitmap_alloc(int numBit)
     {
       BitMap bitmapPtr = new BitMap();
-      if (bitmapPtr == null) {
-        return null;
-      }
-
       bitmapPtr.numBit = numBit;
       int numWord = bitmapPtr.DIVIDE_AND_ROUND_UP(numBit, NUM_BIT_PER_WORD);
       bitmapPtr.numWord = numWord;
-
       bitmapPtr.bits = new int[numWord];
-      if (bitmapPtr.bits == null) {
-        return null;
-      }
       for(int i = 0; i < numWord; i++)
         bitmapPtr.bits[i] = 0;
 
index 1aad1a10d30bdf244becc331905b651508245742..0caf93f11ea39f7461c4b2b51d5867cde49c5074 100644 (file)
@@ -107,19 +107,12 @@ public class Pair {
  * -- Returns NULL if failure
  * =============================================================================
  */
-    public static Pair Ppair_alloc (Object firstPtr, Object secondPtr)
-    {
-        Pair pairPtr;
-
-        pairPtr = new Pair();       
-
-        if(pairPtr != null) {
-            pairPtr.first = firstPtr;
-            pairPtr.second = secondPtr;
-        }
-
-        return pairPtr;
-    }
+  public static Pair Ppair_alloc (Object firstPtr, Object secondPtr) {
+    Pair pairPtr = new Pair();       
+    pairPtr.first = firstPtr;
+    pairPtr.second = secondPtr;
+    return pairPtr;
+  }
 
 
 /* =============================================================================
index d2f930147cffdff3de269fae0e689c6f213f7315..57e3180554a32970646b352e1735af976640cf16 100644 (file)
@@ -4044,16 +4044,20 @@ public class BuildCode {
          output.println(generateTemp(fm, fon.getDest(),lb)+" = ((unsigned int)"+generateTemp(fm, fon.getLeft(),lb)+")>>"+generateTemp(fm,fon.getRight(),lb)+";");
 
       } else if (dc!=null) {
-       output.print(generateTemp(fm, fon.getDest(),lb)+" = ");
+       output.print(generateTemp(fm, fon.getDest(),lb)+" = (");
+       if (fon.getLeft().getType().isPtr()&&(fon.getOp().getOp()==Operation.EQUAL||fon.getOp().getOp()==Operation.NOTEQUAL))
+           output.print("(void *)");
        if (dc.getNeedLeftSrcTrans(lb, fon))
          output.print("("+generateTemp(fm, fon.getLeft(),lb)+"!=NULL?"+generateTemp(fm, fon.getLeft(),lb)+"->"+oidstr+":NULL)");
        else
          output.print(generateTemp(fm, fon.getLeft(),lb));
-       output.print(fon.getOp().toString());
+       output.print(")"+fon.getOp().toString()+"(");
+       if (fon.getRight().getType().isPtr()&&(fon.getOp().getOp()==Operation.EQUAL||fon.getOp().getOp()==Operation.NOTEQUAL))
+           output.print("(void *)");
        if (dc.getNeedRightSrcTrans(lb, fon))
-         output.println("("+generateTemp(fm, fon.getRight(),lb)+"!=NULL?"+generateTemp(fm, fon.getRight(),lb)+"->"+oidstr+":NULL);");
+         output.println("("+generateTemp(fm, fon.getRight(),lb)+"!=NULL?"+generateTemp(fm, fon.getRight(),lb)+"->"+oidstr+":NULL));");
        else
-         output.println(generateTemp(fm,fon.getRight(),lb)+";");
+         output.println(generateTemp(fm,fon.getRight(),lb)+");");
       } else
        output.println(generateTemp(fm, fon.getDest(),lb)+" = "+generateTemp(fm, fon.getLeft(),lb)+fon.getOp().toString()+generateTemp(fm,fon.getRight(),lb)+";");
     } else if (fon.getOp().getOp()==Operation.ASSIGN)
index bd467152603f92e761196b66df674c11bc7b8e76..39c399ff7289aca6218e57a52124abcbb82f2195 100644 (file)
@@ -1227,12 +1227,13 @@ void transCommitProcess(struct garbagelist * oidwrlocked, int numoidwrlocked) {
   arraystack.maxcount=0;
 #endif
   //splice oidwrlocked in
-  oidwrlocked->size=numoidwrtotal;
-  oidwrlocked->next=params;
-  ((struct garbagelist *)locals)->next=oidwrlocked;
-  if (commitmethod!=NULL)
+  if (commitmethod!=NULL) {
+    oidwrlocked->size=numoidwrtotal;
+    oidwrlocked->next=params;
+    ((struct garbagelist *)locals)->next=oidwrlocked;
     commitmethod(params, locals, primitives);
-  ((struct garbagelist *)locals)->next=params;
+    ((struct garbagelist *)locals)->next=params;
+  }
 #endif
 
   /* Release write locks */
index ac663cff359df7388b6dda0c3e970d88683fa1b3..8611dce62cea4a872f95f35651a7227b87013340 100644 (file)
@@ -30,7 +30,7 @@
 
 #define NUMPTRS 100
 
-#define INITIALHEAPSIZE 2048*1024*1024L
+#define INITIALHEAPSIZE 128*1024*1024L
 #define GCPOINT(x) ((INTPTR)((x)*0.99))
 /* This define takes in how full the heap is initially and returns a new heap size to use */
 #define HEAPSIZE(x,y) ((INTPTR)(x+y))*2
index 913e9f80840bf462d64e54f68500044d3ca9b6c8..ca925aa25511d87cf6c800fffec93ff891c57426 100755 (executable)
@@ -171,7 +171,7 @@ then
 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
 elif [[ $1 = '-64bit' ]]
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
+EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64 -m64"
 elif [[ $1 = '-32bit' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -m32"