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;
72 public boolean OPTIONAL=false;
73 public boolean ARRAYBOUNDARYCHECK=true;
74 public boolean RAW=false;
75 public boolean ARRAYPAD=false;
76 public boolean SCHEDULING=false;
77 public boolean USEPROFILE=false;
78 public String profilename = null;
79 public boolean THREAD=false;
80 public boolean CONSCHECK=false;
81 public boolean INSTRUCTIONFAILURE=false;
82 public boolean MLP=false;
83 public boolean MLPDEBUG=false;
84 public int MLP_NUMCORES=0;
85 public int MLP_MAXSESEAGE=0;
86 public boolean METHODEFFECTS=false;
87 public static double TRUEPROB=0.8;
88 public static boolean PRINTFLAT=false;
89 public static boolean PRINTSCHEDULING=false;
90 public static boolean PRINTSCHEDULESIM=false;
91 public static boolean PRINTCRITICALPATH=false;
93 public boolean DSM=false;
94 public boolean DSMTASK=false;
95 public static boolean ABORTREADERS=false;
97 public static boolean STMARRAY=false;
98 public static boolean SINGLETM=false;
99 public static boolean READSET=false;
100 public boolean SANDBOX=false;
101 public boolean DCOPTS=false;
102 public boolean DELAYCOMP=false;
103 public boolean DUALVIEW=false;
104 public boolean HYBRID=false;
106 public int CORENUM = 1;
107 public String structfile;
109 public String outputdir = "/scratch/";
110 public boolean INLINEATOMIC=false;
111 public int inlineatomicdepth;
112 public HashSet selfloops;
113 public HashSet excprefetch;
114 public Vector classpath;
115 public SymbolTable classes;
116 public SymbolTable tasks;
117 public Set parsetrees;
118 public Hashtable treemethodmap;
119 public Hashtable flatmethodmap;
120 private HashSet arraytypes;
121 public Hashtable arraytonumber;
122 private int numclasses=1; // start from 1 instead of 0 for multicore gc
123 private int numtasks=0;
124 private int arraycount=0;
125 public boolean OPTIMIZE=false;
127 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
128 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
130 private Hashtable tagmap;
131 private int numtags=0;
133 public void addArrayType(TypeDescriptor td) {
134 if (!arraytypes.contains(td)) {
136 arraytonumber.put(td,new Integer(arraycount++));
140 public Iterator getArrayIterator() {
141 return arraytypes.iterator();
144 public int getTagId(TagDescriptor tag) {
145 if (tagmap.containsKey(tag)) {
146 return ((Integer) tagmap.get(tag)).intValue();
148 tagmap.put(tag, new Integer(numtags));
153 public int getArrayNumber(TypeDescriptor td) {
154 if (arraytonumber.containsKey(td))
155 return ((Integer)arraytonumber.get(td)).intValue();
159 public int numArrays() {
160 return arraytypes.size();
163 public static TypeDescriptor getTypeDescriptor(int t) {
164 TypeDescriptor td=new TypeDescriptor(t);
168 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
169 TypeDescriptor td=new TypeDescriptor(n);
173 public void addClass(ClassDescriptor tdn) {
174 if (classes.contains(tdn.getSymbol()))
175 throw new Error("Class "+tdn.getSymbol()+" defined twice");
180 public int numClasses() {
184 public BlockNode getMethodBody(MethodDescriptor md) {
185 return (BlockNode)treemethodmap.get(md);
188 public BlockNode getMethodBody(TaskDescriptor td) {
189 return (BlockNode)treemethodmap.get(td);
192 public SymbolTable getClassSymbolTable() {
196 public SymbolTable getTaskSymbolTable() {
200 /** Returns Flat IR representation of MethodDescriptor md. */
202 public FlatMethod getMethodFlat(MethodDescriptor md) {
203 return (FlatMethod)flatmethodmap.get(md);
206 /** Returns Flat IR representation of TaskDescriptor td. */
208 public FlatMethod getMethodFlat(TaskDescriptor td) {
209 return (FlatMethod)flatmethodmap.get(td);
212 // The descriptor is either a method or task desc
213 // and should call one of the above methods
214 public FlatMethod getMethodFlat(Descriptor d) {
216 if( d instanceof MethodDescriptor ) {
217 fm = getMethodFlat( (MethodDescriptor) d);
219 assert d instanceof TaskDescriptor;
220 fm = getMethodFlat( (TaskDescriptor) d);
225 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
226 treemethodmap.put(md,bn);
229 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
230 treemethodmap.put(td,bn);
233 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
234 flatmethodmap.put(md,bn);
237 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
238 flatmethodmap.put(td,bn);
241 public void addTask(TaskDescriptor td) {
242 if (tasks.contains(td.getSymbol()))
243 throw new Error("Task "+td.getSymbol()+" defined twice");