fix javadoc
authorbdemsky <bdemsky>
Thu, 4 Jan 2007 22:33:52 +0000 (22:33 +0000)
committerbdemsky <bdemsky>
Thu, 4 Jan 2007 22:33:52 +0000 (22:33 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/Main/Main.java
Robust/src/Makefile
Robust/src/Runtime/garbage.c

index 62233c567754e211daddaceed7e2d1f5fd312c19..40ea96da43a20a60c9b9160e725a3da2a3993b7c 100644 (file)
@@ -174,10 +174,14 @@ public class BuildCode {
        outclassdefs.println("extern int classsize[];");
        outclassdefs.println("extern int hasflags[];");
        outclassdefs.println("extern int * pointerarray[];");
+       outclassdefs.println("extern int supertypes[];");
 
        //Store the sizes of classes & array elements
        generateSizeArray(outmethod);
        
+       //Store table of supertypes
+       generateSuperTypeTable(outmethod);
+
        //Store the layout of classes
        generateLayoutStructs(outmethod);
 
@@ -602,7 +606,25 @@ public class BuildCode {
        output.println("};");
     }
 
-    /* Force consistent field ordering between inherited classes. */
+    /** Print out table to give us supertypes */
+    private void generateSuperTypeTable(PrintWriter output) {
+       output.println("int supertypes[]={");
+       boolean needcomma=false;
+       for(int i=0;i<state.numClasses();i++) {
+           ClassDescriptor cn=cdarray[i];
+           if (needcomma)
+               output.println(",");
+           needcomma=true;
+           if (cn.getSuperDesc()!=null) {
+               ClassDescriptor cdsuper=cn.getSuperDesc();
+               output.print(cdsuper.getId());
+           } else
+               output.print("-1");
+       }
+       output.println("};");
+    }
+
+    /** Force consistent field ordering between inherited classes. */
 
     private void printClassStruct(ClassDescriptor cn, PrintWriter classdefout) {
        ClassDescriptor sp=cn.getSuperDesc();
@@ -1216,7 +1238,7 @@ public class BuildCode {
     private void generateFlatCastNode(FlatMethod fm, FlatCastNode fcn, PrintWriter output) {
        /* TODO: Do type check here */
        if (fcn.getType().isArray()) {
-           ;
+           throw new Error();
        } else if (fcn.getType().isClass())
            output.println(generateTemp(fm,fcn.getDst())+"=(struct "+fcn.getType().getSafeSymbol()+" *)"+generateTemp(fm,fcn.getSrc())+";");
        else
index af5c038c7d925e869e8df3846cadcf92d199100d..cda51f7814c4639af4a5a4beea815d45923efadc 100644 (file)
@@ -13,6 +13,8 @@ import IR.TypeUtil;
 
 public class Main {
 
+    /** Main method for the compiler.  */
+
   public static void main(String args[]) throws Exception {
       String ClassLibraryPrefix="./ClassLibrary/";
       State state=new State();
@@ -86,6 +88,8 @@ public class Main {
       bc.buildCode();
       System.exit(0);
   }
+
+    /** Reads in a source file and adds the parse tree to the state object. */
     
     private static void readSourceFile(State state, String sourcefile) throws Exception {
        Reader fr = new BufferedReader(new FileReader(sourcefile));
index ca2c2c580fb78257f99516b58be3daa1bb2814e0..fdf5f80b6276b28328ae41d8929b3dab79dcfc05 100644 (file)
@@ -54,7 +54,9 @@ Parse/Parser.java Parse/Sym.java: Parse/java14.cup
 
 javadoc:
        mkdir javadoc
-       javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath .:./ClassLibrary -private -d javadoc Lex Util ClassLibrary IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Main ClassLibrary/*.java
+       javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Main 
 
 clean:
-       rm IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class -r javadoc
+       rm -r javadoc
+       rm IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class 
+
index c4ab01c79e905b07dcb309978f1834de0a91531d..0b97ee339fd4b20655cc10f458ff3e741036fe80 100644 (file)
@@ -282,7 +282,7 @@ void * mygcmalloc(struct garbagelist * stackptr, int size) {
     collect(stackptr);
 
     /* Update stat on previous gc size */
-    lastgcsize=to_heapptr-to_heapbase;
+    lastgcsize=(to_heapptr-to_heapbase)+size;
 
     /* Flip to/curr heaps */
     {
@@ -299,7 +299,10 @@ void * mygcmalloc(struct garbagelist * stackptr, int size) {
       curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(curr_heaptop-curr_heapbase);
       to_heapptr=to_heapbase;
       
-      //XXXXX Need check here in case we allocate a really big object
+      /* Not enough room :(, redo gc */
+      if (curr_heapptr>curr_heapgcpoint)
+       return mygcmalloc(stackptr, size);
+      
       bzero(tmp, curr_heaptop-tmp);
       return tmp;
     }