6 import Analysis.TaskStateAnalysis.*;
10 this.classes=new SymbolTable();
11 this.tasks=new SymbolTable();
12 this.treemethodmap=new Hashtable();
13 this.flatmethodmap=new Hashtable();
14 this.parsetrees=new HashSet();
15 this.arraytypes=new HashSet();
16 this.arraytonumber=new Hashtable();
17 this.tagmap=new Hashtable();
18 this.selfloops=new HashSet();
19 this.excprefetch=new HashSet();
20 this.classpath=new Vector();
23 public void addParseNode(ParseNode parsetree) {
24 parsetrees.add(parsetree);
27 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
28 this.analysisresults=analysisresults;
31 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
32 return analysisresults;
36 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
37 this.optionaltaskdescriptors=optionaltaskdescriptors;
40 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
41 return optionaltaskdescriptors;
45 /** Boolean flag which indicates whether compiler is compiling a task-based
47 public boolean WEBINTERFACE=false;
48 public boolean TASK=false;
49 public boolean FASTCHECK=false;
50 public boolean DSM=false;
51 public boolean PREFETCH=false;
52 public boolean TASKSTATE=false;
53 public boolean TAGSTATE=false;
54 public boolean FLATIRGRAPH=false;
55 public boolean FLATIRGRAPHTASKS=false;
56 public boolean FLATIRGRAPHUSERMETHODS=false;
57 public boolean FLATIRGRAPHLIBMETHODS=false;
58 public boolean MULTICORE=false;
59 public boolean OWNERSHIP=false;
60 public int OWNERSHIPALLOCDEPTH=3;
61 public boolean OWNERSHIPWRITEDOTS=false;
62 public boolean OWNERSHIPWRITEALL=false;
63 public String OWNERSHIPALIASFILE=null;
64 public boolean OPTIONAL=false;
65 public boolean ARRAYBOUNDARYCHECK=true;
66 public boolean RAW=false;
67 public boolean SCHEDULING=false;
68 public boolean USEPROFILE=false;
69 public boolean THREAD=false;
70 public boolean CONSCHECK=false;
71 public boolean INSTRUCTIONFAILURE=false;
72 public static double TRUEPROB=0.8;
73 public static boolean PRINTFLAT=false;
74 public static boolean PRINTSCHEDULING=false;
75 public static boolean PRINTSCHEDULESIM=false;
76 public static boolean ABORTREADERS=false;
77 public int CORENUM = 1;
78 public String structfile;
81 public HashSet selfloops;
82 public HashSet excprefetch;
83 public Vector classpath;
84 public SymbolTable classes;
85 public SymbolTable tasks;
86 public Set parsetrees;
87 public Hashtable treemethodmap;
88 public Hashtable flatmethodmap;
89 private HashSet arraytypes;
90 public Hashtable arraytonumber;
91 private int numclasses=0;
92 private int numtasks=0;
93 private int arraycount=0;
97 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
98 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
100 private Hashtable tagmap;
101 private int numtags=0;
103 public void addArrayType(TypeDescriptor td) {
104 if (!arraytypes.contains(td)) {
106 arraytonumber.put(td,new Integer(arraycount++));
110 public Iterator getArrayIterator() {
111 return arraytypes.iterator();
114 public int getTagId(TagDescriptor tag) {
115 if (tagmap.containsKey(tag)) {
116 return ((Integer) tagmap.get(tag)).intValue();
118 tagmap.put(tag, new Integer(numtags));
123 public int getArrayNumber(TypeDescriptor td) {
124 if (arraytonumber.containsKey(td))
125 return ((Integer)arraytonumber.get(td)).intValue();
129 public int numArrays() {
130 return arraytypes.size();
133 public static TypeDescriptor getTypeDescriptor(int t) {
134 TypeDescriptor td=new TypeDescriptor(t);
138 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
139 TypeDescriptor td=new TypeDescriptor(n);
143 public void addClass(ClassDescriptor tdn) {
144 if (classes.contains(tdn.getSymbol()))
145 throw new Error("Class "+tdn.getSymbol()+" defined twice");
150 public int numClasses() {
154 public BlockNode getMethodBody(MethodDescriptor md) {
155 return (BlockNode)treemethodmap.get(md);
158 public BlockNode getMethodBody(TaskDescriptor td) {
159 return (BlockNode)treemethodmap.get(td);
162 public SymbolTable getClassSymbolTable() {
166 public SymbolTable getTaskSymbolTable() {
170 /** Returns Flat IR representation of MethodDescriptor md. */
172 public FlatMethod getMethodFlat(MethodDescriptor md) {
173 return (FlatMethod)flatmethodmap.get(md);
176 /** Returns Flat IR representation of TaskDescriptor td. */
178 public FlatMethod getMethodFlat(TaskDescriptor td) {
179 return (FlatMethod)flatmethodmap.get(td);
182 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
183 treemethodmap.put(md,bn);
186 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
187 treemethodmap.put(td,bn);
190 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
191 flatmethodmap.put(md,bn);
194 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
195 flatmethodmap.put(td,bn);
198 public void addTask(TaskDescriptor td) {
199 if (tasks.contains(td.getSymbol()))
200 throw new Error("Task "+td.getSymbol()+" defined twice");