import IR.Tree.ParseNode;
import IR.Tree.BuildIR;
import IR.Tree.SemanticCheck;
+import IR.Flat.BuildCodeMultiCore;
import IR.Flat.BuildFlat;
import IR.Flat.BuildCode;
import IR.ClassDescriptor;
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"))
+ else if (option.equals("-trueprob")) {
state.TRUEPROB=Double.parseDouble(args[++i]);
- else if (option.equals("-printflat"))
+ } else if (option.equals("-printflat"))
State.PRINTFLAT=true;
else if (option.equals("-struct"))
state.structfile=args[++i];
state.FLATIRGRAPH=true;
state.FLATIRGRAPHLIBMETHODS=true;
}
+ else if (option.equals("-multicore"))
+ state.MULTICORE=true;
else if (option.equals("-ownership"))
state.OWNERSHIP=true;
else if (option.equals("-optional"))
state.OPTIONAL=true;
+ else if (option.equals("-raw"))
+ state.RAW=true;
else if (option.equals("-scheduling"))
state.SCHEDULING=true;
else if (option.equals("-thread"))
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");
BuildFlat bf=new BuildFlat(state,tu);
bf.buildFlat();
SafetyAnalysis sa=null;
+ PrefetchAnalysis pa=null;
if (state.TAGSTATE) {
CallGraph callgraph=new CallGraph(state);
// Print stuff to the original output and error streams.
// On most systems all of this will end up on your console when you
// run this application.
- origOut.println ("\nRedirect: Round #1");
- System.out.println ("Test output via 'System.out'.");
- origOut.println ("Test output via 'origOut' reference.");
+ //origOut.println ("\nRedirect: Round #1");
+ //System.out.println ("Test output via 'System.out'.");
+ //origOut.println ("Test output via 'origOut' reference.");
// Set the System out and err streams to use our replacements.
System.setOut(stdout);
// should go to the console on most systems while the messages
// printed through the 'System.out' and 'System.err' will end up in
// the files we created for them.
- origOut.println ("\nRedirect: Round #2");
- System.out.println ("Test output via 'SimulatorResult.out'.");
- origOut.println ("Test output via 'origOut' reference.");
+ //origOut.println ("\nRedirect: Round #2");
+ //System.out.println ("Test output via 'SimulatorResult.out'.");
+ //origOut.println ("Test output via 'origOut' reference.");
// for test
// Randomly set the newRate and probability of FEdges
if(numEdges - j == 1) {
pfe.setProbability(total);
} else {
- if(total != 0) {
+ if((total != 0) && (total != 1)){
do {
tint = r.nextInt()%total;
} while(tint <= 0);
pfe.setProbability(tint);
total -= tint;
}
- do {
+ /*do {
tint = r.nextInt()%10;
- } while(tint <= 0);
+ } while(tint <= 0);*/
//int newRate = tint;
- int newRate = (j+1)%2+1;
+ //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);
FlagState fs = (FlagState)it_flags.next();
Iterator it_edges = fs.edges();
while(it_edges.hasNext()) {
- do {
+ /*do {
tint = r.nextInt()%10;
- } while(tint <= 0);
+ } while(tint <= 0);*/
+ tint = 3;
((FEdge)it_edges.next()).setExeTime(tint);
}
}
ScheduleAnalysis scheduleAnalysis = new ScheduleAnalysis(state, ta);
scheduleAnalysis.preSchedule();
scheduleAnalysis.scheduleAnalysis();
- scheduleAnalysis.setCoreNum(scheduleAnalysis.getSEdges4Test().size());
+ //scheduleAnalysis.setCoreNum(scheduleAnalysis.getSEdges4Test().size());
+ scheduleAnalysis.setCoreNum(state.CORENUM);
scheduleAnalysis.schedule();
//simulate these schedulings
}
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();
} catch (Exception e) {
origOut.println ("Redirect: Unable to close files!");
}
+
+ if(state.MULTICORE) {
+ //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();
+ }
}
}
- if (state.DSM) {
- CallGraph callgraph=new CallGraph(state);
- if (state.PREFETCH) {
- PrefetchAnalysis pa=new PrefetchAnalysis(state, callgraph, tu);
+ if(!state.MULTICORE) {
+ if (state.DSM) {
+ CallGraph callgraph=new CallGraph(state);
+ if (state.PREFETCH) {
+ //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, pa);
+ bc.buildCode();
+ } else {
+ BuildCode bc=new BuildCode(state, bf.getMap(), tu, sa, pa);
+ bc.buildCode();
}
- LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu);
- GenerateConversions gc=new GenerateConversions(la, state);
- BuildCode bc=new BuildCode(state, bf.getMap(), tu, la);
- bc.buildCode();
- } else {
- BuildCode bc=new BuildCode(state, bf.getMap(), tu, sa);
- bc.buildCode();
}
if (state.FLATIRGRAPH) {
int allocationDepth = 3;
OwnershipAnalysis oa =
new OwnershipAnalysis( state, callGraph, allocationDepth );
+ //This was breaking the compile
+ // oa.writeAllAliases( "identifiedAliases.txt" );
}
System.exit(0);