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.

    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 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
  • package fpcf
    Definition Classes
    tac
  • package analyses
    Definition Classes
    fpcf
  • package purity
    Definition Classes
    analyses
  • AbstractPurityAnalysis
  • AssertionExceptionRater
  • BaseDomainSpecificRater
  • DomainSpecificRater
  • EagerL1PurityAnalysis
  • EagerL2PurityAnalysis
  • ExceptionRater
  • L1PurityAnalysis
  • L1PurityAnalysisScheduler
  • L2PurityAnalysis
  • L2PurityAnalysisScheduler
  • LazyL1PurityAnalysis
  • LazyL2PurityAnalysis
  • LoggingRater
  • SystemOutErrRater
  • SystemOutLoggingAllExceptionRater
  • SystemOutLoggingAssertionExceptionRater

class L2PurityAnalysis extends AbstractPurityAnalysis

An inter-procedural analysis to determine a method's purity.

Source
L2PurityAnalysis.scala
Note

This analysis is sound only up to the usual standards, i.e. it does not cope with VirtualMachineErrors, LinkageErrors and ReflectiveOperationExceptions and may be unsound in the presence of native code, reflection or sun.misc.Unsafe. Calls to native methods are handled soundly in general as they are considered org.opalj.br.fpcf.properties.ImpureByAnalysis, but native methods may break soundness of this analysis by invalidating assumptions such as which fields are effectively final.

,

This analysis is sound even if the three address code hierarchy is not flat, it will produce better results for a flat hierarchy, though. This is because it will not assess the types of expressions other than org.opalj.tac.Vars.

,

