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

Re: A question about soot



On Mon, Aug 18, 2003 at 08:38:08PM -0500, Venkatesh Prasad Ranganath wrote:
> Hi,
> 
> I use Soot 2.0.1 and was wanting to know if it is possible to have 2 different instances of Scene with different classes 
> loaded in them active at the same time in Soot 2.0.1?  I was under the impression that it was, but recently a discussion with 
> a friend and a bit of code surfing indicates otherwise.  Then, is it correct to say that only one instance of the Soot 
> framework is allowed per class loader/jvm?  If so, are there any plans to support multiple instances of Soot framework per 
> class loader/jvm?
> 
> waiting for reply,

Yes and no. Yes, in the sense that all the hard work needed to do
this was done in the transition to Soot 2.0. No, in that you have to
implemenent the last little bit yourself depending on how exactly you
want to access the multiple instances of Soot.

As of Soot 2.0, everything global is in the class G. The only static
field in Soot that matters is G.instance, and every access to it is
through G.v(). So, if you want multiple instances of Soot, you need to
change G.v() to return the current instance.

For example, you may want to run several threads, with one Soot instance
per thread. In that case, you can use java.lang.ThreadLocal to make
G.v() return the Soot instance for the current thread.

Or, you may just have one thread, and make a call into one instance
of Soot followed by a call into another instance of Soot. For that, you
just update G.instance with the instance of Soot you want to call into.

Ondrej

> 
> -- 
> 
> Venkatesh Prasad Ranganath,
> Dept. Computing and Information Science,
> Kansas State University, US.
> web: http://www.cis.ksu.edu/~rvprasad
>