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

Re: More on invokeGraphs



On Wed, 27 Nov 2002, Ondrej Lhotak wrote:

> On Wed, Nov 27, 2002 at 06:11:16PM -0500, Ankush Varma wrote:
> > - Calling InvokeGraphTrimmer using PAG gave an invokeGraph with no methods
> >   connected to my main method. Funny, but its probably mea culpa, since I
> >   suspect I'm not using it properly.
> > 
> > Let me know if you have any ideas. Do you have a code fragment that trims an
> > InvokeGraph using PAG?
> 
> The correct way to use Spark to get trim an invoke graph is:
> java -Xmx300m soot.Main -a --app --nooutput -p wjtp.Spark disabled:false,trimInvokeGraph:true Hello

I'm calling Soot from inside a java method, rather than from the command
line. Calling SPARK still gives returns an invoke graph with no methods
connected to the main method.

I just called:
---
        SparkTransformer.v().internalTransform("wjtp.Spark",
                _getCustomSparkOptions()); 
---


where  _getCustomSparkOptions() returns a HashMap with the default SPARK
options, except that trimInvokeGraph is set to true.

The output of my program looked like:

---
Start.
Set all classes as apps ...
Initial Scene has 1369 classes.
Build InvokeGraph ....
IG has 12404 methods in 1226 classes.
Main method reaches 4610 methods.
[Spark] Invoke Graph in 0.0 seconds.
[Spark] Pointer Assignment Graph in 11.4 seconds.
[Spark] Type masks in 14.4 seconds.
[Spark] Pointer Graph simplified in 0.3 seconds.
[Spark] Propagation in 7.2 seconds.
[Spark] Solution found in 7.6 seconds.
Trimming invoke graph
Done trimming invoke graph
After SPARK, 12404 methods.
Main method reaches 0 methods.
---

I've attached my Java file to this mail. I simulated --app by setting all
classes in the Scene as application classes.

Can you tell me what's the correct procedure for calling SPARK
analysis from within a program?

Thanks,
Ankush

> Then you retrieve the invoke graph from the Scene with
> Scene.v().getActiveInvokeGraph().
> 
> > The smallest I could get was 2000+ transitive targets for a class that called
> > nothing but System.out.println(int). Over 5000 methods were in the invoke graph
> > for just this test file! Any idea how to get fewer nodes in the invokeGraph? I
> > suspect that the MethodCallGraph is involved.
> 
> When run with the 1.3.1 JDK library, the above gives a graph with 1485
> methods for a Hello, World program (compared to 2973 with just CHA).
> (For comparison: 
> Spark with onFlyCallGraph:true option: 1223
> Spark (default options):               1485
> VTA:                                   1556
> RTA:                                   1919
> CHA:                                   2973
> 
> In Java, it is difficult to get this much lower. First of all, even a
> "trivial" Hello, World program is not at all trivial: using
> java -verbose:class Hello
> lists 280 classes being loaded with who knows how many methods.
> 
> Another difficulty is that class initiliazer methods can be called at
> any time the first time a class is used, so they are treated as possible
> entry points. Many of these create objects, making large numbers of
> methods reachable.
> 
> > PS: The SPARK analysis in the new Soot release looks pretty neat! 
> 
> I'd be interested in hearing about your experiences with it.
> 
> Ondrej
> 
> 

-------------------------------------------------
Ankush Varma
Ph.D. Student / Graduate Research Assistant
DSP-CAD Research Group 
Department of Electrical and Computer Engineering
University of Maryland, College Park.

email:
ankush@eng.umd.edu
not_ankush@yahoo.com

Home: 301-439-0438           Office: 301-405-3089
--------------------------------------------------