start of new file
[IRC.git] / Robust / src / Main / Main.java
index cbcbd8933794681890198db259e32e0414cc6206..e218d333aa46ea1060175e2276071f4dc2c8ff54 100644 (file)
@@ -64,6 +64,10 @@ public class Main {
              state.excprefetch.add(args[++i]);
          else if (option.equals("-classlibrary"))
              ClassLibraryPrefix=args[++i]+"/";
+         else if(option.equals("-numcore")) {
+             ++i;
+             state.CORENUM = Integer.parseInt(args[i]);
+         }
          else if (option.equals("-mainclass"))
              state.main=args[++i];
          else if (option.equals("-trueprob")) {
@@ -98,8 +102,8 @@ public class Main {
              state.OWNERSHIP=true;
          else if (option.equals("-optional"))
              state.OPTIONAL=true;
-         /*else if (option.equals("-raw"))
-                 state.RAW=true;*/
+         else if (option.equals("-raw"))
+                 state.RAW=true;
          else if (option.equals("-scheduling"))
                  state.SCHEDULING=true; 
          else if (option.equals("-thread"))
@@ -148,26 +152,28 @@ public class Main {
       readSourceFile(state, ClassLibraryPrefix+"HashEntry.java");
       readSourceFile(state, ClassLibraryPrefix+"Integer.java");
       readSourceFile(state, ClassLibraryPrefix+"StringBuffer.java");
+      //if(!state.RAW) {
       readSourceFile(state, ClassLibraryPrefix+"FileInputStream.java");
       readSourceFile(state, ClassLibraryPrefix+"InputStream.java");
       readSourceFile(state, ClassLibraryPrefix+"OutputStream.java");
       readSourceFile(state, ClassLibraryPrefix+"FileOutputStream.java");
       readSourceFile(state, ClassLibraryPrefix+"File.java");
-      readSourceFile(state, ClassLibraryPrefix+"Math.java");
       readSourceFile(state, ClassLibraryPrefix+"InetAddress.java");
       readSourceFile(state, ClassLibraryPrefix+"SocketInputStream.java");
       readSourceFile(state, ClassLibraryPrefix+"SocketOutputStream.java");
+      //}
+      readSourceFile(state, ClassLibraryPrefix+"Math.java");
       readSourceFile(state, ClassLibraryPrefix+"gnu/Random.java");
          readSourceFile(state, ClassLibraryPrefix+"Vector.java");
          readSourceFile(state, ClassLibraryPrefix+"Enumeration.java");
 
-
       if (state.TASK) {
          readSourceFile(state, ClassLibraryPrefix+"Object.java");
          readSourceFile(state, ClassLibraryPrefix+"TagDescriptor.java");
       } else if (state.DSM) {
          readSourceFile(state, ClassLibraryPrefix+"ThreadDSM.java");
          readSourceFile(state, ClassLibraryPrefix+"ObjectJavaDSM.java");
+         readSourceFile(state, ClassLibraryPrefix+"Barrier.java");
       } else {
          if (state.THREAD) {
              readSourceFile(state, ClassLibraryPrefix+"Thread.java");
@@ -197,6 +203,7 @@ public class Main {
       BuildFlat bf=new BuildFlat(state,tu);
       bf.buildFlat();
       SafetyAnalysis sa=null;
+      PrefetchAnalysis pa=null;
 
       if (state.TAGSTATE) {
          CallGraph callgraph=new CallGraph(state);
@@ -299,6 +306,15 @@ public class Main {
                                          //int newRate = tint;
                                          //int newRate = (j+1)%2+1;
                                          int newRate = 1;
+                                         String cdname = cd.getSymbol();
+                                         if((cdname.equals("SeriesRunner")) || 
+                                                 (cdname.equals("MDRunner"))) {
+                                             newRate = 16;
+                                         } else if(cdname.equals("SentenceParser")) {
+                                             newRate = 4;
+                                         } /*else if(cdname.equals("ReduceWorker")) {
+                                             newRate = 3;
+                                         }*/
                                          /*do {
                                              tint = r.nextInt()%100;
                                          } while(tint <= 0);
@@ -318,7 +334,7 @@ public class Main {
                              /*do {
                                  tint = r.nextInt()%10;
                              } while(tint <= 0);*/
-                             tint = 1;
+                             tint = 3;
                              ((FEdge)it_edges.next()).setExeTime(tint);
                          }
                      }
@@ -330,8 +346,7 @@ public class Main {
              scheduleAnalysis.preSchedule();
              scheduleAnalysis.scheduleAnalysis();
              //scheduleAnalysis.setCoreNum(scheduleAnalysis.getSEdges4Test().size());
-             scheduleAnalysis.setCoreNum(1);
-             //scheduleAnalysis.setCoreNum(2);
+             scheduleAnalysis.setCoreNum(state.CORENUM);
              scheduleAnalysis.schedule();
              
              //simulate these schedulings
@@ -355,7 +370,7 @@ public class Main {
              }
              System.out.print("Selected schedulings with least exectution time " + processTime + ": \n\t");
              for(int i = 0; i < selectedScheduling.size(); i++) {
-                 System.out.print(selectedScheduling.elementAt(i) + ", ");
+                 System.out.print((selectedScheduling.elementAt(i) + 1) + ", ");
              }
              System.out.println();
              
@@ -401,9 +416,10 @@ public class Main {
              }
              
              if(state.MULTICORE) {
-                 it_scheduling = scheduleAnalysis.getSchedulingsIter();
-                 Vector<Schedule> scheduling = (Vector<Schedule>)it_scheduling.next();
-                 BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, bf.getMap(), tu, sa, scheduling, scheduleAnalysis.getCoreNum());
+                 //it_scheduling = scheduleAnalysis.getSchedulingsIter();
+                 //Vector<Schedule> scheduling = (Vector<Schedule>)it_scheduling.next();
+                 Vector<Schedule> scheduling = scheduleAnalysis.getSchedulings().elementAt(selectedScheduling.elementAt(0));
+                 BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, bf.getMap(), tu, sa, scheduling, scheduleAnalysis.getCoreNum(), pa);
                  bcm.buildCode();
              }
          }
@@ -414,14 +430,17 @@ public class Main {
          if (state.DSM) {
              CallGraph callgraph=new CallGraph(state);
              if (state.PREFETCH) {
-                 PrefetchAnalysis pa=new PrefetchAnalysis(state, callgraph, tu);
+                 //speed up prefetch generation using locality analysis results
+                 LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu);
+                 pa=new PrefetchAnalysis(state, callgraph, tu, la);
              }
+
              LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu);
              GenerateConversions gc=new GenerateConversions(la, state);
-             BuildCode bc=new BuildCode(state, bf.getMap(), tu, la);
+             BuildCode bc=new BuildCode(state, bf.getMap(), tu, la, pa);
              bc.buildCode();
          } else {
-             BuildCode bc=new BuildCode(state, bf.getMap(), tu, sa);
+             BuildCode bc=new BuildCode(state, bf.getMap(), tu, sa, pa);
              bc.buildCode();
          }
       }
@@ -438,6 +457,8 @@ public class Main {
          int allocationDepth  = 3;
          OwnershipAnalysis oa =
              new OwnershipAnalysis( state, callGraph, allocationDepth );
+         //This was breaking the compile
+         //      oa.writeAllAliases( "identifiedAliases.txt" );
       }
 
       System.exit(0);