[Soot-list] Proper way to handle new statement in jimple

Eric Bodden eric.bodden at ec-spride.de
Wed Mar 7 04:36:55 EST 2012


Hi Shams.

The problem you report seems to be due to soem over-eager checking on
the side of BCEL. The following bytecode is certainly legal in terms
of the JVM spec:

>    0:   new   #9; //class Foo
>    3:   astore_1
>    4:   aload_1
>    5:   invokespecial   #2; //Method "<init>":()V

If you really do want to replace the astore/aload by a dup/astore you
can try enabling Soot's intra-procedural optimizations (-o) flag to
see if that does the trick. Otherwise you can implement a peephole
optimization that just recognizes this special pattern and replaces it
accordingly.

Cheers,
Eric


More information about the Soot-list mailing list