8 import Analysis.TaskStateAnalysis.*;
14 this.classes=new SymbolTable();
15 this.tasks=new SymbolTable();
16 this.sclasses=new SymbolTable();
17 this.treemethodmap=new Hashtable();
18 this.flatmethodmap=new Hashtable();
19 this.parsetrees=new HashSet();
20 this.arraytypes=new HashSet();
21 this.arraytonumber=new Hashtable();
22 this.tagmap=new Hashtable();
23 this.selfloops=new HashSet();
24 this.excprefetch=new HashSet();
25 this.classpath=new Vector();
26 this.cd2locationOrderMap=new Hashtable();
30 public void addParseNode(ParseNode parsetree) {
31 parsetrees.add(parsetree);
34 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
35 this.analysisresults=analysisresults;
38 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
39 return analysisresults;
43 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
44 this.optionaltaskdescriptors=optionaltaskdescriptors;
47 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
48 return optionaltaskdescriptors;
52 /** Boolean flag which indicates whether compiler is compiling a task-based
54 public boolean POINTER=false;
55 public boolean COREPROF=false;
56 public boolean WEBINTERFACE=false;
57 public boolean MINIMIZE=false;
58 public boolean TASK=false;
59 public boolean FASTCHECK=false;
60 public boolean PREFETCH=false;
61 public boolean TASKSTATE=false;
62 public boolean TAGSTATE=false;
63 public boolean FLATIRGRAPH=false;
64 public boolean FLATIRGRAPHTASKS=false;
65 public boolean FLATIRGRAPHUSERMETHODS=false;
66 public boolean FLATIRGRAPHLIBMETHODS=false;
67 public boolean KEEP_RG_FOR_ALL_PROGRAM_POINTS=false;
68 public boolean OWNERSHIP=false;
69 public int OWNERSHIPALLOCDEPTH=3;
70 public boolean OWNERSHIPWRITEDOTS=false;
71 public boolean OWNERSHIPWRITEALL=false;
72 public String OWNERSHIPALIASFILE=null;
73 public boolean OWNERSHIPALIASTAB=false;
74 public int OWNERSHIPDEBUGCALLCOUNT=0;
75 public String OWNERSHIPDEBUGCALLEE=null;
76 public String OWNERSHIPDEBUGCALLER=null;
79 public boolean DISJOINT=false;
81 public int DISJOINTALLOCDEPTH=1;
82 public boolean DISJOINTRELEASEMODE=false;
83 public boolean DISJOINTDETERMINISM=false;
85 public boolean DISJOINTDVISITSTACK=true;
86 public boolean DISJOINTDVISITPQUE=false;
87 public boolean DISJOINTDVISITSTACKEESONTOP=false;
89 public boolean DISJOINTWRITEDOTS=false;
90 public boolean DISJOINTWRITEALL=false;
91 public boolean DISJOINTWRITEIHMS=false;
92 public boolean DISJOINTWRITEINITCONTEXTS=false;
94 public String DISJOINTALIASFILE=null;
95 public boolean DISJOINTALIASTAB=false;
97 public String DISJOINTDEBUGCALLEE=null;
98 public String DISJOINTDEBUGCALLER=null;
99 public int DISJOINTDEBUGCALLVISITTOSTART=0;
100 public int DISJOINTDEBUGCALLNUMVISITS=0;
101 public boolean DISJOINTDEBUGCALLSTOPAFTER=false;
103 public String DISJOINTSNAPSYMBOL=null;
104 public int DISJOINTSNAPVISITTOSTART=0;
105 public int DISJOINTSNAPNUMVISITS=0;
106 public boolean DISJOINTSNAPSTOPAFTER=false;
108 public boolean DISJOINTDEBUGSCHEDULING=false;
110 public boolean OOOJAVA=false;
111 public boolean OOODEBUG=false;
112 public boolean RCR=false;
113 public boolean RCR_DEBUG=false;
114 public boolean RCR_DEBUG_VERBOSE=false;
115 public boolean NOSTALLTR=false;
118 public boolean SSJAVA=false;
121 public boolean OPTIONAL=false;
122 public boolean NOLOOP=false;
123 public boolean ARRAYPAD=false;
124 public boolean THREAD=false;
125 public boolean CONSCHECK=false;
126 public boolean INSTRUCTIONFAILURE=false;
127 public int OOO_NUMCORES=0;
128 public int OOO_MAXSESEAGE=0;
129 public boolean METHODEFFECTS=false;
130 public static double TRUEPROB=0.8;
131 public static boolean PRINTFLAT=false;
134 public boolean DSM=false;
135 public boolean DSMTASK=false;
136 public static boolean ABORTREADERS=false;
138 // Recovery Stats Options
139 public boolean DSMRECOVERYSTATS=false;
141 public boolean EVENTMONITOR=false;
142 public static boolean STMARRAY=false;
143 public static boolean SINGLETM=false;
144 public static boolean READSET=false;
145 public boolean SANDBOX=false;
146 public boolean DCOPTS=false;
147 public boolean DELAYCOMP=false;
148 public boolean DUALVIEW=false;
149 public boolean HYBRID=false;
152 public boolean MULTICORE=false;
153 public boolean MULTICOREGC=false;
154 public boolean BAMBOOCOMPILETIME = false;
155 public boolean ARRAYBOUNDARYCHECK=true;
156 public boolean RAW=false;
157 public boolean SCHEDULING=false;
158 public boolean USEPROFILE=false;
159 public static boolean PRINTSCHEDULING=false;
160 public static boolean PRINTSCHEDULESIM=false;
161 public static boolean PRINTCRITICALPATH=false;
162 public int CORENUM = 1;
163 public int CORENUM4GC = 0;
164 public String profilename = null;
165 public String outputdir = "/scratch/";
167 public boolean MGC=false;
170 public String structfile;
172 public boolean INLINEATOMIC=false;
173 public int inlineatomicdepth;
174 public HashSet selfloops;
175 public HashSet excprefetch;
176 public Vector classpath;
177 public SymbolTable classes;
178 public SymbolTable tasks;
179 public SymbolTable sclasses; // table of classes with static field/blocks
180 public Set parsetrees;
181 public Hashtable treemethodmap;
182 public Hashtable flatmethodmap;
183 private HashSet arraytypes;
184 public Hashtable arraytonumber;
185 private int numclasses=1; // start from 1 instead of 0 for multicore gc
186 private int numtasks=0;
187 private int numstaticblocks=0;
188 private int arraycount=0;
189 public Hashtable cd2locationOrderMap;
190 public boolean OPTIMIZE=false;
192 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
193 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
195 private Hashtable tagmap;
196 private int numtags=0;
198 public void addArrayType(TypeDescriptor td) {
199 if (!arraytypes.contains(td)) {
201 arraytonumber.put(td,new Integer(arraycount++));
205 public Iterator getArrayIterator() {
206 return arraytypes.iterator();
209 public int getTagId(TagDescriptor tag) {
210 if (tagmap.containsKey(tag)) {
211 return ((Integer) tagmap.get(tag)).intValue();
213 tagmap.put(tag, new Integer(numtags));
218 public int getArrayNumber(TypeDescriptor td) {
219 if (arraytonumber.containsKey(td))
220 return ((Integer)arraytonumber.get(td)).intValue();
224 public int numArrays() {
225 return arraytypes.size();
228 public static TypeDescriptor getTypeDescriptor(int t) {
229 TypeDescriptor td=new TypeDescriptor(t);
233 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
234 TypeDescriptor td=new TypeDescriptor(n);
238 public void addClass(ClassDescriptor tdn) {
239 if (classes.contains(tdn.getSymbol()))
240 throw new Error("Class "+tdn.getSymbol()+" defined twice");
243 if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
248 public int numClasses() {
252 public int numStaticBlocks() {
253 return numstaticblocks;
256 public BlockNode getMethodBody(MethodDescriptor md) {
257 return (BlockNode)treemethodmap.get(md);
260 public BlockNode getMethodBody(TaskDescriptor td) {
261 return (BlockNode)treemethodmap.get(td);
264 public SymbolTable getClassSymbolTable() {
268 public SymbolTable getTaskSymbolTable() {
272 public SymbolTable getSClassSymbolTable() {
276 /** Returns Flat IR representation of MethodDescriptor md. */
278 public FlatMethod getMethodFlat(MethodDescriptor md) {
279 return (FlatMethod)flatmethodmap.get(md);
282 /** Returns Flat IR representation of TaskDescriptor td. */
284 public FlatMethod getMethodFlat(TaskDescriptor td) {
285 return (FlatMethod)flatmethodmap.get(td);
288 // The descriptor is either a method or task desc
289 // and should call one of the above methods
290 public FlatMethod getMethodFlat(Descriptor d) {
292 if( d instanceof MethodDescriptor ) {
293 fm = getMethodFlat( (MethodDescriptor) d);
295 assert d instanceof TaskDescriptor;
296 fm = getMethodFlat( (TaskDescriptor) d);
301 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
302 treemethodmap.put(md,bn);
305 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
306 treemethodmap.put(td,bn);
309 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
310 flatmethodmap.put(md,bn);
313 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
314 flatmethodmap.put(td,bn);
317 public void addTask(TaskDescriptor td) {
318 if (tasks.contains(td.getSymbol()))
319 throw new Error("Task "+td.getSymbol()+" defined twice");
324 public void addLocationOrder(ClassDescriptor cd, Lattice order){
325 cd2locationOrderMap.put(cd,order);
328 public Hashtable getCd2LocationOrder(){
329 return cd2locationOrderMap;