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 int DISJOINTALLOCDEPTH=3;
73 public boolean DISJOINTWRITEDOTS=false;
74 public boolean DISJOINTWRITEALL=false;
75 public boolean DISJOINTWRITEIHMS=false;
76 public String DISJOINTALIASFILE=null;
77 public boolean DISJOINTALIASTAB=false;
78 public int DISJOINTDEBUGCALLCOUNT=0;
79 public String DISJOINTDEBUGCALLEE=null;
80 public String DISJOINTDEBUGCALLER=null;
81 public String DISJOINTSNAPSYMBOL=null;
82 public int DISJOINTSNAPVISITTOSTART=0;
83 public int DISJOINTSNAPNUMVISITS=0;
84 public boolean DISJOINTSNAPSTOPAFTER=false;
86 public boolean OPTIONAL=false;
87 public boolean ARRAYPAD=false;
88 public boolean THREAD=false;
89 public boolean CONSCHECK=false;
90 public boolean INSTRUCTIONFAILURE=false;
91 public boolean MLP=false;
92 public boolean MLPDEBUG=false;
93 public int MLP_NUMCORES=0;
94 public int MLP_MAXSESEAGE=0;
95 public boolean METHODEFFECTS=false;
96 public static double TRUEPROB=0.8;
97 public static boolean PRINTFLAT=false;
100 public boolean DSM=false;
101 public boolean DSMTASK=false;
102 public static boolean ABORTREADERS=false;
104 // Recovery Stats Options
105 public boolean DSMRECOVERYSTATS=false;
107 public boolean EVENTMONITOR=false;
108 public static boolean STMARRAY=false;
109 public static boolean SINGLETM=false;
110 public static boolean READSET=false;
111 public boolean SANDBOX=false;
112 public boolean DCOPTS=false;
113 public boolean DELAYCOMP=false;
114 public boolean DUALVIEW=false;
115 public boolean HYBRID=false;
118 public boolean MULTICORE=false;
119 public boolean MULTICOREGC=false;
120 public boolean BAMBOOCOMPILETIME = false;
121 public boolean ARRAYBOUNDARYCHECK=true;
122 public boolean RAW=false;
123 public boolean SCHEDULING=false;
124 public boolean USEPROFILE=false;
125 public static boolean PRINTSCHEDULING=false;
126 public static boolean PRINTSCHEDULESIM=false;
127 public static boolean PRINTCRITICALPATH=false;
128 public int CORENUM = 1;
129 public int CORENUM4GC = 0;
130 public String profilename = null;
131 public String outputdir = "/scratch/";
133 public String structfile;
135 public boolean INLINEATOMIC=false;
136 public int inlineatomicdepth;
137 public HashSet selfloops;
138 public HashSet excprefetch;
139 public Vector classpath;
140 public SymbolTable classes;
141 public SymbolTable tasks;
142 public Set parsetrees;
143 public Hashtable treemethodmap;
144 public Hashtable flatmethodmap;
145 private HashSet arraytypes;
146 public Hashtable arraytonumber;
147 private int numclasses=1; // start from 1 instead of 0 for multicore gc
148 private int numtasks=0;
149 private int arraycount=0;
150 public boolean OPTIMIZE=false;
152 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
153 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
155 private Hashtable tagmap;
156 private int numtags=0;
158 public void addArrayType(TypeDescriptor td) {
159 if (!arraytypes.contains(td)) {
161 arraytonumber.put(td,new Integer(arraycount++));
165 public Iterator getArrayIterator() {
166 return arraytypes.iterator();
169 public int getTagId(TagDescriptor tag) {
170 if (tagmap.containsKey(tag)) {
171 return ((Integer) tagmap.get(tag)).intValue();
173 tagmap.put(tag, new Integer(numtags));
178 public int getArrayNumber(TypeDescriptor td) {
179 if (arraytonumber.containsKey(td))
180 return ((Integer)arraytonumber.get(td)).intValue();
184 public int numArrays() {
185 return arraytypes.size();
188 public static TypeDescriptor getTypeDescriptor(int t) {
189 TypeDescriptor td=new TypeDescriptor(t);
193 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
194 TypeDescriptor td=new TypeDescriptor(n);
198 public void addClass(ClassDescriptor tdn) {
199 if (classes.contains(tdn.getSymbol()))
200 throw new Error("Class "+tdn.getSymbol()+" defined twice");
205 public int numClasses() {
209 public BlockNode getMethodBody(MethodDescriptor md) {
210 return (BlockNode)treemethodmap.get(md);
213 public BlockNode getMethodBody(TaskDescriptor td) {
214 return (BlockNode)treemethodmap.get(td);
217 public SymbolTable getClassSymbolTable() {
221 public SymbolTable getTaskSymbolTable() {
225 /** Returns Flat IR representation of MethodDescriptor md. */
227 public FlatMethod getMethodFlat(MethodDescriptor md) {
228 return (FlatMethod)flatmethodmap.get(md);
231 /** Returns Flat IR representation of TaskDescriptor td. */
233 public FlatMethod getMethodFlat(TaskDescriptor td) {
234 return (FlatMethod)flatmethodmap.get(td);
237 // The descriptor is either a method or task desc
238 // and should call one of the above methods
239 public FlatMethod getMethodFlat(Descriptor d) {
241 if( d instanceof MethodDescriptor ) {
242 fm = getMethodFlat( (MethodDescriptor) d);
244 assert d instanceof TaskDescriptor;
245 fm = getMethodFlat( (TaskDescriptor) d);
250 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
251 treemethodmap.put(md,bn);
254 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
255 treemethodmap.put(td,bn);
258 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
259 flatmethodmap.put(md,bn);
262 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
263 flatmethodmap.put(td,bn);
266 public void addTask(TaskDescriptor td) {
267 if (tasks.contains(td.getSymbol()))
268 throw new Error("Task "+td.getSymbol()+" defined twice");