checked in changes
authorbdemsky <bdemsky>
Thu, 3 Aug 2006 21:38:14 +0000 (21:38 +0000)
committerbdemsky <bdemsky>
Thu, 3 Aug 2006 21:38:14 +0000 (21:38 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/designnotes

index c4c2ac055824909ea55dcaebc1a015e358fea5cc..2eadde122134f71cfd03c466103f248ecdbb9244 100644 (file)
@@ -9,6 +9,7 @@ public class BuildCode {
     Hashtable paramstable;
     Hashtable tempstable;
     Hashtable fieldorder;
+    Hashtable flagorder;
     int tag=0;
     String localsprefix="___locals___";
     String paramsprefix="___params___";
@@ -25,6 +26,7 @@ public class BuildCode {
        paramstable=new Hashtable();    
        tempstable=new Hashtable();
        fieldorder=new Hashtable();
+       flagorder=new Hashtable();
        this.typeutil=typeutil;
        virtualcalls=new Virtual(state);
     }
@@ -141,6 +143,7 @@ public class BuildCode {
     }
 
     private int maxcount=0;
+    /** This function outputs the virtual dispatch tables for methods. */
 
     private void buildVirtualTables(PrintWriter outvirtual) {
        Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();
@@ -314,6 +317,39 @@ public class BuildCode {
        }
     }
 
+
+    /* Map flags to integers consistently between inherited
+     * classes. */
+
+    private void mapFlags(ClassDescriptor cn) {
+       ClassDescriptor sp=cn.getSuperDesc();
+       if (sp!=null)
+           mapFlags(sp);
+       int max=0;
+       if (!flagorder.containsKey(cn)) {
+           Hashtable flags=new Hashtable();
+           flagorder.put(cn,flags);
+           if (sp!=null) {
+               Hashtable superflags=(Hashtable)flagorder.get(sp);
+               Iterator superflagit=superflags.keySet().iterator();
+               while(superflagit.hasNext()) {
+                   FlagDescriptor fd=(FlagDescriptor)superflagit.next();
+                   Integer number=(Integer)superflags.get(fd);
+                   flags.put(fd, number);
+                   if (number.intValue()>max)
+                       max=number.intValue();
+               }
+           }
+           
+           Iterator flagit=cn.getFlags();
+           while(flagit.hasNext()) {
+               FlagDescriptor fd=(FlagDescriptor)flagit.next();
+               if (sp==null||!sp.getFlagTable().contains(fd.getSymbol()))
+                   flags.put(fd, new Integer(++max));
+           }
+       }
+    }
+
     /** This function outputs (1) structures that parameters are
      * passed in (when PRECISE GC is enabled) and (2) function
      * prototypes for the methods */
index eba714f0f91fac9360edbe252e248647ab7717d4..f0d2b3b389f650b6d564a966d0b793925aa80913 100644 (file)
@@ -81,3 +81,18 @@ task foo(type1 o1{role1||role2}, type2 o2{role3}) {
        
   exit(o1{role1'=false},o2{role3'=false},onew{role4=true});
 }
+----------------------------------------------------------------
+----------------------------------------------------------------
+
+Initial design:
+----------------------------------------------------------------
+
+Provide runtime with:
+1) List of tasks
+   a) Task names
+   b) Parameter types
+   c) Flag settings
+
+2) List of flags for each type
+
+3) Flag transition calls