Package

org.opalj.ai.domain

l1

Permalink

package l1

Commonly useful methods.

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. l1
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait ArrayValues extends ReferenceValues with PerInstructionPostProcessing with PostEvaluationMemoryManagement

    Permalink

    Enables the tracking of various properties related to arrays.

    Enables the tracking of various properties related to arrays.

    This domain in particular enables the tracking of an array's concrete content in some specific cases (e.g., the Strings stored in an array or some primitive values) or the tracking of information about an array's elements at a higher level. In both cases only arrays up to a specified size (cf. maxTrackedArraySize) are tracked. The content of arrays which track mutable data-structures cannot be tracked since the infrastructure to "update the array's content if the referenced value is changed" is not available!

    Note

    This domain requires that the instantiated domain is only used to analyze one method.

    ,

    This domain does not require modeling the heap. This however, strictly limits the kind of arrays that can be tracked/the information about elements that can be tracked. Tracking the contents of arrays of mutable values is not possible; unless we only track abstract properties that do not depend on the concrete array element's value. For example, if we just want to know the upper type bounds of the values stored in the array, then it is perfectly possible. This property cannot change in an unsound fashion without directly accessing the array.

  2. trait ClassValues extends StringValues with FieldAccessesDomain with MethodCallsDomain

    Permalink

    Enables the tracking of concrete Class values.

    Enables the tracking of concrete Class values.

    This class overrides invokestatic and only delegates to the default implementation if it cannot successfully handle the call. Hence, this trait needs to be mixed in after the trait that handles the default case but before all other traits that "just" analyze invokestatic calls.

    class MyDomain
     extends DefaultTypeLevelInvokeInstructions
     with ClassValues
     with <DOES ANAYLZE INVOKE CALLS>
  3. trait ConcretePrimitiveValuesConversions extends TypeLevelPrimitiveValuesConversions

    Permalink

    Default implementation of a domain that performs basic conversions between primitive values.

  4. trait ConstraintsBetweenIntegerValues extends CoreDomainFunctionality with IntegerRangeValues with TheCodeStructure

    Permalink

    Domain that traces the relationship between integer values; currently, the domain only works in an unbelievable small number of cases...

    Domain that traces the relationship between integer values; currently, the domain only works in an unbelievable small number of cases... it is basically useless at the moment.

  5. trait DefaultArrayValuesBinding extends DefaultReferenceValuesBinding with ArrayValues

    Permalink

  6. trait DefaultClassValuesBinding extends DefaultStringValuesBinding with ClassValues

    Permalink

  7. class DefaultDomain[Source] extends CorrelationalDomain with TheProject with TheMethod with DefaultDomainValueBinding with ThrowAllPotentialExceptionsConfiguration with IgnoreSynchronization with DefaultTypeLevelHandlingOfMethodResults with DefaultTypeLevelFloatValues with DefaultTypeLevelDoubleValues with TypeLevelFieldAccessInstructions with TypeLevelInvokeInstructions with SpecialMethodsHandling with DefaultClassValuesBinding with MaxArrayLengthRefinement with NullPropertyRefinement with DefaultIntegerRangeValues with DefaultLongValues with LongValuesShiftOperators with ConcretePrimitiveValuesConversions

    Permalink

    Default configuration of a domain that uses the most capable l1 domains

  8. class DefaultDomainWithCFG[Source] extends DefaultDomain[Source] with RecordCFG

    Permalink

    Configuration of a domain that uses the most capable l1 domains and which also records the abstract-interpretation time control flow graph.

  9. class DefaultDomainWithCFGAndDefUse[Source] extends DefaultDomainWithCFG[Source] with RecordDefUse

    Permalink

    Configuration of a domain that uses the most capable l1 domains and which also records the abstract-interpretation time control flow graph and def/use information.

  10. trait DefaultIntegerRangeValues extends DefaultDomainValueBinding with IntegerRangeValues

    Permalink

    This domain implements the tracking of integer values at the level of ranges.

  11. trait DefaultIntegerSetValues extends DefaultDomainValueBinding with IntegerSetValues

    Permalink

    This domain implements the tracking of integer values using sets.

  12. trait DefaultIntegerValues extends DefaultDomainValueBinding with IntegerValues

    Permalink

    This domain implements the tracking of simple integer values.

    This domain implements the tracking of simple integer values.

    Note

    This domain uses a single object to represent some integer. I.e., this domain does not support the identification of values that may be equal.

    See also

    IntegerValues for more details.

  13. class DefaultIntervalValuesDomain[Source] extends CorrelationalDomain with TheProject with TheMethod with DefaultDomainValueBinding with ThrowAllPotentialExceptionsConfiguration with DefaultHandlingOfMethodResults with IgnoreSynchronization with DefaultTypeLevelFloatValues with DefaultTypeLevelDoubleValues with TypeLevelFieldAccessInstructions with TypeLevelInvokeInstructions with l0.DefaultReferenceValuesBinding with DefaultIntegerRangeValues with ConstraintsBetweenIntegerValues with DefaultLongValues with LongValuesShiftOperators with ConcretePrimitiveValuesConversions

    Permalink

    This domain uses the l1 level stable domains which handle primitive values using intervals/ranges.

  14. trait DefaultJavaObjectToDomainValueConversion extends AsDomainValue

    Permalink

    Default implementation of the AsDomainValue trait.

  15. trait DefaultLongSetValues extends DefaultDomainValueBinding with CorrelationalDomain with LongSetValues

    Permalink

    This domain implements the tracking of long values at the level of sets.

  16. trait DefaultLongValues extends DefaultDomainValueBinding with LongValues

    Permalink

    This domain is able to track constant long values and to perform mathematical operations related to constant long values.

  17. trait DefaultReferenceValuesBinding extends ReferenceValues with DefaultExceptionsFactory

    Permalink

  18. class DefaultReferenceValuesDomain[Source] extends CorrelationalDomain with TheProject with TheMethod with DefaultDomainValueBinding with ThrowAllPotentialExceptionsConfiguration with DefaultHandlingOfMethodResults with IgnoreSynchronization with DefaultTypeLevelFloatValues with DefaultTypeLevelDoubleValues with TypeLevelFieldAccessInstructions with TypeLevelInvokeInstructions with DefaultReferenceValuesBinding with DefaultTypeLevelIntegerValues with DefaultTypeLevelLongValues with TypeLevelPrimitiveValuesConversions with TypeLevelLongValuesShiftOperators

    Permalink

    This domain uses the l1 level stable, partial domains.

  19. class DefaultSetValuesDomain[Source] extends CorrelationalDomain with TheProject with TheMethod with DefaultDomainValueBinding with ThrowAllPotentialExceptionsConfiguration with DefaultHandlingOfMethodResults with IgnoreSynchronization with DefaultTypeLevelFloatValues with DefaultTypeLevelDoubleValues with TypeLevelFieldAccessInstructions with TypeLevelInvokeInstructions with DefaultClassValuesBinding with NullPropertyRefinement with DefaultIntegerSetValues with DefaultLongSetValues with LongValuesShiftOperators with ConcretePrimitiveValuesConversions

    Permalink

    This domain uses the l1 level stable, partial domains that represent the values of variables using sets.

  20. class DefaultSingletonValuesDomain[Source] extends Domain with TypedValuesFactory with TheProject with TheMethod with DefaultDomainValueBinding with ThrowAllPotentialExceptionsConfiguration with DefaultHandlingOfMethodResults with IgnoreSynchronization with DefaultTypeLevelFloatValues with DefaultTypeLevelDoubleValues with TypeLevelFieldAccessInstructions with TypeLevelInvokeInstructions with l0.DefaultReferenceValuesBinding with DefaultIntegerValues with DefaultLongValues with LongValuesShiftOperators with ConcretePrimitiveValuesConversions

    Permalink

    This domain uses the l1 level stable domains which can "only" represent single values (basically just performs constant propagation).

  21. trait DefaultStringValuesBinding extends DefaultReferenceValuesBinding with StringValues

    Permalink

  22. trait IntegerRangeValues extends IntegerValuesDomain with IntegerRangeValuesFactory with ConcreteIntegerValues

    Permalink

    This domain represents integer values using ranges.

    This domain represents integer values using ranges.

    The cardinality of the range can be configured to satisfy different needs with regard to the desired precision (maxCardinalityOfIntegerRanges). Often, a very small cardinality (e.g., between 2 and 8) may be completely sufficient and a large cardinality does not add the overall precision significantly and just increases the analysis time.

    Constraint Propagation

    This domain facilitates and performs constraint propagation (e.g., intEstablishValue, intEstablishIsLessThan,...). Two integer (range) values (ir1,ir2) are reference equal (eq in Scala) iff both represent the same runtime value.

    In other words, the implementation ensures that two int values that are known to have the same value – even though the precise value may not be known – are represented using the same object. Furthermore, two int values that are not known to represent the same value at runtime are always represented using different objects. For example, consider the following sequence:

    • pcA+0/t1: iadd (Stack: 1 :: AnIntegerValue :: ...; Registers: <ignored>)
    • pcA+1/t2: dup (Stack: v(pcA/t1) :: ...; Registers: <ignored>)
    • pcA+2/t3: iflt true:+10 (Stack: v(pcA/t1) :: v(pcA/t1) :: ...; Registers: <ignored>)
    • pcA+3/t4: ... (Stack: v(pcA/t1) >= 0 :: ...; Registers: <ignored>)
    • pcA+XYZ...
    • pcA+12/t5: ... (Stack: v(pcA/t1) < 0 :: ...; Registers: <ignored>)

    Here, the test (iflt) of the topmost stack value against the constant 0 constraints the second topmost stack value. Both (abstract) values are guaranteed to represent the same value at runtime even though the concrete value may be unknown. In this case, the value was even created at the same point in time.

    In case of this domain the reference of the Domain(Integer)Value is used to identify those values that were created at the same point in time and hence, have the same properties.

    E.g., consider the following fictitious sequence:

    • iconst2 ...
      • Stack: EMPTY
      • Locals: EMPTY
    • dup ...
      • Stack: IntegerRangeValue(2,2)@123456;
      • Locals: EMPTY
    • istore_0 ...
      • Stack: IntegerRangeValue(2,2)@123456 <- IntegerRangeValue(2,2)@123456;
      • Locals: EMPTY
    • iconst2 ...
      • Stack: IntegerRangeValue(2,2)@123456;
      • Locals: 0=IntegerRangeValue(2,2)@123456, 1=EMPTY
    • istore_1 ...
      • Stack: IntegerRangeValue(2,2)@654321 <- IntegerRangeValue(2,2)@123456;
      • Locals: 0=IntegerRangeValue(2,2)@123456, 1=EMPTY
    • ...
      • Stack: IntegerRangeValue(2,2)@123456;
      • Locals: 0=IntegerRangeValue(2,2)@123456, 1=IntegerRangeValue(2,2)@654321

    Additionally, if the sequence would be part of a loop, the next iteration would create new IntegerRangeValues.

    Implementation Requirements

    Subclasses are required to create new instances of IntegerRangeValues and AnIntegerValue whenever a computation is performed that may affect the runtime value. If this property is not satisfied the implemented constraint propagation mechanism will produce unpredictable results as it may constrain unrelated values! This is true for concrete ranges as well as AnIntegerValues.

  23. trait IntegerSetValues extends IntegerValuesDomain with ConcreteIntegerValues with IntegerRangeValuesFactory

    Permalink

    This domain enables the tracking of integer values using sets.

    This domain enables the tracking of integer values using sets. The cardinality of the set can be configured to facilitate different needs with regard to the desired precision. Often, a very small cardinality (e.g., between 2 or 8) may be completely sufficient and a large cardinality does not significantly add to the overall precision.

  24. trait IntegerValues extends IntegerValuesDomain with ConcreteIntegerValues

    Permalink

    This domain enables the tracking of an integer value (a constant); unknown integer values are represented using "AnIntegerValue".

    This domain enables the tracking of an integer value (a constant); unknown integer values are represented using "AnIntegerValue". It basically provides support for constant propagation and constant computations related to integer values.

    Given that it uses one instance to represent arbitrary integer values, constraint propagation is not relevant.

    This domain may be appropriate, e.g., if you want to determine if a field/local is always initialized to a specific value.

  25. trait LongSetValues extends LongValuesDomain with ConcreteLongValues

    Permalink

    This domain enables the tracking of long values using sets.

    This domain enables the tracking of long values using sets. The cardinality of the set can be configured to facilitate different needs with regard to the desired precision.

    This domain supports constraint propagation as every two values that are not guaranteed to have the same value at runtime are always represented using a unique instance of LongValue.

  26. trait LongSetValuesShiftOperators extends LongValuesDomain

    Permalink

    Implements the shift operators for long values.

    Implements the shift operators for long values.

    (The shift operators are put in their own module, because the shift value is always an IntegerValue.)

  27. trait LongValues extends LongValuesDomain with ConcreteLongValues

    Permalink

    Foundation for domains that trace specific long values.

    Foundation for domains that trace specific long values. This domain can directly be used to trace simple computations involving constant long values.

  28. trait LongValuesShiftOperators extends LongValuesDomain

    Permalink

    Implements the shift operators for long values.

  29. trait MaxArrayLengthRefinement extends TypeLevelReferenceValues

    Permalink

    In case that the arraylength is just an integer value, the value is refined to the range [0...Int.MaxValue].

  30. trait NullPropertyRefinement extends CoreDomainFunctionality

    Permalink

    Refines a reference's null property if the reference value may be null and this has resulted in a corresponding exception.

  31. trait RecordAllThrownExceptions extends RecordThrownExceptions

    Permalink

    Records all exception values thrown by a method.

    Records all exception values thrown by a method. I.e., for each instruction that throws an exception (or multiple exceptions) all exceptions are recorded.

  32. trait ReferenceValues extends DefaultTypeLevelReferenceValues with Origin

    Permalink

    This partial domain enables tracking of a reference value's null-ness and must-alias information.

  33. case class RefinedReturnType(method: Method, refinedType: Option[Domain.DomainValue]) extends Product with Serializable

    Permalink
  34. trait ReflectiveInvoker extends DefaultJavaObjectToDomainValueConversion with AsJavaObject

    Permalink

    Support the invocation of methods (using Java reflection) of Java objects that represent concrete domain values.

    Support the invocation of methods (using Java reflection) of Java objects that represent concrete domain values.

    This greatly facilitates the implementation of methods that need to simulate the logic of a specific object.

  35. trait StringBuilderValues extends StringValues

    Permalink

    Enables the tracing of StringBuilders.

    Enables the tracing of StringBuilders.

    TODO ==Implementation Details==

    Copy on Branch

    Given that StringBuilders are mutable, we have to create a copy whenever we have a branch. This enables us to make the domain value that represents the state of the StringBuilder independently mutable on each branch. E.g.,

    val sb : StringBuilder = ....
    if (condition) sb.append("X") else sb.append("Y")
    // here, the represented string either ends with "X" or with "Y", but not with "XY" or "YX"

    Ensure Termination

    To ensure termination in degenerated cases, such as:

    val b : StringBuilder = ...
    while((System.nanoTime % 33L) != 0){
        b.append((System.nanoTime % 33L).toString)
    }
    return b.toString

    We count the number of joins per PC and if that value exceeds the configured threshold, we completely abstract over the contents of the string builder.

  36. trait StringValues extends ReferenceValues with DefaultJavaObjectToDomainValueConversion with MethodCallsDomain with PostEvaluationMemoryManagement

    Permalink

    Enables the tracing of concrete string values and can, e.g., be used to resolve static "class.forName(...)" calls.

