/** * 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 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 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 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); } }
public void removeTarget(CGNode target) { allTargets.remove(getCallGraph().getNumber(target)); for (IntIterator it = targets.safeIterateIndices(); it.hasNext();) { int pc = it.next(); Object value = targets.get(pc); if (value instanceof CGNode) { if (value.equals(target)) { targets.remove(pc); } } else { MutableIntSet s = (MutableIntSet) value; int n = getCallGraph().getNumber(target); if (s.size() > 2) { s.remove(n); } else { assert s.size() == 2; if (s.contains(n)) { s.remove(n); int i = s.intIterator().next(); targets.set(pc, getCallGraph().getNode(i)); } } } } }
public void removeTarget(CGNode target) { allTargets.remove(getCallGraph().getNumber(target)); for (IntIterator it = targets.safeIterateIndices(); it.hasNext();) { int pc = it.next(); Object value = targets.get(pc); if (value instanceof CGNode) { if (value.equals(target)) { targets.remove(pc); } } else { MutableIntSet s = (MutableIntSet) value; int n = getCallGraph().getNumber(target); if (s.size() > 2) { s.remove(n); } else { assert s.size() == 2; if (s.contains(n)) { s.remove(n); int i = s.intIterator().next(); targets.set(pc, getCallGraph().getNode(i)); } } } } }