TypeUtil typeUtil;
AllocFactory allocFactory;
LinkedList<Delta> toprocess;
+ TempDescriptor returntmp;
public Pointer(State state, TypeUtil typeUtil) {
this.state=state;
this.typeUtil=typeUtil;
this.allocFactory=new AllocFactory(state, typeUtil);
this.toprocess=new LinkedList<Delta>();
+ ClassDescriptor stringcd=typeUtil.getClass(TypeUtil.ObjectClass);
+ this.returntmp=new TempDescriptor("RETURNVAL", stringcd);
}
public BasicBlock getBBlock(FlatMethod fm) {
return delta;
}
- void doAnalysis() {
+ public void doAnalysis() {
toprocess.add(buildInitialContext());
while(!toprocess.isEmpty()) {
nodeGraph=graphMap.get(currNode);
delta=processNode(currNode, delta, nodeGraph);
}
- generateFinalDelta(delta, nodeGraph);
+ generateFinalDelta(bblock, delta, nodeGraph);
}
}
- void generateFinalDelta(Delta delta, Graph graph) {
+ void generateFinalDelta(BBlock bblock, Delta delta, Graph graph) {
Delta newDelta=new Delta(null, false);
if (delta.getInit()) {
//First compute the set of temps
/* Now we need to propagate newdelta */
if (!newDelta.heapedgeadd.isEmpty()||!newDelta.heapedgeremove.isEmpty()||!newDelta.varedgeadd.isEmpty()) {
/* We have a delta to propagate */
- BBlock curr=delta.getBlock();
- Vector<BBlock> blockvector=curr.next();
+ Vector<BBlock> blockvector=bblock.next();
for(int i=0;i<blockvector.size();i++) {
if (i==0) {
newDelta.setBlock(blockvector.get(i));
toprocess.add(newDelta.diffBlock(blockvector.get(i)));
}
}
-
}
}
return processFieldElementNode(node, delta, newgraph);
case FKind.FlatCastNode:
case FKind.FlatOpNode:
+ case FKind.FlatReturnNode:
return processCopyNode(node, delta, newgraph);
case FKind.FlatSetFieldNode:
case FKind.FlatSetElementNode:
return processSetFieldElementNode(node, delta, newgraph);
case FKind.FlatMethod:
- case FKind.FlatCall:
- case FKind.FlatReturnNode:
case FKind.FlatExit:
-
+ return processFlatNop(node, delta, newgraph);
+ case FKind.FlatCall:
case FKind.FlatSESEEnterNode:
case FKind.FlatSESEExitNode:
throw new Error("Unimplemented node:"+node);
FlatOpNode fon=(FlatOpNode) node;
src=fon.getLeft();
dst=fon.getDest();
+ } else if (node.kind()==FKind.FlatReturnNode) {
+ FlatReturnNode frn=(FlatReturnNode)node;
+ src=frn.getReturnTemp();
+ dst=returntmp;
} else {
FlatCastNode fcn=(FlatCastNode) node;
src=fcn.getSrc();
}
}
+ Delta processFlatNop(FlatNode node, Delta delta, Graph graph) {
+ applyDiffs(graph, delta);
+ return delta;
+ }
+
Delta processNewNode(FlatNew node, Delta delta, Graph graph) {
AllocNode summary=allocFactory.getAllocNode(node, true);
AllocNode single=allocFactory.getAllocNode(node, false);
import Analysis.Loops.*;
import Analysis.Liveness;
import Analysis.ArrayReferencees;
+import Analysis.Pointer.Pointer;
import IR.MethodDescriptor;
import IR.Flat.FlatMethod;
import Interface.*;
state.OWNERSHIPDEBUGCALLER=args[++i];
} else if (option.equals("-owndebugcallcount")) {
state.OWNERSHIPDEBUGCALLCOUNT=Integer.parseInt(args[++i]);
- }
-
- else if (option.equals("-disjoint"))
+ } else if (option.equals("-pointer")) {
+ state.POINTER=true;
+ } else if (option.equals("-disjoint"))
state.DISJOINT=true;
-
else if (option.equals("-disjoint-k")) {
state.DISJOINTALLOCDEPTH=Integer.parseInt(args[++i]);
}
}
}
+ if (state.POINTER) {
+ Pointer pointgraph=new Pointer(state, tu);
+ pointgraph.doAnalysis();
+ }
if (state.OPTIMIZE) {