[Soot-list] side effect analysis

Jochen Huck jochen.huck at student.kit.edu
Fri Nov 12 11:49:56 EST 2010


Hi,

I sorry for writing another mail but I've got a question regarding the 
results of the side effect analysis. My problem is that I don't really 
understand a certain result
(soot args: -w -annot-side-effect -xml-attributes -f J -p cg.spark 
enabled -p jb use-original-names:true -p jp 
preserve-source-annotations:true -keep- line-number -src-prec java -cp 
<myClassPath> -main-class <MyMainClass>). So I use the most precise 
points-to analysis.
I'll give an example:

public class Sample1 {

     (1) static int[][] m1 = getArray();
     (2) static int[][] m2 = getArray();

     public static void main(String[] args) {
         // empty
     }

     public static int[][] getArray() {
         int size = 100;

         int[][] array = new int[size][size];

         for (int i = 0; i < size; i++) {
             for (int j = 0; j < size; j++) {
                 array[i][j] = i+j;
             }
         }

         return array;
     }
}

Here the side effect analysis tells that (1) and (2) both write to a 
common Set. I really can't understand why there statements should write 
to a common location. If I remove the static keyword the analysis tells 
that (3) and (4) are not dependent at all.

public class Sample2 {

     (3) int[][] m1 = getArray();
     (4) int[][] m2 = getArray();

     public static void main(String[] args) {
         // empty
     }

     public static int[][] getArray() {
         int size = 100;

         int[][] array = new int[size][size];

         for (int i = 0; i < size; i++) {
             for (int j = 0; j < size; j++) {
                 array[i][j] = i+j;
             }
         }

         return array;
     }
}

Because of that I think that the result has something to do with the 
static initializer of the class Sample1. In jimple it looks like

     static void <clinit>()
     {
         int[][] temp$0, temp$1;

         temp$0 = staticinvoke <Sample1: int[][] getArray()>();
   (5) <matrix.MatrixSimple7: int[][] m1> = temp$0;
         temp$1 = staticinvoke <Sample1: int[][] getArray()>();
   (6) <Sample1: int[][] m2> = temp$1;
         return;
     }

And the analysis tells that (5) and (6) read and write the same location.




More information about the Soot-list mailing list