protected void addEdge(int x, int y) { // we only have to track the inverse edge. predecessors.add(y, x); }
protected void addEdge(int x, int y) { // we only have to track the inverse edge. predecessors.add(y, x); }
@Override public void addEdge(T src, T dst) throws IllegalArgumentException { int x = nodeManager.getNumber(src); int y = nodeManager.getNumber(dst); if (x < 0) { throw new IllegalArgumentException("src " + src + " is not in graph"); } if (y < 0) { throw new IllegalArgumentException("dst " + dst + " is not in graph"); } predecessors.add(y, x); successors.add(x, y); hasSuccessor.set(x); }
@Override public void addEdge(T src, T dst) throws IllegalArgumentException { int x = nodeManager.getNumber(src); int y = nodeManager.getNumber(dst); if (x < 0) { throw new IllegalArgumentException("src " + src + " is not in graph"); } if (y < 0) { throw new IllegalArgumentException("dst " + dst + " is not in graph"); } predecessors.add(y, x); successors.add(x, y); hasSuccessor.set(x); }
@Override public void addEdge(T src, T dst) throws IllegalArgumentException { int x = nodeManager.getNumber(src); int y = nodeManager.getNumber(dst); if (x < 0) { throw new IllegalArgumentException("src " + src + " is not in graph"); } if (y < 0) { throw new IllegalArgumentException("dst " + dst + " is not in graph"); } predecessors.add(y, x); successors.add(x, y); hasSuccessor.set(x); }
@Override public void addEdge(CGNode src, CGNode dst) { // we assume that this is called from ExplicitNode.addTarget(). // so we only have to track the inverse edge. int x = getNumber(src); int y = getNumber(dst); predecessors.add(y, x); }
@Override public void addEdge(CGNode src, CGNode dst) { // we assume that this is called from ExplicitNode.addTarget(). // so we only have to track the inverse edge. int x = getNumber(src); int y = getNumber(dst); predecessors.add(y, x); }
/** * Record a summary edge for the flow d1 -> d2 from an entry s_p to an exit x. * * @param s_p local block number an entry * @param x local block number of an exit block * @param d1 source dataflow fact * @param d2 target dataflow fact */ public void insertSummaryEdge(int s_p, int x, int d1, int d2) { int n = getIndexForEntryExitPair(s_p, x); IBinaryNaturalRelation R = summaries.get(n); if (R == null) { // we expect R to usually be sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.SIMPLE); summaries.set(n, R); } R.add(d1, d2); // if (TabulationSolver.DEBUG_LEVEL > 1) { // // System.err.println("recording summary edge, now n=" + n + " summarized by " + R); // } }
/** * Record a summary edge for the flow d1 -> d2 from an entry s_p to an exit x. * * @param s_p local block number an entry * @param x local block number of an exit block * @param d1 source dataflow fact * @param d2 target dataflow fact */ public void insertSummaryEdge(int s_p, int x, int d1, int d2) { int n = getIndexForEntryExitPair(s_p, x); IBinaryNaturalRelation R = summaries.get(n); if (R == null) { // we expect R to usually be sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.SIMPLE); summaries.set(n, R); } R.add(d1, d2); // if (TabulationSolver.DEBUG_LEVEL > 1) { // // System.err.println("recording summary edge, now n=" + n + " summarized by " + R); // } }
public void delegate(CallSiteReference site, CGNode delegateNode, CallSiteReference delegateSite) { CallSite d = new CallSite(delegateSite, delegateNode); targets.set(site.getProgramCounter(), d); int y = getCallGraph().getNumber(this); int x = getCallGraph().getNumber(delegateNode); delegateR.add(x, y); } }
public void delegate(CallSiteReference site, CGNode delegateNode, CallSiteReference delegateSite) { CallSite d = new CallSite(delegateSite, delegateNode); targets.set(site.getProgramCounter(), d); int y = getCallGraph().getNumber(this); int x = getCallGraph().getNumber(delegateNode); delegateR.add(x, y); } }
private void addImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("addImplicitStatement " + eq)); } delegateGraph.addVariable(eq.getLHS()); delegateGraph.addVariable(eq.getRightHandSide()); int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); boolean b = R.add(lhs, rhs); if (b) { implicitUnaryCount++; IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.add(rhs, lhs); } }
private void addImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("addImplicitStatement " + eq)); } delegateGraph.addVariable(eq.getLHS()); delegateGraph.addVariable(eq.getRightHandSide()); int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); boolean b = R.add(lhs, rhs); if (b) { implicitUnaryCount++; IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.add(rhs, lhs); } }
/** * Record that in this procedure we've discovered a same-level realizable path from (s_p,0) to (n,d_j) * * @param n local block number of the basic block n */ @SuppressWarnings("unused") private void addZeroPathEdge(int n, int j) { BitVectorIntSet z = (BitVectorIntSet) zeroPaths.get(j); if (z == null) { z = new BitVectorIntSet(); zeroPaths.set(j, z); } z.add(n); if (altPaths != null) { IBinaryNaturalRelation R = altPaths.get(0); if (R == null) { // we expect the first dimension of R to be dense, the second sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.TWO_LEVEL); altPaths.set(0, R); } R.add(n, j); } if (TabulationSolver.DEBUG_LEVEL > 1) { System.err.println("recording 0-path edge, now d2= " + j + " reached at " + z); } }
/** * Record that in this procedure we've discovered a same-level realizable path from (s_p,0) to (n,d_j) * * @param n local block number of the basic block n */ @SuppressWarnings("unused") private void addZeroPathEdge(int n, int j) { BitVectorIntSet z = (BitVectorIntSet) zeroPaths.get(j); if (z == null) { z = new BitVectorIntSet(); zeroPaths.set(j, z); } z.add(n); if (altPaths != null) { IBinaryNaturalRelation R = altPaths.get(0); if (R == null) { // we expect the first dimension of R to be dense, the second sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.TWO_LEVEL); altPaths.set(0, R); } R.add(n, j); } if (TabulationSolver.DEBUG_LEVEL > 1) { System.err.println("recording 0-path edge, now d2= " + j + " reached at " + z); } }
/** * Record that in this procedure we've discovered a same-level realizable path from (s_p,i) to (n,i) * * @param n local block number of the basic block n */ @SuppressWarnings("unused") private void addIdentityPathEdge(int i, int n) { BitVectorIntSet s = (BitVectorIntSet) identityPaths.get(i); if (s == null) { s = new BitVectorIntSet(); identityPaths.set(i, s); } s.add(n); if (altPaths != null) { IBinaryNaturalRelation R2 = altPaths.get(i); if (R2 == null) { // we expect the first dimension of R to be dense, the second sparse R2 = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.TWO_LEVEL); altPaths.set(i, R2); } R2.add(n, i); } if (TabulationSolver.DEBUG_LEVEL > 1) { System.err.println("recording self-path edge, now d1= " + i + " reaches " + s); } }
/** * Record that we've discovered a call edge <c,d1> -> <s_p, d2> * * @param c global number identifying the call site node * @param d1 source fact at the call edge * @param d2 result fact (result of the call flow function) */ @SuppressWarnings("unused") public void addCallEdge(int c, int d1, int d2) { if (TabulationSolver.DEBUG_LEVEL > 0) { System.err.println("addCallEdge " + c + ' ' + d1 + ' ' + d2); } if (d1 == d2) { BimodalMutableIntSet s = (BimodalMutableIntSet) identityEdges.get(d1); if (s == null) { s = new BimodalMutableIntSet(); identityEdges.set(d1, s); } s.add(c); } else { IBinaryNaturalRelation R = edges.get(d2); if (R == null) { // we expect the first dimension of R to be dense, the second sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.TWO_LEVEL }, BasicNaturalRelation.TWO_LEVEL); edges.set(d2, R); } R.add(c, d1); } }
/** * Record that in this procedure we've discovered a same-level realizable path from (s_p,i) to (n,i) * * @param n local block number of the basic block n */ @SuppressWarnings("unused") private void addIdentityPathEdge(int i, int n) { BitVectorIntSet s = (BitVectorIntSet) identityPaths.get(i); if (s == null) { s = new BitVectorIntSet(); identityPaths.set(i, s); } s.add(n); if (altPaths != null) { IBinaryNaturalRelation R2 = altPaths.get(i); if (R2 == null) { // we expect the first dimension of R to be dense, the second sparse R2 = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.SIMPLE_SPACE_STINGY }, BasicNaturalRelation.TWO_LEVEL); altPaths.set(i, R2); } R2.add(n, i); } if (TabulationSolver.DEBUG_LEVEL > 1) { System.err.println("recording self-path edge, now d1= " + i + " reaches " + s); } }
/** * Record that we've discovered a call edge <c,d1> -> <s_p, d2> * * @param c global number identifying the call site node * @param d1 source fact at the call edge * @param d2 result fact (result of the call flow function) */ @SuppressWarnings("unused") public void addCallEdge(int c, int d1, int d2) { if (TabulationSolver.DEBUG_LEVEL > 0) { System.err.println("addCallEdge " + c + ' ' + d1 + ' ' + d2); } if (d1 == d2) { BimodalMutableIntSet s = (BimodalMutableIntSet) identityEdges.get(d1); if (s == null) { s = new BimodalMutableIntSet(); identityEdges.set(d1, s); } s.add(c); } else { IBinaryNaturalRelation R = edges.get(d2); if (R == null) { // we expect the first dimension of R to be dense, the second sparse R = new BasicNaturalRelation(new byte[] { BasicNaturalRelation.TWO_LEVEL }, BasicNaturalRelation.TWO_LEVEL); edges.set(d2, R); } R.add(c, d1); } }