This analysis derives all purity level. A configurable org.opalj.tac.fpcf.analyses.purity.DomainSpecificRater is used to identify calls, expressions and exceptions that are LBDPure instead of LBImpure or any SideEffectFree purity level. Compared to L1PurityAnaylsis it identifies objects/arrays returned from pure callees that can be considered local. Synchronized methods are treated as ExternallyPure.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. L2PurityAnalysis
  2. AbstractPurityAnalysis
  3. FPCFAnalysis
  4. ProjectBasedAnalysis
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait AnalysisState extends AnyRef

    The state of the analysis.

    The state of the analysis. Analyses are expected to extend this trait with the information they need.

    lbPurity - The current minimum possible purity level for the method ubPurity - The current maximum purity level for the method method - The currently analyzed method context - The corresponding Context to report results for declClass - The declaring class of the currently analyzed method code - The code of the currently analyzed method

    Definition Classes
    AbstractPurityAnalysis
  2. class State extends AnalysisState

    Holds the state of this analysis.

  3. type StateType = State
  4. type V = DUVar[ValueInformation]

    The type of the TAC domain.

    The type of the TAC domain.

    Definition Classes
    AbstractPurityAnalysis

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. def adjustLowerBound()(implicit state: State): Unit

    Raises the lower bound on the purity whenever possible.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def atMost(newLevel: Purity)(implicit state: StateType): Unit

    Reduces the minPurity and maxPurity of the current method to at most the given purity level.

    Reduces the minPurity and maxPurity of the current method to at most the given purity level.

    Definition Classes
    AbstractPurityAnalysis
  7. def baseMethodPurity(context: Context): ProperPropertyComputationResult

    Retrieves and commits the methods purity as calculated for its declaring class type for the current DefinedMethod that represents the non-overwritten method in a subtype.

    Retrieves and commits the methods purity as calculated for its declaring class type for the current DefinedMethod that represents the non-overwritten method in a subtype.

    Definition Classes
    AbstractPurityAnalysis
  8. def c(eps: SomeEPS)(implicit state: State): ProperPropertyComputationResult

    Continuation to handle updates to properties of dependees.

    Continuation to handle updates to properties of dependees. Dependees may be

    • methods / virtual methods called (for their purity)
    • fields read (for their mutability)
    • classes files for class types returned (for their mutability)
  9. final def ch: ClassHierarchy
    Definition Classes
    ProjectBasedAnalysis
  10. def checkFieldAssignability(ep: EOptionP[Field, FieldAssignability], objRef: Option[Expr[V]])(implicit state: StateType): Unit

    Examines the influence that a given field mutability has on the method's purity.

    Examines the influence that a given field mutability has on the method's purity.

    Definition Classes
    AbstractPurityAnalysis
  11. def checkFreshnessOfReturn(pc: Int, data: (Option[Expr[V]], Purity), callees: Callees)(implicit state: State): Unit
  12. def checkLocalityOfField(ep: EOptionP[Field, FieldLocality], data: (Expr[V], Purity))(implicit state: State): Boolean
  13. def checkLocalityOfReturn(ep: EOptionP[Context, Property], data: (Option[Expr[V]], Purity))(implicit state: State): Unit
  14. def checkMethodPurity(ep: EOptionP[Context, Purity], params: Seq[Expr[V]])(implicit state: State): Boolean

    Examines the influence of the purity property of a method on the examined method's purity.

    Examines the influence of the purity property of a method on the examined method's purity.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
    Note

    Adds dependendees when necessary.

  15. def checkPurityOfCallees(calleesEOptP: EOptionP[DeclaredMethod, Callees])(implicit state: StateType): Boolean

    Examines the effect that the purity of all potential callees has on the purity of the method.

    Examines the effect that the purity of all potential callees has on the purity of the method.

    Definition Classes
    AbstractPurityAnalysis
  16. def checkPurityOfExpr(expr: Expr[V])(implicit state: StateType): Boolean

    Examines an expression for its influence on the method's purity.

    Examines an expression for its influence on the method's purity. This method will return false for impure expressions, so evaluation can be terminated early.

    Definition Classes
    AbstractPurityAnalysis
  17. def checkPurityOfFieldRef(fieldRef: FieldRead[V])(implicit state: StateType): Unit

    Examines whether a field read influences a method's purity.

    Examines whether a field read influences a method's purity. Reading values from fields that are not (effectively) final may cause nondeterministic behavior, so the method can only be side-effect free.

    Definition Classes
    AbstractPurityAnalysis
  18. def checkPurityOfMethod(callee: Context, params: Seq[Expr[V]])(implicit state: StateType): Boolean
    Definition Classes
    AbstractPurityAnalysis
  19. def checkPurityOfReturn(returnValue: Expr[V])(implicit state: StateType): Unit

    Examines the effect of returning a value on the method's purity.

    Examines the effect of returning a value on the method's purity. Returning a reference to a mutable object or array may cause nondeterministic behavior as the object/array may be modified between invocations of the method, so the method can only be side-effect free. E.g., a given parameter which references a mutable object is returned (and not otherwise accessed).

    Definition Classes
    AbstractPurityAnalysis
  20. def checkPurityOfStmt(stmt: Stmt[V])(implicit state: State): Boolean

    Examines a statement for its influence on the method's purity.

    Examines a statement for its influence on the method's purity. This method will return false for impure statements, so evaluation can be terminated early.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  21. def checkStaticDataUsage(ep: EOptionP[DeclaredMethod, StaticDataUsage])(implicit state: State): Unit

    Handles the effect of static data usage on the purity level.

    Handles the effect of static data usage on the purity level.

    Note

    Modifies dependees as necessary.

  22. def checkTypeImmutability(ep: EOptionP[ObjectType, Property], returnValue: Expr[V])(implicit state: StateType): Boolean

    Examines the effect that the mutability of a returned value's type has on the method's purity.

    Examines the effect that the mutability of a returned value's type has on the method's purity.

    Definition Classes
    AbstractPurityAnalysis
  23. implicit final def classHierarchy: ClassHierarchy
    Definition Classes
    ProjectBasedAnalysis
  24. def cleanupDependees()(implicit state: State): Unit

    Removes dependees that are known to not be needed anymore as they can not reduce the max purity level further.

  25. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  26. val configuredPurity: ConfiguredPurity
    Definition Classes
    AbstractPurityAnalysis
  27. implicit val declaredMethods: DeclaredMethods
    Attributes
    protected[this]
    Definition Classes
    AbstractPurityAnalysis
  28. def determineMethodPurity(cfg: CFG[Stmt[V], TACStmts[V]])(implicit state: State): ProperPropertyComputationResult

    Determines the purity of a method once TACAI is available.

  29. def determinePurity(context: Context): ProperPropertyComputationResult

    Determines the purity of the given method.

    Determines the purity of the given method.

    context

    A method call context

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  30. def doDeterminePurity(e: Entity): ProperPropertyComputationResult

    Called when the analysis is scheduled lazily.

    Called when the analysis is scheduled lazily.

    Definition Classes
    AbstractPurityAnalysis
  31. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  33. def getCall(stmt: Stmt[V]): Call[V]
    Definition Classes
    AbstractPurityAnalysis
  34. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  35. def getTACAI(method: Method)(implicit state: StateType): Option[TACode[TACMethodParameter, V]]

    Returns the TACode for a method if available, registering dependencies as necessary.

    Returns the TACode for a method if available, registering dependencies as necessary.

    Definition Classes
    AbstractPurityAnalysis
  36. def handleCalleesUpdate(callees: EOptionP[DeclaredMethod, Callees])(implicit state: State): Unit

    Add or remove the dependee when the callees property changes.

    Add or remove the dependee when the callees property changes.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  37. def handleTACAI(ep: EOptionP[Method, properties.TACAI])(implicit state: State): Unit

    Handles what to do if the TACAI is not yet final.

    Handles what to do if the TACAI is not yet final.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  38. def handleUnknownFieldAssignability(ep: EOptionP[Field, FieldAssignability], objRef: Option[Expr[V]])(implicit state: State): Unit

    Adds the dependee necessary if a field mutability is not known yet.

    Adds the dependee necessary if a field mutability is not known yet.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  39. def handleUnknownTypeImmutability(ep: EOptionP[ObjectType, Property], expr: Expr[V])(implicit state: State): Unit

    Adds the dependee necessary if a type mutability is not known yet.

    Adds the dependee necessary if a type mutability is not known yet.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  40. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  41. def isDomainSpecificCall(call: Call[V], receiver: Option[Expr[V]])(implicit state: StateType): Boolean

    Examines whether a call constitutes a domain-specific action using the domain-specific rater.

    Examines whether a call constitutes a domain-specific action using the domain-specific rater. If it is, the maxPurity will be reduced to at most the domain-specific purity returned by the domain-specific rater.

    Definition Classes
    AbstractPurityAnalysis
  42. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  43. def isLocal(expr: Expr[V], otherwise: Purity, excludedDefSites: IntTrieSet = EmptyIntTrieSet)(implicit state: State): Boolean

    Examines whether the given expression denotes an object/array that is local to the current method, i.e.

    Examines whether the given expression denotes an object/array that is local to the current method, i.e. the method has control over the object/array and actions on it might not influence purity.

    otherwise

    The maxPurity will be reduced to at most this level if the expression is not local.

    Definition Classes
    L2PurityAnalysisAbstractPurityAnalysis
  44. def isLocalDefsite(defSite: Int, otherwise: Purity, onParameter: (Int) => Purity, treatParamsAsFresh: Boolean, defSites: IntTrieSet, excludedDefSites: IntTrieSet)(implicit state: State): Boolean

    Examines whether the given defsite denotes an object/array that is local to the current method, i.e.

    Examines whether the given defsite denotes an object/array that is local to the current method, i.e. the method has control over the object/array and actions on it might not influence purity.

    otherwise

    The maxPurity will be reduced to at most this level if the defsite is not local

    onParameter

    The maxPurity will be reduced to at most this level if the defsite is a parameter

    treatParamsAsFresh

    The value to be returned if the defsite is a parameter

  45. def isLocalInternal(expr: Expr[V], otherwise: Purity, onParameter: (Int) => Purity, treatParamsAsFresh: Boolean, excludedDefSites: IntTrieSet = EmptyIntTrieSet)(implicit state: State): Boolean

    Examines whether the given expression denotes an object/array that is local to the current method, i.e.

    Examines whether the given expression denotes an object/array that is local to the current method, i.e. the method has control over the object/array and actions on it might not influence purity.

    otherwise

    The maxPurity will be reduced to at most this level if the expression is not local

    onParameter

    The maxPurity will be reduced to at most this level if the expression can be a parameter

    treatParamsAsFresh

    The value to be returned if the expression can be a parameter

    Note

    Fresh references can be treated as non-escaping as the analysis result will be impure if anything escapes the method via parameters, static field assignments or calls.

  46. def isSourceOfImmediateException(origin: ValueOrigin)(implicit state: StateType): Boolean

    Checks whether the statement, which is the origin of an exception, directly created the exception or if the VM instantiated the exception.

    Checks whether the statement, which is the origin of an exception, directly created the exception or if the VM instantiated the exception. Here, we are only concerned about the exceptions thrown by the instructions not about exceptions that are transitively thrown; e.g. if a method is called. TODO We need this method because currently, for exceptions that terminate the method, no definitions are recorded. Once this is done, use that information instead to determine whether it may be an immediate exception or not.

    Definition Classes
    AbstractPurityAnalysis
  47. implicit final def logContext: LogContext
    Definition Classes
    ProjectBasedAnalysis
  48. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  49. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  50. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  51. implicit final def p: SomeProject
    Definition Classes
    ProjectBasedAnalysis
  52. val project: SomeProject
  53. implicit final val propertyStore: PropertyStore
    Definition Classes
    FPCFAnalysis
  54. final def ps: PropertyStore
    Definition Classes
    FPCFAnalysis
  55. val rater: DomainSpecificRater
  56. val raterFqn: String
  57. def reducePurityLB(newLevel: Purity)(implicit state: StateType): Unit

    Reduces the maxPurity of the current method to at most the given purity level.

    Reduces the maxPurity of the current method to at most the given purity level.

    Definition Classes
    AbstractPurityAnalysis
  58. def resolveDomainSpecificRater(fqn: String): DomainSpecificRater
    Definition Classes
    AbstractPurityAnalysis
  59. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  60. def toString(): String
    Definition Classes
    AnyRef → Any
  61. implicit val typeIterator: TypeIterator
    Attributes
    protected[this]
    Definition Classes
    AbstractPurityAnalysis
  62. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  63. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  64. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AbstractPurityAnalysis

Inherited from FPCFAnalysis

Inherited from ProjectBasedAnalysis

Inherited from AnyRef

Inherited from Any

Ungrouped