pull in class files that already exist in library
[IRC.git] / Robust / src / Main / Main.java
index 28389107e9c75c8877fc2e188e486938188db255..2dd61672e9e61f13180f9cd04e9be7d64172a529 100644 (file)
@@ -96,6 +96,15 @@ public class Main {
        state.MULTICORE=true;
       else if (option.equals("-ownership"))
        state.OWNERSHIP=true;
+      else if (option.equals("-ownallocdepth")) {
+       state.OWNERSHIPALLOCDEPTH=Integer.parseInt(args[++i]);
+      } else if (option.equals("-ownwritedots")) {
+       state.OWNERSHIPWRITEDOTS=true;
+       if (args[++i].equals("all")) {
+         state.OWNERSHIPWRITEALL=true;
+       }
+      } else if (option.equals("-ownaliasfile"))
+       state.OWNERSHIPALIASFILE=args[++i];
       else if (option.equals("-optional"))
        state.OPTIONAL=true;
       else if (option.equals("-raw"))
@@ -130,6 +139,9 @@ public class Main {
        System.out.println("-flatirlibmethods -- create dot files for flat IR graphs of library class methods");
        System.out.println("  note: -flatirusermethods or -flatirlibmethods currently generate all class method flat IR graphs");
        System.out.println("-ownership -- do ownership analysis");
+       System.out.println("-ownallocdepth <d> -- set allocation depth for ownership analysis");
+       System.out.println("-ownwritedots <all/final> -- write ownership graphs; can be all results or just final results");
+       System.out.println("-ownaliasfile <filename> -- write a text file showing all detected aliases in program tasks");
        System.out.println("-optional -- enable optional arguments");
        System.out.println("-webinterface -- enable web interface");
        System.out.println("-help -- print out help");
@@ -162,6 +174,12 @@ public class Main {
     readSourceFile(state, ClassLibraryPrefix+"gnu/Random.java");
     readSourceFile(state, ClassLibraryPrefix+"Vector.java");
     readSourceFile(state, ClassLibraryPrefix+"Enumeration.java");
+    readSourceFile(state, ClassLibraryPrefix+"Dictionary.java");
+    readSourceFile(state, ClassLibraryPrefix+"Writer.java");
+    readSourceFile(state, ClassLibraryPrefix+"BufferedWriter.java");
+    readSourceFile(state, ClassLibraryPrefix+"OutputStreamWriter.java");
+    readSourceFile(state, ClassLibraryPrefix+"FileWriter.java");
+    readSourceFile(state, ClassLibraryPrefix+"Date.java");
 
     if (state.TASK) {
       readSourceFile(state, ClassLibraryPrefix+"Object.java");
@@ -271,10 +289,10 @@ public class Main {
        int tint = 0;
        for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator(); it_classes.hasNext();) {
          ClassDescriptor cd=(ClassDescriptor) it_classes.next();
-         if(cd.hasFlags()){
+         if(cd.hasFlags()) {
            Vector rootnodes=ta.getRootNodes(cd);
            if(rootnodes!=null)
-             for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();){
+             for(Iterator it_rootnodes=rootnodes.iterator(); it_rootnodes.hasNext();) {
                FlagState root=(FlagState)it_rootnodes.next();
                Vector allocatingTasks = root.getAllocatingTasks();
                if(allocatingTasks != null) {
@@ -288,7 +306,7 @@ public class Main {
                      if(numEdges - j == 1) {
                        pfe.setProbability(total);
                      } else {
-                       if((total != 0) && (total != 1)){
+                       if((total != 0) && (total != 1)) {
                          do {
                            tint = r.nextInt()%total;
                          } while(tint <= 0);
@@ -450,12 +468,14 @@ public class Main {
     }
 
     if (state.OWNERSHIP) {
-      CallGraph callGraph  = new CallGraph(state);
-      int allocationDepth  = 3;
-      OwnershipAnalysis oa =
-        new OwnershipAnalysis(state, callGraph, allocationDepth);
-      //This was breaking the compile
-      //         oa.writeAllAliases( "identifiedAliases.txt" );
+      CallGraph callGraph = new CallGraph(state);
+      OwnershipAnalysis oa = new OwnershipAnalysis(state,
+                                                   tu,
+                                                   callGraph,
+                                                   state.OWNERSHIPALLOCDEPTH,
+                                                   state.OWNERSHIPWRITEDOTS,
+                                                   state.OWNERSHIPWRITEALL,
+                                                   state.OWNERSHIPALIASFILE);
     }
 
     System.exit(0);