|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSymbolTable
CgenClassTable
class CgenClassTable
This class is used for representing the inheritance tree during code generation. You will need to fill in some of its methods and potentially extend it in other useful ways.
Field Summary | |
---|---|
private int |
boolclasstag
|
private int |
intclasstag
|
private java.util.Vector |
nds
All classes in the program, represented as CgenNode |
private java.io.PrintStream |
str
This is the stream to which assembly instructions are output |
private int |
stringclasstag
|
Constructor Summary | |
---|---|
CgenClassTable(Classes cls,
java.io.PrintStream str)
Constructs a new class table and invokes the code generator |
Method Summary | |
---|---|
private void |
buildInheritanceTree()
|
void |
code()
This method is the meat of the code generator. |
private void |
codeBools(int classtag)
Emits code definitions for boolean constants. |
private void |
codeConstants()
Emits code to reserve space for and initialize all of the constants. |
private void |
codeGlobalData()
Emits code to start the .data segment and to declare the global names. |
private void |
codeGlobalText()
Emits code to start the .text segment and to declare the global names. |
private void |
codeSelectGc()
Generates GC choice constants (pointers to GC functions) |
private void |
installBasicClasses()
Creates data structures representing basic Cool classes (Object, IO, Int, Bool, String). |
private void |
installClass(CgenNode nd)
|
private void |
installClasses(Classes cs)
|
CgenNode |
root()
Gets the root of the inheritance tree |
private void |
setRelations(CgenNode nd)
|
Methods inherited from class SymbolTable |
---|
addId, enterScope, exitScope, lookup, probe, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.Vector nds
private java.io.PrintStream str
private int stringclasstag
private int intclasstag
private int boolclasstag
Constructor Detail |
---|
public CgenClassTable(Classes cls, java.io.PrintStream str)
Method Detail |
---|
private void codeGlobalData()
private void codeGlobalText()
private void codeBools(int classtag)
private void codeSelectGc()
private void codeConstants()
private void installBasicClasses()
private void installClass(CgenNode nd)
private void installClasses(Classes cs)
private void buildInheritanceTree()
private void setRelations(CgenNode nd)
public void code()
public CgenNode root()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |