private void codeObjInits() { str.println("\n# Object Initializers"); for (Object obj : nds) { CgenNode nd = (CgenNode) obj; // code object initailzers (constructor method) CgenSupport.emitInitRef(nd.getName(), str); str.print(CgenSupport.LABEL); nd.codeObjInit(str); } }
/** Emits code to start the .text segment and to declare the global names. */ private void codeGlobalText() { str.println("\n# Global Text"); str.println(CgenSupport.GLOBAL + CgenSupport.HEAP_START); str.print(CgenSupport.HEAP_START + CgenSupport.LABEL); str.println(CgenSupport.WORD + 0); str.println("\t.text"); str.print(CgenSupport.GLOBAL); CgenSupport.emitInitRef(TreeConstants.Main, str); str.println(""); str.print(CgenSupport.GLOBAL); CgenSupport.emitInitRef(TreeConstants.Int, str); str.println(""); str.print(CgenSupport.GLOBAL); CgenSupport.emitInitRef(TreeConstants.Str, str); str.println(""); str.print(CgenSupport.GLOBAL); CgenSupport.emitInitRef(TreeConstants.Bool, str); str.println(""); str.print(CgenSupport.GLOBAL); CgenSupport.emitMethodRef(TreeConstants.Main, TreeConstants.main_meth, str); str.println(""); }
private void codeClassObjTable() { str.println("\n# Class Object Table"); str.print(CgenSupport.CLASSOBJTAB + CgenSupport.LABEL); for (Object obj : nds) { AbstractSymbol className = ((CgenNode) obj).getName(); // code prototype object reference str.print(CgenSupport.WORD); CgenSupport.emitProtObjRef(className, str); str.println(); // code initializer reference str.print(CgenSupport.WORD); CgenSupport.emitInitRef(className, str); str.println(); } }