TempDescriptor tmpthis=fcall.getThis();
MethodDescriptor md=fcall.getMethod();
HashSet<MethodDescriptor> targets=new HashSet<MethodDescriptor>();
- if (md.isStatic()) {
+ if (md.isStatic()||fcall.getSuper()) {
targets.add(md);
} else {
//Compute Edges
returnDelta=new Delta(null, false);
Vector<FlatNode> exitblocknodes=block.getExit().nodes();
FlatExit fexit=(FlatExit)exitblocknodes.get(exitblocknodes.size()-1);
+ if (graphMap.get(fexit)==null) {
+ System.out.println(fcall);
+ System.out.println(fm);
+ }
buildInitDelta(graphMap.get(fexit), returnDelta);
if (!returnDelta.heapedgeadd.isEmpty()||!returnDelta.heapedgeremove.isEmpty()||!returnDelta.varedgeadd.isEmpty()) {
returnDelta.setBlock(new PPoint(callblock, callindex));
output.print(generateTemp(fm,fc.getReturnTemp())+"=");
/* Do we need to do virtual dispatch? */
- if (md.isStatic()||md.getReturnType()==null||singleCall(fc.getThis().getType().getClassDesc(),md)) {
+ if (md.isStatic()||md.getReturnType()==null||singleCall(fc.getThis().getType().getClassDesc(),md)||fc.getSuper()) {
//no
output.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring);
} else {
FlatCall fc;
if(md.getReturnType()==null||md.getReturnType().isVoid())
- fc=new FlatCall(md, null, thisarg, temps);
+ fc=new FlatCall(md, null, thisarg, temps, min.getSuper());
else
- fc=new FlatCall(md, out_temp, thisarg, temps);
+ fc=new FlatCall(md, out_temp, thisarg, temps, min.getSuper());
fc.setNumLine(min.getNumLine());
TempDescriptor this_temp;
TempDescriptor dst;
MethodDescriptor method;
+ boolean isSuper;
public FlatCall(MethodDescriptor md, TempDescriptor dst, TempDescriptor this_temp, TempDescriptor[] args) {
+ this(md, dst, this_temp, args, false);
+ }
+
+ public FlatCall(MethodDescriptor md, TempDescriptor dst, TempDescriptor this_temp, TempDescriptor[] args, boolean isSuper) {
this.method=md;
this.dst=dst;
this.this_temp=this_temp;
this.args=args;
+ this.isSuper=isSuper;
}
public void rewriteUse(TempMap t) {
for(int i=0;i<args.length;i++)
return new FlatCall(method, ndst, nthis, nargs);
}
+ public boolean getSuper() {
+ return isSuper;
+ }
public MethodDescriptor getMethod() {
return method;
NameDescriptor basename;
ExpressionNode en;
MethodDescriptor md;
+ boolean isSuper;
public MethodInvokeNode(NameDescriptor name) {
methodid=name.getIdentifier();
argumentlist=new Vector();
en=null;
md=null;
+ isSuper=false;
}
public MethodInvokeNode(String methodid, ExpressionNode exp) {
argumentlist=new Vector();
md=null;
this.basename=null;
+ isSuper=false;
+ }
+
+ public void setSuper() {
+ isSuper=true;
+ }
+
+ public boolean getSuper() {
+ return isSuper;
}
public NameDescriptor getBaseName() {
if (rootname.equals("super")) {
ClassDescriptor supercd=((MethodDescriptor)md).getClassDesc().getSuperDesc();
typetolookin=new TypeDescriptor(supercd);
+ min.setSuper();
} else if (rootname.equals("this")) {
if(isstatic) {
throw new Error("use this object in static method md = "+ md.toString());