[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Naming of Jimple Locals
Some transformations run only on stack locals by default. They have a
only-stack-locals phase option which specifies this. The convention is
that stack locals have a $ in them, while normal locals don't, and this
is how these transformations distinguish stack locals from normal
locals. If you want these transformations to run on all locals, you just
need to give them the phase option only-stack-locals:false.
I wouldn't recommend having multiple locals with the same name.
Ondrej
On Fri, May 30, 2003 at 08:22:04PM -0400, Amit Manjhi wrote:
> >
> > >
> > > You can even (although this
> > >is a pretty bad idea!) give the same name to different locals, and Soot
> > >should handle it correctly. But don't count on it!
> >
> > Actually, the naming business is nasty. It works most of the time, but
> > some of the built-in
> > optimizations index by name, and then break. (I seem to recall having this
> > difficulty with the ConstantPropagator, for instance. Fortunately, you can
> > run the
> > LocalNameStandardizer by hand to fix the names. It also doesn't work if
> > you write
> > to jimple and read back in, because jimple uses the string names for locals.
>
>
> Initially, I was also under the impression that having a $ or not
> does not make any difference in Jimple code. But, while debugging
> recently, I found out that having a $ while naming a new local
> produced the expected result, while not having one did not. (I was
> writing to jimple, modifying the code by introducing a new local by
> hand, and using soot to read the jimple file back in and produce the
> actual class file.)
>
> Unfortunately, I am not able to reproduce the bug now :). If it later
> comes back to haunt me, I will ask for help.
>
> thanks,
> -amit
>
> P.S.: What tools/JVMs exist to verify a classfile that output the offending
> instruction, if the verification fails (or produce a more
> understandable error output)?
>
>