11 this.classes=new SymbolTable();
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();
20 public void addParseNode(ParseNode parsetree) {
21 parsetrees.add(parsetree);
24 /** Boolean flag which indicates whether compiler is compiling a task-based
28 public SymbolTable classes;
29 public SymbolTable tasks;
30 public Set parsetrees;
31 public Hashtable treemethodmap;
32 public Hashtable flatmethodmap;
33 private HashSet arraytypes;
34 public Hashtable arraytonumber;
35 private int numclasses=0;
36 private int numtasks=0;
37 private int arraycount=0;
39 public void addArrayType(TypeDescriptor td) {
40 if (!arraytypes.contains(td)) {
42 arraytonumber.put(td,new Integer(arraycount++));
46 public Iterator getArrayIterator() {
47 return arraytypes.iterator();
50 public int getArrayNumber(TypeDescriptor td) {
51 return ((Integer)arraytonumber.get(td)).intValue();
54 public int numArrays() {
55 return arraytypes.size();
58 public static TypeDescriptor getTypeDescriptor(int t) {
59 TypeDescriptor td=new TypeDescriptor(t);
63 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
64 TypeDescriptor td=new TypeDescriptor(n);
68 public void addClass(ClassDescriptor tdn) {
69 if (classes.contains(tdn.getSymbol()))
70 throw new Error("Class "+tdn.getSymbol()+" defined twice");
75 public int numClasses() {
79 public BlockNode getMethodBody(MethodDescriptor md) {
80 return (BlockNode)treemethodmap.get(md);
83 public BlockNode getMethodBody(TaskDescriptor td) {
84 return (BlockNode)treemethodmap.get(td);
87 public SymbolTable getClassSymbolTable() {
91 public SymbolTable getTaskSymbolTable() {
95 /** Returns Flat IR representation of MethodDescriptor md. */
97 public FlatMethod getMethodFlat(MethodDescriptor md) {
98 return (FlatMethod)flatmethodmap.get(md);
101 /** Returns Flat IR representation of TaskDescriptor td. */
103 public FlatMethod getMethodFlat(TaskDescriptor td) {
104 return (FlatMethod)flatmethodmap.get(td);
107 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
108 treemethodmap.put(md,bn);
111 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
112 treemethodmap.put(td,bn);
115 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
116 flatmethodmap.put(md,bn);
119 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
120 flatmethodmap.put(td,bn);
123 public void addTask(TaskDescriptor td) {
124 if (tasks.contains(td.getSymbol()))
125 throw new Error("Task "+td.getSymbol()+" defined twice");