more bugs
authorbdemsky <bdemsky>
Thu, 8 Nov 2007 08:47:44 +0000 (08:47 +0000)
committerbdemsky <bdemsky>
Thu, 8 Nov 2007 08:47:44 +0000 (08:47 +0000)
Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java
Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java
Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java
Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java
Robust/src/IR/Flat/BuildCode.java

index f1cbdb210583c51b0272f6ea3a47e1ae0b4f57bc..8cb134968b4202dd16397e0787466674fd275c70 100644 (file)
@@ -62,6 +62,10 @@ public class SafetyAnalysis {
        return fstotimap.get(fs).get(new TaskIndex(td, index));
     }
 
+    public Set<OptionalTaskDescriptor> getOptions(FlagState fs, TaskIndex ti) {
+       return fstotimap.get(fs).get(ti);
+    }
+
     public Set<TaskIndex> getTaskIndex(FlagState fs) {
        return fstotimap.get(fs).keySet();
     }
@@ -168,13 +172,15 @@ public class SafetyAnalysis {
                else
                    setotd=new HashSet<OptionalTaskDescriptor>();
            }
-
-           TaskIndex ti=new TaskIndex(egnode.getTD(), egnode.getIndex());
-           if (timap.containsKey(ti)) {
-               //AND case
-               timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor()));
-           } else {
-               timap.put(ti, setotd);
+           TaskIndex ti=egnode.isRuntime()?new TaskIndex():new TaskIndex(egnode.getTD(), egnode.getIndex());
+           if (!ti.runtime) {
+               //runtime edges don't do anything...don't have to take them, can't predict when we can.
+               if (timap.containsKey(ti)) {
+                   //AND case
+                   timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor()));
+               } else {
+                   timap.put(ti, setotd);
+               }
            }
        }
 
index 93840a162d7d3f565fd3f0f8fb5753bc79aff6f7..c33f759236dfad9104e85c9ddb3696ec5264d495 100644 (file)
@@ -46,7 +46,7 @@ public class TagAnalysis {
        for(int i=0;i<scc.numSCC();i++) {
            Set component=scc.getSCC(i);
            HashSet flagset=new HashSet();
-           for(Iterator compit=flagset.iterator();compit.hasNext();) {
+           for(Iterator compit=component.iterator();compit.hasNext();) {
                TagBinding tb=(TagBinding)compit.next();
                flagset.addAll(tb.getAllocations());
                for(Iterator edgeit=tb.edges();edgeit.hasNext();) {
@@ -55,7 +55,7 @@ public class TagAnalysis {
                    flagset.addAll(tb2.getAllocations());
                }
            }
-           for(Iterator compit=flagset.iterator();compit.hasNext();) {
+           for(Iterator compit=component.iterator();compit.hasNext();) {
                TagBinding tb=(TagBinding)compit.next();
                tb.getAllocations().addAll(flagset);
            }
@@ -90,6 +90,7 @@ public class TagAnalysis {
     }
 
 private void computeCallsFlags(FlatMethod fm, Hashtable parammap, Set tagbindings, Set newflags) {
+    System.out.println("   "+fm.getMethod());
     Set nodeset=fm.getNodeSet();
     for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) {
        FlatNode fn=(FlatNode)nodeit.next();
@@ -182,7 +183,7 @@ private void computeCallsFlags(FlatMethod fm, Hashtable parammap, Set tagbinding
     
     private void computeTagBindings(Set roots) {
        tovisit.addAll(roots);
-
+       
        for(Iterator it=roots.iterator();it.hasNext();) {
            TagBinding tb=(TagBinding)it.next();
            discovered.put(tb,tb);
index dd1c4c251cf4728f40181924cb19b39959202063..6f6eed0f59e48a7bcff7f7e44717694b92747132 100644 (file)
@@ -186,7 +186,7 @@ private void analyseTasks(FlagState fs) {
            continue;
        
        if (trigger_ctr>1)
-           throw new Error("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task.");
+           System.out.println("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task:"+fs + " in "+td);
        
        
        Set newstates=taganalysis.getFlagStates(td);
index 02b64190c7de2bd3f8353b48f6c44832c41e3996..84f21d0d047a3b66ac3f5f2614ca1a311a5bc4ca 100644 (file)
@@ -4,18 +4,33 @@ import IR.TaskDescriptor;
 public class TaskIndex {
     TaskDescriptor td;
     int index;
+    boolean runtime;
     public TaskIndex(TaskDescriptor td, int index) {
        this.td=td;
        this.index=index;
+       runtime=false;
+    }
+
+    public TaskIndex() {
+       runtime=true;
+    }
+
+    public boolean isRuntime() {
+       return runtime;
     }
 
     public int hashCode() {
+       if (runtime)
+           return 71;
        return td.hashCode()^index;
     }
 
     public boolean equals(Object o) {
        if (o instanceof TaskIndex) {
            TaskIndex ti=(TaskIndex) o;
+           if (ti.runtime==runtime)
+               return true;
+
            if (ti.index==index && ti.td==td)
                return true;
        }
index a4679e761bfcb0145af2f26358052056c83deb5f..91a96e578b5cc24b47bdd4cad9048306e0425fd3 100644 (file)
@@ -2366,7 +2366,10 @@ public class BuildCode {
                 Set<TaskIndex> tiset=sa.getTaskIndex(fs);
                 for(Iterator<TaskIndex> itti=tiset.iterator();itti.hasNext();) {
                     TaskIndex ti=itti.next();
-                    Set<OptionalTaskDescriptor> otdset=sa.getOptions(fs, ti.getTask(), ti.getIndex());
+                    if (ti.isRuntime())
+                        continue;
+
+                    Set<OptionalTaskDescriptor> otdset=sa.getOptions(fs, ti);
 
                     output.print("struct optionaltaskdescriptor * optionaltaskfailure_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+"_array[] = {");
                     boolean needcomma=false;
@@ -2389,9 +2392,14 @@ public class BuildCode {
 
                 tiset=sa.getTaskIndex(fs);
                 boolean needcomma=false;
+                int runtimeti=0;
                 output.println("struct taskfailure * taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+"[]={");
                 for(Iterator<TaskIndex> itti=tiset.iterator();itti.hasNext();) {
                     TaskIndex ti=itti.next();
+                    if (ti.isRuntime()) {
+                        runtimeti++;
+                        continue;
+                    }
                     if (needcomma)
                         output.print(", ");
                     needcomma=true;
@@ -2405,7 +2413,7 @@ public class BuildCode {
                 output.println("/*flag*/"+flagid+",");
                 output.println("/* number of tags*/"+tagcounter+",");
                 output.println("tags_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+",");
-                output.println("/* numtask failures */"+tiset.size()+",");
+                output.println("/* numtask failures */"+(tiset.size()-runtimeti)+",");
                 output.println("taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+",");
                 output.println("/* number of optionaltaskdescriptors */"+availabletasks.size()+",");
                 output.println("optionaltaskdescriptorarray_FS"+fscounter+"_"+cdtemp.getSafeSymbol());