Class/Object

org.opalj.ai

InstructionCountBoundedAI

Related Docs: object InstructionCountBoundedAI | package ai

Permalink

class InstructionCountBoundedAI[D <: Domain] extends AI[D]

An abstract interpreter that interrupts itself after the evaluation of the given number of instructions.

Thread Safety

This class is thread-safe. I.e., one instance of the InstructionCountBoundedAI can be used to run multiple abstract interpretations in parallel and to ensure that they terminate (as a whole) if the threshold is exceeded.

Linear Supertypes
AI[D], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InstructionCountBoundedAI
  2. AI
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new InstructionCountBoundedAI(code: Code, maxEvaluationFactor: Double = 1.5d, identifyDeadVariables: Boolean = true)(implicit logContext: LogContext)

    Permalink

    maxEvaluationFactor

    Determines the maximum number of instruction evaluations before the evaluation of the method is automatically interrupted.

  2. new InstructionCountBoundedAI(maxEvaluationCount: Int, IdentifyDeadVariables: Boolean)

    Permalink

    maxEvaluationCount

    Determines the maximum number of instructions that should be interpreted. If the interpretation did not finish before that, the abstract interpretation is aborted. An aborted abstract interpretation can be continued later on using the continueInterpretation method of the AIAborted object. In general, it makes sense to determine this value based on the complexity of the code as it is done by InstructionCountBoundedAI.calculateMaxEvaluationCount.

