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);
}
}
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");
}
}
+
+ 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);
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;
}