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;
27 public boolean TASKSTATE=false;
28 public boolean THREAD=false;
29 public boolean INSTRUCTIONFAILURE=false;
30 public String structfile;
32 public boolean CONSCHECK=false;
34 public SymbolTable classes;
35 public SymbolTable tasks;
36 public Set parsetrees;
37 public Hashtable treemethodmap;
38 public Hashtable flatmethodmap;
39 private HashSet arraytypes;
40 public Hashtable arraytonumber;
41 private int numclasses=0;
42 private int numtasks=0;
43 private int arraycount=0;
45 private Hashtable tagmap;
46 private int numtags=0;
48 public void addArrayType(TypeDescriptor td) {
49 if (!arraytypes.contains(td)) {
51 arraytonumber.put(td,new Integer(arraycount++));
55 public Iterator getArrayIterator() {
56 return arraytypes.iterator();
59 public int getTagId(TagDescriptor tag) {
60 if (tagmap.containsKey(tag)) {
61 return ((Integer) tagmap.get(tag)).intValue();
63 tagmap.put(tag, new Integer(numtags));
68 public int getArrayNumber(TypeDescriptor td) {
69 return ((Integer)arraytonumber.get(td)).intValue();
72 public int numArrays() {
73 return arraytypes.size();
76 public static TypeDescriptor getTypeDescriptor(int t) {
77 TypeDescriptor td=new TypeDescriptor(t);
81 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
82 TypeDescriptor td=new TypeDescriptor(n);
86 public void addClass(ClassDescriptor tdn) {
87 if (classes.contains(tdn.getSymbol()))
88 throw new Error("Class "+tdn.getSymbol()+" defined twice");
93 public int numClasses() {
97 public BlockNode getMethodBody(MethodDescriptor md) {
98 return (BlockNode)treemethodmap.get(md);
101 public BlockNode getMethodBody(TaskDescriptor td) {
102 return (BlockNode)treemethodmap.get(td);
105 public SymbolTable getClassSymbolTable() {
109 public SymbolTable getTaskSymbolTable() {
113 /** Returns Flat IR representation of MethodDescriptor md. */
115 public FlatMethod getMethodFlat(MethodDescriptor md) {
116 return (FlatMethod)flatmethodmap.get(md);
119 /** Returns Flat IR representation of TaskDescriptor td. */
121 public FlatMethod getMethodFlat(TaskDescriptor td) {
122 return (FlatMethod)flatmethodmap.get(td);
125 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
126 treemethodmap.put(md,bn);
129 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
130 treemethodmap.put(td,bn);
133 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
134 flatmethodmap.put(md,bn);
137 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
138 flatmethodmap.put(td,bn);
141 public void addTask(TaskDescriptor td) {
142 if (tasks.contains(td.getSymbol()))
143 throw new Error("Task "+td.getSymbol()+" defined twice");