Type Members

  1. type SomeLocals[V <: AI.SomeLocals.V.d.type.DomainValue forSome {val d: D}] = Option[IndexedSeq[V]]

    Permalink
    Definition Classes
    AI

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to any2stringadd[InstructionCountBoundedAI[D]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (InstructionCountBoundedAI[D], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to ArrowAssoc[InstructionCountBoundedAI[D]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final val IdentifyDeadVariables: Boolean

    Permalink
    Definition Classes
    AI
  7. def apply(classFile: ClassFile, method: Method, theDomain: D): AIResult { val domain: theDomain.type }

    Permalink

    Performs an abstract interpretation of the given method using the given domain.

    Performs an abstract interpretation of the given method using the given domain.

    classFile

    The method's defining class file.

    method

    A non-native, non-abstract method of the given class file that will be analyzed. All parameters are automatically initialized with sensible default values.

    theDomain

    The domain that will be used to perform computations related to values.

    Definition Classes
    AI
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def continueInterpretation(code: Code, cfJoins: BitSet, liveVariables: LiveVariables, theDomain: D)(initialWorkList: Chain[PC], alreadyEvaluated: Chain[PC], theOperandsArray: AI.D.OperandsArray, theLocalsArray: AI.D.LocalsArray, theMemoryLayoutBeforeSubroutineCall: Chain[(PC, AI.D.OperandsArray, AI.D.LocalsArray)], theSubroutinesOperandsArray: AI.D.OperandsArray, theSubroutinesLocalsArray: AI.D.LocalsArray): AIResult { val domain: theDomain.type }

    Permalink

    Continues the interpretation of/performs an abstract interpretation of the given method (code) using the given domain.

    Continues the interpretation of/performs an abstract interpretation of the given method (code) using the given domain.

    code

    The bytecode that will be interpreted using the given domain.

    cfJoins

    The set of instructions where two or more control flow paths join. The abstract interpretation framework will only perform a join operation for those instructions.

    theDomain

    The domain that will be used to perform the domain dependent computations.

    initialWorkList

    The list of program counters with which the interpretation will continue. If the method was never analyzed before, the list should just contain the value "0"; i.e., we start with the interpretation of the first instruction (see initialWorkList). Note that the worklist may contain negative values. These values are not related to a specific instruction per-se but encode the necessary information to handle subroutines. In case of calls to a subroutine we add the special values SUBROUTINE and SUBROUTINE_START to the list to encode when the evaluation started. This is needed to completely process the subroutine (to explore all paths) before we finally return to the main method.

    alreadyEvaluated

    The list of the program counters (PC) of the instructions that were already evaluated. Initially (i.e., if the given code is analyzed the first time) this list is empty. This list is primarily needed to correctly resolve jumps to sub routines (JSR(_W) and RET instructions.) For each instruction that was evaluated, the operands array and the locals array must be non-empty (not null).

    theOperandsArray

    The array that contains the operand stacks. Each value in the array contains the operand stack before the instruction with the corresponding index is executed. This array can be empty except of the indexes that are referred to by the initialWorklist. The operandsArray data structure is mutated by OPAL-AI and it is recommended that a Domain does not directly mutate the state of this array.

    theLocalsArray

    The array that contains the local variable assignments. Each value in the array contains the local variable assignments before the instruction with the corresponding program counter is executed. The localsArray data structure is mutated by OPAL-AI and it is recommended that a Domain does not directly mutate the state of this array.

    theSubroutinesOperandsArray

    The array that contains the intermediate information about the subroutines' operands. This value should be null unless we are continuing an aborted computation and a subroutine was already analyzed.

    theSubroutinesLocalsArray

    The array that contains the intermediate information about the subroutines' locals. This value should be null unless we are continuing an aborted computation and a subroutine was already analyzed.

    Definition Classes
    AI
  11. def continueInterpretation(code: Code, theDomain: D)(initialWorkList: Chain[PC], alreadyEvaluated: Chain[PC], theOperandsArray: AI.D.OperandsArray, theLocalsArray: AI.D.LocalsArray): AIResult { val domain: theDomain.type }

    Permalink
    Definition Classes
    AI
  12. def currentEvaluationCount: Int

    Permalink
  13. def ensuring(cond: (InstructionCountBoundedAI[D]) ⇒ Boolean, msg: ⇒ Any): InstructionCountBoundedAI[D]

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to Ensuring[InstructionCountBoundedAI[D]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (InstructionCountBoundedAI[D]) ⇒ Boolean): InstructionCountBoundedAI[D]

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to Ensuring[InstructionCountBoundedAI[D]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: ⇒ Any): InstructionCountBoundedAI[D]

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to Ensuring[InstructionCountBoundedAI[D]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): InstructionCountBoundedAI[D]

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to Ensuring[InstructionCountBoundedAI[D]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to StringFormat[InstructionCountBoundedAI[D]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. def initialLocals(classFile: ClassFile, method: Method, domain: D)(someLocals: SomeLocals[AI.D.DomainValue] = None): AI.D.Locals

    Permalink

    Returns the initial register assignment (the initialized locals) that is used when analyzing a new method.

    Returns the initial register assignment (the initialized locals) that is used when analyzing a new method.

    Initially, only the registers that contain the method's parameters (including the self reference (this)) are used. If no initial assignment is provided (someLocals == None) a valid assignment is automatically created using the domain. See perform(...) for further details regarding the initial register assignment.

    This method is called by the perform method with the same signature. It may be overridden by subclasses to perform some additional processing. In that case, however, it is highly recommended to call this method to finalize the initial assignment.

    classFile

    The class file which defines the given method.

    method

    A non-native, non-abstract method. I.e., a method that has an implementation in Java bytecode (e.g., method.body.isDefined === true).

    domain

    The domain that will be used to perform computations related to values.

    Definition Classes
    AI
  24. def initialOperands(classFile: ClassFile, method: Method, domain: D): AI.D.Operands

    Permalink

    Returns the initial set of operands that will be used for the abstract interpretation of the given method.

    Returns the initial set of operands that will be used for the abstract interpretation of the given method.

    In general, an empty list is returned as the JVM specification mandates that the operand stack is empty at the very beginning of a method.

    This method is called by the perform method with the same signature. It may be overridden by subclasses to perform some additional processing.

    Definition Classes
    AI
  25. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  26. def isInterrupted: Boolean

    Permalink

    Determines whether a running (or to be started) abstract interpretation should be interrupted (default: false).

    Determines whether a running (or to be started) abstract interpretation should be interrupted (default: false).

    In general, interrupting the abstract interpreter may be meaningful if the abstract interpretation takes too long or if the currently used domain is not sufficiently precise enough/if additional information is needed to continue with the analysis.

    Called during the abstract interpretation of a method to determine whether the computation should be aborted. This method is always called directly before the evaluation of the first/next instruction. I.e., before the very first instruction or after the ai has completely evaluated an instruction, updated the memory and stated all constraints.

    Definition Classes
    InstructionCountBoundedAIAI
    Note

    When the abstract interpreter is currently waiting on the result of the interpretation of a called method it may take some time before the interpretation of the current method (this abstract interpreter) is actually aborted. This method needs to be overridden in subclasses to identify situations in which a running abstract interpretation should be interrupted.

  27. val maxEvaluationCount: Int

    Permalink

    Determines the maximum number of instructions that should be interpreted.

    Determines the maximum number of instructions that should be interpreted. If the interpretation did not finish before that, the abstract interpretation is aborted. An aborted abstract interpretation can be continued later on using the continueInterpretation method of the AIAborted object. In general, it makes sense to determine this value based on the complexity of the code as it is done by InstructionCountBoundedAI.calculateMaxEvaluationCount.

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

    Permalink
    Definition Classes
    AnyRef
  29. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  31. def perform(classFile: ClassFile, method: Method, theDomain: D)(someLocals: Option[IndexedSeq[AI.D.DomainValue]] = None): AIResult { val domain: theDomain.type }

    Permalink

    Analyzes the given method using the given domain and the pre-initialized parameter values (if any).

    Analyzes the given method using the given domain and the pre-initialized parameter values (if any). Basically, first the set of initial operands and locals is calculated before the respective perform(...,initialOperands,initialLocals) method is called.

    Controlling the AI

    The abstract interpretation of a method is aborted if the AI's isInterrupted method returns true.

    classFile

    Some class file; needed to determine the type of this if the method is an instance method.

    method

    A non-abstract, non-native method of the given class file. I.e., a method with a body.

    theDomain

    The abstract domain that will be used for the abstract interpretation of the given method.

    someLocals

    The initial register assignment (the parameters passed to the method). If the values passed to a method are already known, the abstract interpretation will be performed under that assumption. The specified number of locals has to be equal or larger than the number of parameters (including this in case of a non-static method.). If the number is lower than method.body.maxLocals it will be adjusted as required.

    returns

    The result of the abstract interpretation. Basically, the calculated memory layouts; i.e., the list of operands and local variables before each instruction. Each calculated memory layout represents the layout before the instruction with the corresponding program counter was interpreted. If the interpretation was aborted, the returned result object contains all necessary information to continue the interpretation if needed/desired.

    Definition Classes
    AI
  32. def performInterpretation(strictfp: Boolean, code: Code, theDomain: D)(initialOperands: AI.D.Operands, initialLocals: AI.D.Locals): AIResult { val domain: theDomain.type }

    Permalink

    Performs an abstract interpretation of the given (byte)code using the given domain and the initial operand stack and initial register assignment.

    Performs an abstract interpretation of the given (byte)code using the given domain and the initial operand stack and initial register assignment.

    Definition Classes
    AI
  33. def preInterpretationInitialization(code: Code, instructions: Array[Instruction], cfJoins: BitSet, liveVariables: LiveVariables, theDomain: D)(theOperandsArray: AI.D.OperandsArray, theLocalsArray: AI.D.LocalsArray, theMemoryLayoutBeforeSubroutineCall: Chain[(PC, AI.D.OperandsArray, AI.D.LocalsArray)], theSubroutinesOperandsArray: AI.D.OperandsArray, theSubroutinesLocalsArray: AI.D.LocalsArray): Unit

    Permalink

    Performs additional initializations of the Domain, if the Domain implements the trait TheAI, TheCodeStructure, TheMemoryLayout or CustomInitialization.

    Performs additional initializations of the Domain, if the Domain implements the trait TheAI, TheCodeStructure, TheMemoryLayout or CustomInitialization.

    This method is called before the abstract interpretation is started/continued.

    Attributes
    protected[this]
    Definition Classes
    AI
  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  35. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  36. def tracer: Option[AITracer]

    Permalink

    The tracer (default: None) that is called by OPAL while performing the abstract interpretation of a method.

    The tracer (default: None) that is called by OPAL while performing the abstract interpretation of a method.

    This method is called at different points to report on the analysis progress (see org.opalj.ai.AITracer for further details)

    It is possible to attach/detach a tracer at any time.

    To attach a tracer to the abstract interpreter override this method in subclasses and return some tracer object.

    Definition Classes
    AI
  37. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. def [B](y: B): (InstructionCountBoundedAI[D], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from InstructionCountBoundedAI[D] to ArrowAssoc[InstructionCountBoundedAI[D]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AI[D]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from InstructionCountBoundedAI[D] to any2stringadd[InstructionCountBoundedAI[D]]

Inherited by implicit conversion StringFormat from InstructionCountBoundedAI[D] to StringFormat[InstructionCountBoundedAI[D]]

Inherited by implicit conversion Ensuring from InstructionCountBoundedAI[D] to Ensuring[InstructionCountBoundedAI[D]]

Inherited by implicit conversion ArrowAssoc from InstructionCountBoundedAI[D] to ArrowAssoc[InstructionCountBoundedAI[D]]

Ungrouped