@Override public String instructionAnnotate(InstructionHandle handle, BasicBlock bb) { try { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Location loc = new Location(handle, bb); Fact fact = flip ? dataflow.getAnalysis().getFactAfterLocation(loc) : dataflow.getAnalysis().getFactAtLocation(loc); return " " + dataflow.getAnalysis().factToString(fact); } catch (DataflowAnalysisException e) { throw new IllegalStateException("Caught exception: " + e.toString()); } }
this.cfg = cfg; this.analysis = analysis; blockOrder = analysis.getBlockOrder(cfg); isForwards = analysis.isForwards(); numIterations = 0; BasicBlock block = i.next(); Fact result = analysis.getResultFact(block); if (block == logicalEntryBlock()) { try { analysis.initEntryFact(result); } catch (DataflowAnalysisException e) { analysis.makeFactTop(result); analysis.makeFactTop(result);
@Override public String edgeAnnotate(Edge edge) { String edgeAnnotation = ""; try { edgeAnnotation = " " + dataflow.getAnalysis().factToString(dataflow.getAnalysis().getFactOnEdge(edge)); } catch (Throwable e) { // ignore } return edgeAnnotation; }
analysis.startIteration(); Fact start = analysis.getStartFact(block); assert start != null; Fact result = analysis.getResultFact(block); assert result != null; int originalResultTimestamp = analysis.getLastUpdateTimestamp(result); analysis.makeFactTop(start); analysis.initEntryFact(start); if (debug) { debug(block, "Init entry fact ==> " + analysis.factToString(start) + "\n"); int lastCalculated = analysis.getLastUpdateTimestamp(start); Iterator<Edge> predEdgeIter = logicalPredecessorEdgeIterator(block); Fact predFact = analysis.getResultFact(logicalPred); int predLastUpdated = analysis.getLastUpdateTimestamp(predFact); if (!analysis.isTop(predFact)) { predCount++; if (predLastUpdated >= lastCalculated) { analysis.makeFactTop(start); predEdgeIter = logicalPredecessorEdgeIterator(block); while (predEdgeIter.hasNext()) { Fact predFact = analysis.getResultFact(logicalPred);
@Override public String blockAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getStartFact(bb) : dataflow.getResultFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }
/** * Get the fact that is true on the given control edge. * * @param edge * the edge * @return the fact that is true on the edge * @throws DataflowAnalysisException */ public Fact getFactOnEdge(Edge edge) throws DataflowAnalysisException { return analysis.getFactOnEdge(edge); }
/** * Get dataflow fact at (just before) given Location. Note "before" is meant * in the logical sense, so for backward analyses, before means after the * location in the control flow sense. * * @param location * the Location * @return the dataflow value at given Location * @throws DataflowAnalysisException */ public/* final */Fact getFactAtLocation(Location location) throws DataflowAnalysisException { return analysis.getFactAtLocation(location); }
/** * Get the dataflow fact representing the point just after given Location. * Note "after" is meant in the logical sense, so for backward analyses, * after means before the location in the control flow sense. * * @param location * the Location * @return the dataflow value after given Location * @throws DataflowAnalysisException */ public/* final */Fact getFactAfterLocation(Location location) throws DataflowAnalysisException { return analysis.getFactAfterLocation(location); }
public void dumpDataflow(AnalysisType analysis) { System.out.println(this.getClass().getName() + " analysis for " + getCFG().getMethodName() + getCFG().getMethodSig() + " { "); try { for (Location loc : getCFG().orderedLocations()) { System.out.println("\nBefore: " + analysis.factToString(getFactAtLocation(loc))); System.out.println("Location: " + loc); System.out.println("After: " + analysis.factToString(getFactAfterLocation(loc))); } } catch (DataflowAnalysisException e) { AnalysisContext.logError("error dumping dataflow analysis", e); System.out.println(e); } System.out.println("}"); } }
analysis.startIteration(); Fact start = analysis.getStartFact(block); assert start != null; Fact result = analysis.getResultFact(block); assert result != null; int originalResultTimestamp = analysis.getLastUpdateTimestamp(result); analysis.makeFactTop(start); analysis.initEntryFact(start); if (DEBUG) { debug(block, "Init entry fact ==> " + analysis.factToString(start) + "\n"); int lastCalculated = analysis.getLastUpdateTimestamp(start); Iterator<Edge> predEdgeIter = logicalPredecessorEdgeIterator(block); Fact predFact = analysis.getResultFact(logicalPred); int predLastUpdated = analysis.getLastUpdateTimestamp(predFact); if (!analysis.isTop(predFact)) { predCount++; if (predLastUpdated >= lastCalculated) { analysis.makeFactTop(start); predEdgeIter = logicalPredecessorEdgeIterator(block); while (predEdgeIter.hasNext()) { Fact predFact = analysis.getResultFact(logicalPred);
@Override public String blockStartAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getResultFact(bb) : dataflow.getStartFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }
/** * Get the fact that is true on the given control edge. * * @param edge * the edge * @return the fact that is true on the edge * @throws DataflowAnalysisException */ public Fact getFactOnEdge(Edge edge) throws DataflowAnalysisException { return analysis.getFactOnEdge(edge); }
/** * Get dataflow fact at (just before) given Location. Note "before" is meant * in the logical sense, so for backward analyses, before means after the * location in the control flow sense. * * @param location * the Location * @return the dataflow value at given Location * @throws DataflowAnalysisException */ public/* final */Fact getFactAtLocation(Location location) throws DataflowAnalysisException { return analysis.getFactAtLocation(location); }
/** * Get the dataflow fact representing the point just after given Location. * Note "after" is meant in the logical sense, so for backward analyses, * after means before the location in the control flow sense. * * @param location * the Location * @return the dataflow value after given Location * @throws DataflowAnalysisException */ public/* final */Fact getFactAfterLocation(Location location) throws DataflowAnalysisException { return analysis.getFactAfterLocation(location); }
public void dumpDataflow(AnalysisType analysis) { System.out.println(this.getClass().getName() + " analysis for " + getCFG().getMethodName() + getCFG().getMethodSig() + " { "); try { for (Location loc : getCFG().orderedLocations()) { System.out.println("\nBefore: " + analysis.factToString(getFactAtLocation(loc))); System.out.println("Location: " + loc); System.out.println("After: " + analysis.factToString(getFactAfterLocation(loc))); } } catch (DataflowAnalysisException e) { AnalysisContext.logError("error dumping dataflow analysis", e); System.out.println(e); } System.out.println("}"); } }
this.cfg = cfg; this.analysis = analysis; blockOrder = analysis.getBlockOrder(cfg); isForwards = analysis.isForwards(); numIterations = 0; BasicBlock block = i.next(); Fact result = analysis.getResultFact(block); if (block == logicalEntryBlock()) { try { analysis.initEntryFact(result); } catch (DataflowAnalysisException e) { analysis.makeFactTop(result); analysis.makeFactTop(result);
@Override public String instructionAnnotate(InstructionHandle handle, BasicBlock bb) { try { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Location loc = new Location(handle, bb); Fact fact = flip ? dataflow.getAnalysis().getFactAfterLocation(loc) : dataflow.getAnalysis().getFactAtLocation(loc); return " " + dataflow.getAnalysis().factToString(fact); } catch (DataflowAnalysisException e) { throw new IllegalStateException("Caught exception: " + e.toString()); } }
@Override public String blockAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getStartFact(bb) : dataflow.getResultFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }
@Override public String edgeAnnotate(Edge edge) { String edgeAnnotation = ""; try { edgeAnnotation = " " + dataflow.getAnalysis().factToString(dataflow.getAnalysis().getFactOnEdge(edge)); } catch (Throwable e) { // ignore } return edgeAnnotation; }
@Override public String blockStartAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getResultFact(bb) : dataflow.getStartFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }