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();
19 public void addParseNode(ParseNode parsetree) {
20 parsetrees.add(parsetree);
23 /** Boolean flag which indicates whether compiler is compiling a task-based
25 public boolean WEBINTERFACE=false;
26 public boolean TASK=false;
27 public boolean DSM=false;
28 public boolean TASKSTATE=false;
29 public boolean OPTIONAL=false;
30 public boolean THREAD=false;
31 public boolean CONSCHECK=false;
32 public boolean INSTRUCTIONFAILURE=false;
33 public String structfile;
36 public SymbolTable classes;
37 public SymbolTable tasks;
38 public Set parsetrees;
39 public Hashtable treemethodmap;
40 public Hashtable flatmethodmap;
41 private HashSet arraytypes;
42 public Hashtable arraytonumber;
43 private int numclasses=0;
44 private int numtasks=0;
45 private int arraycount=0;
47 private Hashtable tagmap;
48 private int numtags=0;
50 public void addArrayType(TypeDescriptor td) {
51 if (!arraytypes.contains(td)) {
53 arraytonumber.put(td,new Integer(arraycount++));
57 public Iterator getArrayIterator() {
58 return arraytypes.iterator();
61 public int getTagId(TagDescriptor tag) {
62 if (tagmap.containsKey(tag)) {
63 return ((Integer) tagmap.get(tag)).intValue();
65 tagmap.put(tag, new Integer(numtags));
70 public int getArrayNumber(TypeDescriptor td) {
71 return ((Integer)arraytonumber.get(td)).intValue();
74 public int numArrays() {
75 return arraytypes.size();
78 public static TypeDescriptor getTypeDescriptor(int t) {
79 TypeDescriptor td=new TypeDescriptor(t);
83 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
84 TypeDescriptor td=new TypeDescriptor(n);
88 public void addClass(ClassDescriptor tdn) {
89 if (classes.contains(tdn.getSymbol()))
90 throw new Error("Class "+tdn.getSymbol()+" defined twice");
95 public int numClasses() {
99 public BlockNode getMethodBody(MethodDescriptor md) {
100 return (BlockNode)treemethodmap.get(md);
103 public BlockNode getMethodBody(TaskDescriptor td) {
104 return (BlockNode)treemethodmap.get(td);
107 public SymbolTable getClassSymbolTable() {
111 public SymbolTable getTaskSymbolTable() {
115 /** Returns Flat IR representation of MethodDescriptor md. */
117 public FlatMethod getMethodFlat(MethodDescriptor md) {
118 return (FlatMethod)flatmethodmap.get(md);
121 /** Returns Flat IR representation of TaskDescriptor td. */
123 public FlatMethod getMethodFlat(TaskDescriptor td) {
124 return (FlatMethod)flatmethodmap.get(td);
127 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
128 treemethodmap.put(md,bn);
131 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
132 treemethodmap.put(td,bn);
135 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
136 flatmethodmap.put(md,bn);
139 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
140 flatmethodmap.put(td,bn);
143 public void addTask(TaskDescriptor td) {
144 if (tasks.contains(td.getSymbol()))
145 throw new Error("Task "+td.getSymbol()+" defined twice");