Value Members

  1. object ArrayValues

    Permalink
  2. object IfNullParameterAnalysis extends DefaultOneStepAnalysis

    Permalink

    A very basic analysis that determines the behavior of a method if a parameter is potentially null compared to a call of the method where the parameter is guaranteed to be non-null.

    A very basic analysis that determines the behavior of a method if a parameter is potentially null compared to a call of the method where the parameter is guaranteed to be non-null.

    Note that the difference may not just manifest in the number of thrown exceptions. E.g., consider the following code from javax.imageio.ImageIO:

    public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) {
     if (fileSuffix == null) {
         throw new IllegalArgumentException("fileSuffix == null!");
     }
     // Ensure category is present
     ...

    Here, the difference is that an IllegalArgumentException is thrown. The reported result is: Map(13 -> Set(java.lang.IllegalArgumentException(origin=4))) and states that the instruction with the program counter 13 (the throw instruction) throws the exception created by program counter 4 (the new Illegal... expression).

  3. object IntegerRangeValues

    Permalink

    Defines common constants related to integer ranges.

  4. object MethodReturnValuesAnalysis extends DefaultOneStepAnalysis

    Permalink

    A shallow analysis that tries to refine the return types of methods.

  5. object OwnershipAnalysis extends DefaultOneStepAnalysis

    Permalink

    Find methods that return an internal (private) array to callers of the class.

  6. object SimpleDefUseAnalysis extends DefaultOneStepAnalysis

    Permalink

    Simple analysis that takes the "unused"-Node from the def-use graph and returns all its children, that is definitions and assignments that are not used again locally.

  7. object StringBuilderValues

    Permalink
  8. object StringValues

    Permalink
  9. def constructorCallForNewReferenceValueWithOrigin(code: Code, receiverOrigin: PC, domain: ReferenceValues)(operandsArray: l1.ReferenceValues.OperandsArray): Seq[PC]

    Permalink

    Note

    At the bytecode level, the allocation of memory and the call of the constructor are not atomic and it is possible to associate one "new" instruction with multiple constructor calls (INVOKESPECIAL(...,"<init>",...)); however, such code is not generated by any known compiler so far (Dec. 2014).

Inherited from AnyRef

Inherited from Any

Ungrouped