--- /dev/null
+package Analysis.MLP;
+
+import Analysis.CallGraph.*;
+import Analysis.OwnershipAnalysis.*;
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+
+public class MLPAnalysis {
+
+ // data from the compiler
+ private State state;
+ private TypeUtil typeUtil;
+ private CallGraph callGraph;
+ private OwnershipAnalysis ownAnalysis;
+
+ public MLPAnalysis(State state,
+ TypeUtil tu,
+ CallGraph callGraph,
+ OwnershipAnalysis ownAnalysis
+ ) {
+
+ double timeStartAnalysis = (double) System.nanoTime();
+
+ this.state = state;
+ this.typeUtil = tu;
+ this.callGraph = callGraph;
+ this.ownAnalysis = ownAnalysis;
+
+
+ double timeEndAnalysis = (double) System.nanoTime();
+ double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) );
+ String treport = String.format( "The mlp analysis took %.3f sec.", dt );
+ System.out.println( treport );
+ }
+
+
+ Stack<FlatSESEEnterNode> seseStack;
+
+ protected void analyze() {
+ seseStack = new Stack<FlatSESEEnterNode>();
+
+ /*
+ if( !seseStack.empty() ) {
+ seseStack.peek().addInVar( tmp );
+ seseStack.peek().addOutVar( out_temp );
+ }
+ */
+
+ /*
+ if( !seseStack.empty() ) {
+ throw new Error("Error: return statement enclosed within SESE "+seseStack.peek());
+ }
+ */
+
+ /*
+
+ */
+ }
+}
double timeEndAnalysis = (double) System.nanoTime();
double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) );
- String treport = String.format( "The analysis took %.3f sec.", dt );
+ String treport = String.format( "The reachability analysis took %.3f sec.", dt );
System.out.println( treport );
if( writeDOTs && !writeAllDOTs ) {
public static String PREFIX="";
public static String arraytype="ArrayObject";
public static int flagcount = 0;
- public boolean MLP=false;
Virtual virtualcalls;
TypeUtil typeutil;
protected int maxtaskparams=0;
this.backuptable=new Hashtable<LocalityBinding, Hashtable<TempDescriptor, TempDescriptor>>();
this.wb=new WriteBarrier(locality, st);
}
-
- this.MLP=st.MLP;
}
/** The buildCode method outputs C code for all the methods. The Flat
} else if(current_node.numNext()==1) {
output.print(" ");
generateFlatNode(fm, lb, current_node, output);
+ if (state.MLP && current_node.kind()==FKind.FlatSESEEnterNode) {
+ current_node=((FlatSESEEnterNode)current_node).getFlatExit();
+ }
FlatNode nextnode=current_node.getNext(0);
if (visited.contains(nextnode)) {
output.println("goto L"+nodetolabel.get(nextnode)+";");
return;
case FKind.FlatSESEEnterNode:
- if( MLP ) generateFlatSESEEnterNode(fm, lb, (FlatSESEEnterNode) fn, output);
+ if( state.MLP ) generateFlatSESEEnterNode(fm, lb, (FlatSESEEnterNode) fn, output);
return;
case FKind.FlatSESEExitNode:
- if( MLP ) generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode) fn, output);
+ if( state.MLP ) generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode) fn, output);
return;
case FKind.FlatGlobalConvNode:
output.println("}");
}
+
+ public void generateSESE(FlatMethod fm, LocalityBinding lb, FlatSESEEnterNode faen, PrintWriter output) {
+
+ }
+
+
public void generateFlatSESEEnterNode(FlatMethod fm, LocalityBinding lb, FlatSESEEnterNode faen, PrintWriter output) {
- output.println("mlpEnqueue( (struct SESE*)0 );");
+ /*
+ output.println("struct sese"+faen.getPrettyIdentifier()+"in {");
+ Iterator<TempDescriptor> itr = faen.getInVarSet().iterator();
+ while( itr.hasNext() ) {
+ TempDescriptor td = itr.next();
+ output.println(" "+td+";");
+ }
+ output.println("}");
+
+ output.println("struct sese"+faen.getPrettyIdentifier()+"out {");
+ itr = faen.getOutVarSet().iterator();
+ while( itr.hasNext() ) {
+ TempDescriptor td = itr.next();
+ output.println(" "+td+";");
+ }
+ output.println("}");
+ */
}
public void generateFlatSESEExitNode(FlatMethod fm, LocalityBinding lb, FlatSESEExitNode faen, PrintWriter output) {
- output.println("mlpNotifyExit( (struct SESE*)0 );");
+ //output.println("mlpNotifyExit( (struct SESE*)0 );");
}
private void generateFlatCheckNode(FlatMethod fm, LocalityBinding lb, FlatCheckNode fcn, PrintWriter output) {
FlatSESEExitNode fsexn=new FlatSESEExitNode(sn);
sn.setFlatExit(fsexn);
- fsexn.setFlatEnter( sn.getStart().getFlatEnter() );
+ FlatSESEEnterNode fsen=sn.getStart().getFlatEnter();
+ fsexn.setFlatEnter(fsen);
sn.getStart().getFlatEnter().setFlatExit( fsexn );
return new NodePair(fsexn, fsexn);
}
package IR.Flat;
import IR.Tree.SESENode;
-import java.util.Vector;
+import java.util.HashSet;
public class FlatSESEEnterNode extends FlatNode {
private static int identifier=0;
private int id;
protected FlatSESEExitNode exit;
protected SESENode treeNode;
+ protected HashSet<TempDescriptor> inVars;
+ protected HashSet<TempDescriptor> outVars;
public FlatSESEEnterNode( SESENode sn ) {
- this.id=identifier++;
- treeNode = sn;
+ this.id = identifier++;
+ treeNode = sn;
+ inVars = new HashSet<TempDescriptor>();
+ outVars = new HashSet<TempDescriptor>();
}
+
public void rewriteUse() {
}
+
public void rewriteDef() {
}
+
+ public void addInVar( TempDescriptor td ) {
+ inVars.add( td );
+ }
+
+ public void addOutVar( TempDescriptor td ) {
+ outVars.add( td );
+ }
+
+ public void addInVarSet( HashSet<TempDescriptor> s ) {
+ inVars.addAll( s );
+ }
+
+ public void addOutVarSet( HashSet<TempDescriptor> s ) {
+ outVars.addAll( s );
+ }
+
+ public HashSet<TempDescriptor> getInVarSet() {
+ return inVars;
+ }
+
+ public HashSet<TempDescriptor> getOutVarSet() {
+ return outVars;
+ }
+
public SESENode getTreeNode() {
return treeNode;
}
import Analysis.Prefetch.PrefetchAnalysis;
import Analysis.FlatIRGraph.FlatIRGraph;
import Analysis.OwnershipAnalysis.OwnershipAnalysis;
+import Analysis.MLP.MLPAnalysis;
import Analysis.Loops.*;
import IR.MethodDescriptor;
import IR.Flat.FlatMethod;
sc.getClass("TagDescriptor");
}
if (state.THREAD||state.DSM||state.SINGLETM) {
- sc.getClass("Thread");
+ sc.getClass("Thread");
}
sc.semanticCheck();
}
}
+ if (state.FLATIRGRAPH) {
+ FlatIRGraph firg = new FlatIRGraph(state,
+ state.FLATIRGRAPHTASKS,
+ state.FLATIRGRAPHUSERMETHODS,
+ state.FLATIRGRAPHLIBMETHODS);
+ }
+ if (state.OWNERSHIP && !state.MLP) {
+ CallGraph callGraph = new CallGraph(state);
+ OwnershipAnalysis oa = new OwnershipAnalysis(state,
+ tu,
+ callGraph,
+ state.OWNERSHIPALLOCDEPTH,
+ state.OWNERSHIPWRITEDOTS,
+ state.OWNERSHIPWRITEALL,
+ state.OWNERSHIPALIASFILE);
+ }
+
+ if (state.MLP) {
+ // gotta run this to have mlp turned on
+ assert state.OWNERSHIP;
+
+ CallGraph callGraph = new CallGraph(state);
+ OwnershipAnalysis oa = new OwnershipAnalysis(state,
+ tu,
+ callGraph,
+ state.OWNERSHIPALLOCDEPTH,
+ state.OWNERSHIPWRITEDOTS,
+ state.OWNERSHIPWRITEALL,
+ state.OWNERSHIPALIASFILE);
+ MLPAnalysis mlpa = new MLPAnalysis(state,
+ tu,
+ callGraph,
+ oa);
+ }
if (state.TAGSTATE) {
CallGraph callgraph=new CallGraph(state);
}
}
- if (state.FLATIRGRAPH) {
- FlatIRGraph firg = new FlatIRGraph(state,
- state.FLATIRGRAPHTASKS,
- state.FLATIRGRAPHUSERMETHODS,
- state.FLATIRGRAPHLIBMETHODS);
- }
-
- if (state.OWNERSHIP) {
- CallGraph callGraph = new CallGraph(state);
- OwnershipAnalysis oa = new OwnershipAnalysis(state,
- tu,
- callGraph,
- state.OWNERSHIPALLOCDEPTH,
- state.OWNERSHIPWRITEDOTS,
- state.OWNERSHIPWRITEALL,
- state.OWNERSHIPALIASFILE);
- }
-
-
System.out.println("Lines="+state.lines);
System.exit(0);
}
Analysis/OwnershipAnalysis/ChangeTupleSet.class \
Analysis/OwnershipAnalysis/Canonical.class \
Analysis/OwnershipAnalysis/MethodContext.class \
+Analysis/MLP/MLPAnalysis.class \
Util/GraphNode.class Util/Namer.class Util/Relation.class \
Interface/HTTPHeader.class Interface/HTTPResponse.class \
Interface/HTTPServices.class Interface/HashStrings.class \
Analysis/Loops/*.java \
Analysis/Locality/*.java \
Analysis/OwnershipAnalysis/*.java \
+ Analysis/MLP/*.java \
Analysis/Prefetch/*.java \
Analysis/Scheduling/*.java \
Analysis/TaskStateAnalysis/*.java \
javadoc:
mkdir javadoc
- javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Analysis.Locality Analysis.Prefetch Main Analysis.OwnershipAnalysis Analysis.Scheduling
+ javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Analysis.Locality Analysis.Prefetch Main Analysis.OwnershipAnalysis Analysis.MLP Analysis.Scheduling
clean:
- rm -f IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/Scheduling/*.class Analysis/Loops/*.class
+ rm -f IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/MLP/*.class Analysis/Scheduling/*.class Analysis/Loops/*.class
cleanclass:
- rm -f IR/*.class IR/Tree/*.class Main/*.class IR/Flat/*.class Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/Scheduling/*.class Analysis/Loops/*.class
+ rm -f IR/*.class IR/Tree/*.class Main/*.class IR/Flat/*.class Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/MLP/*.class Analysis/Scheduling/*.class Analysis/Loops/*.class
cleandoc:
rm -rf javadoc
BUILDSCRIPT=~/research/Robust/src/buildscript
BSFLAGS= -mlp -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt #-justanalyze -recover
+#BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt #-justanalyze -recover
all: $(PROGRAM).bin