[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CompleteBlockGraph.getHeads() bug or feature?
On Sun, 30 Mar 2003, Navindra Umanee wrote:
> int x = 1;
> int y = 0;
>
> try{
> int z = x/y;
...
> Block 0:
> i0 = 1;
> i1 = 0;
> Block 2: Block 3:
> goto ???; $r0 := @caughtexception
> \ r1 = $r0
> \ java.lang.System.exit(1);
> \ goto ???;
> However, both Block 0 and Block 3 are returned as heads of the graph
> (with BlockGraph.getHeads()). Is this a bug or feature?
I think that you want Block 3 as a head in the BriefBlockGraph. It
doesn't seem like you'd want it in the CompleteBlockGraph. (At first, I
was going to suggest that you might want Block 3 as a head because it
could happen before the first statement in the try block completes its
execution, but that's not relevant to your example because you have code
before the try block starts.)
> 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.
I agree. We only want that condition for brief block graphs (if we
didn't have it, the exception handlers would be dead code). Feel free to
check in a fix.
pat