Package

org.opalj

tac

Permalink

package tac

Common definitions related to the definition and processing of three address code.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. tac
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait ASTNode[+V <: Var[V]] extends AnyRef

    Permalink

    Defines nodes used by statements and expressions.

  2. case class ArrayLength[+V <: Var[V]](pc: PC, arrayRef: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink
  3. case class ArrayLoad[+V <: Var[V]](pc: PC, index: Expr[V], arrayRef: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink
  4. case class ArrayStore[+V <: Var[V]](pc: PC, arrayRef: Expr[V], index: Expr[V], value: Expr[V]) extends Stmt[V] with Product with Serializable

    Permalink
  5. case class Assignment[+V <: Var[V]](pc: PC, targetVar: V, expr: Expr[V]) extends Stmt[V] with Product with Serializable

    Permalink
  6. case class BinaryExpr[+V <: Var[V]](pc: PC, cTpe: ComputationalType, op: BinaryArithmeticOperator, left: Expr[V], right: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink

    cTpe

    The computational type of the result of the binary expression.

  7. trait Call[+V <: Var[V]] extends AnyRef

    Permalink

    Common supertrait of statements and expressions calling a method.

  8. case class Checkcast[+V <: Var[V]](pc: PC, value: Expr[V], cmpTpe: ReferenceType) extends Expr[V] with Product with Serializable

    Permalink

    A checkcast expression as defined by the JVM specification.

  9. case class ClassConst(pc: PC, value: ReferenceType) extends SimpleValueConst with Product with Serializable

    Permalink
  10. case class Compare[+V <: Var[V]](pc: PC, left: Expr[V], condition: RelationalOperator, right: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink
  11. sealed abstract class Const extends ValueExpr[Nothing]

    Permalink
  12. abstract class DUVar[+Value <: DomainValue] extends Var[DUVar[Value]]

    Permalink

    Identifies a variable which has a single static definition/initialization site.

  13. class DVar[+Value <: DomainValue] extends DUVar[Value]

    Permalink

    Identifies the single index(pc) of the instruction which initialized the variable.

    Identifies the single index(pc) of the instruction which initialized the variable. I.e., per method there must be at most one D variable which has the given origin. Initially, the pc of the underlying bytecode instruction is used.

  14. case class DoubleConst(pc: PC, value: Double) extends SimpleValueConst with Product with Serializable

    Permalink
  15. trait Expr[+V <: Var[V]] extends ASTNode[V]

    Permalink

    Represents an expression.

    Represents an expression. In general, every expression should be a simple expression, where the child expression are just Vars. However, when the code is going to be transformed to human readable code (e.g., Java oder Scala), then it is possible to build up complex expressions.

  16. case class ExprStmt[+V <: Var[V]](pc: PC, expr: Expr[V]) extends Stmt[V] with Product with Serializable

    Permalink

    An expression where the value is not further used.

  17. case class FailingExpression[+V <: Var[V]](pc: PC, expr: Expr[V]) extends FailingInstruction[V] with Product with Serializable

    Permalink

    The underlying expression will always throw an exception.

  18. sealed abstract class FailingInstruction[+V <: Var[V]] extends Stmt[V]

    Permalink
  19. case class FailingStatement[+V <: Var[V]](pc: PC, stmt: Stmt[V]) extends FailingInstruction[V] with Product with Serializable

    Permalink
  20. sealed abstract class FieldWriteAccessStmt[+V <: Var[V]] extends Stmt[V]

    Permalink
  21. case class FloatConst(pc: PC, value: Float) extends SimpleValueConst with Product with Serializable

    Permalink
  22. sealed abstract class FunctionCall[+V <: Var[V]] extends Expr[V] with Call[V]

    Permalink
  23. case class GetField[+V <: Var[V]](pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, objRef: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink
  24. case class GetStatic(pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType) extends Expr[Nothing] with Product with Serializable

    Permalink
  25. case class Goto(pc: PC, target: Int) extends Stmt[Nothing] with Product with Serializable

    Permalink

    target

    First the pc (absolute) of the target instruction in the original bytecode array; then the index of the respective quadruples instruction.

  26. sealed trait IdBasedVar extends Var[IdBasedVar]

    Permalink

    Id based variables are named based on the position of the stack/register they were defined.

  27. case class If[+V <: Var[V]](pc: PC, left: Expr[V], condition: RelationalOperator, right: Expr[V], target: Int) extends Stmt[V] with Product with Serializable

    Permalink

    left

    The expression left to the relational operator. In general, this can be expected to be a Var. However, it is not expression to facilitate advanced use cases such as generating source code.

    right

    The expression right to the relational operator. In general, this can be expected to be a Var. However, it is not expression to facilitate advanced use cases such as generating source code.

    target

    Index in the statements array.

  28. sealed abstract class InstanceFunctionCall[+V <: Var[V]] extends FunctionCall[V]

    Permalink
  29. sealed abstract class InstanceMethodCall[+V <: Var[V]] extends MethodCall[V]

    Permalink
  30. case class InstanceOf[+V <: Var[V]](pc: PC, value: Expr[V], cmpTpe: ReferenceType) extends Expr[V] with Product with Serializable

    Permalink

    An instance of expression as defined by the JVM specification.

  31. case class IntConst(pc: PC, value: Int) extends SimpleValueConst with Product with Serializable

    Permalink
  32. case class Invokedynamic[+V <: Var[V]](pc: PC, bootstrapMethod: BootstrapMethod, name: String, descriptor: MethodDescriptor, params: Seq[Expr[V]]) extends Expr[V] with Product with Serializable

    Permalink
  33. case class JumpToSubroutine(pc: PC, target: Int) extends Stmt[Nothing] with Product with Serializable

    Permalink

    JSR/RET instructions in the bytecode are mapped to corresponding statements where the Ret instruction explicitly encodes the control flow by explicitly listing all target instructions.

    JSR/RET instructions in the bytecode are mapped to corresponding statements where the Ret instruction explicitly encodes the control flow by explicitly listing all target instructions. The target instructions implicitly encode the JSR instruction which called the subroutine.

    target

    At creation time the pc (absolute) of the target instruction in the original bytecode array; then the index of the respective quadruples instruction.

  34. case class LongConst(pc: PC, value: Long) extends SimpleValueConst with Product with Serializable

    Permalink
  35. sealed abstract class MethodCall[+V <: Var[V]] extends Stmt[V] with Call[V]

    Permalink
  36. case class MethodHandleConst(pc: PC, value: MethodHandle) extends Const with Product with Serializable

    Permalink
  37. case class MethodTypeConst(pc: PC, value: MethodDescriptor) extends Const with Product with Serializable

    Permalink
  38. case class MonitorEnter[+V <: Var[V]](pc: PC, objRef: Expr[V]) extends SynchronizationStmt[V] with Product with Serializable

    Permalink
  39. case class MonitorExit[+V <: Var[V]](pc: PC, objRef: Expr[V]) extends SynchronizationStmt[V] with Product with Serializable

    Permalink
  40. case class New(pc: PC, tpe: ObjectType) extends Expr[Nothing] with Product with Serializable

    Permalink

    Allocates memory for the (non-abstract) given object.

    Allocates memory for the (non-abstract) given object. Note, that the call of the separator is done later and therefore the object is not considered to be properly initialized and – therefore – no further operations other than the call of a constructor are allowed.

  41. case class NewArray[+V <: Var[V]](pc: PC, counts: Seq[Expr[V]], tpe: ArrayType) extends Expr[V] with Product with Serializable

    Permalink

    counts

    Encodes the number of dimensions that are initialized and the size of the respective dimension.

    tpe

    The type of the array. The number of dimensions is always >= count.size.

  42. case class NonVirtualFunctionCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceFunctionCall[V] with Product with Serializable

    Permalink
  43. case class NonVirtualMethodCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceMethodCall[V] with Product with Serializable

    Permalink
  44. case class Nop(pc: PC) extends SimpleStmt[Nothing] with Product with Serializable

    Permalink
  45. case class NullExpr(pc: PC) extends SimpleValueConst with Product with Serializable

    Permalink
  46. case class Param(cTpe: ComputationalType, name: String) extends ValueExpr[Nothing] with Product with Serializable

    Permalink

    Explicit reference to a parameter.

    Explicit reference to a parameter. Parameter statements are only used by the naive representation (TACNaive) where it is necessary to perform an initial initialization of the register values.

  47. case class PrefixExpr[+V <: Var[V]](pc: PC, cTpe: ComputationalType, op: UnaryArithmeticOperator, operand: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink

    cTpe

    The computational type of the result of the prefix expression.

  48. case class PrimitiveTypecastExpr[+V <: Var[V]](pc: PC, targetTpe: BaseType, operand: Expr[V]) extends Expr[V] with Product with Serializable

    Permalink
  49. case class PutField[+V <: Var[V]](pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, objRef: Expr[V], value: Expr[V]) extends FieldWriteAccessStmt[V] with Product with Serializable

    Permalink
  50. case class PutStatic[+V <: Var[V]](pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, value: Expr[V]) extends FieldWriteAccessStmt[V] with Product with Serializable

    Permalink
  51. case class Ret(pc: PC, returnAddresses: PCs) extends Stmt[Nothing] with Product with Serializable

    Permalink

    Return from subroutine; only to be used in combination with JSR instructions.

    Return from subroutine; only to be used in combination with JSR instructions.

    returnAddresses

    The set of return addresses. Based on the return addresses it is immediately possible to determine the original JSR instruction that led to the execution of the subroutine. It is the JSR instruction directly preceding the instruction to which this RET instruction jumps to. This information is only relevant in case of flow-sensitive analyses.

  52. case class Return(pc: PC) extends SimpleStmt[Nothing] with Product with Serializable

    Permalink
  53. case class ReturnValue[+V <: Var[V]](pc: PC, expr: Expr[V]) extends Stmt[V] with Product with Serializable

    Permalink
  54. sealed abstract class SimpleStmt[+V <: Var[V]] extends Stmt[V]

    Permalink
  55. sealed abstract class SimpleValueConst extends Const

    Permalink
  56. case class SimpleVar(id: Int, cTpe: ComputationalType) extends IdBasedVar with Product with Serializable

    Permalink

    The id determines the name of the local variable and is equivalent to "the position of the value on the operand stack" or "-1-(the accessed register)".

    The id determines the name of the local variable and is equivalent to "the position of the value on the operand stack" or "-1-(the accessed register)". If the id is Int.MinValue then the variable is an intermediate variable that was artificially generated.

  57. case class StaticFunctionCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, params: Seq[Expr[V]]) extends FunctionCall[V] with Product with Serializable

    Permalink
  58. case class StaticMethodCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, params: Seq[Expr[V]]) extends MethodCall[V] with Product with Serializable

    Permalink
  59. sealed abstract class Stmt[+V <: Var[V]] extends ASTNode[V]

    Permalink

    Super trait of all quadruple statements.

  60. case class StringConst(pc: PC, value: String) extends SimpleValueConst with Product with Serializable

    Permalink
  61. case class Switch[+V <: Var[V]](pc: PC, defaultTarget: PC, index: Expr[V], npairs: IndexedSeq[(Int, PC)]) extends Stmt[V] with Product with Serializable

    Permalink
  62. sealed abstract class SynchronizationStmt[+V <: Var[V]] extends Stmt[V]

    Permalink
  63. trait TACAIKey extends ProjectInformationKey[(Method) ⇒ TACode[DUVar[ai.Domain.DomainValue]]]

    Permalink
  64. trait TACOptimization[V <: Var[V]] extends AnyRef

    Permalink

    Common interface of all code optimizers that operate on the three-address code representation.

  65. case class TACOptimizationResult[V <: Var[V]](code: TACode[V], wasTransformed: Boolean) extends Product with Serializable

    Permalink

    Encapsulates the result of an optimization/transformation of some three-address code.

  66. case class TACode[V <: Var[V]](stmts: Array[Stmt[V]], cfg: CFG, exceptionHandlers: ExceptionHandlers, lineNumberTable: Option[LineNumberTable]) extends Attribute with Product with Serializable

    Permalink

    Representation of the 3-address code of a method.

    Representation of the 3-address code of a method.

    Attributes

    The following attributes are directly reused: LineNumberTableAttribute; the statements keep the reference to the underlying/original instruction which is used to retrieve the respective information.

  67. case class Throw[+V <: Var[V]](pc: PC, exception: Expr[V]) extends Stmt[V] with Product with Serializable

    Permalink
  68. class UVar[+Value <: DomainValue] extends DUVar[Value]

    Permalink
  69. trait ValueExpr[+V <: Var[V]] extends Expr[V]

    Permalink
  70. trait Var[+V <: Var[V]] extends ValueExpr[V]

    Permalink
  71. case class VirtualFunctionCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceFunctionCall[V] with Product with Serializable

    Permalink
  72. case class VirtualMethodCall[+V <: Var[V]](pc: PC, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceMethodCall[V] with Product with Serializable

    Permalink

Value Members

  1. final val AllTACNaiveOptimizations: List[TACOptimization[IdBasedVar]]

    Permalink
  2. object ArrayLength extends Serializable

    Permalink
  3. object ArrayLoad extends Serializable

    Permalink
  4. object ArrayStore extends Serializable

    Permalink
  5. object Assignment extends Serializable

    Permalink
  6. object BinaryExpr extends Serializable

    Permalink
  7. object Call

    Permalink
  8. object Checkcast extends Serializable

    Permalink
  9. object ClassConst extends Serializable

    Permalink
  10. object Compare extends Serializable

    Permalink
  11. object DVar

    Permalink
  12. object DefaultTACAIKey extends TACAIKey

    Permalink

    Key to get the 3-address based code of a method computed using the result of the data-flow analysis performed by SimpleAIKey.

    Key to get the 3-address based code of a method computed using the result of the data-flow analysis performed by SimpleAIKey.

    Example:
    1. To get the index use the org.opalj.br.analyses.Project's get method and pass in this object.

  13. object DoubleConst extends Serializable

    Permalink
  14. object ExprStmt extends Serializable

    Permalink
  15. object FailingExpression extends Serializable

    Permalink
  16. object FailingStatement extends Serializable

    Permalink
  17. object FloatConst extends Serializable

    Permalink
  18. object GetField extends Serializable

    Permalink
  19. object GetStatic extends Serializable

    Permalink
  20. object Goto extends Serializable

    Permalink
  21. object If extends Serializable

    Permalink
  22. object InstanceMethodCall

    Permalink
  23. object InstanceOf extends Serializable

    Permalink
  24. object IntConst extends Serializable

    Permalink
  25. object Invokedynamic extends Serializable

    Permalink
  26. object JumpToSubroutine extends Serializable

    Permalink
  27. object LongConst extends Serializable

    Permalink
  28. object MethodHandleConst extends Serializable

    Permalink
  29. object MethodTypeConst extends Serializable

    Permalink
  30. object MonitorEnter extends Serializable

    Permalink
  31. object MonitorExit extends Serializable

    Permalink
  32. object New extends Serializable

    Permalink
  33. object NewArray extends Serializable

    Permalink
  34. object NonVirtualFunctionCall extends Serializable

    Permalink
  35. object NonVirtualMethodCall extends Serializable

    Permalink
  36. object Nop extends Serializable

    Permalink
  37. object NullExpr extends Serializable

    Permalink
  38. object OperandVar

    Permalink
  39. object Param extends Serializable

    Permalink
  40. object PrefixExpr extends Serializable

    Permalink
  41. object PrimitiveTypecastExpr extends Serializable

    Permalink
  42. object PutField extends Serializable

    Permalink
  43. object PutStatic extends Serializable

    Permalink
  44. object RegisterVar

    Permalink
  45. object Ret extends Serializable

    Permalink
  46. object Return extends Serializable

    Permalink
  47. object ReturnValue extends Serializable

    Permalink
  48. object SimplePropagation extends TACOptimization[IdBasedVar]

    Permalink

    A very simple peephole optimizer which performs intra-basic block constant and copy propagation.

  49. object SimpleTACAIKey extends TACAIKey

    Permalink

    Key to get the 3-address based code of a method computed using the configured domain/data-flow analysis.

    Key to get the 3-address based code of a method computed using the configured domain/data-flow analysis. This key performs the underlying data-flow analysis on demand using the configured data-flow analyses; the results of the data-flow analysis are NOT shared. Hence, this key should only be used if the result of the underlying analysis is no longer required after generating the TAC.

    Example:
    1. To get the index use the org.opalj.br.analyses.Project's get method and pass in this object.

  50. object StaticFunctionCall extends Serializable

    Permalink
  51. object StaticMethodCall extends Serializable

    Permalink
  52. object StringConst extends Serializable

    Permalink
  53. object Switch extends Serializable

    Permalink
  54. object TAC

    Permalink

    Creates the three-address representation for some method and prints it to std out.

    Creates the three-address representation for some method and prints it to std out.

    Example:
    1. To convert all files of a project to TAC you can use:

      import org.opalj.io.write
      import org.opalj.tac._
      import org.opalj.util.PerformanceEvaluation.time
      val f = new java.io.File("/Users/eichberg/Downloads/presto-verifier-0.147-executable.zip")
      val p = org.opalj.br.analyses.Project(f)
      var i = 0
      time {
      p.parForeachMethodWithBody(parallelizationLevel=32){ mi =>
        val (code,_) = org.opalj.tac.AsQuadruples(mi.method,p.classHierarchy)
        val tac = ToTxt(code)
        val fileNamePrefix = mi.classFile.thisType.toJava+"."+mi.method.name
        val file = write(tac, fileNamePrefix, ".tac.txt")
        i+= 1
        println(i+":"+file)
      }
      }(t => println("Analysis time: "+t.toSeconds))
  55. object TACAI

    Permalink

    Factory to convert the bytecode of a method into a three address representation using the results of a(n) (local) abstract interpretation of the method.

    Factory to convert the bytecode of a method into a three address representation using the results of a(n) (local) abstract interpretation of the method.

    The generated representation is completely parameterized over the domains that were used to perform the abstract interpretation. The only requirement is that the Def/Use information is recorded while performing the abstract interpretation (see org.opalj.ai.domain.RecordDefUse). The generated representation is necessarily in static single assignment form: each variable is assigned exactly once, and every variable is defined before it is used. However, no PHI instructions are inserted; instead - in case of a use - we simply directly refer to all usage sites.

  56. object TACNaive

    Permalink

    Converts the bytecode of a method into a three address representation using a very naive approach where each each operand stack value is stored in a local variable based on the position of the value on the stack and where each local variable is stored in a local variable named based on the register's index (In general, you should use the three-address code create using TACAI).

    Converts the bytecode of a method into a three address representation using a very naive approach where each each operand stack value is stored in a local variable based on the position of the value on the stack and where each local variable is stored in a local variable named based on the register's index (In general, you should use the three-address code create using TACAI).

    The converted method has an isomorophic CFG when compared to the original method, but may contain more instructions due to the way how the stack manipulation instructions are transformed. In general - unless JSR/RET instructions are found - no CFG is created and used. This approach relies on the invariant that the stack has to have the same layout on all paths. This makes the transformation very fast, but also makes it impossible to trivially compute the type information.

  57. object TACode extends Serializable

    Permalink
  58. object TempVar

    Permalink
  59. object Throw extends Serializable

    Permalink
  60. object ToTxt

    Permalink

    Converts a list of three-address instructions into a text-based representation.

    Converts a list of three-address instructions into a text-based representation.

    Note

    This representation is primarily provided for debugging purposes and is not performance optimized.

  61. object UVar

    Permalink
  62. object Var

    Permalink
  63. object VirtualFunctionCall extends Serializable

    Permalink
  64. object VirtualMethodCall extends Serializable

    Permalink
  65. def tacToDot[V <: Var[V]](stmts: Array[Stmt[V]], cfg: CFG): String

    Permalink
  66. def tacToGraph[V <: Var[V]](stmts: Array[Stmt[V]], cfg: CFG): Iterable[Node]

    Permalink
  67. def updateExceptionHandlers(exceptionHandlers: ExceptionHandlers, newIndexes: Array[Int]): ExceptionHandlers

    Permalink

    Updates the exception handlers by adjusting the start, end and handler index (pc).

    Updates the exception handlers by adjusting the start, end and handler index (pc).

    This method can only be used in simple cases where the order of instructions remains the same - deleting instructions is supported.

    newIndexes

    A map that contains for each previous index the new index that should be used.

    returns

    The new exception handler.

Inherited from AnyRef

Inherited from Any

Ungrouped