Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package opalj
    Definition Classes
    org
  • package br

    In this representation of Java bytecode references to a Java class file's constant pool and to attributes are replaced by direct references to the corresponding constant pool entries.

    In this representation of Java bytecode references to a Java class file's constant pool and to attributes are replaced by direct references to the corresponding constant pool entries. This facilitates developing analyses and fosters comprehension.

    Based on the fact that indirect references to constant pool entries are resolved and replaced by direct references this representation is called the resolved representation.

    This representation of Java bytecode is considered as OPAL's standard representation for writing Scala based analyses. This representation is engineered such that it facilitates writing analyses that use pattern matching.

    Definition Classes
    opalj
  • package cfg
    Definition Classes
    br
  • BasicBlock
  • CFG
  • CFGFactory
  • CFGNode
  • CatchNode
  • ExitNode

case class CFG[I <: AnyRef, C <: CodeSequence[I]](code: C, 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!

Self Type
CFG[I, C]
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: C, normalReturnNode: ExitNode, abnormalReturnNode: ExitNode, catchNodes: Seq[CatchNode], basicBlocks: Array[BasicBlock])

    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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val abnormalReturnNode: ExitNode
  5. def allBBs: Iterator[BasicBlock]

    Iterates over the set of all BasicBlocks.

    Iterates over the set of all BasicBlocks. (I.e., the exit and catch nodes are not returned.) Always returns the basic block containing the first instruction first.

  6. def allNodes: Iterator[CFGNode]
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. final def bb(pc: Int): BasicBlock

    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.

  9. val catchNodes: Seq[CatchNode]
  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  11. val code: C
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def foreachPredecessor(pc: Int)(f: (Int) ⇒ Unit): Unit
  15. def foreachSuccessor(pc: Int)(f: (Int) ⇒ Unit): Unit

    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.)

  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def mapPCsToIndexes[NewI <: AnyRef, NewC <: CodeSequence[NewI]](newCode: NewC, pcToIndex: Array[Int], singletonBBsExpander: (Int) ⇒ Int, lastIndex: Int): CFG[NewI, NewC]

    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.

    singletonBBsExpander

    Function called for each basic block which encompasses a single instruction to expand the BB to encompass more instructions. This supports the case where an instruction was transformed in a way that resulted in multiple instructions/statements, but which all belong to the same basic block. This situation cannot be handled using pcToIndex. This information is used to ensure that - if a basic block, which currently just encompasses a single instruction, will encompass the new and the old instruction afterwards. The returned value will be used as the endIndex. endIndex = singletonBBsExpander(pcToIndex(pc of singleton bb)) Hence, the function is given the mapped index has to return that value if the index does not belong to the expanded instruction.

    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.

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. val normalReturnNode: ExitNode
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def predecessors(pc: Int): IntTrieSet
  24. lazy val reachableBBs: Set[CFGNode]

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

  25. final def startBlock: BasicBlock

    The basic block associated with the very first instruction.

  26. def successors(pc: Int): IntTrieSet

    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.

  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toDot(f: (BasicBlock) ⇒ String, includeAbnormalReturns: Boolean = true): (Node, Iterable[Node])

    returns

    The pair: (Node for the start BB, all Nodes (incl. the node for the start BB))

  29. def toDot: String
  30. def toString(): String
    Definition Classes
    CFG → AnyRef → Any
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped