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

Re: Original names; was: Assignment statement isn't parsing



Hi all,

What I've said may not be fully correct, but I believe the code in
LocalVariableTable_attribute.java (line 77)
should be consistant with code in soot/Util/Coffi.java between line 1043
to 1047. Any suggestion?

  1034      static Local getLocalForIndex(JimpleBody listBody, int index)
  1035      {
  1036          String name = null;
  1037          boolean assignedName = false;
  1038
  1039          if(useFaithfulNaming && activeVariableTable != null)
  1040          {
  1041              if(activeOriginalIndex != -1)
  1042              {
  1043                  if(isLocalStore)
  1044                      activeOriginalIndex++;
  1045                  if(isWideLocalStore)
  1046                      activeOriginalIndex++;
  1047
  1048                  name =
activeVariableTable.getLocalVariableName(activeConstantPool,
  1049                      index, activeOriginalIndex);

>     77                (code>=e.start_pc && code<e.start_pc+e.length))) {

Cheers,
===========================================================
Feng Qian                             fqian@sable.mcgill.ca

On Sun, 3 Mar 2002, Feng QIAN wrote:

> Nathan,
>
> I believe the problem was caused by following code
>     74           e = local_variable_table[i];
>     75           if (e.index==idx &&
>     76               (code==-1 ||
>     77                (code>=e.start_pc && code<e.start_pc+e.length))) {
>
> Line 77 should be a bug, because according to the spec, the interval
> should be [start_pc, start_pc+length] inclusively. So changing the line
> 77 to:
>  new 77               (code>=e.start_pc && code<=e.start_pc+e.length))) {
>                     /* [start_pc, start_pc+length] should be inclusive */
>
> This will fix the bug in your example, and hopefully it will fix your other
> programs as well.
>
> Cheers,
> ===========================================================
> Feng Qian                             fqian@sable.mcgill.ca
>
> On Sat, 2 Mar 2002, Nathan Kitchen wrote:
>
> > I didn't miss Pat's email about the splitter.  The 'verbatim' option
> > subsumes 'no-splitting' and a slew of others, because it prevents _any_
> > BodyTransformers, including LocalSplitter, from transforming the body.
> > At least that's what I see in the source code that I have.
> >
> > About the output being wrong:  The real reason I'm making such a fuss
> > about this is because I'm trying very hard to keep the original variable
> > names.  I realize that I won't always be able to do that, because the
> > info won't always be in the class files that I parse.  However, I don't
> > believe that that justifies my failure to get the results I want in this
> > case.  This is what I want to see with the command line below:
> >
> > void run()
> > {
> >     .unknown this, $stack0, e;
> >
> >     this := @this;
> >     $stack0 = 0;
> >     e = $stack0;
> >     $stack0 = this;
> >     $stack0 = $stack0.calc();
> >     e = $stack0;  // This line is the key.
> >     return;
> > }
> >
> > Navindra Umanee wrote:
> > >>(command line: java soot.Main --soot-classpath
> > >>.:$JAVA_HOME/jre/lib/rt.jar -p jb use-original-names -p jb verbatim -j
> > >>A).  This is the result I get:
> > >>
> > >
> > > I think you missed Pat's email about the splitter.  I added "-p jb
> > > no-splitting" and it seemed to produce the desired output.  Either
> > > way, I'm not sure I see what the problem was with the original
> > > output...
> > >
> > >
> > >>public class A extends java.lang.Object
> > >>{
> > >>     void run()
> > >>     {
> > >>         .unknown this, $stack0, e, l1;
> > >>
> > >>         this := @this;
> > >>         $stack0 = 0;
> > >>         e = $stack0;
> > >>         $stack0 = this;
> > >>         $stack0 = $stack0.calc();
> > >>         l1 = $stack0;
> > >>         return;
> > >>     }
> > >>
> > --
> > Nathan Kitchen
> > kitchen@ee.byu.edu
> >
>