Class

org.opalj.br.cfg

CFG

Related Doc: package cfg

Permalink

case class CFG(code: Code, normalReturnNode: ExitNode, abnormalReturnNode: ExitNode, catchNodes: Seq[CatchNode], basicBlocks: Array[BasicBlock]) extends Product with Serializable

Represents the control flow graph of a method.

To compute a CFG use the CFGFactory.

Thread-Safety

This class is thread-safe; all data is effectively immutable after construction time.

code

The code for which the CFG was build.

normalReturnNode

The unique exit node of the control flow graph if the method returns normally. If the method always throws an exception this node will not have any predecessors.

abnormalReturnNode

The unique exit node of the control flow graph if the method returns abnormally (throws an exception). If the method is guaranteed to never throw an exception, this node will not have any predecessors.

catchNodes

List of all catch nodes. (Usually, we have one CatchNode per org.opalj.br.ExceptionHandler, but if an exception handler does not catch anything, no CatchNode is created.)

basicBlocks

An implicit map between a program counter and its associated BasicBlock; it may be a sparse array!

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CFG
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CFG(code: Code, normalReturnNode: ExitNode, abnormalReturnNode: ExitNode, catchNodes: Seq[CatchNode], basicBlocks: Array[BasicBlock])

    Permalink

    code

    The code for which the CFG was build.

    normalReturnNode

    The unique exit node of the control flow graph if the method returns normally. If the method always throws an exception this node will not have any predecessors.

    abnormalReturnNode

    The unique exit node of the control flow graph if the method returns abnormally (throws an exception). If the method is guaranteed to never throw an exception, this node will not have any predecessors.

    catchNodes

    List of all catch nodes. (Usually, we have one CatchNode per org.opalj.br.ExceptionHandler, but if an exception handler does not catch anything, no CatchNode is created.)

    basicBlocks

    An implicit map between a program counter and its associated BasicBlock; it may be a sparse array!

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val abnormalReturnNode: ExitNode

    Permalink

    The unique exit node of the control flow graph if the method returns abnormally (throws an exception).

    The unique exit node of the control flow graph if the method returns abnormally (throws an exception). If the method is guaranteed to never throw an exception, this node will not have any predecessors.

  5. def allBBs: Iterator[BasicBlock]

    Permalink

    Iterates over the set of all BasicBlocks.

    Iterates over the set of all BasicBlocks. (I.e., the exit and catch nodes are not returned.)

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def bb(pc: PC): BasicBlock

    Permalink

    Returns the basic block to which the instruction with the given pc belongs.

    Returns the basic block to which the instruction with the given pc belongs.

    pc

    A valid pc.

    returns

    The basic block associated with the given pc. If the pc is not valid null is returned or an index out of bounds exception is thrown.

  8. val catchNodes: Seq[CatchNode]

    Permalink

    List of all catch nodes.

    List of all catch nodes. (Usually, we have one CatchNode per org.opalj.br.ExceptionHandler, but if an exception handler does not catch anything, no CatchNode is created.)

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. val code: Code

    Permalink

    The code for which the CFG was build.

  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def foreachPredecessor(pc: PC)(f: (PC) ⇒ Unit): Unit

    Permalink
  14. def foreachSuccessor(pc: PC)(f: (PC) ⇒ Unit): Unit

    Permalink

    Iterates over the direct successors of the instruction with the given pc and calls the given function f for each successor.

    Iterates over the direct successors of the instruction with the given pc and calls the given function f for each successor. f is guaranteed to be called only once for each successor instruction. (E.g., relevant in case of a switch where multiple cases are handled in the same way.)

  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def mapPCsToIndexes(pcToIndex: Array[PC], lastIndex: Int): CFG

    Permalink

    Creates a new CFG where the boundaries of the basic blocks are updated given the pcToIndex mapping.

    Creates a new CFG where the boundaries of the basic blocks are updated given the pcToIndex mapping. The assumption is made that the indexes are continuous. If the first index (i.e., pcToIndex(0) is not 0, then a new basic block for the indexes in {0,pcToIndex(0)} is created if necessary.

    lastIndex

    The index of the last instruction of the underlying (non-empty) code array. I.e., if the instruction array contains one instruction then the lastIndex has to be 0.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. val normalReturnNode: ExitNode

    Permalink

    The unique exit node of the control flow graph if the method returns normally.

    The unique exit node of the control flow graph if the method returns normally. If the method always throws an exception this node will not have any predecessors.

  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. def predecessors(pc: PC): Set[PC]

    Permalink
  23. lazy val reachableBBs: Set[CFGNode]

    Permalink

    Returns the set of all reachable CFGNodes of the control flow graph.

  24. final def startBlock: BasicBlock

    Permalink

    The basic block associated with the very first instruction.

  25. def successors(pc: PC): Set[PC]

    Permalink

    Returns all direct runtime successors of the instruction with the given pc.

    Returns all direct runtime successors of the instruction with the given pc.

    If the returned set is empty, then the instruction is either a return instruction or an instruction that always causes an exception to be thrown that is not handled by a handler of the respective method.

    pc

    A valid pc of an instruction of the code block from which this cfg was derived.

    Note

    If possible the function foreachSuccessor should be used as it does not have to create comparatively expensive intermediate data structures.

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  27. def toDot: String

    Permalink
  28. def toString(): String

    Permalink
    Definition Classes
    CFG → AnyRef → Any
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped