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 DSMTASK=false;
56 public boolean PREFETCH=false;
57 public boolean TASKSTATE=false;
58 public boolean TAGSTATE=false;
59 public boolean FLATIRGRAPH=false;
60 public boolean FLATIRGRAPHTASKS=false;
61 public boolean FLATIRGRAPHUSERMETHODS=false;
62 public boolean FLATIRGRAPHLIBMETHODS=false;
63 public boolean MULTICORE=false;
64 public boolean MULTICOREGC=false;
65 public boolean OWNERSHIP=false;
66 public int OWNERSHIPALLOCDEPTH=3;
67 public boolean OWNERSHIPWRITEDOTS=false;
68 public boolean OWNERSHIPWRITEALL=false;
69 public String OWNERSHIPALIASFILE=null;
70 public boolean OWNERSHIPALIASTAB=false;
71 public boolean OPTIONAL=false;
72 public boolean ARRAYBOUNDARYCHECK=true;
73 public boolean RAW=false;
74 public boolean ARRAYPAD=false;
75 public boolean SCHEDULING=false;
76 public boolean USEPROFILE=false;
77 public String profilename = null;
78 public boolean THREAD=false;
79 public boolean CONSCHECK=false;
80 public boolean INSTRUCTIONFAILURE=false;
81 public boolean MLP=false;
82 public boolean MLPDEBUG=false;
83 public int MLP_NUMCORES=0;
84 public int MLP_MAXSESEAGE=0;
85 public boolean METHODEFFECTS=false;
86 public static double TRUEPROB=0.8;
87 public static boolean PRINTFLAT=false;
88 public static boolean PRINTSCHEDULING=false;
89 public static boolean PRINTSCHEDULESIM=false;
90 public static boolean PRINTCRITICALPATH=false;
91 public static boolean ABORTREADERS=false;
92 public static boolean SINGLETM=false;
93 public static boolean READSET=false;
94 public boolean SANDBOX=false;
95 public int CORENUM = 1;
96 public String structfile;
98 public String outputdir = "/scratch/";
99 public boolean INLINEATOMIC=false;
100 public int inlineatomicdepth;
101 public HashSet selfloops;
102 public HashSet excprefetch;
103 public Vector classpath;
104 public SymbolTable classes;
105 public SymbolTable tasks;
106 public Set parsetrees;
107 public Hashtable treemethodmap;
108 public Hashtable flatmethodmap;
109 private HashSet arraytypes;
110 public Hashtable arraytonumber;
111 private int numclasses=1; // start from 1 instead of 0 for multicore gc
112 private int numtasks=0;
113 private int arraycount=0;
114 public boolean OPTIMIZE=false;
115 public boolean DCOPTS=false;
116 public boolean DELAYCOMP=false;
119 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
120 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
122 private Hashtable tagmap;
123 private int numtags=0;
125 public void addArrayType(TypeDescriptor td) {
126 if (!arraytypes.contains(td)) {
128 arraytonumber.put(td,new Integer(arraycount++));
132 public Iterator getArrayIterator() {
133 return arraytypes.iterator();
136 public int getTagId(TagDescriptor tag) {
137 if (tagmap.containsKey(tag)) {
138 return ((Integer) tagmap.get(tag)).intValue();
140 tagmap.put(tag, new Integer(numtags));
145 public int getArrayNumber(TypeDescriptor td) {
146 if (arraytonumber.containsKey(td))
147 return ((Integer)arraytonumber.get(td)).intValue();
151 public int numArrays() {
152 return arraytypes.size();
155 public static TypeDescriptor getTypeDescriptor(int t) {
156 TypeDescriptor td=new TypeDescriptor(t);
160 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
161 TypeDescriptor td=new TypeDescriptor(n);
165 public void addClass(ClassDescriptor tdn) {
166 if (classes.contains(tdn.getSymbol()))
167 throw new Error("Class "+tdn.getSymbol()+" defined twice");
172 public int numClasses() {
176 public BlockNode getMethodBody(MethodDescriptor md) {
177 return (BlockNode)treemethodmap.get(md);
180 public BlockNode getMethodBody(TaskDescriptor td) {
181 return (BlockNode)treemethodmap.get(td);
184 public SymbolTable getClassSymbolTable() {
188 public SymbolTable getTaskSymbolTable() {
192 /** Returns Flat IR representation of MethodDescriptor md. */
194 public FlatMethod getMethodFlat(MethodDescriptor md) {
195 return (FlatMethod)flatmethodmap.get(md);
198 /** Returns Flat IR representation of TaskDescriptor td. */
200 public FlatMethod getMethodFlat(TaskDescriptor td) {
201 return (FlatMethod)flatmethodmap.get(td);
204 // The descriptor is either a method or task desc
205 // and should call one of the above methods
206 public FlatMethod getMethodFlat(Descriptor d) {
208 if( d instanceof MethodDescriptor ) {
209 fm = getMethodFlat( (MethodDescriptor) d);
211 assert d instanceof TaskDescriptor;
212 fm = getMethodFlat( (TaskDescriptor) d);
217 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
218 treemethodmap.put(md,bn);
221 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
222 treemethodmap.put(td,bn);
225 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
226 flatmethodmap.put(md,bn);
229 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
230 flatmethodmap.put(td,bn);
233 public void addTask(TaskDescriptor td) {
234 if (tasks.contains(td.getSymbol()))
235 throw new Error("Task "+td.getSymbol()+" defined twice");