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