[Soot-list] Why JSubExpr if Jimple does not have subexpression?

Patrick Lam p.lam at ece.uwaterloo.ca
Fri Jul 6 07:19:40 EDT 2012


Subtraction from a constant is probably not the interesting thing. 
That's easy to convert back to a SubExpr if you want anyway. I'd bet 
that javac/Soot doen't convert subtractions from integer values to AddExprs.

pat

On 07/06/2012 03:29 AM, Eric Bodden wrote:
> Hmmm, interesting. Maybe the compiler just compiles the code that way
> (for whatever reason). I would be surprised if Soot actually did this
> conversion. Anyway - does it hurt?
>
> Eric
>
> On 6 July 2012 07:32, Z<zell08v at orange.fr>  wrote:
>> Thanks Eric.
>>
>> In the following, I show 2 different versions of jimple files generated
>> within my Eclipse. They are output to the same sootOutput directory, with
>> the same file name "tester.Snippet.Jimple" . But the 2nd one seems to
>> transform each SubExpr "x-1" to AddExpr "x+ -1" . Am I doing something wrong
>> here? Thank you for your help.
>>
>> Zell.
>>
>> ---------My original test4() method in tester.Snippet.java is------------
>>      static void test4() {
>>          int y;
>>          y = 7;
>>          y = y+1;
>>          y= y-1;
>>      }
>>
>> -------This  following one is generated by right-clicking the java source,
>> then SOOT->process SOOT File->create Jimple ---------------
>>      static void test4()
>>      {
>>          int y, temp$0, temp$1, temp$2, temp$3;
>>
>>          temp$0 = 7;
>>          y = temp$0;
>>          temp$1 = y;
>>          temp$2 = temp$1 + 1;
>>          y = temp$2;
>>          temp$3 = y - 1;
>>          y = temp$3;
>>          return;
>>      }
>>
>> ---------------This following  one is launched by this  main() in Java:
>> " ...main(String[] args) {  args="-f J tester.Snippet".split(" "); ...
>> soot.Main.main(args);}" -------------
>>
>>      static void test4()
>>      {
>>          byte b0;
>>          int i1, i2;
>>
>>          b0 = 7;
>>          i1 = b0 + 1;
>>          i2 = i1 + -1;
>>          return;
>>
>>      }
>>
>> On Wed, Jul 4, 2012 at 10:34 AM, Eric Bodden<eric.bodden at ec-spride.de>
>> wrote:
>>>
>>>> Apparently, Jimple transforms all the expressions like "x = y - 7 " to "
>>>> z =
>>>> y +  (-7)",
>>>
>>> I don't think it does - at least not if you process bytecode.
>>
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>
>
>



More information about the Soot-list mailing list