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

Re: Spark Pointer analysis



Spark does a flow-insensitive analysis, so there is one points-to graph
for the whole program, not one at each program point. The graph is way
too big to have many different copies of it.

The points-to sets are provided only for local variables, not for
arbitrary expressions. The points-to set for a local variable can be
accessed using the PAG method:
    public PointsToSet reachingObjects( Local l );

Ondrej

On Wed, May 28, 2003 at 01:24:58PM -0700, Nikhil Mahajan wrote:
>     
>    hi,
>     
>    heres what i intend to do. I need a points to analysis graph at every
>    program point and based on that i do a data flow analysis.
>     
>    Now, when i generate the PAG as shown below, i get around  4757 alloc
>    nodes which i understand are created from the standard class library.
>     
>    Now, for a particular jimple statement i want to know
>     
>    a. the nodes in the statement and
>    b. the nodes pointed to by these nodes.
>     
>    for part a. i tried doing this :
>     
>    If its an assignment statement, 
>     
>    Value lval = assignStmt.getLeftOp();
>    Value rval = assignStmt.getRightOp();
>    VarNode vLeftNode = findVarNode(lval);
>    VarNode vRightNode = findVarNode(rval);
>    System.out.println("VarNode (Right): ",+vRightNode.toString());
>    System.out.println("VarNode (Left): ",+vLeftNode.toString());
>     
>    However, this gives me a null pointer exception. Am I doing something
>    wrong here ??? and if that gets solved how do i solve part b.
>     
>    Please help.
>     
>    Regards,
>     
>    Nikhil
>    PS: the code for construction of PAG
>     
>    SootClass c = Scene.v().loadClassAndSupport("hello");
>      c.setApplicationClass();
>      Scene.v().setMainClass(c);
>      
>      Iterator itClasses=Scene.v().getClasses().iterator();
>      while(itClasses.hasNext()){
>          SootClass sc=(SootClass)itClasses.next();
>          String scName=sc.getName();
>       sc.setApplicationClass();
>      }
>      System.out.print("*** Constructing the PAG...");
>      HashMap map = new HashMap();
>      System.out.println("*** Reading default options ");
>      String defaultOptions = SparkOptions.getDefaultOptions();
>      StringTokenizer decoupe = new StringTokenizer(defaultOptions, " ");
>      while(decoupe.hasMoreElements()){
>       String option = decoupe.nextToken();
>       StringTokenizer decoupeOption = new StringTokenizer(option, ":");
>       String key = decoupeOption.nextToken();
>       String value = decoupeOption.nextToken();
>       map.put(key, value);
>       System.out.println("Option "+key+"   * Set "+value);
>      }
>      SparkOptions options = new SparkOptions(map);
>      SparkTransformer.v().internalTransform("wjtp", map);
>      PAG pag = (PAG)Scene.v().getActivePointsToAnalysis();
>     
> 
>      ----------------------------------------------------------------------
> 
>    Do you Yahoo!?
>    Free online calendar with sync to Outlook(TM).