[Soot-list] Possible bug in Dominators Analysis

mbatch at cs.mcgill.ca mbatch at cs.mcgill.ca
Mon Aug 21 19:25:56 EDT 2006


> However, on some
> methods I get an exception, which seems to come from the underlying
> dominators analysis (see trace 1).

The exception you are getting from the DominatorAnalysis is caused by the
fact that it expects a graph with a single head. Unfortunately,
ExceptionalUnitGraphs can have more than one head. This is because an
exception can be raised _before_ the first unit of a method. The following
(from your file) is a good example:

static String method () {
  try  {
    String s = getString();
    return ( s == null ? "jaguar" : s ) ;
  }
  catch (Exception e) { return "panthere" ; }
}

Since the VM may throw an asychronous exception after the method is
entered but before the "s = getString" line is actually executed, the trap
handler unit (the first instruction of the line `return "panthere" ' is
included as a "head" of the exceptional unit graph of this method. In
fact, if any instructions from the line s = getString can implicitly throw
an exception the handler will be a head. From the ExceptionalUnitGraph:

"For every Unit which may implicitly throw an exception that could be
caught by a Trap in the Body, there will be an edge from each of the
excepting Unit's predecessors to the Trap handler's first Unit (since any
of those predecessors may have been the last Unit to complete execution
before the handler starts execution)."

I do not know how to appropriately get around this issue (because the
dominator analysis definitely wants a single head). Navin, the SSA man of
Soot, might be the person to ask, although I am not sure if he still reads
this list.

Michael



More information about the Soot-list mailing list