Packages

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

    OPAL is a Scala-based framework for the static analysis, manipulation and creation of Java bytecode.

    OPAL is a Scala-based framework for the static analysis, manipulation and creation of Java bytecode. OPAL is designed with performance, scalability and adaptability in mind.

    Its main components are:

    • a library (Common) which provides generally useful data-structures and algorithms for static analyses.
    • a framework for implementing lattice based static analyses (Static Analysis Infrastructure)
    • a framework for parsing Java bytecode (Bytecode Infrastructure) that can be used to create arbitrary representations.
    • a library to create a one-to-one in-memory representation of Java bytecode (Bytecode Disassembler).
    • a library to create a representation of Java bytecode that facilitates writing simple static analyses (Bytecode Representation - org.opalj.br).
    • a scalable, easily customizable framework for the abstract interpretation of Java bytecode (Abstract Interpretation Framework - org.opalj.ai).
    • a library to extract dependencies between code elements and to facilitate checking architecture definitions.
    • a library for the lightweight manipulation and creation of Java bytecode (Bytecode Assembler).

    General Design Decisions

    Thread Safety

    Unless explicitly noted, OPAL is thread safe. I.e., the classes defined by OPAL can be considered to be thread safe unless otherwise stated. (For example, it is possible to read and process class files concurrently without explicit synchronization on the client side.)

    No null Values

    Unless explicitly noted, OPAL does not null values I.e., fields that are accessible will never contain null values and methods will never return null. If a method accepts null as a value for a parameter or returns a null value it is always explicitly documented. In general, the behavior of methods that are passed null values is undefined unless explicitly documented.

    No Typecasts for Collections

    For efficiency reasons, OPAL sometimes uses mutable data-structures internally. After construction time, these data-structures are generally represented using their generic interfaces (e.g., scala.collection.{Set,Map}). However, a downcast (e.g., to add/remove elements) is always forbidden as it would effectively prevent thread-safety. Furthermore, the concrete data-structure is always considered an implementation detail and may change at any time.

    Assertions

    OPAL makes heavy use of Scala's Assertion Facility to facilitate writing correct code. Hence, for production builds (after thorough testing(!)) it is highly recommend to build OPAL again using -Xdisable-assertions.

    Definition Classes
    org
  • package ai

    Implementation of an abstract interpretation (ai) framework – also referred to as OPAL.

    Implementation of an abstract interpretation (ai) framework – also referred to as OPAL.

    Please note that OPAL/the abstract interpreter just refers to the classes and traits defined in this package (ai). The classes and traits defined in the sub-packages (in particular in domain) are not considered to be part of the core of OPAL/the abstract interpreter.

    Definition Classes
    opalj
    Note

    This framework assumes that the analyzed bytecode is valid; i.e., the JVM's bytecode verifier would be able to verify the code. Furthermore, load-time errors (e.g., LinkageErrors) are – by default – completely ignored to facilitate the analysis of parts of a project. In general, if the presented bytecode is not valid, the result is undefined (i.e., OPAL may report meaningless results, crash or run indefinitely).

    See also

    org.opalj.ai.AI - Implements the abstract interpreter that processes a methods code and uses an analysis-specific domain to perform the abstract computations.

    org.opalj.ai.Domain - The core interface between the abstract interpretation framework and the abstract domain that is responsible for performing the abstract computations.

  • package av
    Definition Classes
    opalj
  • package ba

    Implementation of an eDSL for creating Java bytecode.

    Implementation of an eDSL for creating Java bytecode. The eDSL is designed to facilitate the creation of correct class files; i.e., whenever possible it tries to fill wholes. For example, when an interface is specified the library automatically ensures that the super class type is (initially) set to java.lang.Object as required by the JVM specification.

    This package in particular provides functionality to convert org.opalj.br classes to org.opalj.da classes.

    Definition Classes
    opalj
  • package bc
    Definition Classes
    opalj
  • package bi

    Implementation of a library for parsing Java bytecode and creating arbitrary representations.

    Implementation of a library for parsing Java bytecode and creating arbitrary representations.

    OPAL's primary representation of Java byte code is the org.opalj.br representation which is defined in the respective package. A second representation that represents bytecode one-by-one is found in the org.opalj.da package.

    This Package

    Common constants and type definitions used across OPAL.

    Definition Classes
    opalj
  • 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 bytecode

    Defines functionality commonly useful when processing Java bytecode.

    Defines functionality commonly useful when processing Java bytecode.

    Definition Classes
    opalj
  • package collection

    Defines helper methods related to Scala's and OPAL's collections APIs.

    Defines helper methods related to Scala's and OPAL's collections APIs.

    Definition Classes
    opalj
  • package concurrent

    Common constants, factory methods and objects used throughout OPAL when performing concurrent computations.

    Common constants, factory methods and objects used throughout OPAL when performing concurrent computations.

    Definition Classes
    opalj
  • package constraints

    Defines helper values and methods related to modeling constraints.

    Defines helper values and methods related to modeling constraints.

    Definition Classes
    opalj
  • package control

    Defines common control abstractions.

    Defines common control abstractions.

    Definition Classes
    opalj
  • package da

    Defines convenience methods related to representing certain class file elements.

    Defines convenience methods related to representing certain class file elements.

    Definition Classes
    opalj
  • package de

    Functionality to extract dependencies between class files.

    Functionality to extract dependencies between class files.

    Definition Classes
    opalj
  • package fpcf

    The fixpoint computations framework (fpcf) is a general framework to perform fixpoint computations of properties ordered by a lattice.

    The fixpoint computations framework (fpcf) is a general framework to perform fixpoint computations of properties ordered by a lattice. The framework in particular supports the development of static analyses.

    In this case, the fixpoint computations/static analyses are generally operating on the code and need to be executed until the computations have reached their (implicit) fixpoint. The fixpoint framework explicitly supports resolving cyclic dependencies/computations. A prime use case of the fixpoint framework are all those analyses that may interact with the results of other analyses.

    For example, an analysis that analyzes all field write accesses to determine if we can refine a field's type (for the purpose of the analysis) can (reuse) the information about the return types of methods, which however may depend on the refined field types.

    The framework is generic enough to facilitate the implementation of anytime algorithms.

    Definition Classes
    opalj
    Note

    This framework assumes that all data-structures (e.g., dependee lists and properties) that are passed to the framework are effectively immutable! (Effectively immutable means that the datastructure is never updated after it was passed to the framework.)

    ,

    The dependency relation is as follows: “A depends on B” === “A is the depender, B is the dependee”. === “B is depended on by A”

    ,

    The very core of the framework is described in: Lattice Based Modularization of Static Analyses

  • package graphs

    This package defines graph algorithms as well as factory methods to describe and compute graphs and trees.

    This package defines graph algorithms as well as factory methods to describe and compute graphs and trees.

    This package supports the following types of graphs:

    1. graphs based on explicitly connected nodes (org.opalj.graphs.Node),
    2. graphs where the relationship between the nodes are encoded externally (org.opalj.graphs.Graph).
    Definition Classes
    opalj
  • package hermes
    Definition Classes
    opalj
  • package io

    Various io-related helper methods and classes.

    Various io-related helper methods and classes.

    Definition Classes
    opalj
    Note

    The implementations of the methods rely on Java NIO(2).

  • package issues

    Defines implicit conversions to wrap some types of analyses such that they generate results of type org.opalj.br.analyses.ReportableAnalysisResult.

    Defines implicit conversions to wrap some types of analyses such that they generate results of type org.opalj.br.analyses.ReportableAnalysisResult.

    Definition Classes
    opalj
  • package log
    Definition Classes
    opalj
  • package support
    Definition Classes
    opalj
  • package tac

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

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

    Definition Classes
    opalj
  • ASTNode
  • ArrayExpr
  • ArrayLength
  • ArrayLoad
  • ArrayStore
  • Assignment
  • BinaryExpr
  • Call
  • CaughtException
  • Checkcast
  • ClassConst
  • Compare
  • Const
  • DUVar
  • DVar
  • DefSites
  • DefaultTACAIKey
  • DoubleConst
  • Expr
  • ExprStmt
  • FieldAndArrayUsageAnalysis
  • FieldRead
  • FieldWriteAccessStmt
  • FloatConst
  • FunctionCall
  • GetField
  • GetStatic
  • Goto
  • IdBasedVar
  • If
  • InstanceFunctionCall
  • InstanceMethodCall
  • InstanceOf
  • IntConst
  • Invokedynamic
  • JSR
  • LocalPointsTo
  • LongConst
  • MethodCall
  • MethodCallParameters
  • MethodHandleConst
  • MethodTypeConst
  • MonitorEnter
  • MonitorExit
  • New
  • NewArray
  • NonVirtualFunctionCall
  • NonVirtualFunctionCallStatement
  • NonVirtualMethodCall
  • Nop
  • NullExpr
  • OperandVar
  • Param
  • Parameters
  • PrefixExpr
  • PrimitiveTypecastExpr
  • PrintTAC
  • PutField
  • PutStatic
  • RegisterVar
  • Ret
  • Return
  • ReturnValue
  • SimplePropagation
  • SimpleStmt
  • SimpleTACAIKey
  • SimpleValueConst
  • SimpleVar
  • StaticFunctionCall
  • StaticFunctionCallStatement
  • StaticMethodCall
  • Stmt
  • StringConst
  • Switch
  • SynchronizationStmt
  • TAC
  • TACAI
  • TACAIKey
  • TACAItoGraphs
  • TACMethodParameter
  • TACNaive
  • TACOptimization
  • TACOptimizationResult
  • TACStmts
  • TACTemplate
  • TACode
  • TempVar
  • Throw
  • ToTxt
  • UVar
  • ValueExpr
  • Var
  • VirtualCall
  • VirtualFunctionCall
  • VirtualFunctionCallStatement
  • VirtualMethodCall
  • package util

    Utility methods.

    Utility methods.

    Definition Classes
    opalj
  • package value

    Provides a general query interface for querying a value's properties.

    Provides a general query interface for querying a value's properties.

    Definition Classes
    opalj

