[Soot-list] Doubt in Pointers Analysis Result

Saswat Anand saswat at cc.gatech.edu
Thu Oct 28 12:26:04 EDT 2004


> I am confused by your question. The subject of your message mentions
> "Pointers Analysis", but the purported problem that you are describing
> is with the side-effect analysis, not the points-to analysis.

I am very sorry for the misleading subject. The result I am refering to is
infact from the side-effect analysis. Since side-effect analysis is just an
interface to points-to result, I  wrote that. But I apologize.

> A side-effect analysis, using the may point-to knowledge that x in fun1
> cannot be aliased to y in fun2, should be able to determine that the
> call to fun1 will not modify the member field that was written in the
> statement "y.member = z". The side-effect analysis in Soot did indeed
> determine this for me (using Spark points-to information) when I made a
> class out of your example and ran it through the analysis.
>
> Even if a may side-effect analysis could not determine this, it would be
> imprecise but not unsafe.

You are right. It would safe, but it would be more imprecise that what one
should expect from a context-insensitive analysis  (according to my
understanding).

Thanks,
Saswat

I am using the following programs:

import soot.*;
import java.util.*;
import soot.jimple.toolkits.pointer.*;
import soot.jimple.*;

public class Checker extends BodyTransformer{
    private PASideEffectTester sideEffectTester = null;

    public Checker(){}

    protected void internalTransform(
            Body b, String phaseName, Map options)
    {
 if( sideEffectTester == null )
     sideEffectTester = new PASideEffectTester();

 if( ! b.getMethod().getDeclaringClass().isApplicationClass() )
     return;

 System.out.println("Method : " + b.getMethod().getName());
 sideEffectTester.newMethod( b.getMethod() );

 ArrayList set = new ArrayList();
 Iterator sIt = b.getUnits().iterator();

        while( sIt.hasNext() ) {

            Stmt s = (Stmt) sIt.next();

     if( s instanceof DefinitionStmt && !( s instanceof IdentityStmt ) ) {
  Value lhs = ( (DefinitionStmt) s ).getLeftOp();
  if( lhs instanceof InstanceFieldRef )
      set.add( lhs );
     }

     if( ! s.containsInvokeExpr() ) continue;

     for( Iterator it = set.iterator(); it.hasNext(); ){
  Value v = (Value) it.next();
  if( sideEffectTester.unitCanWriteTo( s, v ) )
      System.out.println( "\t" + v );
     }
 }

    }
}

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

import soot.*;
import java.io.*;

public class Main{
    public static void main(String[] args)
    {

 PackManager.v().getPack("jtp").add( new Transform( "jtp.chk", new
Checker() ) );
 soot.Main.main( args );
    }
}

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

public class Test14{
    Test14 m;

    public void fun1( Test14 x )
    {
 Test14 y = new Test14();
 y.m = new Test14();
    }

    public void fun2()
    {
 Test14 x = new Test14();
 x.m = new Test14();
 fun1( new Test14() );
    }

    public static void main(String[] arg)
    {
 Test14 a = new Test14();
 a.fun2();
    }
}



More information about the Soot-list mailing list