[Soot-list] Soot Wishlist

Aaloan Miftah aaloanmiftah at yahoo.com
Thu Jan 5 10:24:41 EST 2012


Hi,

First a patch,
Index: AbstractFloatBinopExpr.java
===================================================================
--- AbstractFloatBinopExpr.java(revision 3612)
+++ AbstractFloatBinopExpr.java(working copy)
@@ -38,23 +38,24 @@
     {
         Value op1 = op1Box.getValue();
         Value op2 = op1Box.getValue();
-
-        if((op1.getType().equals(IntType.v()) || 
-            op1.getType().equals(ByteType.v()) ||
-            op1.getType().equals(ShortType.v()) ||
-            op1.getType().equals(CharType.v()) ||
-            op1.getType().equals(BooleanType.v())) &&
-           (op2.getType().equals(IntType.v()) ||
-            op2.getType().equals(ByteType.v()) ||
-            op2.getType().equals(ShortType.v()) ||
-            op2.getType().equals(CharType.v()) ||
-            op2.getType().equals(BooleanType.v())))
+Type op1t = op1.getType();
+Type op2t = op2.getType();
+        if((op1t.equals(IntType.v()) || 
+            op1t.equals(ByteType.v()) ||
+            op1t.equals(ShortType.v()) ||
+            op1t.equals(CharType.v()) ||
+            op1t.equals(BooleanType.v())) &&
+           (op2t.equals(IntType.v()) ||
+            op2t.equals(ByteType.v()) ||
+            op2t.equals(ShortType.v()) ||
+            op2t.equals(CharType.v()) ||
+            op2t.equals(BooleanType.v())))
           return IntType.v();
-        else if(op1.getType().equals(LongType.v()) || op2.getType().equals(LongType.v()))
+        else if(op1t.equals(LongType.v()) || op2t.equals(LongType.v()))
           return LongType.v();
-        else if(op1.getType().equals(DoubleType.v()) || op2.getType().equals(DoubleType.v()))
+        else if(op1t.equals(DoubleType.v()) || op2t.equals(DoubleType.v()))
           return DoubleType.v();
-        else if(op1.getType().equals(FloatType.v()) || op2.getType().equals(FloatType.v()))
+        else if(op1t.equals(FloatType.v()) || op2t.equals(FloatType.v()))
           return FloatType.v();
         else
           return UnknownType.v();

This patch fixes numerous recursive calls with large grimple statements when getType() is called (namely when writing Jasmin/class files from grimple bodies), e.g.
return op1+op2*op4+op5/op8+44+op32 ... etc

Now for the wishlist,
1. A class transformer (there is a body transformer, and a scene transformer already, but no class transformer). This is useful for when you want to transform different members of classes based on the members declared. Granted we could use SceneTransformer, but to add such a transformer to an available pack would require us to enable whole program mode (which we don't really need/takes too much time). It would also be nice if there were 2 packs available by default in soot for such transformers, one that is ran _before_ whole-program transformers and one that is ran _after_ body transformers.
2. Pre jimple body creation pack. This pack would be ran before a jimple body is parsed through the jb phase. This is important if we want to apply transformations before the jb phase.
3. If this wish is granted, than the previous two don't have to be. Ability to add our own packs, and insert them before/after other packs. I noticed we couldn't add to the jimple body pack, which was kind of disappointing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120105/87badaef/attachment-0001.html 


More information about the Soot-list mailing list