// The reach state may be null--if not the predicate is
// satisfied when the edge exists AND it has the state.
protected Integer n_hrnID;
+
+ // the preds on this state are irrelevant, so always strip them off
+ // when we store it in this ExistPred to make sure it equals other
+ // ExistPred objects with the same ne_state, preds ignored.
protected ReachState ne_state;
// An edge existence predicate is satisfied if the elements
ReachState state) {
assert hrnID != null;
this.n_hrnID = hrnID;
- this.ne_state = state;
+ this.ne_state = removePreds( state );
this.predType = TYPE_NODE;
e_tdSrc = null;
e_hrnSrcID = null;
this.e_hrnDstID = hrnDstID;
this.e_type = type;
this.e_field = field;
- this.ne_state = state;
+ this.ne_state = removePreds( state );
this.e_taint = taint;
this.predType = TYPE_EDGE;
n_hrnID = null;
+ private ReachState removePreds( ReachState state ) {
+ return state == null ? null : Canonical.attach( state, ExistPredSet.factory() );
+ }
+
+
// only consider the subest of the caller elements that
// are reachable by callee when testing predicates--if THIS
if( pred.ne_state != null ) {
return false;
}
- } else if( !ne_state.equals(pred.ne_state) ) {
+ } else if( !ne_state.equalsIgnorePreds(pred.ne_state) ) {
return false;
}
public int hashCodeSpecific() {
+
if( predType == TYPE_TRUE ) {
return 1;
}
int hash = n_hrnID.intValue()*17;
if( ne_state != null ) {
- hash ^= ne_state.hashCode();
+ hash ^= ne_state.hashCodeNoPreds();
}
return hash;
} else {
hash ^= e_hrnSrcID.hashCode()*11;
if( e_srcOutCalleeContext ) {
- hash ^= 0xf1aeb;
+ hash ^= 0x01;
}
if( e_srcOutCallerContext ) {
- hash ^= 0x875d;
+ hash ^= 0x80;
}
}
hash += e_hrnDstID.hashCode();
if( ne_state != null ) {
- hash ^= ne_state.hashCode();
+ hash ^= ne_state.hashCodeNoPreds();
}
if( e_taint != null ) {
// fixed point, so use this method to determine if
// a node is "equal" to some previous visit, basically
public boolean equalsIncludingAlphaAndPreds(HeapRegionNode hrn) {
-
return equals(hrn) &&
alpha.equals(hrn.alpha) &&
preds.equals(hrn.preds);
- static boolean dbgEquals = false;
+ static public boolean dbgEquals = false;
// it is necessary in the equals() member functions
// there is an edge in the right place with the right field,
// but do they have the same attributes?
- if( edgeA.getBeta().equals(edgeB.getBeta() ) &&
- edgeA.equalsPreds(edgeB)
- ) {
+ if( edgeA.equalsIncludingBetaPredsTaints( edgeB ) ) {
edgeFound = true;
}
}
}
+ public int hashCodeNoPreds() {
+ return reachTuples.hashCode();
+ }
+
+
public boolean equalsIgnorePreds(Object o) {
if( o == null ) {
return false;
import IR.*;
import IR.Flat.*;
+import java.util.*;
+
public class RefEdge {
return false;
}
- // Equality of edges is only valid within a graph, so
- // compare src and dst by reference
- if( !(src == edge.src) ||
- !(dst == edge.dst) ) {
+ if( src instanceof VariableNode ) {
+ VariableNode vsrc = (VariableNode) src;
+ if( !vsrc.equals( (VariableNode) edge.src ) ) {
+ return false;
+ }
+ } else {
+ HeapRegionNode hsrc = (HeapRegionNode) src;
+ if( !hsrc.equalsIncludingAlphaAndPreds( (HeapRegionNode) edge.src ) ) {
+ return false;
+ }
+ }
+
+ if( !dst.equalsIncludingAlphaAndPreds( edge.dst ) ) {
return false;
}
long start_time = System.currentTimeMillis();
for (int step = 0; step < local_ntimesteps; step++) { // time-step the system
ComputeCenterAndDiameter();
- ArrayIndexedGraph octree = new ArrayIndexedGraph(8);
+ ArrayIndexedGraph octree = disjoint AIG new ArrayIndexedGraph(8);
ArrayIndexedNode root = octree.createNode(new OctTreeNodeData(centerx, centery, centerz)); // create the tree's root
octree.addNode(root);
double radius = diameter * 0.5;
+
+ genreach b0;
+
for (int i = 0; i < local_nbodies; i++) {
Insert(octree, root, body[i], radius); // grow the tree by inserting each body
body[i].root=root;
}
curr = 0;
+
+
+ genreach b1;
+
+
// summarize subtree info in each internal node (plus restructure tree and sort bodies for performance reasons)
ComputeCenterOfMass(octree, root);
+
+ genreach b2;
+
+
sese force {
+
+ genreach b3;
+
for(int i=0; i < local_nbodies; i++){
// compute the acceleration of each body (consumes most of the total runtime)
// n.ComputeForce(octree, root, diameter, itolsq, step, dthf, epssq);
double dt=dthf;
double ep=epssq;
sese parallel{
+ genreach intoPar;
eachbody.ComputeForce(octree, di, it, step, dt, ep);
}
}
} // end of time step
+
long end_time=System.currentTimeMillis();
if (isFirstRun) {