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;
110 public boolean OPTIONAL=false;
111 public boolean NOLOOP=false;
112 public boolean ARRAYPAD=false;
113 public boolean THREAD=false;
114 public boolean CONSCHECK=false;
115 public boolean INSTRUCTIONFAILURE=false;
116 public boolean MLP=false;
117 public boolean MLPDEBUG=false;
118 public int MLP_NUMCORES=0;
119 public int MLP_MAXSESEAGE=0;
120 public boolean METHODEFFECTS=false;
121 public static double TRUEPROB=0.8;
122 public static boolean PRINTFLAT=false;
125 public boolean DSM=false;
126 public boolean DSMTASK=false;
127 public static boolean ABORTREADERS=false;
129 // Recovery Stats Options
130 public boolean DSMRECOVERYSTATS=false;
132 public boolean EVENTMONITOR=false;
133 public static boolean STMARRAY=false;
134 public static boolean SINGLETM=false;
135 public static boolean READSET=false;
136 public boolean SANDBOX=false;
137 public boolean DCOPTS=false;
138 public boolean DELAYCOMP=false;
139 public boolean DUALVIEW=false;
140 public boolean HYBRID=false;
143 public boolean MULTICORE=false;
144 public boolean MULTICOREGC=false;
145 public boolean BAMBOOCOMPILETIME = false;
146 public boolean ARRAYBOUNDARYCHECK=true;
147 public boolean RAW=false;
148 public boolean SCHEDULING=false;
149 public boolean USEPROFILE=false;
150 public static boolean PRINTSCHEDULING=false;
151 public static boolean PRINTSCHEDULESIM=false;
152 public static boolean PRINTCRITICALPATH=false;
153 public int CORENUM = 1;
154 public int CORENUM4GC = 0;
155 public String profilename = null;
156 public String outputdir = "/scratch/";
158 public boolean MGC=false;
161 public String structfile;
163 public boolean INLINEATOMIC=false;
164 public int inlineatomicdepth;
165 public HashSet selfloops;
166 public HashSet excprefetch;
167 public Vector classpath;
168 public SymbolTable classes;
169 public SymbolTable tasks;
170 public SymbolTable sclasses; // table of classes with static field/blocks
171 public Set parsetrees;
172 public Hashtable treemethodmap;
173 public Hashtable flatmethodmap;
174 private HashSet arraytypes;
175 public Hashtable arraytonumber;
176 private int numclasses=1; // start from 1 instead of 0 for multicore gc
177 private int numtasks=0;
178 private int numstaticblocks=0;
179 private int arraycount=0;
180 public boolean OPTIMIZE=false;
182 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
183 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
185 private Hashtable tagmap;
186 private int numtags=0;
188 public void addArrayType(TypeDescriptor td) {
189 if (!arraytypes.contains(td)) {
191 arraytonumber.put(td,new Integer(arraycount++));
195 public Iterator getArrayIterator() {
196 return arraytypes.iterator();
199 public int getTagId(TagDescriptor tag) {
200 if (tagmap.containsKey(tag)) {
201 return ((Integer) tagmap.get(tag)).intValue();
203 tagmap.put(tag, new Integer(numtags));
208 public int getArrayNumber(TypeDescriptor td) {
209 if (arraytonumber.containsKey(td))
210 return ((Integer)arraytonumber.get(td)).intValue();
214 public int numArrays() {
215 return arraytypes.size();
218 public static TypeDescriptor getTypeDescriptor(int t) {
219 TypeDescriptor td=new TypeDescriptor(t);
223 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
224 TypeDescriptor td=new TypeDescriptor(n);
228 public void addClass(ClassDescriptor tdn) {
229 if (classes.contains(tdn.getSymbol()))
230 throw new Error("Class "+tdn.getSymbol()+" defined twice");
232 if(!tdn.isInterface()) {
235 if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
240 public int numClasses() {
244 public int numStaticBlocks() {
245 return numstaticblocks;
248 public BlockNode getMethodBody(MethodDescriptor md) {
249 return (BlockNode)treemethodmap.get(md);
252 public BlockNode getMethodBody(TaskDescriptor td) {
253 return (BlockNode)treemethodmap.get(td);
256 public SymbolTable getClassSymbolTable() {
260 public SymbolTable getTaskSymbolTable() {
264 public SymbolTable getSClassSymbolTable() {
268 /** Returns Flat IR representation of MethodDescriptor md. */
270 public FlatMethod getMethodFlat(MethodDescriptor md) {
271 return (FlatMethod)flatmethodmap.get(md);
274 /** Returns Flat IR representation of TaskDescriptor td. */
276 public FlatMethod getMethodFlat(TaskDescriptor td) {
277 return (FlatMethod)flatmethodmap.get(td);
280 // The descriptor is either a method or task desc
281 // and should call one of the above methods
282 public FlatMethod getMethodFlat(Descriptor d) {
284 if( d instanceof MethodDescriptor ) {
285 fm = getMethodFlat( (MethodDescriptor) d);
287 assert d instanceof TaskDescriptor;
288 fm = getMethodFlat( (TaskDescriptor) d);
293 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
294 treemethodmap.put(md,bn);
297 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
298 treemethodmap.put(td,bn);
301 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
302 flatmethodmap.put(md,bn);
305 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
306 flatmethodmap.put(td,bn);
309 public void addTask(TaskDescriptor td) {
310 if (tasks.contains(td.getSymbol()))
311 throw new Error("Task "+td.getSymbol()+" defined twice");