[Soot-list] Disable Jimple unused variable elimination process

Eric Bodden eric.bodden at uni-paderborn.de
Thu Oct 4 10:55:38 EDT 2018


Hi again.

This is strange, especially because Soot normally generates Shimple from the Jimple representation. Hence, if the variable is not present in Jimple, how can it show up in Shimple? I actually wonder whether it’s somehow reintroduced by the value numbering that occurs during the SSA generation.

To be sure about the bytecode, would you mind using “javac” to inspect the .class file to see whether “a” is present there?

Cheers
Eric

> On 2. Oct 2018, at 17:07, 陳日揚 <t106598014 at ntut.org.tw> wrote:
> 
> Hi Eric,
> 
> Thanks for your reply!
> I've tried to output Shimple format instead of Jimple, and I found that the unused local variable's information was still retained in Shimple format("i0" for the following example).
> So I think those variables are not thrown away by the compiler.
> 
> Here are the bytecode and the Shimple code of the previous example:
> 
> Bytecode:
> public void foo();
>    Code:
>       0: aload_0
>       1: invokespecial #2                  // Method method1:()I
>       4: istore_1
>       5: return
> 
> Shimple code:
> public void foo()
> {
>     X r0;
>     int i0;
> 
>     r0 := @this;
> 
>     i0 = specialinvoke r0.method1();
> 
>     return;
> }
> 
> Thank you for your help!
> 
> Best regard,
> Andy
> 
> Eric Bodden <eric.bodden at uni-paderborn.de> 於 2018年10月2日 週二 下午10:16寫道:
> Hi Andy.
> 
> Are you sure that those variables are actually not already thrown away by the compiler? I would think so, actually. If so, then obviously Soot has no way to recover them, except if you analyze the source code.
> 
> Cheers
> Eric
> 
> > On 26. Sep 2018, at 15:42, 陳日揚 <t106598014 at ntut.org.tw> wrote:
> > 
> > Hi,
> > 
> > I want to do some analyses in BodyTransformer for Jimple code which was transformed from .class files. It seems that Soot've done some optimizations like eliminating unused variables in Jimple Body Creation phase. I'm wondering can I disable such elimination process so that I can get unused variables' informations in Jimple code.
> > 
> > I've tried disable "Unused Local Eliminator" and "Dead Assignment Eliminator" commandline options("-p jb.ulp enabled:false -p jb.dae enabled:false"), but the input program below still output Jimple code without variable "a"'s information.
> > 
> > Java source code(compile to .class file before running Soot):
> > public void foo() {        
> >     int a = method1();
> > }
> > 
> > Output Jimple code:
> > public void foo() {
> >           X r0;
> >           r0 := @this: X;
> >           specialinvoke r0.<X: int method1()>();
> >           return;    
> >  }
> > 
> > Thanks a lot !
> > 
> > Best regard,
> > Andy
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at CS.McGill.CA
> > https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
> 



More information about the Soot-list mailing list