[Soot-list] Question on the DEF/USE analysis

CREGUT Pierre RD-MAPS-LAN pierre.cregut at orange-ftgroup.com
Mon Oct 4 09:36:51 EDT 2010


I have a question on the Def/Use analysis as implemented by 
SmartLocalDefs (and used by LocalSplitter).
It relies on an ExceptionalUnitGraph.
Let us assume we have the following code to analyze
lab1:
  ....
  .... (U1)
  x = f(args....) (U2)
lab2 :
lab 3 :  ..... x ... (U3)

catch from lab1 to lab2:

If f may raise an exception,  there is an edge from U1 (the previous 
statement) to U3 (1) but there is also an edge in the graph from U2 to  
U3 (2)  as f may have some side effect.But when we compute the def/use 
analysis, having an edge from U2 to U3 means that the assignment to x at 
U2 is taken into account for the computation of the def set at U3 even 
if it can never occur. So from the point of view of this analysis, the 
edge (2) is superfluous and adds an unnecessary def point for x at lab3.

To avoid this, I have added a version of the ExceptionalUnitGraph class 
where "allvaysAddSelfEdges" is false (mightHaveSideEffect is static and 
cannot be overridden). This is true as long as the definition effect 
occurs after any potential exception has been raised for all the 
statements of the intermediate language. I think this is true in Jimple.

Am I wrong, or is this something that could be modified to make the 
def/use analysis more precise ?

Pierre Crégut




More information about the Soot-list mailing list