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

Re: Identifying loop body



Hi Oksana,

> I am working on an analysis where I need to identify loops and then
> traverse them again to identify whether they contain a path with certain
> properties. I can identify the first statement of a loop using a dfs-like
> procedure on a method control flow graph. The problem is to identify the
> loop body. When processing loops, I want to make sure I don't jump outside
> the loop body.

You definitely want to read Jerome Miecznikowski's master's thesis:

http://www.sable.mcgill.ca/publications/thesis/#jeromeMastersThesis

and also the CycleFinder code (in soot.dava.toolkits.base.finders), which
implements the CFG -> AST loop conversion.  You might conceivably get
arbitrarily bad Jimple code, because it didn't necessarily have to come
from a compiler.  CycleFinder seems to find loops and identify what sort
of looping construct they might have come from.

pat