[Soot-list] How can cancel other default optimization?

Jian Xu fightmyway at gmail.com
Mon Nov 10 09:33:11 EST 2008


Hi Eric:
Thank you for your reply.

I do instrumentation, and insert instrument one instruction into every
ExceptionalBlockGraph's node --- Block.
        PackManager.v().getPack("jtp").add(
                new Transform("jtp.instrumenter", Mystrument.v()));
        soot.Main.main();

when I implement my Mystrument, soot read body which is a parameter of
"*internalTransform(Body
b, String phaseName, Map options)*". I find the body is generated by javac
and not have optimized. At last, soot create new optimized bytecode. Of
course, this is the power of soot. because I insert instruction into every
Block, but at last the new bytecode optimized the Block. The jimple code
doesn't have any statement of that Block in the original bytecode, except my
instrument instruction. So this instrument instruction is useless and
strange.

*for example original code is*
Block 0:
statement 1
statement 2

Block 1:
statement 3

Block 2:
statement 4

*then do instrumentation and I expect the code generated at last is *
Block 0:
statement 1
statement 2
my instruction0

Block 1:
statement 3
my instruction1

Block 2:
statement 4
my instruction2

*but actually*
Block 0:
statement 1
statement 2
my instruction0
my instruction1

Block 1:
statement 4
my instruction2

so all the Block index change. And the " my instruction1" in the actual code
is useless. Is there a way to solve the problem?

Now I reach my goal by changing the bytecode created by javac first using
soot.
*So the original code above is like:*
Block 0:
statement 1
statement 2

Block 1:
statement 4

*the new code*
Block 0:
statement 1
statement 2
my instruction0

Block 1:
statement 4
my instruction1

Then every "my instruction " is useful. But you know when there are too many
bytecodes, this way is time consuming.








On Sun, Nov 9, 2008 at 10:25 PM, Eric Bodden <eric.bodden at mail.mcgill.ca>wrote:

> Hi Jian.
>
> This came up on the list just recently. See here:
>
> http://www.sable.mcgill.ca/pipermail/soot-list/2008-October/002012.html
>
> In a nutshell, you can disable most but not all optimizations, using
> phase options:
> http://www.sable.mcgill.ca/soot/tutorial/phase/index.html
>
>
> Eric
>
> 2008/11/9 Jian Xu <fightmyway at gmail.com>:
> > Hi:
> > I make instrument to bytecode, so I add my transfer object into "jtp"
> pack
> > then call Soot.Main.main() in my main function. But I find the bytecode
> > which generated by soot do more modification than my transfer object do.
> I
> > know when I call Soot.Main.main(), Soot do more optimization besides what
> I
> > want to. So is there one way to do my transfer only but don't do others?
> >
> > Regards
> > Jan
> >
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at sable.mcgill.ca
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >
> >
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University, Montréal, Canada
> Got an interesting job offer? http://www.bodden.de/hire-me/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081110/e3c3d6eb/attachment-0001.htm


More information about the Soot-list mailing list