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

Re: bug in generating variable names




--- Patrick LAM <plam@sable.mcgill.ca> wrote:

<snip>

> On Fri, 8 Jun 2001, Florin Mateoc wrote:
> 
> > I would like to ask something related to my
> > experiment: the jimple output files kept improving
> > with every iteration. Do you have an idea why (I
> mean
> > why didn't the first pass find these
> jimple-specific
> > optimization opportunities)?
> 
> I'm quite surprised by your finding, especially
> because you're not using
> whole-program optimization (-W).  Soot shouldn't be
> doing anything
> nontrivial with just -O, and certainly not anything
> that doesn't show up
> in the first pass.  Can you show me an example?
 

Here is an example of what was happening in soot 1.2.1
and 1.2.2, from gnu.getopt.Getopt.jimple, in the
method protected void exchange(java.lang.String[])

The "optimized" jimple representation after a
translation from .class to .jimple looks like:     

     label1:
        $cseTmp1 = i0 + i4;
        r2 = r1[$cseTmp1];
        $i10 = i2 - $cseTmp3;
        $i11 = $i10 + i4;
        $r3 = r1[$i11];
        r1[$cseTmp1] = $r3;
        $i13 = i2 - $cseTmp3;
        $i14 = $i13 + i4;
        r1[$i14] = r2;
        i4 = i4 + 1;


When run a second time (reading the previous .jimple
and outputting .jimple) we get:     

     label1:
        $cseTmp1 = i0 + i4;
        r2 = r1[$cseTmp1];
        $cseTmp0 = i2 - $cseTmp3;
        $i11 = $cseTmp0 + i4;
        $r3 = r1[$i11];
        r1[$cseTmp1] = $r3;
        $i14 = $cseTmp0 + i4;
        r1[$i14] = r2;
        i4 = i4 + 1;

When run a third time:


     label1:
        $cseTmp1 = i0 + i4;
        r2 = r1[$cseTmp1];
        $cseTmp0 = i2 - $cseTmp3;
        $cseTmp0 = $cseTmp0 + i4;
        $r3 = r1[$cseTmp0];
        r1[$cseTmp1] = $r3;
        r1[$cseTmp0] = r2;
        i4 = i4 + 1;


In the third case we have an additional subexpression
elimination, but also a manifestation of the bug that
started this thread, where what was previously $i11
(and $i14) was renamed to $cseTmp0 (already in use).
As you can see, this was not harmless.

Results from running with the new code will follow
shortly

Florin


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/