package tac

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

Source
package.scala
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

    Defines nodes used by statements and expressions.

  2. trait ArrayExpr[+V <: Var[V]] extends Expr[V]
  3. case class ArrayLength[+V <: Var[V]](pc: PC, arrayRef: Expr[V]) extends ArrayExpr[V] with Product with Serializable
  4. case class ArrayLoad[+V <: Var[V]](pc: PC, index: Expr[V], arrayRef: Expr[V]) extends ArrayExpr[V] with Product with Serializable
  5. case class ArrayStore[+V <: Var[V]](pc: Int, arrayRef: Expr[V], index: Expr[V], value: Expr[V]) extends Stmt[V] with Product with Serializable
  6. case class Assignment[+V <: Var[V]](pc: Int, targetVar: V, expr: Expr[V]) extends Stmt[V] with Product with Serializable
  7. 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

    cTpe

    The computational type of the result of the binary expression if the expression succeeds.

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

    Common supertrait of statements and expressions calling a method.

  9. case class CaughtException[+V <: Var[V]](pc: Int, exceptionType: Option[ObjectType], throwingStmts: IntTrieSet) extends Stmt[V] with Product with Serializable

    A caught exception is essential to ensure that the "throw" is never optimized away, even if the exception object as such is not used.

    A caught exception is essential to ensure that the "throw" is never optimized away, even if the exception object as such is not used.

    Note

    CaughtException expression are only created by TACAI!

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

    A checkcast as defined by the JVM specification.

  11. case class ClassConst(pc: PC, value: ReferenceType) extends SimpleValueConst with Product with Serializable
  12. case class Compare[+V <: Var[V]](pc: PC, left: Expr[V], condition: RelationalOperator, right: Expr[V]) extends Expr[V] with Product with Serializable

    A comparison of two values.

  13. sealed abstract class Const extends ValueExpr[Nothing]

    A constant value expression.

  14. abstract class DUVar[+Value <: KnownTypedValue] extends Var[DUVar[Value]]

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

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

    A (final) variable definition, which is uniquely identified by its origin/the index of the corresponding AssignmentStatement.

    A (final) variable definition, which is uniquely identified by its origin/the index of the corresponding AssignmentStatement. 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.

  16. case class DoubleConst(pc: PC, value: Double) extends SimpleValueConst with Product with Serializable
  17. trait Expr[+V <: Var[V]] extends ASTNode[V]

    Represents an expression.

    Represents an expression. In general, every expression should be a simple expression, where the child expressions are just Vars or Consts. 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/nested expressions after all transformations and static analyses have been performed.

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

    An expression where the value is not further used.

  19. abstract class FieldRead[+V <: Var[V]] extends Expr[V]
  20. sealed abstract class FieldWriteAccessStmt[+V <: Var[V]] extends Stmt[V]
  21. case class FloatConst(pc: PC, value: Float) extends SimpleValueConst with Product with Serializable
  22. sealed abstract class FunctionCall[+V <: Var[V]] extends Expr[V] with Call[V]
  23. case class GetField[+V <: Var[V]](pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, objRef: Expr[V]) extends FieldRead[V] with Product with Serializable
  24. case class GetStatic(pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType) extends FieldRead[Nothing] with Product with Serializable
  25. case class Goto(pc: PC, target: Int) extends Stmt[Nothing] with Product with Serializable

    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]

    Id based variables are named based on the position of the corresponding stack/register value.

  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

    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]
  29. sealed abstract class InstanceMethodCall[+V <: Var[V]] extends MethodCall[V]
  30. case class InstanceOf[+V <: Var[V]](pc: PC, value: Expr[V], cmpTpe: ReferenceType) extends Expr[V] with Product with Serializable

    An instance of expression as defined by the JVM specification.

  31. case class IntConst(pc: PC, value: Int) extends SimpleValueConst with Product with Serializable
  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
  33. case class JSR(pc: PC, target: Int) extends Stmt[Nothing] with Product with Serializable

    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
  35. sealed abstract class MethodCall[+V <: Var[V]] extends Stmt[V] with Call[V]
  36. case class MethodHandleConst(pc: PC, value: MethodHandle) extends Const with Product with Serializable
  37. case class MethodTypeConst(pc: PC, value: MethodDescriptor) extends Const with Product with Serializable
  38. case class MonitorEnter[+V <: Var[V]](pc: PC, objRef: Expr[V]) extends SynchronizationStmt[V] with Product with Serializable
  39. case class MonitorExit[+V <: Var[V]](pc: PC, objRef: Expr[V]) extends SynchronizationStmt[V] with Product with Serializable
  40. case class New(pc: PC, tpe: ObjectType) extends Expr[Nothing] with Product with Serializable

    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 ArrayExpr[V] with Product with Serializable

    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: ObjectType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceFunctionCall[V] with Product with Serializable

    An instance based method call which does not require virtual method lookup.

    An instance based method call which does not require virtual method lookup. In other words the target method is either directly found in the specified class or a super class thereof. (Basically corresponds to an invokespecial at bytecode level.)

    V

    The type of the Var used by this representation.

    pc

    The pc of the underlying, original bytecode instruction. Primarily useful to do a lookup in the line-/local-variable tables.

    declaringClass

    The declaring class of the target method.

    isInterface

    true if the declaring class defines an interface type. (Required since Java 8.)

    name

    The name of the target method.

    descriptor

    The descriptor.

    receiver

    The receiver object.

    params

    The parameters of the method call (including the implicit this reference.)

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

    Call of an instance method for which no virtual method call resolution has to happen.

    Call of an instance method for which no virtual method call resolution has to happen. I.e., it is either a super-call, a private instance method call or a constructor call.

  44. case class Nop(pc: Int) extends SimpleStmt with Product with Serializable
  45. case class NullExpr(pc: PC) extends SimpleValueConst with Product with Serializable
  46. case class Param(cTpe: ComputationalType, name: String) extends ValueExpr[Nothing] with Product with Serializable

    Explicit initialization of a parameter.

    Explicit initialization of 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. In case of TACAI, usage of parameters are implicitly encoded using parameter origins (see DUVar).

  47. class Parameters[P <: AnyRef] extends (Int) ⇒ P

    Information about a method's explicit and implicit parameters.

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

    cTpe

    The computational type of the result of the prefix expression.

  49. case class PrimitiveTypecastExpr[+V <: Var[V]](pc: PC, targetTpe: BaseType, operand: Expr[V]) extends Expr[V] with Product with Serializable
  50. case class PutField[+V <: Var[V]](pc: Int, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, objRef: Expr[V], value: Expr[V]) extends FieldWriteAccessStmt[V] with Product with Serializable
  51. case class PutStatic[+V <: Var[V]](pc: PC, declaringClass: ObjectType, name: String, declaredFieldType: FieldType, value: Expr[V]) extends FieldWriteAccessStmt[V] with Product with Serializable
  52. case class Ret(pc: PC, returnAddresses: PCs) extends Stmt[Nothing] with Product with Serializable

    Return from subroutine; only to be used in combination with JSR instructions (Java 6 and earlier).

    Return from subroutine; only to be used in combination with JSR instructions (Java 6 and earlier).

    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.

  53. case class Return(pc: Int) extends SimpleStmt with Product with Serializable
  54. case class ReturnValue[+V <: Var[V]](pc: Int, expr: Expr[V]) extends Stmt[V] with Product with Serializable
  55. sealed abstract class SimpleStmt extends Stmt[Nothing]
  56. sealed abstract class SimpleValueConst extends Const
  57. case class SimpleVar(id: Int, cTpe: ComputationalType) extends IdBasedVar with Product with Serializable

    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.

  58. case class StaticFunctionCall[+V <: Var[V]](pc: PC, declaringClass: ObjectType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, params: Seq[Expr[V]]) extends FunctionCall[V] with Product with Serializable
  59. case class StaticMethodCall[+V <: Var[V]](pc: Int, declaringClass: ObjectType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, params: Seq[Expr[V]]) extends MethodCall[V] with Product with Serializable
  60. sealed abstract class Stmt[+V <: Var[V]] extends ASTNode[V]

    Super trait of all quadruple statements.

  61. case class StringConst(pc: PC, value: String) extends SimpleValueConst with Product with Serializable
  62. case class Switch[+V <: Var[V]](pc: PC, defaultTarget: PC, index: Expr[V], npairs: IndexedSeq[(Int, PC)]) extends Stmt[V] with Product with Serializable
  63. sealed abstract class SynchronizationStmt[+V <: Var[V]] extends Stmt[V]
  64. trait TACAIKey extends ProjectInformationKey[(Method) ⇒ TACode[TACMethodParameter, DUVar[KnownTypedValue]], Nothing]

  65. case class TACMethodParameter(origin: ValueOrigin, useSites: IntTrieSet) extends Product with Serializable

    Captures essential information about a method's parameter.

  66. trait TACOptimization[P <: AnyRef, V <: Var[V]] extends AnyRef

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

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

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

  68. case class TACStmts[V <: Var[V]](instructions: Array[Stmt[V]]) extends CodeSequence[Stmt[V]] with Product with Serializable

    Wrapper class to warp an array of statements.

  69. case class TACode[P <: AnyRef, V <: Var[V]](params: Parameters[P], stmts: Array[Stmt[V]], pcToIndex: Array[Int], cfg: CFG[Stmt[V], TACStmts[V]], exceptionHandlers: ExceptionHandlers, lineNumberTable: Option[LineNumberTable]) extends Attribute with CodeSequence[Stmt[V]] with Product with Serializable

    Contains the 3-address code of a method.

    Contains the 3-address code of a method.

    Attributes

    The following code attributes are directly reused (i.e., the PCs are not transformed): - LineNumberTableAttribute; the statements keep the reference to the underlying/original instruction which is used to retrieve the respective information.

    params

    The variables which store the method's explicit and implicit (this in case of an instance method) parameters. In case of the ai-based representation (TACAI - default representation), the variables are returned which store (the initial) parameters. If these variables are written and we have a loop which includes the very first instruction, the value will reflect this usage. In case of the naive representation it "just" contains the names of the registers which store the parameters.

    pcToIndex

    The mapping between the pcs of the original bytecode instructions to the index of the first statement that was generated for the bytecode instruction

    • if any. For details see TACNaive and TACAI
  70. case class Throw[+V <: Var[V]](pc: Int, exception: Expr[V]) extends Stmt[V] with Product with Serializable
  71. class UVar[+Value <: DomainValue] extends DUVar[Value]
  72. trait ValueExpr[+V <: Var[V]] extends Expr[V]
  73. trait Var[+V <: Var[V]] extends ValueExpr[V]

    Represents a variable.

    Represents a variable. Depending on the concrete usage, it is possible to distinguish between a use and/or definition site. Typically, V is directly bound by the direct subtypes of Var.

    V

    Specifies the type of Var used by the three address representation. V is also the self type.

    Example:
    1. trait MyVar extends Var[MyVar]
  74. trait VirtualCall[+V <: Var[V]] extends AnyRef
  75. 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 VirtualCall[V] with Product with Serializable
  76. case class VirtualMethodCall[+V <: Var[V]](pc: Int, declaringClass: ReferenceType, isInterface: Boolean, name: String, descriptor: MethodDescriptor, receiver: Expr[V], params: Seq[Expr[V]]) extends InstanceMethodCall[V] with VirtualCall[V] with Product with Serializable

