OSDN Git Service

Removed unused files.
authort-hatano <tnotawa@gmail.com>
Mon, 8 Feb 2016 15:09:21 +0000 (00:09 +0900)
committert-hatano <tnotawa@gmail.com>
Mon, 8 Feb 2016 15:09:21 +0000 (00:09 +0900)
JavaAnalysisToolsDemo/.classpath
JavaAnalysisToolsDemo/src/demo/wala/SlicerMain.java [deleted file]

index c3c7765..4498788 100644 (file)
@@ -4,9 +4,8 @@
        <classpathentry kind="src" path="sample"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.core"/>\r
-       <classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.util"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/soba"/>\r
-       <classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.shrike"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/soot"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.util"/>\r
        <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
diff --git a/JavaAnalysisToolsDemo/src/demo/wala/SlicerMain.java b/JavaAnalysisToolsDemo/src/demo/wala/SlicerMain.java
deleted file mode 100644 (file)
index aabcad3..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-package demo.wala;\r
-\r
-import java.io.IOException;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-\r
-import com.ibm.wala.classLoader.ShrikeBTMethod;\r
-import com.ibm.wala.ipa.callgraph.AnalysisCache;\r
-import com.ibm.wala.ipa.callgraph.AnalysisOptions;\r
-import com.ibm.wala.ipa.callgraph.AnalysisScope;\r
-import com.ibm.wala.ipa.callgraph.CGNode;\r
-import com.ibm.wala.ipa.callgraph.CallGraph;\r
-import com.ibm.wala.ipa.callgraph.Entrypoint;\r
-import com.ibm.wala.ipa.callgraph.impl.Util;\r
-import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;\r
-import com.ibm.wala.ipa.cha.ClassHierarchy;\r
-import com.ibm.wala.ipa.slicer.NormalStatement;\r
-import com.ibm.wala.ipa.slicer.Slicer;\r
-import com.ibm.wala.ipa.slicer.Statement;\r
-import com.ibm.wala.ssa.IR;\r
-import com.ibm.wala.ssa.SSAInstruction;\r
-import com.ibm.wala.types.Descriptor;\r
-import com.ibm.wala.util.CancelException;\r
-import com.ibm.wala.util.WalaException;\r
-import com.ibm.wala.util.config.AnalysisScopeReader;\r
-import com.ibm.wala.util.debug.Assertions;\r
-import com.ibm.wala.util.io.FileProvider;\r
-import com.ibm.wala.util.strings.Atom;\r
-\r
-import demo.util.DemoUtil;\r
-\r
-public class SlicerMain {\r
-\r
-       public static void main(String[] args) {\r
-               try {\r
-                       if (args.length > 0) {\r
-                               doSlicing(args[0]);\r
-                       }\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-\r
-       public static void doSlicing(String appJar) throws WalaException, IOException, IllegalArgumentException, CancelException {\r
-               // create an analysis scope representing the appJar as a J2SE application\r
-//             AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,CallGraphTestUtil.REGRESSION_EXCLUSIONS);\r
-//             AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, null);\r
-//             AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));\r
-               AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider()).getFile(DemoUtil.REGRESSION_EXCLUSIONS));\r
-\r
-               ClassHierarchy cha = ClassHierarchy.make(scope);\r
-\r
-               Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);\r
-               AnalysisOptions options = new AnalysisOptions(scope, entrypoints);\r
-\r
-               // build the call graph\r
-               com.ibm.wala.ipa.callgraph.CallGraphBuilder cgb = Util.makeZeroCFABuilder(options, new AnalysisCache(),cha, scope, null, null);\r
-//             CallGraph cg = cgb.makeCallGraph(options);\r
-               CallGraph cg = cgb.makeCallGraph(options, null);\r
-               PointerAnalysis pa = cgb.getPointerAnalysis();\r
-\r
-               // find seed statement\r
-               Statement statement = findCallTo(findMainMethod(cg), "println");\r
-\r
-               Collection<Statement> slice;\r
-\r
-               // context-sensitive traditional slice\r
-               slice = Slicer.computeBackwardSlice ( statement, cg, pa );\r
-               dumpSlice(slice);\r
-\r
-               slice.stream()\r
-                       .mapToInt(s -> getLineNumber(s))\r
-                       .filter(line -> line != -1)\r
-                       .mapToObj(line -> "line = " + line)\r
-                       .forEach(System.out::println);\r
-               \r
-               // context-sensitive thin slice\r
-               //          slice = Slicer.computeBackwardSlice(statement, cg, pa, DataDependenceOptions.NO_BASE_PTRS,\r
-               //              ControlDependenceOptions.NONE);\r
-               //          dumpSlice(slice);\r
-               //\r
-               //          // context-insensitive slice\r
-               //          ThinSlicer ts = new ThinSlicer(cg,pa);\r
-               //          Collection<Statement> slice = ts.computeBackwardThinSlice ( statement );\r
-               //          dumpSlice(slice);\r
-       }\r
-\r
-       public static int getLineNumber(Statement s) {\r
-               if (s.getKind() == Statement.Kind.NORMAL) { // ignore special kinds of statements\r
-                       int bcIndex, instructionIndex = ((NormalStatement) s).getInstructionIndex();\r
-                       try {\r
-                               bcIndex = ((ShrikeBTMethod) s.getNode().getMethod()).getBytecodeIndex(instructionIndex);\r
-                               try {\r
-                                       int src_line_number = s.getNode().getMethod().getLineNumber(bcIndex);\r
-                                       return src_line_number;\r
-//                                     System.err.println ( "Source line number = " + src_line_number );\r
-                               } catch (Exception e) {\r
-//                                     System.err.println("Bytecode index no good");\r
-//                                     System.err.println(e.getMessage());\r
-                                       return -1;\r
-                               }\r
-                       } catch (Exception e ) {\r
-                               return -1;\r
-//                             System.err.println("it's probably not a BT method (e.g. it's a fakeroot method)");\r
-//                             System.err.println(e.getMessage());\r
-                       }\r
-               }\r
-               return -1;\r
-       }\r
-       \r
-       public static CGNode findMainMethod(CallGraph cg) {\r
-               Descriptor d = Descriptor.findOrCreateUTF8("([Ljava/lang/String;)V");\r
-               Atom name = Atom.findOrCreateUnicodeAtom("main");\r
-               for (Iterator<? extends CGNode> it = cg.getSuccNodes(cg.getFakeRootNode()); it.hasNext();) {\r
-                       CGNode n = it.next();\r
-                       if (n.getMethod().getName().equals(name) && n.getMethod().getDescriptor().equals(d)) {\r
-                               return n;\r
-                       }\r
-               }\r
-               Assertions.UNREACHABLE("failed to find main() method");\r
-               return null;\r
-       }\r
-\r
-       public static Statement findCallTo(CGNode n, String methodName) {\r
-               IR ir = n.getIR();\r
-               for (Iterator<SSAInstruction> it = ir.iterateAllInstructions(); it.hasNext();) {\r
-                       SSAInstruction s = it.next();\r
-                       if (s instanceof com.ibm.wala.ssa.SSAAbstractInvokeInstruction) {\r
-                               com.ibm.wala.ssa.SSAAbstractInvokeInstruction call = (com.ibm.wala.ssa.SSAAbstractInvokeInstruction) s;\r
-                               if (call.getCallSite().getDeclaredTarget().getName().toString().equals(methodName)) {\r
-                                       com.ibm.wala.util.intset.IntSet indices = ir.getCallInstructionIndices(call.getCallSite());\r
-                                       com.ibm.wala.util.debug.Assertions.productionAssertion(indices.size() == 1, "expected 1 but got " + indices.size());\r
-                                       return new com.ibm.wala.ipa.slicer.NormalStatement(n, indices.intIterator().next());\r
-                               }\r
-                       }\r
-               }\r
-               Assertions.UNREACHABLE("failed to find call to " + methodName + " in " + n);\r
-               return null;\r
-       }\r
-\r
-       public static void dumpSlice(Collection<Statement> slice) {\r
-               for (Statement s : slice) {\r
-//                     System.err.println(s);\r
-                       System.out.println(s);\r
-               }\r
-       }\r
-\r
-}\r