[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loop identification



The structure of the Jimple code depends on the structure of the
original bytecode, which can be arbitrary. If you restrict yourself to
javac-generated bytecode, you may be able to make some assumptions, but
I don't know which ones.

In general, the problem of restructuring loops is quite complicated. I
suggest reading the Control Flow Analysis chapter in the Muchnick book
(Advanced Compiler Design and Implementation). For something more
specific to Soot, Jerome Miecznikowski's master's thesis talks a lot
about loop restructuring, and you may also find some of his related
papers useful (all at http://www.sable.mcgill.ca/publications/).
In fact, maybe the Dava representation that he creates in Soot may be
more appropriate for your application than Jimple.

Ondrej

On Fri, Aug 22, 2003 at 10:53:41AM +0200, Richard Stahl wrote:
> Hello,
> 
> I am interested in identification of loops in the Jimple. I have found 
> out that it has a simple pattern you use to create an iterative 
> behaviour. the pattern look more or less like:
> 
> label0:
>    do sth;
>    ...
> 
> label1:                         // begin nested loop
>    do sth else;
>    ...
> 
> label2:
>    $z0 = ...;
>    if $z0 != 0 goto label1;      // end nested loop
> 
>    ...
> 
> label3:
>    $z1 = ...;
>    if $z1 != 0 goto label0;
> 
>    ...
> 
> This looks quite convenient. My question is if i do not miss something, 
> some other situations which can occur?
> 
> Is it possible to have, for example, two different places with the 
> conditional branch to the same label or it is always only one for sure?
> 
> or:
> 
> Is there more convenient way to identify loops?
> 
> Thanks a lot.
> 
> Best regards,
> 
> Richard
>