*** empty log message ***
authorbdemsky <bdemsky>
Thu, 29 Apr 2004 16:32:08 +0000 (16:32 +0000)
committerbdemsky <bdemsky>
Thu, 29 Apr 2004 16:32:08 +0000 (16:32 +0000)
Repair/RepairCompiler/MCC/IR/ArrayAnalysis.java
Repair/RepairCompiler/MCC/IR/Termination.java
Repair/RepairCompiler/MCC/IR/UpdateNode.java
Repair/RepairCompiler/MCC/IR/Updates.java

index ca142f7..dc5f289 100755 (executable)
@@ -156,6 +156,18 @@ public class ArrayAnalysis {
        SetDescriptor startset;
        VarDescriptor startvar;
 
+       public boolean isSet() {
+           return setStart;
+       }
+
+       public SetDescriptor getSet() {
+           return startset;
+       }
+
+       public VarDescriptor getVar() {
+           return startvar;
+       }
+
 
        public void startSet(SetDescriptor sd) {
            this.startset=sd;
index 465675c..2687f51 100755 (executable)
@@ -885,7 +885,7 @@ public class Termination {
                    System.out.println("ERROR:Index is assignable");
                    return false;
                }
-               Updates updates=new Updates(index,i,ap,slotnumber);
+               Updates updates=new Updates(index,i,ap,lexpr,slotnumber);
                un.addUpdate(updates);
            }
        }
index 7c0e5a4..d458382 100755 (executable)
@@ -356,6 +356,7 @@ class UpdateNode {
            if (u.getType()==Updates.ACCESSPATH) {
                VarDescriptor newright=VarDescriptor.makeNew("right");
                /* Need to do the modulo computation here...FIXME */
+               generate_accesspath(cr, right,newright,u);
                right=newright;
            }
            VarDescriptor left=VarDescriptor.makeNew("left");
@@ -432,6 +433,38 @@ class UpdateNode {
        }
     }
 
+
+    private void generate_accesspath(CodeWriter cr, VarDescriptor right, VarDescriptor newright, Updates u) {
+       Vector dotvector=new Vector();
+       Expr ptr=u.getRightExpr();
+
+       while(true) {
+           /* Does something other than a dereference? */
+           dotvector.add(ptr);
+           if (ptr instanceof DotExpr)
+               ptr=((DotExpr)ptr).left;
+           else if (ptr instanceof CastExpr)
+               ptr=((CastExpr)ptr).getExpr();
+
+           if (ptr instanceof VarExpr) {
+               /* Finished constructing vector */
+               break;
+           }
+       }
+       ArrayAnalysis.AccessPath ap=u.getAccessPath();
+       VarDescriptor init=VarDescriptor.makeNew("init");
+       if (ap.isSet()) {
+           cr.outputline("int "+init.getSafeSymbol()+"="+ap.getSet().getSafeSymbol()+"_hash->firstkey();")
+       } else {
+           init=ap.getVar();
+       }
+       for(int i=dotvector.size()-1;i>=0;i--) {
+           Expr e=(Expr)dotvector.get(i);
+           
+       }
+       
+    }
+
     private void generate_bindings(CodeWriter cr, String slot0, String slot1) {
        for(int i=0;i<bindings.size();i++) {
            Binding b=(Binding)bindings.get(i);
index 99694cd..acda79f 100755 (executable)
@@ -15,12 +15,12 @@ class Updates {
     ArrayAnalysis.AccessPath ap;
     int fieldnum;
 
-    public Updates(Expr lexpr, int fieldnum, ArrayAnalysis.AccessPath ap, int slot) {
+    public Updates(Expr lexpr, int fieldnum, ArrayAnalysis.AccessPath ap, Expr rexpr, int slot) {
        this.leftexpr=lexpr;
        this.fieldnum=fieldnum;
        this.ap=ap;
        this.rightposition=slot;
-
+       this.rightexpr=rexpr;
        this.type=Updates.ACCESSPATH;
        this.opcode=Opcode.EQ;
     }