[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fixed patch [Was: Soot typing failure]
Please forget the previous patch that had an obvious bug.
Here's the right patch to apply in the soot trunk:
https://svn.sable.mcgill.ca/soot/soot/trunk/src/soot/jimple/toolkits/typing
rev 1320
$ svn diff
Index: TypeNode.java
===================================================================
--- TypeNode.java (revision 1320)
+++ TypeNode.java (working copy)
@@ -450,11 +450,22 @@
{
if(type instanceof ArrayType ||
type instanceof NullType ||
- (type instanceof RefType))
+ type instanceof RefType)
{
return true;
}
return false;
}
+
+ public boolean isArray()
+ {
+ if(type instanceof ArrayType ||
+ type instanceof NullType)
+ {
+ return true;
+ }
+
+ return false;
+ }
}
Index: ConstraintChecker.java
===================================================================
--- ConstraintChecker.java (revision 1320)
+++ ConstraintChecker.java (working copy)
@@ -276,7 +276,7 @@
ArrayRef ref = (ArrayRef) l;
TypeNode base = hierarchy.typeNode(((Local) ref.getBase()).getType());
- if(!base.hasElement())
+ if(!base.isArray())
{
error("Type Error(16)");
}
@@ -342,16 +342,16 @@
ArrayRef ref = (ArrayRef) r;
TypeNode base = hierarchy.typeNode(((Local) ref.getBase()).getType());
- if(!base.hasElement())
+ if(!base.isArray())
{
- if(base == hierarchy.NULL)
- {
- return;
- }
-
error("Type Error(19): " + base + " is not an array type");
}
+ if(base == hierarchy.NULL)
+ {
+ return;
+ }
+
if(!left.hasDescendantOrSelf(base.element()))
{
if(fix)
@@ -696,7 +696,7 @@
if(le.getOp() instanceof Local)
{
- if(!hierarchy.typeNode(((Local) le.getOp()).getType()).hasElement())
+ if(!hierarchy.typeNode(((Local) le.getOp()).getType()).isArray())
{
error("Type Error(39)");
}
Have fun!
Etienne
Etienne Gagnon wrote:
Here's a patch to be applied in the following context:
$ svn info
Path:
URL:
https://svn.sable.mcgill.ca/soot/soot/trunk/src/soot/jimple/toolkits/typing
Repository UUID: 8cfe803f-38b8-0310-ad8c-c0bb4caa2ed3
Revision: 1320
Node Kind: directory
Schedule: normal
Last Changed Author: olhota
Last Changed Rev: 1320
Last Changed Date: 2003-11-22 19:21:47 -0500 (Sat, 22 Nov 2003)
Properties Last Updated: 2003-11-22 20:38:32 -0500 (Sat, 22 Nov 2003)
$ svn diff
Index: TypeNode.java
===================================================================
--- TypeNode.java (revision 1320)
+++ TypeNode.java (working copy)
@@ -450,11 +450,22 @@
{
if(type instanceof ArrayType ||
type instanceof NullType ||
- (type instanceof RefType))
+ type instanceof RefType)
{
return true;
}
return false;
}
+
+ public boolean isArray()
+ {
+ if(type instanceof ArrayType ||
+ type instanceof NullType)
+ {
+ return true;
+ }
+
+ return false;
+ }
}
Index: ConstraintChecker.java
===================================================================
--- ConstraintChecker.java (revision 1320)
+++ ConstraintChecker.java (working copy)
@@ -276,7 +276,7 @@
ArrayRef ref = (ArrayRef) l;
TypeNode base = hierarchy.typeNode(((Local)
ref.getBase()).getType());
- if(!base.hasElement())
+ if(!base.isArray())
{
error("Type Error(16)");
}
@@ -342,7 +342,7 @@
ArrayRef ref = (ArrayRef) r;
TypeNode base = hierarchy.typeNode(((Local)
ref.getBase()).getType());
- if(!base.hasElement())
+ if(!base.isArray())
{
if(base == hierarchy.NULL)
{
@@ -696,7 +696,7 @@
if(le.getOp() instanceof Local)
{
- if(!hierarchy.typeNode(((Local)
le.getOp()).getType()).hasElement())
+ if(!hierarchy.typeNode(((Local)
le.getOp()).getType()).isArray())
{
error("Type Error(39)");
}
Mainly, I added an explicit isArray() method that says YES for
null_type, as it should.
Etienne
--
Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/
SableVM: http://www.sablevm.org/
SableCC: http://www.sablecc.org/