forgot these two files
authorbdemsky <bdemsky>
Tue, 10 Apr 2007 10:40:09 +0000 (10:40 +0000)
committerbdemsky <bdemsky>
Tue, 10 Apr 2007 10:40:09 +0000 (10:40 +0000)
Robust/src/IR/Flat/FlatTagActionNode.java [new file with mode: 0644]
Robust/src/IR/Flat/TempTagPair.java [new file with mode: 0644]

diff --git a/Robust/src/IR/Flat/FlatTagActionNode.java b/Robust/src/IR/Flat/FlatTagActionNode.java
new file mode 100644 (file)
index 0000000..95afd20
--- /dev/null
@@ -0,0 +1,62 @@
+package IR.Flat;
+import IR.TagVarDescriptor;
+import java.util.Hashtable;
+import java.util.HashSet;
+import java.util.Iterator;
+
+public class FlatTagActionNode extends FlatNode {
+    Hashtable temptagpairs; 
+    int taskexit;
+    public static final int NEWOBJECT=0;
+    public static final int PRE=1;
+    public static final int TASKEXIT=2;
+
+
+    public FlatTagActionNode(int taskexit) {
+       temptagpairs=new Hashtable();
+       this.taskexit=taskexit;
+    }
+
+    public int getTaskType() {
+       return taskexit;
+    }
+
+    public void addTagAction(TempDescriptor td, TagVarDescriptor tvd, boolean status) {
+       TempTagPair ttp=new TempTagPair(td,tvd);
+       if (temptagpairs.containsKey(ttp)) {
+           throw new Error("Temp/Tag combination used twice: "+ttp);
+       }
+       temptagpairs.put(ttp, new Boolean(status));
+    }
+
+    public int kind() {
+        return FKind.FlatTagActionNode;
+    }
+    
+    /** This method returns an iterator over the Temp/Tag pairs. */
+    
+    public Iterator getTempTagPairs() {
+       return temptagpairs.keySet().iterator();
+    }
+
+    public boolean getTagChange(TempTagPair ttp) {
+       return ((Boolean)temptagpairs.get(ttp)).booleanValue();
+    }
+
+    public TempDescriptor [] readsTemps() {
+        if (temptagpairs.size()==0)
+            return new TempDescriptor [0];
+        else {
+           HashSet temps=new HashSet();
+           for(Iterator it=temptagpairs.keySet().iterator();it.hasNext();) {
+               TempTagPair ttp=(TempTagPair)it.next();
+               temps.add(ttp.getTemp());
+           }
+            return (TempDescriptor[]) temps.toArray(new TempDescriptor [temps.size()]);
+       }
+    }
+
+    public String toString() {
+       return "FlatTagActionNode";
+    }
+}
diff --git a/Robust/src/IR/Flat/TempTagPair.java b/Robust/src/IR/Flat/TempTagPair.java
new file mode 100644 (file)
index 0000000..c777a06
--- /dev/null
@@ -0,0 +1,37 @@
+package IR.Flat;
+import IR.TagVarDescriptor;
+
+public class TempTagPair {
+    TagVarDescriptor tvd;
+    TempDescriptor td;
+
+    public TempTagPair(TempDescriptor td, TagVarDescriptor tvd) {
+       this.tvd=tvd;
+       this.td=td;
+    }
+    public int hashCode() {
+       if (tvd!=null)
+           return tvd.hashCode()^td.hashCode();
+       else
+           return td.hashCode();
+    }
+
+    public TempDescriptor getTemp() {
+       return td;
+    }
+
+    public TagVarDescriptor getTag() {
+       return tvd;
+    }
+
+    public boolean equals(Object o) {
+       if (!(o instanceof TempTagPair))
+           return false;
+       TempTagPair ttp=(TempTagPair)o;
+       return ttp.tvd==tvd&&(ttp.td==td);
+    }
+
+    public String toString() {
+       return "<"+tvd+","+td+">";
+    }
+}