6 import Analysis.TaskStateAnalysis.*;
12 this.classes=new SymbolTable();
13 this.tasks=new SymbolTable();
14 this.sclasses=new SymbolTable();
15 this.treemethodmap=new Hashtable();
16 this.flatmethodmap=new Hashtable();
17 this.parsetrees=new HashSet();
18 this.arraytypes=new HashSet();
19 this.arraytonumber=new Hashtable();
20 this.tagmap=new Hashtable();
21 this.selfloops=new HashSet();
22 this.excprefetch=new HashSet();
23 this.classpath=new Vector();
27 public void addParseNode(ParseNode parsetree) {
28 parsetrees.add(parsetree);
31 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
32 this.analysisresults=analysisresults;
35 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
36 return analysisresults;
40 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
41 this.optionaltaskdescriptors=optionaltaskdescriptors;
44 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
45 return optionaltaskdescriptors;
49 /** Boolean flag which indicates whether compiler is compiling a task-based
51 public boolean COREPROF=false;
52 public boolean WEBINTERFACE=false;
53 public boolean MINIMIZE=false;
54 public boolean TASK=false;
55 public boolean FASTCHECK=false;
56 public boolean PREFETCH=false;
57 public boolean TASKSTATE=false;
58 public boolean TAGSTATE=false;
59 public boolean FLATIRGRAPH=false;
60 public boolean FLATIRGRAPHTASKS=false;
61 public boolean FLATIRGRAPHUSERMETHODS=false;
62 public boolean FLATIRGRAPHLIBMETHODS=false;
63 public boolean OWNERSHIP=false;
64 public int OWNERSHIPALLOCDEPTH=3;
65 public boolean OWNERSHIPWRITEDOTS=false;
66 public boolean OWNERSHIPWRITEALL=false;
67 public String OWNERSHIPALIASFILE=null;
68 public boolean OWNERSHIPALIASTAB=false;
69 public int OWNERSHIPDEBUGCALLCOUNT=0;
70 public String OWNERSHIPDEBUGCALLEE=null;
71 public String OWNERSHIPDEBUGCALLER=null;
74 public boolean DISJOINT=false;
76 public int DISJOINTALLOCDEPTH=1;
77 public boolean DISJOINTRELEASEMODE=false;
78 public boolean DISJOINTDETERMINISM=false;
80 public boolean DISJOINTDVISITSTACK=true;
81 public boolean DISJOINTDVISITPQUE=false;
82 public boolean DISJOINTDVISITSTACKEESONTOP=false;
84 public boolean DISJOINTWRITEDOTS=false;
85 public boolean DISJOINTWRITEALL=false;
86 public boolean DISJOINTWRITEIHMS=false;
87 public boolean DISJOINTWRITEINITCONTEXTS=false;
89 public String DISJOINTALIASFILE=null;
90 public boolean DISJOINTALIASTAB=false;
92 public String DISJOINTDEBUGCALLEE=null;
93 public String DISJOINTDEBUGCALLER=null;
94 public int DISJOINTDEBUGCALLVISITTOSTART=0;
95 public int DISJOINTDEBUGCALLNUMVISITS=0;
96 public boolean DISJOINTDEBUGCALLSTOPAFTER=false;
98 public String DISJOINTSNAPSYMBOL=null;
99 public int DISJOINTSNAPVISITTOSTART=0;
100 public int DISJOINTSNAPNUMVISITS=0;
101 public boolean DISJOINTSNAPSTOPAFTER=false;
103 public boolean DISJOINTDEBUGSCHEDULING=false;
105 public boolean OOOJAVA=false;
106 public boolean OOODEBUG=false;
107 public boolean RCR=false;
108 public boolean NOSTALLTR=false;
111 public boolean OPTIONAL=false;
112 public boolean NOLOOP=false;
113 public boolean ARRAYPAD=false;
114 public boolean THREAD=false;
115 public boolean CONSCHECK=false;
116 public boolean INSTRUCTIONFAILURE=false;
117 public boolean MLP=false;
118 public boolean MLPDEBUG=false;
119 public int MLP_NUMCORES=0;
120 public int MLP_MAXSESEAGE=0;
121 public boolean METHODEFFECTS=false;
122 public static double TRUEPROB=0.8;
123 public static boolean PRINTFLAT=false;
126 public boolean DSM=false;
127 public boolean DSMTASK=false;
128 public static boolean ABORTREADERS=false;
130 // Recovery Stats Options
131 public boolean DSMRECOVERYSTATS=false;
133 public boolean EVENTMONITOR=false;
134 public static boolean STMARRAY=false;
135 public static boolean SINGLETM=false;
136 public static boolean READSET=false;
137 public boolean SANDBOX=false;
138 public boolean DCOPTS=false;
139 public boolean DELAYCOMP=false;
140 public boolean DUALVIEW=false;
141 public boolean HYBRID=false;
144 public boolean MULTICORE=false;
145 public boolean MULTICOREGC=false;
146 public boolean BAMBOOCOMPILETIME = false;
147 public boolean ARRAYBOUNDARYCHECK=true;
148 public boolean RAW=false;
149 public boolean SCHEDULING=false;
150 public boolean USEPROFILE=false;
151 public static boolean PRINTSCHEDULING=false;
152 public static boolean PRINTSCHEDULESIM=false;
153 public static boolean PRINTCRITICALPATH=false;
154 public int CORENUM = 1;
155 public int CORENUM4GC = 0;
156 public String profilename = null;
157 public String outputdir = "/scratch/";
159 public boolean MGC=false;
162 public String structfile;
164 public boolean INLINEATOMIC=false;
165 public int inlineatomicdepth;
166 public HashSet selfloops;
167 public HashSet excprefetch;
168 public Vector classpath;
169 public SymbolTable classes;
170 public SymbolTable tasks;
171 public SymbolTable sclasses; // table of classes with static field/blocks
172 public Set parsetrees;
173 public Hashtable treemethodmap;
174 public Hashtable flatmethodmap;
175 private HashSet arraytypes;
176 public Hashtable arraytonumber;
177 private int numclasses=1; // start from 1 instead of 0 for multicore gc
178 private int numtasks=0;
179 private int numstaticblocks=0;
180 private int arraycount=0;
181 public boolean OPTIMIZE=false;
183 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
184 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
186 private Hashtable tagmap;
187 private int numtags=0;
189 public void addArrayType(TypeDescriptor td) {
190 if (!arraytypes.contains(td)) {
192 arraytonumber.put(td,new Integer(arraycount++));
196 public Iterator getArrayIterator() {
197 return arraytypes.iterator();
200 public int getTagId(TagDescriptor tag) {
201 if (tagmap.containsKey(tag)) {
202 return ((Integer) tagmap.get(tag)).intValue();
204 tagmap.put(tag, new Integer(numtags));
209 public int getArrayNumber(TypeDescriptor td) {
210 if (arraytonumber.containsKey(td))
211 return ((Integer)arraytonumber.get(td)).intValue();
215 public int numArrays() {
216 return arraytypes.size();
219 public static TypeDescriptor getTypeDescriptor(int t) {
220 TypeDescriptor td=new TypeDescriptor(t);
224 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
225 TypeDescriptor td=new TypeDescriptor(n);
229 public void addClass(ClassDescriptor tdn) {
230 if (classes.contains(tdn.getSymbol()))
231 throw new Error("Class "+tdn.getSymbol()+" defined twice");
233 if(!tdn.isInterface()) {
236 if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
241 public int numClasses() {
245 public int numStaticBlocks() {
246 return numstaticblocks;
249 public BlockNode getMethodBody(MethodDescriptor md) {
250 return (BlockNode)treemethodmap.get(md);
253 public BlockNode getMethodBody(TaskDescriptor td) {
254 return (BlockNode)treemethodmap.get(td);
257 public SymbolTable getClassSymbolTable() {
261 public SymbolTable getTaskSymbolTable() {
265 public SymbolTable getSClassSymbolTable() {
269 /** Returns Flat IR representation of MethodDescriptor md. */
271 public FlatMethod getMethodFlat(MethodDescriptor md) {
272 return (FlatMethod)flatmethodmap.get(md);
275 /** Returns Flat IR representation of TaskDescriptor td. */
277 public FlatMethod getMethodFlat(TaskDescriptor td) {
278 return (FlatMethod)flatmethodmap.get(td);
281 // The descriptor is either a method or task desc
282 // and should call one of the above methods
283 public FlatMethod getMethodFlat(Descriptor d) {
285 if( d instanceof MethodDescriptor ) {
286 fm = getMethodFlat( (MethodDescriptor) d);
288 assert d instanceof TaskDescriptor;
289 fm = getMethodFlat( (TaskDescriptor) d);
294 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
295 treemethodmap.put(md,bn);
298 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
299 treemethodmap.put(td,bn);
302 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
303 flatmethodmap.put(md,bn);
306 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
307 flatmethodmap.put(td,bn);
310 public void addTask(TaskDescriptor td) {
311 if (tasks.contains(td.getSymbol()))
312 throw new Error("Task "+td.getSymbol()+" defined twice");