harpoon.Analysis
Class FCFGBasicBlock

java.lang.Object
  extended by harpoon.Analysis.FCFGBasicBlock
All Implemented Interfaces:
BasicBlockInterf

public class FCFGBasicBlock
extends Object
implements BasicBlockInterf

FCFGBasicBlock is a basic block structure for the Factored Control Flow Graph (FCFG) representation. This representation is based on a factored and implicit representation of exceptions. It is described in detail in the paper Efficient and Precise Modeling of Exceptions for the Analysis of Java Programs by Choi, Grove, Hind and Sarkar.

Each FCFGBasicBlock corresponds to a list of consecutive instructions, such that:

Therefore, a FCFGBasicBlock has a single entry point, a single normal exit point and possibly many lateral exits due to exceptions. As all the instructions a FCFGBasicBlock are protected by the same set of handlers (in fact a list because the order the handlers are processed in is important), these lateral exits can be kept once for the entire basic block, hence the name factored.

Similar to BasicBlocks, the only way of producing FCFGBasicBlocks is by using FCFGBasicBlock.Factory.

Version:
$Id: FCFGBasicBlock.java,v 1.7 2004/02/08 01:49:03 cananian Exp $
Author:
Alexandru SALCIANU <salcianu@MIT.edu>

Nested Class Summary
static class FCFGBasicBlock.Factory
          Factory structure for generating FCFGBasicBlock views of an HCode.
 
Field Summary
protected  Quad first
           
protected  List handler_bb
          Successor BBs in the exceptional control flow.
protected  int id
           
protected  Quad last
           
protected  Set next_bb
          Next BBs (according to the normal control flow).
protected  Set prev_bb
          Previous BBs (according to the normal control flow).
protected  Set protected_bb
          Predecessor BBs in the exceptional control flow.
 
Constructor Summary
protected FCFGBasicBlock(Quad q, FCFGBasicBlock.Factory f)
          Creates a FCFGBasicBlock.
 
Method Summary
 void accept(BasicBlockInterfVisitor v)
          Calls the appropriate visit method from visitor.
protected static void addExcpEdge(FCFGBasicBlock from, FCFGBasicBlock to)
           
protected static void addNormalEdge(FCFGBasicBlock from, FCFGBasicBlock to)
           
 HCodeElement getFirst()
          Returns the first instruction of this basic block.
 HCodeElement getLast()
          Returns the last instruction of this basic block.
 List handlerList()
          Returns the list of successor BBs in the exceptional control flow.
 Set nextSet()
          Returns all the successors of the basic block, according to the normal and the exceptional control flow.
 Set normalNextSet()
          Returns the set of predecessor BBs in the normal control flow.
 Set normalPrevSet()
          Returns the set of successor BBs in the normal control flow.
 Set prevSet()
          Returns all the predecessors of the basic block, according to the normal and the exceptional control flow.
 Set protectedSet()
          Returns the set of predecessor BBs in the exceptional control flow.
 List statements()
          Returns the list of the statements composing the basic block.
 String toString()
          Returns a string identifying this FCFGBasicBlock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id

next_bb

protected Set next_bb
Next BBs (according to the normal control flow).


prev_bb

protected Set prev_bb
Previous BBs (according to the normal control flow).


protected_bb

protected Set protected_bb
Predecessor BBs in the exceptional control flow.


handler_bb

protected List handler_bb
Successor BBs in the exceptional control flow.


first

protected Quad first

last

protected Quad last
Constructor Detail

FCFGBasicBlock

protected FCFGBasicBlock(Quad q,
                         FCFGBasicBlock.Factory f)
Creates a FCFGBasicBlock. This method is called only by the FCFGBasicBlock.Factory.

Method Detail

getFirst

public HCodeElement getFirst()
Returns the first instruction of this basic block.

Specified by:
getFirst in interface BasicBlockInterf

getLast

public HCodeElement getLast()
Returns the last instruction of this basic block.

Specified by:
getLast in interface BasicBlockInterf

normalNextSet

public Set normalNextSet()
Returns the set of predecessor BBs in the normal control flow.


normalPrevSet

public Set normalPrevSet()
Returns the set of successor BBs in the normal control flow.


addNormalEdge

protected static void addNormalEdge(FCFGBasicBlock from,
                                    FCFGBasicBlock to)

protectedSet

public Set protectedSet()
Returns the set of predecessor BBs in the exceptional control flow. For a basic block that starts with a HANDLER instruction, this is the set of basic blocks whose instructions are protected by that handler. FOOTER is the default handler: the uncaught exceptions are sent to the caller. For any other basic block, this set is empty.


handlerList

public List handlerList()
Returns the list of successor BBs in the exceptional control flow. These are the handlers that protect the instructions from this basic block. FOOTER is the default handler: the uncaught exceptions are sent to the caller. The order of the handlers in the list is the order in which the JVM tries to find an appropriate handler.


prevSet

public Set prevSet()
Returns all the predecessors of the basic block, according to the normal and the exceptional control flow.

Specified by:
prevSet in interface BasicBlockInterf

nextSet

public Set nextSet()
Returns all the successors of the basic block, according to the normal and the exceptional control flow.

Specified by:
nextSet in interface BasicBlockInterf

addExcpEdge

protected static void addExcpEdge(FCFGBasicBlock from,
                                  FCFGBasicBlock to)

statements

public List statements()
Description copied from interface: BasicBlockInterf
Returns the list of the statements composing the basic block.

Specified by:
statements in interface BasicBlockInterf

accept

public void accept(BasicBlockInterfVisitor v)
Description copied from interface: BasicBlockInterf
Calls the appropriate visit method from visitor. The concept of BasicBlockInterfVisitor is similar to the concept of QuadVisitor. Both of them were introduced to allow pure object oriented programming, that is virtual methods instead of instanceof tests.

Specified by:
accept in interface BasicBlockInterf

toString

public String toString()
Returns a string identifying this FCFGBasicBlock. All the FCFGBasicBlocks generated for a given method have different string representations.

Overrides:
toString in class Object