6 import Analysis.TaskStateAnalysis.*;
10 this.classes=new SymbolTable();
11 this.discclass=new HashSet();
12 this.tasks=new SymbolTable();
13 this.treemethodmap=new Hashtable();
14 this.flatmethodmap=new Hashtable();
15 this.parsetrees=new HashSet();
16 this.arraytypes=new HashSet();
17 this.arraytonumber=new Hashtable();
18 this.tagmap=new Hashtable();
19 this.selfloops=new HashSet();
20 this.excprefetch=new HashSet();
21 this.classpath=new Vector();
24 public void addParseNode(ParseNode parsetree) {
25 parsetrees.add(parsetree);
28 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
29 this.analysisresults=analysisresults;
32 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
33 return analysisresults;
37 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
38 this.optionaltaskdescriptors=optionaltaskdescriptors;
41 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
42 return optionaltaskdescriptors;
46 /** Boolean flag which indicates whether compiler is compiling a task-based
48 public boolean WEBINTERFACE=false;
49 public boolean TASK=false;
50 public boolean FASTCHECK=false;
51 public boolean DSM=false;
52 public boolean PREFETCH=false;
53 public boolean TASKSTATE=false;
54 public boolean TAGSTATE=false;
55 public boolean FLATIRGRAPH=false;
56 public boolean FLATIRGRAPHTASKS=false;
57 public boolean FLATIRGRAPHUSERMETHODS=false;
58 public boolean FLATIRGRAPHLIBMETHODS=false;
59 public boolean MULTICORE=false;
60 public boolean OWNERSHIP=false;
61 public int OWNERSHIPALLOCDEPTH=3;
62 public boolean OWNERSHIPWRITEDOTS=false;
63 public boolean OWNERSHIPWRITEALL=false;
64 public String OWNERSHIPALIASFILE=null;
65 public boolean OPTIONAL=false;
66 public boolean ARRAYBOUNDARYCHECK=true;
67 public boolean RAW=false;
68 public boolean SCHEDULING=false;
69 public boolean USEPROFILE=false;
70 public boolean THREAD=false;
71 public boolean CONSCHECK=false;
72 public boolean INSTRUCTIONFAILURE=false;
73 public static double TRUEPROB=0.8;
74 public static boolean PRINTFLAT=false;
75 public static boolean PRINTSCHEDULING=false;
76 public static boolean PRINTSCHEDULESIM=false;
77 public static boolean ABORTREADERS=false;
78 public int CORENUM = 1;
79 public String structfile;
82 public HashSet selfloops;
83 public HashSet excprefetch;
84 public Vector classpath;
85 public HashSet discclass;
86 public SymbolTable classes;
87 public SymbolTable tasks;
88 public Set parsetrees;
89 public Hashtable treemethodmap;
90 public Hashtable flatmethodmap;
91 private HashSet arraytypes;
92 public Hashtable arraytonumber;
93 private int numclasses=0;
94 private int numtasks=0;
95 private int arraycount=0;
99 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
100 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
102 private Hashtable tagmap;
103 private int numtags=0;
105 public void addArrayType(TypeDescriptor td) {
106 if (!arraytypes.contains(td)) {
108 arraytonumber.put(td,new Integer(arraycount++));
112 public Iterator getArrayIterator() {
113 return arraytypes.iterator();
116 public int getTagId(TagDescriptor tag) {
117 if (tagmap.containsKey(tag)) {
118 return ((Integer) tagmap.get(tag)).intValue();
120 tagmap.put(tag, new Integer(numtags));
125 public int getArrayNumber(TypeDescriptor td) {
126 if (arraytonumber.containsKey(td))
127 return ((Integer)arraytonumber.get(td)).intValue();
131 public int numArrays() {
132 return arraytypes.size();
135 public static TypeDescriptor getTypeDescriptor(int t) {
136 TypeDescriptor td=new TypeDescriptor(t);
140 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
141 TypeDescriptor td=new TypeDescriptor(n);
145 public void addClass(ClassDescriptor tdn) {
146 if (classes.contains(tdn.getSymbol()))
147 throw new Error("Class "+tdn.getSymbol()+" defined twice");
152 public int numClasses() {
156 public BlockNode getMethodBody(MethodDescriptor md) {
157 return (BlockNode)treemethodmap.get(md);
160 public BlockNode getMethodBody(TaskDescriptor td) {
161 return (BlockNode)treemethodmap.get(td);
164 public SymbolTable getClassSymbolTable() {
168 public SymbolTable getTaskSymbolTable() {
172 /** Returns Flat IR representation of MethodDescriptor md. */
174 public FlatMethod getMethodFlat(MethodDescriptor md) {
175 return (FlatMethod)flatmethodmap.get(md);
178 /** Returns Flat IR representation of TaskDescriptor td. */
180 public FlatMethod getMethodFlat(TaskDescriptor td) {
181 return (FlatMethod)flatmethodmap.get(td);
184 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
185 treemethodmap.put(md,bn);
188 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
189 treemethodmap.put(td,bn);
192 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
193 flatmethodmap.put(md,bn);
196 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
197 flatmethodmap.put(td,bn);
200 public void addTask(TaskDescriptor td) {
201 if (tasks.contains(td.getSymbol()))
202 throw new Error("Task "+td.getSymbol()+" defined twice");