Value Members

  1. final val AllTACNaiveOptimizations: List[TACOptimization[Param, IdBasedVar]]
  2. final val OriginOfThis: Int(-1)

    Identifies the implicit this reference in the 3-address code representation.

    Identifies the implicit this reference in the 3-address code representation. -1 always identifies the origin of the self reference(this) if the the method is an instance method; if the method is not an instance method the origin -1 is not used.

  3. final val SelfReferenceParameter: IntTrieSet
  4. def tacToDot[V <: Var[V]](stmts: Array[Stmt[V]], cfg: CFG[Stmt[V], TACStmts[V]]): String
  5. def tacToGraph[V <: Var[V]](stmts: Array[Stmt[V]], cfg: CFG[Stmt[V], TACStmts[V]]): Iterable[Node]
  6. def updateExceptionHandlers(newIndexes: Array[Int])(implicit aiResult: AIResult { val domain: org.opalj.ai.Domain with org.opalj.ai.domain.RecordDefUse }): ExceptionHandlers

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

    newIndexes

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

    aiResult

    The result of the abstract interpretation of the method.

    returns

    The new exception handlers.

    Note

    This method can only be used in cases where the order of instructions remains the same and/or instructions are deleted. If instructions are reordered this method cannot be used!

  7. object ArrayLength extends Serializable
  8. object ArrayLoad extends Serializable
  9. object ArrayStore extends Serializable
  10. object Assignment extends Serializable
  11. object BinaryExpr extends Serializable
  12. object Call
  13. object CaughtException extends Serializable
  14. object Checkcast extends Serializable
  15. object ClassConst extends Serializable
  16. object Compare extends Serializable
  17. object DUVar
  18. object DVar
  19. object DefSites

    Extractor to get the definition site of an expression's/statement's value.

    Extractor to get the definition site of an expression's/statement's value.

    This extractor may fail (i.e., throw an exception), when the expr is not a DVar or a Const; this decision was made to capture programming failures as early as possible (flat).

    Example:
    1. To get a return value's definition sites (unless the value is constant).

      val tac.ReturnValue(pc,tac.DefSites(defSites)) = code.stmts(5)
  20. object DefaultTACAIKey extends TACAIKey

    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.

  21. object DoubleConst extends Serializable
  22. object ExprStmt extends Serializable
  23. object FieldAndArrayUsageAnalysis extends DefaultOneStepAnalysis

    An evaluation of the impact of field/array writes to the org.opalj.fpcf.analyses.escape.SimpleEscapeAnalysis as the three-address code currently does not support may-alias information for fields and arrays.

    An evaluation of the impact of field/array writes to the org.opalj.fpcf.analyses.escape.SimpleEscapeAnalysis as the three-address code currently does not support may-alias information for fields and arrays.

    Among others, it estimates the number of arraystores/putfields with non-escaping objects as receiver.

  24. object FloatConst extends Serializable
  25. object GetField extends Serializable
  26. object GetStatic extends Serializable
  27. object Goto extends Serializable
  28. object If extends Serializable
  29. object InstanceMethodCall
  30. object InstanceOf extends Serializable
  31. object IntConst extends Serializable
  32. object Invokedynamic extends Serializable
  33. object JSR extends Serializable
  34. object LocalPointsTo

    Collects points-to information related to a method.

  35. object LongConst extends Serializable
  36. object MethodCallParameters
  37. object MethodHandleConst extends Serializable
  38. object MethodTypeConst extends Serializable
  39. object MonitorEnter extends Serializable
  40. object MonitorExit extends Serializable
  41. object New extends Serializable
  42. object NewArray extends Serializable
  43. object NonVirtualFunctionCall extends Serializable
  44. object NonVirtualFunctionCallStatement

    Matches a statement which – in flat form – directly calls a non-virtual function; basically abstracts over ExprStmts and Assignments.

  45. object NonVirtualMethodCall extends Serializable
  46. object Nop extends Serializable
  47. object NullExpr extends Serializable
  48. object OperandVar
  49. object Param extends Serializable
  50. object PrefixExpr extends Serializable
  51. object PrimitiveTypecastExpr extends Serializable
  52. object PrintTAC

    Prints the 3-address code for all methods of all classes found in the given jar/folder.

  53. object PutField extends Serializable
  54. object PutStatic extends Serializable
  55. object RegisterVar
  56. object Ret extends Serializable
  57. object Return extends Serializable
  58. object ReturnValue extends Serializable
  59. object SimplePropagation extends TACOptimization[Param, IdBasedVar]

    A very simple peephole optimizer which performs intra-basic block constant and copy propagation for the naive representation (in case of the ai-based representation these steps are already done at abstract-interpretation time).

  60. object SimpleTACAIKey extends TACAIKey

    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 analyses are NOT cached/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.

  61. object StaticFunctionCall extends Serializable
  62. object StaticFunctionCallStatement

    Matches a statement which – in flat form – directly calls a static function; basically abstracts over ExprStmts and Assignments.

  63. object StaticMethodCall extends Serializable
  64. object StringConst extends Serializable
  65. object Switch extends Serializable
  66. object TAC

    Creates the three-address representation for some method(s) and prints it to std out or writes it to a file.

    Creates the three-address representation for some method(s) and prints it to std out or writes it to a file.

    Example:
    1. To convert all files of a project to the AI based three-address code, you can use:

      import org.opalj.io.write
      import org.opalj.util.PerformanceEvaluation.time
      import org.opalj.tac._
      val f = new java.io.File("OPAL/bi/target/scala-2.12/resource_managed/test/ai.jar")
      val p = org.opalj.br.analyses.Project(f)
      var i = 0
      val errors = time {
        p.parForeachMethodWithBody(parallelizationLevel=32){ mi =>
          val TACode(code,cfg,ehs,_) = org.opalj.tac.TACAI(p,mi.method)()
          val tac = ToTxt(code, Some(cfg))
          val fileNamePrefix = mi.classFile.thisType.toJava+"."+mi.method.name
          val file = write(tac, fileNamePrefix, ".tac.txt")
          i+= 1
          println(i+":"+file)
        }
      }(t => println("transformation time: "+t.toSeconds))
      if(errors.nonEmpty) println(errors.mkString("\n"))
  67. object TACAI

    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 def sites.

  68. object TACAItoGraphs extends DefaultOneStepAnalysis

    Creates for all methods of a given project the Control-flow Graph and the DefUse Graph.

  69. object TACNaive

    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.

  70. object TACTemplate

    A template for implementing 3-address code based analyses.

  71. object TACode extends Serializable
  72. object TempVar
  73. object Throw extends Serializable
  74. object ToTxt

    Converts a list of three-address instructions into a text-based representation for comprehension purposes only.

    Converts a list of three-address instructions into a text-based representation for comprehension purposes only.

    Note

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

  75. object UVar
  76. object Var
  77. object VirtualFunctionCall extends Serializable
  78. object VirtualFunctionCallStatement

    Matches a statement which – in flat form – directly calls a virtual function; basically abstracts over ExprStmts and Assignments.

  79. object VirtualMethodCall extends Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped