8 import Analysis.TaskStateAnalysis.*;
9 import Analysis.CallGraph.CallGraph;
12 public static long startTime;
13 public static long lastTime;
14 public static void logEvent(String event) {
15 long currTime=System.nanoTime();
16 double delta=((double)(currTime-startTime))/1000000000;
17 double deltaLast=((double)(currTime-lastTime))/1000000000;
18 System.out.println("TLOG: Time of "+event+"="+delta);
19 System.out.println("TLOG: Elapsed time "+event+"="+deltaLast);
23 public static void initTimer() {
24 startTime=System.nanoTime();
30 this.classes=new SymbolTable();
31 this.tasks=new SymbolTable();
32 this.sclasses=new SymbolTable();
33 this.treemethodmap=new Hashtable();
34 this.flatmethodmap=new Hashtable();
35 this.parsetrees=new HashSet();
36 this.arraytypes=new HashSet();
37 this.arraytonumber=new Hashtable();
38 this.tagmap=new Hashtable();
39 this.selfloops=new HashSet();
40 this.excprefetch=new HashSet();
41 this.classpath=new Vector();
42 this.cd2locationOrderMap=new Hashtable();
43 this.cd2locationPropertyMap=new Hashtable();
47 public void addParseNode(ParseNode parsetree) {
48 parsetrees.add(parsetree);
51 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
52 this.analysisresults=analysisresults;
55 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
56 return analysisresults;
60 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
61 this.optionaltaskdescriptors=optionaltaskdescriptors;
64 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
65 return optionaltaskdescriptors;
69 /** Boolean flag which indicates whether compiler is compiling a task-based
71 public boolean JNI=false;
72 public boolean POINTER=false;
73 public boolean COREPROF=false;
74 public boolean WEBINTERFACE=false;
75 public boolean MINIMIZE=false;
76 public boolean TASK=false;
77 public boolean FASTCHECK=false;
78 public boolean PREFETCH=false;
79 public boolean TASKSTATE=false;
80 public boolean TAGSTATE=false;
81 public boolean FLATIRGRAPH=false;
82 public boolean FLATIRGRAPHTASKS=false;
83 public boolean FLATIRGRAPHUSERMETHODS=false;
84 public boolean FLATIRGRAPHLIBMETHODS=false;
85 public boolean KEEP_RG_FOR_ALL_PROGRAM_POINTS=false;
86 public boolean OWNERSHIP=false;
87 public int OWNERSHIPALLOCDEPTH=3;
88 public boolean OWNERSHIPWRITEDOTS=false;
89 public boolean OWNERSHIPWRITEALL=false;
90 public String OWNERSHIPALIASFILE=null;
91 public boolean OWNERSHIPALIASTAB=false;
92 public int OWNERSHIPDEBUGCALLCOUNT=0;
93 public String OWNERSHIPDEBUGCALLEE=null;
94 public String OWNERSHIPDEBUGCALLER=null;
97 public boolean DISJOINT=false;
99 public int DISJOINTALLOCDEPTH=1;
100 public boolean DISJOINTRELEASEMODE=false;
101 public boolean DISJOINTDETERMINISM=false;
103 public boolean DISJOINTDVISITSTACK=true;
104 public boolean DISJOINTDVISITPQUE=false;
105 public boolean DISJOINTDVISITSTACKEESONTOP=false;
107 public boolean DISJOINTWRITEDOTS=false;
108 public boolean DISJOINTWRITEALL=false;
109 public boolean DISJOINTWRITEIHMS=false;
110 public boolean DISJOINTWRITEINITCONTEXTS=false;
112 public String DISJOINTALIASFILE=null;
113 public boolean DISJOINTALIASTAB=false;
115 public String DISJOINTDEBUGCALLEE=null;
116 public String DISJOINTDEBUGCALLER=null;
117 public int DISJOINTDEBUGCALLVISITTOSTART=0;
118 public int DISJOINTDEBUGCALLNUMVISITS=0;
119 public boolean DISJOINTDEBUGCALLSTOPAFTER=false;
121 public String DISJOINTSNAPSYMBOL=null;
122 public int DISJOINTSNAPVISITTOSTART=0;
123 public int DISJOINTSNAPNUMVISITS=0;
124 public boolean DISJOINTSNAPSTOPAFTER=false;
126 public boolean DISJOINTDEBUGSCHEDULING=false;
128 public boolean OOOJAVA=false;
129 public boolean OOODEBUG=false;
130 public boolean RCR=false;
131 public boolean RCR_DEBUG=false;
132 public boolean RCR_DEBUG_VERBOSE=false;
133 public boolean NOSTALLTR=false;
136 public boolean SSJAVA=false;
139 public boolean OPTIONAL=false;
140 public boolean NOLOOP=false;
141 public boolean ARRAYPAD=false;
142 public boolean THREAD=false;
143 public boolean CONSCHECK=false;
144 public boolean INSTRUCTIONFAILURE=false;
145 public int OOO_NUMCORES=0;
146 public int OOO_MAXSESEAGE=0;
147 public boolean METHODEFFECTS=false;
148 public static double TRUEPROB=0.8;
149 public static boolean PRINTFLAT=false;
152 public boolean DSM=false;
153 public boolean DSMTASK=false;
154 public static boolean ABORTREADERS=false;
156 // Recovery Stats Options
157 public boolean DSMRECOVERYSTATS=false;
159 public boolean EVENTMONITOR=false;
160 public static boolean STMARRAY=false;
161 public static boolean SINGLETM=false;
162 public static boolean READSET=false;
163 public boolean SANDBOX=false;
164 public boolean DCOPTS=false;
165 public boolean DELAYCOMP=false;
166 public boolean DUALVIEW=false;
167 public boolean HYBRID=false;
170 public boolean MULTICORE=false;
171 public boolean MULTICOREGC=false;
172 public boolean BAMBOOCOMPILETIME = false;
173 public boolean ARRAYBOUNDARYCHECK=true;
174 public boolean RAW=false;
175 public boolean SCHEDULING=false;
176 public boolean USEPROFILE=false;
177 public static boolean PRINTSCHEDULING=false;
178 public static boolean PRINTSCHEDULESIM=false;
179 public static boolean PRINTCRITICALPATH=false;
180 public int CORENUM = 1;
181 public int CORENUM4GC = 0;
182 public String profilename = null;
183 public String outputdir = "/scratch/";
185 public boolean MGC=false;
186 public boolean OBJECTLOCKDEBUG=false;
189 public String structfile;
191 public boolean INLINEATOMIC=false;
192 public int inlineatomicdepth;
193 public HashSet selfloops;
194 public HashSet excprefetch;
195 public Vector classpath;
196 public SymbolTable classes;
197 public SymbolTable tasks;
198 public SymbolTable sclasses; // table of classes with static field/blocks
199 public Set parsetrees;
200 public Hashtable treemethodmap;
201 public Hashtable flatmethodmap;
202 SymbolTable methods2gen;
203 private HashSet arraytypes;
204 public Hashtable arraytonumber;
205 private int numclasses=1; // start from 1 instead of 0 for multicore gc
206 private int numinterfaces = 0;
207 private int numtasks=0;
208 private int numstaticblocks=0;
209 private int arraycount=0;
210 public Hashtable cd2locationOrderMap;
211 public Hashtable cd2locationPropertyMap;
212 public boolean OPTIMIZE=false;
213 public boolean LINENUM=false;
215 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
216 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
218 private Hashtable tagmap;
219 private int numtags=0;
221 public void addArrayType(TypeDescriptor td) {
222 if (!arraytypes.contains(td)) {
224 arraytonumber.put(td,new Integer(arraycount++));
228 public Iterator getArrayIterator() {
229 return arraytypes.iterator();
232 public int getTagId(TagDescriptor tag) {
233 if (tagmap.containsKey(tag)) {
234 return ((Integer) tagmap.get(tag)).intValue();
236 tagmap.put(tag, new Integer(numtags));
241 public int getArrayNumber(TypeDescriptor td) {
242 if (arraytonumber.containsKey(td))
243 return ((Integer)arraytonumber.get(td)).intValue();
247 public int numArrays() {
248 return arraytypes.size();
251 public static TypeDescriptor getTypeDescriptor(int t) {
252 TypeDescriptor td=new TypeDescriptor(t);
256 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
257 TypeDescriptor td=new TypeDescriptor(n);
261 public static TypeDescriptor getTypeDescriptor(String n) {
262 TypeDescriptor td=new TypeDescriptor(n);
266 public void addClass(ClassDescriptor tdn) {
267 if (classes.contains(tdn.getSymbol()))
268 throw new Error("Class "+tdn.getSymbol()+" defined twice");
270 if(tdn.isInterface()) {
275 if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
280 public int numClasses() {
284 public int numInterfaces() {
285 return numinterfaces;
288 public int numStaticBlocks() {
289 return numstaticblocks;
292 public BlockNode getMethodBody(MethodDescriptor md) {
293 return (BlockNode)treemethodmap.get(md);
296 public BlockNode getMethodBody(TaskDescriptor td) {
297 return (BlockNode)treemethodmap.get(td);
300 public SymbolTable getClassSymbolTable() {
304 public SymbolTable getTaskSymbolTable() {
308 public SymbolTable getSClassSymbolTable() {
312 /** Returns Flat IR representation of MethodDescriptor md. */
314 public FlatMethod getMethodFlat(MethodDescriptor md) {
315 return (FlatMethod)flatmethodmap.get(md);
318 /** Returns Flat IR representation of TaskDescriptor td. */
320 public FlatMethod getMethodFlat(TaskDescriptor td) {
321 return (FlatMethod)flatmethodmap.get(td);
324 // The descriptor is either a method or task desc
325 // and should call one of the above methods
326 public FlatMethod getMethodFlat(Descriptor d) {
328 if( d instanceof MethodDescriptor ) {
329 fm = getMethodFlat( (MethodDescriptor) d);
331 assert d instanceof TaskDescriptor;
332 fm = getMethodFlat( (TaskDescriptor) d);
337 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
338 treemethodmap.put(md,bn);
341 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
342 treemethodmap.put(td,bn);
345 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
346 flatmethodmap.put(md,bn);
349 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
350 flatmethodmap.put(td,bn);
353 public void addTask(TaskDescriptor td) {
354 if (tasks.contains(td.getSymbol()))
355 throw new Error("Task "+td.getSymbol()+" defined twice");
360 public void addLocationOrder(ClassDescriptor cd, Lattice order){
361 cd2locationOrderMap.put(cd,order);
364 public Hashtable getCd2LocationOrder(){
365 return cd2locationOrderMap;
368 public void addLocationPropertySet(ClassDescriptor cd, Set<String> set){
369 cd2locationPropertyMap.put(cd,set);
372 public Hashtable getCd2LocationPropertyMap(){
373 return cd2locationPropertyMap;