[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CompleteBlockGraph.getHeads() bug or feature?
Hi,
I suspect this might be a bug -- on the other hand, maybe there's a
good reason for it... I'm building a CompleteBlockGraph for the
following:
public class SimpleExcept
{
public static void test()
{
int x = 1;
int y = 0;
try{
int z = x/y;
}
catch(Exception e){
System.exit(1);
}
}
}
The graph looks like this:
Block 0:
i0 = 1;
i1 = 0;
|
|
V
Block 1:
i3 = i0/i1;
/ \
/ \
/ \
/ \
V V
Block 2: Block 3:
goto ???; $r0 := @caughtexception
\ r1 = $r0
\ java.lang.System.exit(1);
\ goto ???;
\ /
\ /
\ /
\ /
V V
Block 4:
return;
However, both Block 0 and Block 3 are returned as heads of the graph
(with BlockGraph.getHeads()). Is this a bug or feature?
Relevant piece of code in BlockGraph.java:
while(blockIt.hasNext()) {
Block b = (Block) blockIt.next();
if(b.getHead() == mUnits.getFirst() ||
handlerList.contains(b.getHead())) {
mHeads.add(b);
}
}
I think it makes sense to ignore the second condition for complete
block graphs.
Thanks,
Navin.