From: bdemsky Date: Mon, 9 Nov 2009 08:25:25 +0000 (+0000) Subject: bug fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b0a9f3e141f7af6afab25aad702fc5eeec293efa;p=IRC.git bug fixes remove assertions from benchmarks code generation improvements get rid of some annoying C compiler warnings --- diff --git a/Robust/src/Analysis/Locality/DCWrapper.java b/Robust/src/Analysis/Locality/DCWrapper.java index b28a14e0..508b44a6 100644 --- a/Robust/src/Analysis/Locality/DCWrapper.java +++ b/Robust/src/Analysis/Locality/DCWrapper.java @@ -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 localityset=locality.getLocalityBindings(); for(Iterator lbit=localityset.iterator();lbit.hasNext();) { processlb(lbit.next()); @@ -40,7 +44,9 @@ public class DCWrapper { Hashtable> derefmap=new Hashtable>(); 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> getCannotDelayMap() { diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java index 22d55e90..40a88c6b 100644 --- a/Robust/src/Analysis/Locality/DiscoverConflicts.java +++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java @@ -124,6 +124,13 @@ public class DiscoverConflicts { private void computeneedsarrayget(LocalityBinding lb, Hashtable>> fnmap) { // Set 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()); + return; + } + } + Set gwriteset=treadmap.get(lb); FlatMethod fm=state.getMethodFlat(lb.getMethod()); HashSet needsget=new HashSet(); @@ -143,7 +150,6 @@ public class DiscoverConflicts { } } } - } getmap.put(lb, needsget); } diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Adtree.java b/Robust/src/Benchmarks/SingleTM/Bayes/Adtree.java index f70fca10..7d5eb116 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Adtree.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Adtree.java @@ -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); } } diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Bayes.java b/Robust/src/Benchmarks/SingleTM/Bayes/Bayes.java index 460e1187..419432b9 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Bayes.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Bayes.java @@ -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(); diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Data.java b/Robust/src/Benchmarks/SingleTM/Bayes/Data.java index a376db25..79f87f86 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Data.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Data.java @@ -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, diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/IntList.java b/Robust/src/Benchmarks/SingleTM/Bayes/IntList.java index 907d23d4..414a7b8d 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/IntList.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/IntList.java @@ -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; } diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/IntVector.java b/Robust/src/Benchmarks/SingleTM/Bayes/IntVector.java index 25c62465..1d5bc42e 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/IntVector.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/IntVector.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java b/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java index f10105d4..e3fd9e6f 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java @@ -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 diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/List.java b/Robust/src/Benchmarks/SingleTM/Bayes/List.java index 1e102826..2ce2bcab 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/List.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/List.java @@ -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; } diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Net.java b/Robust/src/Benchmarks/SingleTM/Bayes/Net.java index dfbd7859..ea99e41f 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Net.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Net.java @@ -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(); } diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Queue.java b/Robust/src/Benchmarks/SingleTM/Bayes/Queue.java index 9ee50a19..e2015045 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Queue.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Queue.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Vector_t.java b/Robust/src/Benchmarks/SingleTM/Bayes/Vector_t.java index b134600f..a6bbf565 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Vector_t.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Vector_t.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java b/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java index d8df63e9..9ce94802 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java @@ -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; } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java b/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java index 3a42ad5f..943fe1b4 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java @@ -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'A' && str[i] < 'Z') { str[i] +=(byte)32; } } - } else { - System.out.println("NOOOOOOOOOOOOO"); } } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java b/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java index 2186fe29..44e07886 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java @@ -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"); - } } } } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/List_t.java b/Robust/src/Benchmarks/SingleTM/Intruder/List_t.java index 619bf290..3ac8b05f 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/List_t.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/List_t.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Queue_t.java b/Robust/src/Benchmarks/SingleTM/Intruder/Queue_t.java index fbf9d5da..3fc05b9c 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Queue_t.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Queue_t.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/RBTree.java b/Robust/src/Benchmarks/SingleTM/Intruder/RBTree.java index 6b3f4272..307f1e6a 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/RBTree.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/RBTree.java @@ -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; } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java b/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java index 04c2cba6..18ece414 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java @@ -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++; } } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Vector_t.java b/Robust/src/Benchmarks/SingleTM/Intruder/Vector_t.java index cf6e3a3c..b90422f5 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Vector_t.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Vector_t.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/Labyrinth3D/Grid.java b/Robust/src/Benchmarks/SingleTM/Labyrinth3D/Grid.java index 7c2831af..760b7e96 100644 --- a/Robust/src/Benchmarks/SingleTM/Labyrinth3D/Grid.java +++ b/Robust/src/Benchmarks/SingleTM/Labyrinth3D/Grid.java @@ -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= 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; diff --git a/Robust/src/Benchmarks/SingleTM/Vacation/Customer.java b/Robust/src/Benchmarks/SingleTM/Vacation/Customer.java index e55499e5..2e918585 100644 --- a/Robust/src/Benchmarks/SingleTM/Vacation/Customer.java +++ b/Robust/src/Benchmarks/SingleTM/Vacation/Customer.java @@ -128,11 +128,6 @@ public class Customer { } boolean status = reservationInfoListPtr.remove(findReservationInfo); - if (!status) { - System.out.println("TMRESTART15"); - System.exit(-1); - } - return true; } diff --git a/Robust/src/Benchmarks/SingleTM/Vacation/Manager.java b/Robust/src/Benchmarks/SingleTM/Vacation/Manager.java index 409a8531..8596526c 100644 --- a/Robust/src/Benchmarks/SingleTM/Vacation/Manager.java +++ b/Robust/src/Benchmarks/SingleTM/Vacation/Manager.java @@ -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; } diff --git a/Robust/src/Benchmarks/SingleTM/Vacation/Reservation.java b/Robust/src/Benchmarks/SingleTM/Vacation/Reservation.java index a2098e1c..4b5513c9 100644 --- a/Robust/src/Benchmarks/SingleTM/Vacation/Reservation.java +++ b/Robust/src/Benchmarks/SingleTM/Vacation/Reservation.java @@ -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); - } } diff --git a/Robust/src/Benchmarks/SingleTM/Vacation/Vacation.java b/Robust/src/Benchmarks/SingleTM/Vacation/Vacation.java index af363ab2..da995b15 100644 --- a/Robust/src/Benchmarks/SingleTM/Vacation/Vacation.java +++ b/Robust/src/Benchmarks/SingleTM/Vacation/Vacation.java @@ -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."); } diff --git a/Robust/src/Benchmarks/SingleTM/common/BitMap.java b/Robust/src/Benchmarks/SingleTM/common/BitMap.java index 44708e2b..b67006b5 100644 --- a/Robust/src/Benchmarks/SingleTM/common/BitMap.java +++ b/Robust/src/Benchmarks/SingleTM/common/BitMap.java @@ -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; diff --git a/Robust/src/Benchmarks/SingleTM/common/Pair.java b/Robust/src/Benchmarks/SingleTM/common/Pair.java index 1aad1a10..0caf93f1 100644 --- a/Robust/src/Benchmarks/SingleTM/common/Pair.java +++ b/Robust/src/Benchmarks/SingleTM/common/Pair.java @@ -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; + } /* ============================================================================= diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index d2f93014..57e31805 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -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) diff --git a/Robust/src/Runtime/STM/commit.c b/Robust/src/Runtime/STM/commit.c index bd467152..39c399ff 100644 --- a/Robust/src/Runtime/STM/commit.c +++ b/Robust/src/Runtime/STM/commit.c @@ -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 */ diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index ac663cff..8611dce6 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -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 diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 913e9f80..ca925aa2 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -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"