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

Original names; was: Assignment statement isn't parsing



The behavior I'm getting that bothers me really comes from a problem 
with the coffi package; the BodyTransformers are not responsible.

This is how I diagnosed it:

I used this source code:

public class A {
   void run() {
     int e = 0;
     e =  calc();
   }

   int calc() {
     return 0;
   }
}

I disabled every transformer and passed in the option 
'use-original-names' so that soot.coffi.Util would use faithful naming 
(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:

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;
     }

[ calc and <init> methods omitted because they're not relevant ]
}

Here is the bytecode for the run method as produced by javap -c:

Method void run()
    0 iconst_0
    1 istore_1
    2 aload_0
    3 invokevirtual #13 <Method int calc()>
    6 istore_1
    7 return

Note that the constant 0 and calc's return value are both assigned to 
local variable 1.  However, the first instance of local 1 is named e in 
the jimple representation, and the second instance is named l1.

-- 
Nathan Kitchen
kitchen@ee.byu.edu