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());
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() {
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>();
}
}
}
-
}
getmap.put(lb, needsget);
}
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];
(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);
}
}
*/
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();
*/
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;
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);
}
}
}
}
- if(numOrder != numVar) {
- System.out.println("Assert failed: numVar should be equal to numOrder");
- System.exit(0);
- }
/*
* Create records
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);
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;
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,
allocNode (int dataPtr)
{
IntListNode nodePtr = new IntListNode();
- if (nodePtr == null) {
- return null;
- }
nodePtr.dataPtr = dataPtr;
nodePtr.nextPtr = null;
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;
#endif
nodePtr = allocNode(dataPtr);
- if (nodePtr == null) {
- return false;
- }
nodePtr.nextPtr = currPtr;
prevPtr.nextPtr = nodePtr;
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;
}
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;
}
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];
int srcCapacity = srcVectorPtr.capacity;
int[] elements = new int[srcCapacity];
- if (elements == null) {
- return false;
- }
dstVectorPtr.elements = null;
dstVectorPtr.elements = elements;
dstVectorPtr.capacity = srcCapacity;
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)));
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);
* 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++) {
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++) {
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
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;
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);
- }
}
}
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);
- }
}
}
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();
}
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();
}
*/
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();
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;
}
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();
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
*/
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();
/*
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
*/
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();
*/
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();
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);
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);
}
}
#endif // LEARNER_TRY_REVERSE
- } else {
- System.out.println("Assert failed: We should not reach here in learnerPtr()");
- System.exit(0);
- } //switch op
+ }
} //if isTaskValid
allocNode (LearnerTask dataPtr)
{
ListNode nodePtr = new ListNode();
- if (nodePtr == null) {
- return null;
- }
nodePtr.dataPtr = dataPtr;
nodePtr.nextPtr = null;
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;
#endif
nodePtr = allocNode(dataPtr);
- if (nodePtr == null) {
- return false;
- }
nodePtr.nextPtr = currPtr;
prevPtr.nextPtr = nodePtr;
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;
}
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;
}
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);
}
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);
- }
}
/* =============================================================================
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);
}
}
{
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();
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;
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);
- }
}
}
}
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;
} 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;
}
}
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;
}
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;
}
{
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();
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);
}
}
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);
}
}
}
{
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();
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);
}
}
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);
}
}
}
{
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);
}
}
- if(net_isCycle()) {
- System.out.println("Assert failed: Cycle detected in net_generateRandomEdges()");
- System.exit(0);
- }
-
visitedBitmapPtr.bitmap_free();
workQueuePtr.queue_free();
}
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;
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;
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;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
int[] newElements = new int[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
int[] tmpelements = elements;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
int[] newElements = new int[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
int[] elements = queuePtr.elements;
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;
* =============================================================================
*/
public Object vector_at (int i) {
- if ((i < 0) || (i >= size)) {
- System.out.println("Illegal Vector.element\n");
- return null;
- }
return (elements[i]);
}
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];
int srcCapacity = srcVectorPtr.capacity;
Object[] elements = new Object[srcCapacity];
- if (elements == null) {
- return false;
- }
dstVectorPtr.elements = null;
dstVectorPtr.elements = elements;
dstVectorPtr.capacity = srcCapacity;
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
*/
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;
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 {
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;
}
*/
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);
- }
}
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");
}
}
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];
if(err != 0) {
boolean status = errorVectorPtr.vector_pushBack(new Integer(decodedFlowId[0]));
- if(!status) {
- System.out.println("Assertion in Intruder.processPacket");
- }
}
}
}
currPtr = prevPtr.nextPtr;
nodePtr = allocNode(dataPtr);
- if (nodePtr == null) {
- return false;
- }
nodePtr.nextPtr = currPtr;
prevPtr.nextPtr = nodePtr;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
Object[] newElements = new Object[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
Object[] elements = queuePtr.elements;
if ( ex != null) {
node = null;
}
- return ((ex == null) ? true : false);
+ return ex == null;
}
}
if(node != null) {
}
- return ((node != null) ? true : false);
-
+ return node != null;
}
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);
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;
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;
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
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++) {
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 */
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++;
}
}
* =============================================================================
*/
public Object vector_at (int i) {
- if ((i < 0) || (i >= size)) {
- System.out.println("Illegal Vector.element\n");
- return null;
- }
return (elements[i]);
}
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];
int srcCapacity = srcVectorPtr.capacity;
Object[] elements = new Object[srcCapacity];
- if (elements == null) {
- return false;
- }
dstVectorPtr.elements = null;
dstVectorPtr.elements = elements;
dstVectorPtr.capacity = srcCapacity;
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;
}
{
List_Node nodePtr = new List_Node();
- if(nodePtr == null) {
- return null;
- }
nodePtr.dataPtr = dataPtr;
nodePtr.nextPtr = null;
{
List_t listPtr = new List_t();
- if(listPtr == null) {
- return null;
- }
listPtr.head.dataPtr = null;
listPtr.head.nextPtr = null;
{
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;
}
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);
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;
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;
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;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
int[] newElements = new int[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
int[] tmpelements = elements;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
int[] newElements = new int[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
int[] elements = queuePtr.elements;
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;
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;
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;
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;
int newCapacity = capacity * QUEUE_GROWTH_FACTOR;
Object[] newElements = new Object[newCapacity];
- if (newElements == null) {
- return false;
- }
int dst = 0;
Object[] tmpelements = elements;
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;
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) {
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;
}
if(success) {
boolean status = myPathVectorPtr.vector_pushBack(pointVectorPtr);
- if(!status) {
- System.out.println("Assert in Router_Solve");
- System.exit(1);
- }
}
}
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;
}
* =============================================================================
*/
public Object vector_at (int i) {
- if ((i < 0) || (i >= size)) {
- System.out.println("Illegal Vector.element\n");
- return null;
- }
return (elements[i]);
}
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];
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;
}
boolean status = reservationInfoListPtr.remove(findReservationInfo);
- if (!status) {
- System.out.println("TMRESTART15");
- System.exit(-1);
- }
-
return true;
}
}
if (reservationPtr.numTotal == 0) {
boolean status = tablePtr.remove(id);
- if (!status) {
- System.out.println("TMRESTART7");
- System.exit(-1);
- }
} else {
reservationPtr.reservation_updatePrice(price);
}
customerPtr = new Customer(customerId);
// assert(customerPtr != null);
status = customerTablePtr.insert(customerId, customerPtr);
- if (!status) {
- System.out.println("TMRESTART8");
- System.exit(-1);
- }
return true;
}
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;
}
reservationPtr.price)) {
/* Undo previous successful reservation */
boolean status = reservationPtr.reservation_cancel();
- if (!status) {
- System.out.println("TMRESTART12");
- System.exit(-1);
- }
return false;
}
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;
}
*/
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);
- }
}
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);
}
}
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.");
}
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;
* -- 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;
+ }
/* =============================================================================
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)
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 */
#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
EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
elif [[ $1 = '-64bit' ]]
then
-EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
+EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64 -m64"
elif [[ $1 = '-32bit' ]]
then
EXTRAOPTIONS="$EXTRAOPTIONS -m32"