9 this.classes=new SymbolTable();
10 this.tasks=new SymbolTable();
11 this.treemethodmap=new Hashtable();
12 this.flatmethodmap=new Hashtable();
13 this.parsetrees=new HashSet();
14 this.arraytypes=new HashSet();
15 this.arraytonumber=new Hashtable();
16 this.tagmap=new Hashtable();
17 this.analysisresult=new Hashtable();
18 this.myoptionals=new Hashtable();
21 public void addParseNode(ParseNode parsetree) {
22 parsetrees.add(parsetree);
25 public void storeAnalysisResult(Hashtable result){
26 analysisresult = result;
29 public void storeMyOptionals(Hashtable myoptionals){
30 this.myoptionals=myoptionals;
33 public Hashtable getAnalysisResult(){
34 return analysisresult;
37 public Hashtable getMyOptionals(){
41 /** Boolean flag which indicates whether compiler is compiling a task-based
43 public boolean WEBINTERFACE=false;
44 public boolean TASK=false;
45 public boolean DSM=false;
46 public boolean TASKSTATE=false;
47 public boolean OPTIONAL=false;
48 public boolean THREAD=false;
49 public boolean CONSCHECK=false;
50 public boolean INSTRUCTIONFAILURE=false;
51 public String structfile;
54 public SymbolTable classes;
55 public SymbolTable tasks;
56 public Set parsetrees;
57 public Hashtable treemethodmap;
58 public Hashtable flatmethodmap;
59 private HashSet arraytypes;
60 public Hashtable arraytonumber;
61 private int numclasses=0;
62 private int numtasks=0;
63 private int arraycount=0;
65 private Hashtable analysisresult;
66 private Hashtable myoptionals;
68 private Hashtable tagmap;
69 private int numtags=0;
71 public void addArrayType(TypeDescriptor td) {
72 if (!arraytypes.contains(td)) {
74 arraytonumber.put(td,new Integer(arraycount++));
78 public Iterator getArrayIterator() {
79 return arraytypes.iterator();
82 public int getTagId(TagDescriptor tag) {
83 if (tagmap.containsKey(tag)) {
84 return ((Integer) tagmap.get(tag)).intValue();
86 tagmap.put(tag, new Integer(numtags));
91 public int getArrayNumber(TypeDescriptor td) {
92 return ((Integer)arraytonumber.get(td)).intValue();
95 public int numArrays() {
96 return arraytypes.size();
99 public static TypeDescriptor getTypeDescriptor(int t) {
100 TypeDescriptor td=new TypeDescriptor(t);
104 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
105 TypeDescriptor td=new TypeDescriptor(n);
109 public void addClass(ClassDescriptor tdn) {
110 if (classes.contains(tdn.getSymbol()))
111 throw new Error("Class "+tdn.getSymbol()+" defined twice");
116 public int numClasses() {
120 public BlockNode getMethodBody(MethodDescriptor md) {
121 return (BlockNode)treemethodmap.get(md);
124 public BlockNode getMethodBody(TaskDescriptor td) {
125 return (BlockNode)treemethodmap.get(td);
128 public SymbolTable getClassSymbolTable() {
132 public SymbolTable getTaskSymbolTable() {
136 /** Returns Flat IR representation of MethodDescriptor md. */
138 public FlatMethod getMethodFlat(MethodDescriptor md) {
139 return (FlatMethod)flatmethodmap.get(md);
142 /** Returns Flat IR representation of TaskDescriptor td. */
144 public FlatMethod getMethodFlat(TaskDescriptor td) {
145 return (FlatMethod)flatmethodmap.get(td);
148 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
149 treemethodmap.put(md,bn);
152 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
153 treemethodmap.put(td,bn);
156 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
157 flatmethodmap.put(md,bn);
160 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
161 flatmethodmap.put(td,bn);
164 public void addTask(TaskDescriptor td) {
165 if (tasks.contains(td.getSymbol()))
166 throw new Error("Task "+td.getSymbol()+" defined twice");