6 import Analysis.TaskStateAnalysis.*;
12 this.classes=new SymbolTable();
13 this.tasks=new SymbolTable();
14 this.treemethodmap=new Hashtable();
15 this.flatmethodmap=new Hashtable();
16 this.parsetrees=new HashSet();
17 this.arraytypes=new HashSet();
18 this.arraytonumber=new Hashtable();
19 this.tagmap=new Hashtable();
20 this.selfloops=new HashSet();
21 this.excprefetch=new HashSet();
22 this.classpath=new Vector();
26 public void addParseNode(ParseNode parsetree) {
27 parsetrees.add(parsetree);
30 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
31 this.analysisresults=analysisresults;
34 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
35 return analysisresults;
39 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
40 this.optionaltaskdescriptors=optionaltaskdescriptors;
43 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
44 return optionaltaskdescriptors;
48 /** Boolean flag which indicates whether compiler is compiling a task-based
50 public boolean WEBINTERFACE=false;
51 public boolean MINIMIZE=false;
52 public boolean TASK=false;
53 public boolean FASTCHECK=false;
54 public boolean DSM=false;
55 public boolean PREFETCH=false;
56 public boolean TASKSTATE=false;
57 public boolean TAGSTATE=false;
58 public boolean FLATIRGRAPH=false;
59 public boolean FLATIRGRAPHTASKS=false;
60 public boolean FLATIRGRAPHUSERMETHODS=false;
61 public boolean FLATIRGRAPHLIBMETHODS=false;
62 public boolean MULTICORE=false;
63 public boolean MULTICOREGC=false;
64 public boolean OWNERSHIP=false;
65 public int OWNERSHIPALLOCDEPTH=3;
66 public boolean OWNERSHIPWRITEDOTS=false;
67 public boolean OWNERSHIPWRITEALL=false;
68 public String OWNERSHIPALIASFILE=null;
69 public boolean OPTIONAL=false;
70 public boolean ARRAYBOUNDARYCHECK=true;
71 public boolean RAW=false;
72 public boolean ARRAYPAD=false;
73 public boolean SCHEDULING=false;
74 public boolean USEPROFILE=false;
75 public String profilename = null;
76 public boolean THREAD=false;
77 public boolean CONSCHECK=false;
78 public boolean INSTRUCTIONFAILURE=false;
79 public boolean MLP=false;
80 public boolean MLPDEBUG=false;
81 public int MLP_NUMCORES=0;
82 public int MLP_MAXSESEAGE=0;
83 public static double TRUEPROB=0.8;
84 public static boolean PRINTFLAT=false;
85 public static boolean PRINTSCHEDULING=false;
86 public static boolean PRINTSCHEDULESIM=false;
87 public static boolean PRINTCRITICALPATH=false;
88 public static boolean ABORTREADERS=false;
89 public static boolean SINGLETM=false;
90 public static boolean READSET=false;
91 public int CORENUM = 1;
92 public String structfile;
94 public String outputdir = "/scratch/";
95 public boolean INLINEATOMIC=false;
96 public int inlineatomicdepth;
97 public HashSet selfloops;
98 public HashSet excprefetch;
99 public Vector classpath;
100 public SymbolTable classes;
101 public SymbolTable tasks;
102 public Set parsetrees;
103 public Hashtable treemethodmap;
104 public Hashtable flatmethodmap;
105 private HashSet arraytypes;
106 public Hashtable arraytonumber;
107 private int numclasses=0;
108 private int numtasks=0;
109 private int arraycount=0;
110 public boolean OPTIMIZE=false;
111 public boolean DCOPTS=false;
112 public boolean DELAYCOMP=false;
115 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
116 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
118 private Hashtable tagmap;
119 private int numtags=0;
121 public void addArrayType(TypeDescriptor td) {
122 if (!arraytypes.contains(td)) {
124 arraytonumber.put(td,new Integer(arraycount++));
128 public Iterator getArrayIterator() {
129 return arraytypes.iterator();
132 public int getTagId(TagDescriptor tag) {
133 if (tagmap.containsKey(tag)) {
134 return ((Integer) tagmap.get(tag)).intValue();
136 tagmap.put(tag, new Integer(numtags));
141 public int getArrayNumber(TypeDescriptor td) {
142 if (arraytonumber.containsKey(td))
143 return ((Integer)arraytonumber.get(td)).intValue();
147 public int numArrays() {
148 return arraytypes.size();
151 public static TypeDescriptor getTypeDescriptor(int t) {
152 TypeDescriptor td=new TypeDescriptor(t);
156 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
157 TypeDescriptor td=new TypeDescriptor(n);
161 public void addClass(ClassDescriptor tdn) {
162 if (classes.contains(tdn.getSymbol()))
163 throw new Error("Class "+tdn.getSymbol()+" defined twice");
168 public int numClasses() {
172 public BlockNode getMethodBody(MethodDescriptor md) {
173 return (BlockNode)treemethodmap.get(md);
176 public BlockNode getMethodBody(TaskDescriptor td) {
177 return (BlockNode)treemethodmap.get(td);
180 public SymbolTable getClassSymbolTable() {
184 public SymbolTable getTaskSymbolTable() {
188 /** Returns Flat IR representation of MethodDescriptor md. */
190 public FlatMethod getMethodFlat(MethodDescriptor md) {
191 return (FlatMethod)flatmethodmap.get(md);
194 /** Returns Flat IR representation of TaskDescriptor td. */
196 public FlatMethod getMethodFlat(TaskDescriptor td) {
197 return (FlatMethod)flatmethodmap.get(td);
200 // The descriptor is either a method or task desc
201 // and should call one of the above methods
202 public FlatMethod getMethodFlat(Descriptor d) {
204 if( d instanceof MethodDescriptor ) {
205 fm = getMethodFlat( (MethodDescriptor) d);
207 assert d instanceof TaskDescriptor;
208 fm = getMethodFlat( (TaskDescriptor) d);
213 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
214 treemethodmap.put(md,bn);
217 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
218 treemethodmap.put(td,bn);
221 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
222 flatmethodmap.put(md,bn);
225 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
226 flatmethodmap.put(td,bn);
229 public void addTask(TaskDescriptor td) {
230 if (tasks.contains(td.getSymbol()))
231 throw new Error("Task "+td.getSymbol()+" defined twice");