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;
105 public int CORENUM = 1;
106 public String structfile;
108 public String outputdir = "/scratch/";
109 public boolean INLINEATOMIC=false;
110 public int inlineatomicdepth;
111 public HashSet selfloops;
112 public HashSet excprefetch;
113 public Vector classpath;
114 public SymbolTable classes;
115 public SymbolTable tasks;
116 public Set parsetrees;
117 public Hashtable treemethodmap;
118 public Hashtable flatmethodmap;
119 private HashSet arraytypes;
120 public Hashtable arraytonumber;
121 private int numclasses=1; // start from 1 instead of 0 for multicore gc
122 private int numtasks=0;
123 private int arraycount=0;
124 public boolean OPTIMIZE=false;
126 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
127 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
129 private Hashtable tagmap;
130 private int numtags=0;
132 public void addArrayType(TypeDescriptor td) {
133 if (!arraytypes.contains(td)) {
135 arraytonumber.put(td,new Integer(arraycount++));
139 public Iterator getArrayIterator() {
140 return arraytypes.iterator();
143 public int getTagId(TagDescriptor tag) {
144 if (tagmap.containsKey(tag)) {
145 return ((Integer) tagmap.get(tag)).intValue();
147 tagmap.put(tag, new Integer(numtags));
152 public int getArrayNumber(TypeDescriptor td) {
153 if (arraytonumber.containsKey(td))
154 return ((Integer)arraytonumber.get(td)).intValue();
158 public int numArrays() {
159 return arraytypes.size();
162 public static TypeDescriptor getTypeDescriptor(int t) {
163 TypeDescriptor td=new TypeDescriptor(t);
167 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
168 TypeDescriptor td=new TypeDescriptor(n);
172 public void addClass(ClassDescriptor tdn) {
173 if (classes.contains(tdn.getSymbol()))
174 throw new Error("Class "+tdn.getSymbol()+" defined twice");
179 public int numClasses() {
183 public BlockNode getMethodBody(MethodDescriptor md) {
184 return (BlockNode)treemethodmap.get(md);
187 public BlockNode getMethodBody(TaskDescriptor td) {
188 return (BlockNode)treemethodmap.get(td);
191 public SymbolTable getClassSymbolTable() {
195 public SymbolTable getTaskSymbolTable() {
199 /** Returns Flat IR representation of MethodDescriptor md. */
201 public FlatMethod getMethodFlat(MethodDescriptor md) {
202 return (FlatMethod)flatmethodmap.get(md);
205 /** Returns Flat IR representation of TaskDescriptor td. */
207 public FlatMethod getMethodFlat(TaskDescriptor td) {
208 return (FlatMethod)flatmethodmap.get(td);
211 // The descriptor is either a method or task desc
212 // and should call one of the above methods
213 public FlatMethod getMethodFlat(Descriptor d) {
215 if( d instanceof MethodDescriptor ) {
216 fm = getMethodFlat( (MethodDescriptor) d);
218 assert d instanceof TaskDescriptor;
219 fm = getMethodFlat( (TaskDescriptor) d);
224 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
225 treemethodmap.put(md,bn);
228 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
229 treemethodmap.put(td,bn);
232 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
233 flatmethodmap.put(md,bn);
236 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
237 flatmethodmap.put(td,bn);
240 public void addTask(TaskDescriptor td) {
241 if (tasks.contains(td.getSymbol()))
242 throw new Error("Task "+td.getSymbol()+" defined twice");