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

newmultiarrays in Spark



Hello Soot-ers,

For the following test program,
in method foo(), Spark computes
the points-to set of the incoming
multiarray-typed parameter r0 (using
Jimple names) correctly:
  "AllocNode 1 Pair newmultiarray (int)[5][4],2 in method <ArrayTest: void main(java.lang.String[])>,"

But the temporary local r1 has no
points-to information computed.

I took a look at spark/builder/StandardParms
and put in some printlns in caseNewMultiArrayExpr
and saw that AllocNodes are indeed being created 
for both the 2-D multiarray and its 1-D sub-array:

  AllocNode 1 Pair newmultiarray (int)[5][4],2 in method <ArrayTest: void main(java.lang.String[])>,

  AllocNode 2 Pair newmultiarray (int)[5][4],1 in method <ArrayTest: void main(java.lang.String[])>,

And these seem to be linked in correctly
into the PAG.

So why doesn't Spark then use the assignment
r1 = r0[1] to compute that r1 will point 
to the second AllocNode?

Thanks,
Manoj


-------------------------------------

Java source:

class ArrayTest
{
  public static void main(String[] args)
  {
    int[][] ia;
    ia = new int[5][4];
    foo(ia);
  }

  static void foo(int[][] ja)
  {
     ja[1][3] = -2;
  }

}

-------------------------------------

Jimple output:

class ArrayTest extends java.lang.Object
{

    void <init>()
    {
        ArrayTest r0;

        r0 := @this: ArrayTest;
6
        specialinvoke r0.<java.lang.Object: void <init>()>();
        return;
    }

    public static void main(java.lang.String[])
    {
        java.lang.String[] r0;
        int[][] r1;

        r0 := @parameter0: java.lang.String[];
6
        r1 = newmultiarray (int)[5][4];
        staticinvoke <ArrayTest: void foo(int[][])>(r1);
        return;
    }

    static void foo(int[][])
    {
        int[][] r0;
        int[] $r1;

        r0 := @parameter0: int[][];
6
        $r1 = r0[1];
        $r1[3] = -2;
        return;
    }
}

-------------------------------------