[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scene rebuild
On Tue, Aug 19, 2003 at 06:10:17PM -0500, Manoj Plakal wrote:
>
> Hello Soot-ers,
>
> What's the recommended way to rebuild a Scene's
> hierarchies and analyses after modifying a Scene?
>
> I'm adding classes and modifying
> methods and adding entry points, and right
> now I'm manually calling Scene methods to
> delete and rebuild certain analyses. But
> I'm not 100% sure if I'm missing an update
> somewhere.
>
> Is there a canonical way to rebuild the
> entire scene including the hierarchy, call graph,
> and points-to analysis, ensuring everything
> is consistent and up-to-date?
>
> Perhaps forceRebuildScene() could be added as
> a method to the Scene class.
Unfortunately, that's easier said than done. The Scene is a container of
global data, not an active object that actually builds things. It's used
as a place where pieces of Soot store things for other pieces of Soot to
pick up. When classes are read in, they are stored in the Scene. When
a call graph is read in, it is stored in the Scene. If you wanted a way
to clear out "everything" from the Scene, you would first have to define
what you mean by "everything". Presumably, in your case, you don't want
it to clear out and rebuild all the classes, even though conceptually,
they are no different than the call graph, in that they're just
something that's built by some phase of Soot and stashed in the Scene.
As for rebuilding all the things once you clear them out, you need to
figure out where they get rebuilt. The hierarchy gets magically built
when you first ask for it, because it's used by the intraprocedural type
inference code. The call graph and points-to analysis get built by the
cg phase.
I agree that the Scene contains a lot of cruft that makes it difficult
to tell what everything is and what gets created where, and how it
should all be cleaned up. We cleaned up a lot of this in the transition
to Soot 2.0, by moving a lot of things out of the Scene. Concrete
suggestions for ways of cleaning it up further are welcome.
>
> Thanks,
> Manoj
>
> PS: I'd also like to know the recommended way
> to add entry points of my own and then rebuild
> the call graph and points-to analysis. Right now
> I'm imitating what I see in the Soot source.
The recommended way is to call Scene.v().setEntryPoints() before doing
anything else with Soot.
>