projects
/
IRC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0832f5e
)
add support for super calls...ie...super.foo()
author
bdemsky
<bdemsky>
Sat, 26 Mar 2011 02:35:36 +0000
(
02:35
+0000)
committer
bdemsky
<bdemsky>
Sat, 26 Mar 2011 02:35:36 +0000
(
02:35
+0000)
Robust/src/Analysis/Pointer/Pointer.java
patch
|
blob
|
history
Robust/src/IR/Flat/BuildCode.java
patch
|
blob
|
history
Robust/src/IR/Flat/BuildFlat.java
patch
|
blob
|
history
Robust/src/IR/Flat/FlatCall.java
patch
|
blob
|
history
Robust/src/IR/Tree/MethodInvokeNode.java
patch
|
blob
|
history
Robust/src/IR/Tree/SemanticCheck.java
patch
|
blob
|
history
diff --git
a/Robust/src/Analysis/Pointer/Pointer.java
b/Robust/src/Analysis/Pointer/Pointer.java
index 3e30f2c44aa88b399c03950c1efc4e4b672fe3f5..8deb3b2252a7c0564d8d4896651f92a56f0cfb26 100644
(file)
--- a/
Robust/src/Analysis/Pointer/Pointer.java
+++ b/
Robust/src/Analysis/Pointer/Pointer.java
@@
-655,7
+655,7
@@
public class Pointer implements HeapAnalysis{
TempDescriptor tmpthis=fcall.getThis();
MethodDescriptor md=fcall.getMethod();
HashSet<MethodDescriptor> targets=new HashSet<MethodDescriptor>();
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
targets.add(md);
} else {
//Compute Edges
@@
-714,6
+714,10
@@
public class Pointer implements HeapAnalysis{
returnDelta=new Delta(null, false);
Vector<FlatNode> exitblocknodes=block.getExit().nodes();
FlatExit fexit=(FlatExit)exitblocknodes.get(exitblocknodes.size()-1);
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));
buildInitDelta(graphMap.get(fexit), returnDelta);
if (!returnDelta.heapedgeadd.isEmpty()||!returnDelta.heapedgeremove.isEmpty()||!returnDelta.varedgeadd.isEmpty()) {
returnDelta.setBlock(new PPoint(callblock, callindex));
diff --git
a/Robust/src/IR/Flat/BuildCode.java
b/Robust/src/IR/Flat/BuildCode.java
index 39ff5ba7c196f8c300a132fc73fa0c63a7b90de4..f6803b08ca0f47586c75ac05ac1e380dd5318f62 100644
(file)
--- a/
Robust/src/IR/Flat/BuildCode.java
+++ b/
Robust/src/IR/Flat/BuildCode.java
@@
-2523,7
+2523,7
@@
public class BuildCode {
output.print(generateTemp(fm,fc.getReturnTemp())+"=");
/* Do we need to do virtual dispatch? */
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 {
//no
output.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+mdstring);
} else {
diff --git
a/Robust/src/IR/Flat/BuildFlat.java
b/Robust/src/IR/Flat/BuildFlat.java
index 148f089a0b678b9fe10b54b34717e6b0c4be07ed..14987216e5fafdb17afda6269161b89317425fb1 100644
(file)
--- a/
Robust/src/IR/Flat/BuildFlat.java
+++ b/
Robust/src/IR/Flat/BuildFlat.java
@@
-524,9
+524,9
@@
public class BuildFlat {
FlatCall fc;
if(md.getReturnType()==null||md.getReturnType().isVoid())
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
else
- fc=new FlatCall(md, out_temp, thisarg, temps);
+ fc=new FlatCall(md, out_temp, thisarg, temps
, min.getSuper()
);
fc.setNumLine(min.getNumLine());
fc.setNumLine(min.getNumLine());
diff --git
a/Robust/src/IR/Flat/FlatCall.java
b/Robust/src/IR/Flat/FlatCall.java
index f2ca858ea6a2a932961a991cde20a1d486f51e29..be50e3609722c6ae94727b660ee0016c9be29ee6 100644
(file)
--- a/
Robust/src/IR/Flat/FlatCall.java
+++ b/
Robust/src/IR/Flat/FlatCall.java
@@
-6,12
+6,18
@@
public class FlatCall extends FlatNode {
TempDescriptor this_temp;
TempDescriptor dst;
MethodDescriptor method;
TempDescriptor this_temp;
TempDescriptor dst;
MethodDescriptor method;
+ boolean isSuper;
public FlatCall(MethodDescriptor md, TempDescriptor dst, TempDescriptor this_temp, TempDescriptor[] args) {
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.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++)
}
public void rewriteUse(TempMap t) {
for(int i=0;i<args.length;i++)
@@
-30,6
+36,9
@@
public class FlatCall extends FlatNode {
return new FlatCall(method, ndst, nthis, nargs);
}
return new FlatCall(method, ndst, nthis, nargs);
}
+ public boolean getSuper() {
+ return isSuper;
+ }
public MethodDescriptor getMethod() {
return method;
public MethodDescriptor getMethod() {
return method;
diff --git
a/Robust/src/IR/Tree/MethodInvokeNode.java
b/Robust/src/IR/Tree/MethodInvokeNode.java
index 8c9bcd79a185cc3a745738a3be36227322fd25e9..7fbe7f67a6ef0a4e4c595a98a62923a1a15b4e65 100644
(file)
--- a/
Robust/src/IR/Tree/MethodInvokeNode.java
+++ b/
Robust/src/IR/Tree/MethodInvokeNode.java
@@
-10,6
+10,7
@@
public class MethodInvokeNode extends ExpressionNode {
NameDescriptor basename;
ExpressionNode en;
MethodDescriptor md;
NameDescriptor basename;
ExpressionNode en;
MethodDescriptor md;
+ boolean isSuper;
public MethodInvokeNode(NameDescriptor name) {
methodid=name.getIdentifier();
public MethodInvokeNode(NameDescriptor name) {
methodid=name.getIdentifier();
@@
-19,6
+20,7
@@
public class MethodInvokeNode extends ExpressionNode {
argumentlist=new Vector();
en=null;
md=null;
argumentlist=new Vector();
en=null;
md=null;
+ isSuper=false;
}
public MethodInvokeNode(String methodid, ExpressionNode exp) {
}
public MethodInvokeNode(String methodid, ExpressionNode exp) {
@@
-27,6
+29,15
@@
public class MethodInvokeNode extends ExpressionNode {
argumentlist=new Vector();
md=null;
this.basename=null;
argumentlist=new Vector();
md=null;
this.basename=null;
+ isSuper=false;
+ }
+
+ public void setSuper() {
+ isSuper=true;
+ }
+
+ public boolean getSuper() {
+ return isSuper;
}
public NameDescriptor getBaseName() {
}
public NameDescriptor getBaseName() {
diff --git
a/Robust/src/IR/Tree/SemanticCheck.java
b/Robust/src/IR/Tree/SemanticCheck.java
index cc4e04636bdaf5f7d4275ac80af2a05a00ab40eb..9b68aa0bedd03c8b3c8324715d47f34686563dd8 100644
(file)
--- a/
Robust/src/IR/Tree/SemanticCheck.java
+++ b/
Robust/src/IR/Tree/SemanticCheck.java
@@
-1155,6
+1155,7
@@
NextMethod:
if (rootname.equals("super")) {
ClassDescriptor supercd=((MethodDescriptor)md).getClassDesc().getSuperDesc();
typetolookin=new TypeDescriptor(supercd);
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());
} else if (rootname.equals("this")) {
if(isstatic) {
throw new Error("use this object in static method md = "+ md.toString());