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 PREFETCH=false;
55 public boolean TASKSTATE=false;
56 public boolean TAGSTATE=false;
57 public boolean FLATIRGRAPH=false;
58 public boolean FLATIRGRAPHTASKS=false;
59 public boolean FLATIRGRAPHUSERMETHODS=false;
60 public boolean FLATIRGRAPHLIBMETHODS=false;
61 public boolean OWNERSHIP=false;
62 public int OWNERSHIPALLOCDEPTH=3;
63 public boolean OWNERSHIPWRITEDOTS=false;
64 public boolean OWNERSHIPWRITEALL=false;
65 public String OWNERSHIPALIASFILE=null;
66 public boolean OWNERSHIPALIASTAB=false;
67 public int OWNERSHIPDEBUGCALLCOUNT=0;
68 public String OWNERSHIPDEBUGCALLEE=null;
69 public String OWNERSHIPDEBUGCALLER=null;
71 public boolean DISJOINT=false;
72 public boolean DISJOINTRELEASEMODE=false;
73 public int DISJOINTALLOCDEPTH=3;
74 public boolean DISJOINTWRITEDOTS=false;
75 public boolean DISJOINTWRITEALL=false;
76 public boolean DISJOINTWRITEIHMS=false;
77 public String DISJOINTALIASFILE=null;
78 public boolean DISJOINTALIASTAB=false;
79 public int DISJOINTDEBUGCALLCOUNT=0;
80 public String DISJOINTDEBUGCALLEE=null;
81 public String DISJOINTDEBUGCALLER=null;
82 public String DISJOINTSNAPSYMBOL=null;
83 public int DISJOINTSNAPVISITTOSTART=0;
84 public int DISJOINTSNAPNUMVISITS=0;
85 public boolean DISJOINTSNAPSTOPAFTER=false;
86 public boolean DISJOINTDVISITSTACK=true;
87 public boolean DISJOINTDVISITPQUE=false;
88 public boolean DISJOINTDVISITSTACKEESONTOP=false;
90 public boolean OPTIONAL=false;
91 public boolean ARRAYPAD=false;
92 public boolean THREAD=false;
93 public boolean CONSCHECK=false;
94 public boolean INSTRUCTIONFAILURE=false;
95 public boolean MLP=false;
96 public boolean MLPDEBUG=false;
97 public int MLP_NUMCORES=0;
98 public int MLP_MAXSESEAGE=0;
99 public boolean METHODEFFECTS=false;
100 public static double TRUEPROB=0.8;
101 public static boolean PRINTFLAT=false;
104 public boolean DSM=false;
105 public boolean DSMTASK=false;
106 public static boolean ABORTREADERS=false;
108 // Recovery Stats Options
109 public boolean DSMRECOVERYSTATS=false;
111 public boolean EVENTMONITOR=false;
112 public static boolean STMARRAY=false;
113 public static boolean SINGLETM=false;
114 public static boolean READSET=false;
115 public boolean SANDBOX=false;
116 public boolean DCOPTS=false;
117 public boolean DELAYCOMP=false;
118 public boolean DUALVIEW=false;
119 public boolean HYBRID=false;
122 public boolean MULTICORE=false;
123 public boolean MULTICOREGC=false;
124 public boolean BAMBOOCOMPILETIME = false;
125 public boolean ARRAYBOUNDARYCHECK=true;
126 public boolean RAW=false;
127 public boolean SCHEDULING=false;
128 public boolean USEPROFILE=false;
129 public static boolean PRINTSCHEDULING=false;
130 public static boolean PRINTSCHEDULESIM=false;
131 public static boolean PRINTCRITICALPATH=false;
132 public int CORENUM = 1;
133 public int CORENUM4GC = 0;
134 public String profilename = null;
135 public String outputdir = "/scratch/";
137 public String structfile;
139 public boolean INLINEATOMIC=false;
140 public int inlineatomicdepth;
141 public HashSet selfloops;
142 public HashSet excprefetch;
143 public Vector classpath;
144 public SymbolTable classes;
145 public SymbolTable tasks;
146 public Set parsetrees;
147 public Hashtable treemethodmap;
148 public Hashtable flatmethodmap;
149 private HashSet arraytypes;
150 public Hashtable arraytonumber;
151 private int numclasses=1; // start from 1 instead of 0 for multicore gc
152 private int numtasks=0;
153 private int arraycount=0;
154 public boolean OPTIMIZE=false;
156 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
157 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
159 private Hashtable tagmap;
160 private int numtags=0;
162 public void addArrayType(TypeDescriptor td) {
163 if (!arraytypes.contains(td)) {
165 arraytonumber.put(td,new Integer(arraycount++));
169 public Iterator getArrayIterator() {
170 return arraytypes.iterator();
173 public int getTagId(TagDescriptor tag) {
174 if (tagmap.containsKey(tag)) {
175 return ((Integer) tagmap.get(tag)).intValue();
177 tagmap.put(tag, new Integer(numtags));
182 public int getArrayNumber(TypeDescriptor td) {
183 if (arraytonumber.containsKey(td))
184 return ((Integer)arraytonumber.get(td)).intValue();
188 public int numArrays() {
189 return arraytypes.size();
192 public static TypeDescriptor getTypeDescriptor(int t) {
193 TypeDescriptor td=new TypeDescriptor(t);
197 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
198 TypeDescriptor td=new TypeDescriptor(n);
202 public void addClass(ClassDescriptor tdn) {
203 if (classes.contains(tdn.getSymbol()))
204 throw new Error("Class "+tdn.getSymbol()+" defined twice");
209 public int numClasses() {
213 public BlockNode getMethodBody(MethodDescriptor md) {
214 return (BlockNode)treemethodmap.get(md);
217 public BlockNode getMethodBody(TaskDescriptor td) {
218 return (BlockNode)treemethodmap.get(td);
221 public SymbolTable getClassSymbolTable() {
225 public SymbolTable getTaskSymbolTable() {
229 /** Returns Flat IR representation of MethodDescriptor md. */
231 public FlatMethod getMethodFlat(MethodDescriptor md) {
232 return (FlatMethod)flatmethodmap.get(md);
235 /** Returns Flat IR representation of TaskDescriptor td. */
237 public FlatMethod getMethodFlat(TaskDescriptor td) {
238 return (FlatMethod)flatmethodmap.get(td);
241 // The descriptor is either a method or task desc
242 // and should call one of the above methods
243 public FlatMethod getMethodFlat(Descriptor d) {
245 if( d instanceof MethodDescriptor ) {
246 fm = getMethodFlat( (MethodDescriptor) d);
248 assert d instanceof TaskDescriptor;
249 fm = getMethodFlat( (TaskDescriptor) d);
254 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
255 treemethodmap.put(md,bn);
258 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
259 treemethodmap.put(td,bn);
262 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
263 flatmethodmap.put(md,bn);
266 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
267 flatmethodmap.put(td,bn);
270 public void addTask(TaskDescriptor td) {
271 if (tasks.contains(td.getSymbol()))
272 throw new Error("Task "+td.getSymbol()+" defined twice");