Commit 4d0e0a18 authored by Joachim Müssig's avatar Joachim Müssig
Browse files

Remove unused code, sysout

parent 8e55ee20
...@@ -248,7 +248,6 @@ public class CombinedApproach { ...@@ -248,7 +248,6 @@ public class CombinedApproach {
int sdgNodeId = description.getInt(SDG_NODE_ID); int sdgNodeId = description.getInt(SDG_NODE_ID);
nodeSupplier = () -> { nodeSupplier = () -> {
SDGNode node = analysis.getProgram().getSDG().getNode(sdgNodeId); SDGNode node = analysis.getProgram().getSDG().getNode(sdgNodeId);
System.out.println("Node: " + node.getLabel() + " : " + node.getBytecodeName());
//analysis.getProgram().findCoveringProgramPart(node); //analysis.getProgram().findCoveringProgramPart(node);
Collection<SDGNode> parts = new ArrayList<>(); Collection<SDGNode> parts = new ArrayList<>();
parts.add(node); parts.add(node);
......
...@@ -78,7 +78,7 @@ public class SDGAnalysis extends IFCAnalysis { ...@@ -78,7 +78,7 @@ public class SDGAnalysis extends IFCAnalysis {
setIFCType(ifcType); setIFCType(ifcType);
long time = 0L; long time = 0L;
time = System.currentTimeMillis(); time = System.currentTimeMillis();
Collection<? extends IViolation<SecurityNode>> vios = this.ifc.checkIFlow(); //TODO muessig no vios sometimes ?! Collection<? extends IViolation<SecurityNode>> vios = this.ifc.checkIFlow();
time = System.currentTimeMillis() - time; time = System.currentTimeMillis() - time;
// debug.outln(String.format("IFC Analysis took %d ms.", time)); // debug.outln(String.format("IFC Analysis took %d ms.", time));
annManager.unapplyAllAnnotations(); annManager.unapplyAllAnnotations();
...@@ -86,15 +86,10 @@ public class SDGAnalysis extends IFCAnalysis { ...@@ -86,15 +86,10 @@ public class SDGAnalysis extends IFCAnalysis {
} }
public void addAnnotation(SDGNodeAnnotation annotation) { //TODO muessig why sometimes this parameter not the field (IFLoop2WithSDGNew2) public void addAnnotation(SDGNodeAnnotation annotation) {
annManager.addAnnotation(annotation); annManager.addAnnotation(annotation);
} }
//TODO: override doIFCAndGroupByPPPart and groupByPPPart ?
//TODO: addSourceAnnotation etc. correct ? -> implement
public void addSourceAnnotation(SDGNode sdgNode, String level) { public void addSourceAnnotation(SDGNode sdgNode, String level) {
SDGProgramPart toMark = program.findCoveringProgramPart(sdgNode); SDGProgramPart toMark = program.findCoveringProgramPart(sdgNode);
......
...@@ -139,7 +139,7 @@ public class StateSaver { ...@@ -139,7 +139,7 @@ public class StateSaver {
created.append("\"" + CG_NODE + "s" + "\" : [").append("\n"); created.append("\"" + CG_NODE + "s" + "\" : [").append("\n");
for (PersistentCGNode persistentCGNode : persistentCGNodes) { for (PersistentCGNode persistentCGNode : persistentCGNodes) {
try { try {
if (!(persistentCGNode.getIR() == null)) { //TODO: why persistenCGNode.persistentIR can be null ? if (!(persistentCGNode.getIR() == null)) {
String current_CG_Node = persistentCGNode.generateSaveString(); String current_CG_Node = persistentCGNode.generateSaveString();
created.append("{"); created.append("{");
created.append(current_CG_Node); created.append(current_CG_Node);
...@@ -224,169 +224,6 @@ public class StateSaver { ...@@ -224,169 +224,6 @@ public class StateSaver {
return disjunctPointsToSets.get(persistentLocalPointerKey); return disjunctPointsToSets.get(persistentLocalPointerKey);
} }
// public void generatePersistenceStructuresFromPointerAnalysis() throws NullPointerException{
//
// ArrayList<LocalPointerKey> localPointerKeys = new ArrayList<>();
//
// int id = 0;
// for (PointerKey pk : pointerAnalysis.getPointerKeys()) {
// if (pk instanceof LocalPointerKey) {
// LocalPointerKey localPointerKey = (LocalPointerKey) pk;
//
// if (!localPointerKey.isParameter()) {
// continue;
// }
//
// CGNode corresCgNode = localPointerKey.getNode();
// localPointerKeys.add(localPointerKey);
//
// if (!cgNodesToPersistentCGNodes.containsKey(corresCgNode)) {
// PersistentCGNode persistentCGNode = new PersistentCGNode(id);
// cgNodesToPersistentCGNodes.put(corresCgNode, persistentCGNode);
// persistentCGNodes.add(persistentCGNode);
// id++;
// }
// }
// }
// generateIRsAndPersistentLocalPointerKeys(localPointerKeys);
// calculateDisjunctPointsToKeys(localPointerKeys);
// }
// public void generatePersistanceStructuresFromCallGraph(SDG sdg) {
// Set<SDGEdge> edgeSet = sdg.edgeSet();
// for (SDGEdge e : edgeSet) {
// if (e.getKind() == SDGEdge.Kind.SUMMARY) {
// SDGNode actualInNode = e.getSource();
// SDGNode actualOutNode = e.getTarget();
// Collection<SDGNodeTuple> formalNodePairs =
// sdg.getAllFormalPairs(actualInNode, actualOutNode);
// for (SDGNodeTuple formalNodeTuple : formalNodePairs) {
// SDGNode formalInNode = formalNodeTuple.getFirstNode();
// SDGNode methodNode = sdg.getEntry(formalInNode);
// int cgNodeId = sdg.getCGNodeId(methodNode);
// CGNode cgNode = callGraph.getNode(cgNodeId);
// PersistentCGNode corresPersCGNode =
// cgNodesToPersistentCGNodes.get(cgNode);
// if (corresPersCGNode != null) {
// corresPersCGNode.setCgNodeId(cgNodeId);
// formalInsToPersistentCGNodes.put(formalInNode, corresPersCGNode);
// }
// }
// }
// }
// }
// public void generatePersistenceStructures(SDG sdg) {
// ArrayList<LocalPointerKey> localPointerKeys = new ArrayList<>();
//
// int id = 0;
// for (PointerKey pk : pointerAnalysis.getPointerKeys()) { //FIXME loaded sdg file cause an exception here !
// if (pk instanceof LocalPointerKey) {
// LocalPointerKey localPointerKey = (LocalPointerKey) pk;
//
// if (!localPointerKey.isParameter()) {
// continue;
// }
//
// CGNode corresCgNode = localPointerKey.getNode();
// localPointerKeys.add(localPointerKey);
//
// if (!cgNodesToPersistentCGNodes.containsKey(corresCgNode)) {
// PersistentCGNode persistentCGNode = new PersistentCGNode(id);
// cgNodesToPersistentCGNodes.put(corresCgNode, persistentCGNode);
// persistentCGNodes.add(persistentCGNode);
// id++;
// }
// }
// }
//
// Set<SDGEdge> edgeSet = sdg.edgeSet();
// for (SDGEdge e : edgeSet) {
// if (e.getKind() == SDGEdge.Kind.SUMMARY) {
// SDGNode actualInNode = e.getSource();
// SDGNode actualOutNode = e.getTarget();
// Collection<SDGNodeTuple> formalNodePairs =
// sdg.getAllFormalPairs(actualInNode, actualOutNode);
// for (SDGNodeTuple formalNodeTuple : formalNodePairs) {
// SDGNode formalInNode = formalNodeTuple.getFirstNode();
// SDGNode methodNode = sdg.getEntry(formalInNode);
// int cgNodeId = sdg.getCGNodeId(methodNode);
// CGNode cgNode = callGraph.getNode(cgNodeId);
// PersistentCGNode corresPersCGNode =
// cgNodesToPersistentCGNodes.get(cgNode);
// if (corresPersCGNode != null) {
// corresPersCGNode.setCgNodeId(cgNodeId);
// formalInsToPersistentCGNodes.put(formalInNode, corresPersCGNode);
// }
// }
// }
// }
// generateIRsAndPersistentLocalPointerKeys(localPointerKeys);
// calculateDisjunctPointsToKeys(localPointerKeys);
//
// }
// private void generateIRsAndPersistentLocalPointerKeys(
// ArrayList<LocalPointerKey> localPointerKeys) {
// for (int i = 0; i < localPointerKeys.size(); ++i) {
// LocalPointerKey currentLocalPointerKey = localPointerKeys.get(i);
// CGNode cgNode = currentLocalPointerKey.getNode();
// PersistentCGNode persistentCGNode =
// cgNodesToPersistentCGNodes.get(cgNode);
// persistentCGNode.createPersistentIR(cgNode, localPointerKeys);
//
// Integer currentCGNodeId = persistentCGNode.getCgNodeId();
// cgNodeIdToPersistentCGNodes.put(currentCGNodeId, persistentCGNode);
//
// PersistentLocalPointerKey persistentLocalPointerKey =
// new PersistentLocalPointerKey(currentLocalPointerKey,
// persistentCGNode, i);
// persistentLocalPointerKeys.add(persistentLocalPointerKey);
// }
// }
//
// private void calculateDisjunctPointsToKeys(ArrayList<LocalPointerKey>
// localPointerKeys) {
// for (int i = 0; i < localPointerKeys.size(); ++i) {
// OrdinalSet<? extends InstanceKey> currentPointsToset =
// pointerAnalysis.getPointsToSet(localPointerKeys.get(i));
// for (int j = 0; j < localPointerKeys.size(); ++j) {
// if (i == j) {
// continue;
// } else if (!localPointerKeys.get(i).getNode()
// .equals(localPointerKeys.get(j).getNode())) {
// continue;
// }
// OrdinalSet<? extends InstanceKey> otherPointsToSet =
// pointerAnalysis.getPointsToSet(localPointerKeys.get(j));
// if (disjunct(currentPointsToset, otherPointsToSet)) {
// if (disjunctPointsToSets
// .containsKey(persistentLocalPointerKeys.get(i))) {
// disjunctPointsToSets.get(persistentLocalPointerKeys.get(i))
// .add(persistentLocalPointerKeys.get(j));
// } else {
// List<PersistentLocalPointerKey> list = new ArrayList<>();
// list.add(persistentLocalPointerKeys.get(j));
// disjunctPointsToSets.put(persistentLocalPointerKeys.get(i),
// list);
// }
// }
// }
// }
// }
// private static boolean disjunct(OrdinalSet<?> s1, OrdinalSet<?> s2) {
// for (Object e1 : s1) {
// for (Object e2 : s2) {
// if (e1.equals(e2)) {
// return false;
// }
// }
// }
// return true;
// }
public PersistentCGNode getNode(int nodeID) { public PersistentCGNode getNode(int nodeID) {
return cgNodeIdToPersistentCGNodes.get(nodeID); return cgNodeIdToPersistentCGNodes.get(nodeID);
} }
......
...@@ -290,7 +290,6 @@ public class StateSaverCGConsumerBuilder implements StateSaverBuilder, CGConsume ...@@ -290,7 +290,6 @@ public class StateSaverCGConsumerBuilder implements StateSaverBuilder, CGConsume
// #GraphWriter<CallGraph>; // #GraphWriter<CallGraph>;
SDGBuilder builder = SDGBuilder.create(conf); SDGBuilder builder = SDGBuilder.create(conf);
TIntIntMap map = builder.getEntryNode2CGNode(); TIntIntMap map = builder.getEntryNode2CGNode();
System.out.println("MAP ::: " +map);
// StateSaver sv = stateSaverBuilder.buildStateSaver(sdg); // StateSaver sv = stateSaverBuilder.buildStateSaver(sdg);
// cg = sv.getCallGraph(); // cg = sv.getCallGraph();
CGResult result = builder.buildCallgraph(new NullProgressMonitor()); CGResult result = builder.buildCallgraph(new NullProgressMonitor());
...@@ -328,7 +327,6 @@ public class StateSaverCGConsumerBuilder implements StateSaverBuilder, CGConsume ...@@ -328,7 +327,6 @@ public class StateSaverCGConsumerBuilder implements StateSaverBuilder, CGConsume
LocalPointerKey currentLocalPointerKey = localPointerKeys.get(i); LocalPointerKey currentLocalPointerKey = localPointerKeys.get(i);
CGNode cgNode = currentLocalPointerKey.getNode(); CGNode cgNode = currentLocalPointerKey.getNode();
PersistentCGNode persistentCGNode = saver.getCgNodesToPersistentCGNodes().get(cgNode); PersistentCGNode persistentCGNode = saver.getCgNodesToPersistentCGNodes().get(cgNode);
System.out.println(cgNode.getGraphNodeId() + " ::: " + persistentCGNode.getUniqueId());
persistentCGNode.createPersistentIR(cgNode, localPointerKeys); persistentCGNode.createPersistentIR(cgNode, localPointerKeys);
Integer currentCGNodeId = persistentCGNode.getCgNodeId(); Integer currentCGNodeId = persistentCGNode.getCgNodeId();
......
...@@ -123,15 +123,6 @@ public class ViolationChop { ...@@ -123,15 +123,6 @@ public class ViolationChop {
}); });
} }
public void getCallNodes() { //TODO muessig test
for(SDGEdge edgeTest : inducedSubgraph.edgeSet()) { //TODO muessig remove
if(edgeTest.getKind().equals(SDGEdge.Kind.CALL)) {
System.out.println(true);
System.out.println("callNode: " + edgeTest.getTarget().getId());
}
}
}
private static boolean isSummaryEdge(SDGEdge currentEdge) { private static boolean isSummaryEdge(SDGEdge currentEdge) {
return currentEdge.getKind() == SDGEdge.Kind.SUMMARY; return currentEdge.getKind() == SDGEdge.Kind.SUMMARY;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment