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

Re: LocalUses and FlowAnalysis documentation bugs



Hi Ondrej,

src/dest is the only good pair I can come up with, and I agree that in/out should be replaced if convention also has in/out referring to program flow, since Soot apparently thinks it means dataflow.
before/after seems to be used consistently everywhere. It would be best if there was only one pair of terms for program flow and only one pair of terms for dataflow.


Can you confirm for me that flowThrough() is expected, not by the API but by the existing classes, to take in (parm1) and compute out (parm3), both backwards and forwards, which means that they do in fact refer to dataflow direction? If not, I need to seriously re-examine a few things of my own.

Cheers,
Chris

Ondrej Lhotak wrote:
Hi Chris...

At various times, someone makes a change to some piece of the
documentation because it doesn't fit with their definitions of terms
like in, out, before, after. The result is the current mess that you
see, with these terms being used to mean different things in different
files. So, rather than making yet another of these changes that uses
certain definitions for a couple files, I think it would be better to
standardize on some terms, then get someone to go through all the files
and make sure only those terms are used everywhere.

What terms should we use? Both before/after and in/out, at least to
me, suggest program flow direction. Certainly before/after are used
in the names of methods in Soot, and I think it would be hard to
convince anyone that they could mean dataflow direction. In/out are more
ambiguous, but lots of people, including the Muchnick book, use them for
program flow direction. So, given this ambiguity, I suggest avoiding
in/out altogether, and coming up with some unambigiuous terms for the
data flow direction. Anyone have any suggestions?

Ondrej

On Wed, Jul 07, 2004 at 06:13:11AM -0400, Chris Pickett wrote:

Hi,

I think I've found a couple more bugs in the API. I've attached a patch that fixes both of them, although there might be better ways to do it (as was the case with FlowSet.java).

First, LocalUses says it returns a List of Units, whereas in reality both implementations of this interface return a List of UnitValueBoxPairs. Also, SimpleLocalUses says it returns a UnitValueBoxPair, but it returns a List of them.

Second, at line 139 of BackwardFlowAnalysis.java:

flowThrough(afterFlow, s, beforeFlow);

which says that the afterFlow is the IN set and the beforeFlow is the OUT set.

And at line 159 of ForwardFlowAnalysis.java:

flowThrough(beforeFlow, s, afterFlow);

which says that the beforeFlow is the IN set and the afterFlow is the OUT set.

(okay, there are other places to see it, but that seems clearest)

However, the documentation says that getFlowBefore(s) returns the IN set and getFlowAfter(s) returns the OUT set, and makes no mention of direction. I had assumed until now that "before" always meant "in" and "after" always mean "out", and only just caught this bug in my analyses. If I'm wrong, then I've seriously misunderstood something here, and would still appreciate an explanation.

I'm not sure, but it might be worth checking through all BackwardFlowAnalysis subclasses and their clients to see that they understand before and after correctly.

Thanks,
Chris