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 DSM=false;
55 public boolean PREFETCH=false;
56 public boolean TASKSTATE=false;
57 public boolean TAGSTATE=false;
58 public boolean FLATIRGRAPH=false;
59 public boolean FLATIRGRAPHTASKS=false;
60 public boolean FLATIRGRAPHUSERMETHODS=false;
61 public boolean FLATIRGRAPHLIBMETHODS=false;
62 public boolean MULTICORE=false;
63 public boolean MULTICOREGC=false;
64 public boolean OWNERSHIP=false;
65 public int OWNERSHIPALLOCDEPTH=3;
66 public boolean OWNERSHIPWRITEDOTS=false;
67 public boolean OWNERSHIPWRITEALL=false;
68 public String OWNERSHIPALIASFILE=null;
69 public boolean OPTIONAL=false;
70 public boolean ARRAYBOUNDARYCHECK=true;
71 public boolean RAW=false;
72 public boolean ARRAYPAD=false;
73 public boolean SCHEDULING=false;
74 public boolean USEPROFILE=false;
75 public String profilename = null;
76 public boolean THREAD=false;
77 public boolean CONSCHECK=false;
78 public boolean INSTRUCTIONFAILURE=false;
79 public boolean MLP=false;
80 public boolean MLPDEBUG=false;
81 public int MLP_NUMCORES=0;
82 public int MLP_MAXSESEAGE=0;
83 public boolean METHODEFFECTS=false;
84 public static double TRUEPROB=0.8;
85 public static boolean PRINTFLAT=false;
86 public static boolean PRINTSCHEDULING=false;
87 public static boolean PRINTSCHEDULESIM=false;
88 public static boolean PRINTCRITICALPATH=false;
89 public static boolean ABORTREADERS=false;
90 public static boolean SINGLETM=false;
91 public static boolean READSET=false;
92 public int CORENUM = 1;
93 public String structfile;
95 public String outputdir = "/scratch/";
96 public boolean INLINEATOMIC=false;
97 public int inlineatomicdepth;
98 public HashSet selfloops;
99 public HashSet excprefetch;
100 public Vector classpath;
101 public SymbolTable classes;
102 public SymbolTable tasks;
103 public Set parsetrees;
104 public Hashtable treemethodmap;
105 public Hashtable flatmethodmap;
106 private HashSet arraytypes;
107 public Hashtable arraytonumber;
108 private int numclasses=1; // start from 1 instead of 0 for multicore gc
109 private int numtasks=0;
110 private int arraycount=0;
111 public boolean OPTIMIZE=false;
112 public boolean DCOPTS=false;
113 public boolean DELAYCOMP=false;
116 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
117 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
119 private Hashtable tagmap;
120 private int numtags=0;
122 public void addArrayType(TypeDescriptor td) {
123 if (!arraytypes.contains(td)) {
125 arraytonumber.put(td,new Integer(arraycount++));
129 public Iterator getArrayIterator() {
130 return arraytypes.iterator();
133 public int getTagId(TagDescriptor tag) {
134 if (tagmap.containsKey(tag)) {
135 return ((Integer) tagmap.get(tag)).intValue();
137 tagmap.put(tag, new Integer(numtags));
142 public int getArrayNumber(TypeDescriptor td) {
143 if (arraytonumber.containsKey(td))
144 return ((Integer)arraytonumber.get(td)).intValue();
148 public int numArrays() {
149 return arraytypes.size();
152 public static TypeDescriptor getTypeDescriptor(int t) {
153 TypeDescriptor td=new TypeDescriptor(t);
157 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
158 TypeDescriptor td=new TypeDescriptor(n);
162 public void addClass(ClassDescriptor tdn) {
163 if (classes.contains(tdn.getSymbol()))
164 throw new Error("Class "+tdn.getSymbol()+" defined twice");
169 public int numClasses() {
173 public BlockNode getMethodBody(MethodDescriptor md) {
174 return (BlockNode)treemethodmap.get(md);
177 public BlockNode getMethodBody(TaskDescriptor td) {
178 return (BlockNode)treemethodmap.get(td);
181 public SymbolTable getClassSymbolTable() {
185 public SymbolTable getTaskSymbolTable() {
189 /** Returns Flat IR representation of MethodDescriptor md. */
191 public FlatMethod getMethodFlat(MethodDescriptor md) {
192 return (FlatMethod)flatmethodmap.get(md);
195 /** Returns Flat IR representation of TaskDescriptor td. */
197 public FlatMethod getMethodFlat(TaskDescriptor td) {
198 return (FlatMethod)flatmethodmap.get(td);
201 // The descriptor is either a method or task desc
202 // and should call one of the above methods
203 public FlatMethod getMethodFlat(Descriptor d) {
205 if( d instanceof MethodDescriptor ) {
206 fm = getMethodFlat( (MethodDescriptor) d);
208 assert d instanceof TaskDescriptor;
209 fm = getMethodFlat( (TaskDescriptor) d);
214 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
215 treemethodmap.put(md,bn);
218 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
219 treemethodmap.put(td,bn);
222 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
223 flatmethodmap.put(md,bn);
226 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
227 flatmethodmap.put(td,bn);
230 public void addTask(TaskDescriptor td) {
231 if (tasks.contains(td.getSymbol()))
232 throw new Error("Task "+td.getSymbol()+" defined twice");