Class

org.opalj.ai.analyses.cg

CallGraphCache

Related Doc: package cg

Permalink

class CallGraphCache[Contour, Value] extends AnyRef

A thread-safe cache for information that is associated with a specific ObjectType and an additional key (Contour). Conceptually, the cache is a Map of Maps where the keys of the first map are ObjectTypes and which return values that are maps where the keys are Contours and the values are the stored/cached information.

To minimize contention the cache's maps are all preinitialized based on the number of different types that we have seen. This ensure that two threads can always concurrently access the cache (without blocking) if the information is associated with two different ObjectTypes. If two threads want to access information that is associated with the same ObjectType the data-structures try to minimize potential contention. Hence, this is not a general purpose cache. Using this cache is only appropriate if you need/will cache a lot of information that is associated with different object types.

It is required that the cache object is created before the threads are created that use the cache!

Example Usage

To store the result of the computation of all target methods for a virtual method call (given some declaring class type and a method signature), the cache could be instantiated as follows:

val cache = new CallGraphCache[MethodSignature,Iterable[Method]](project)
Source
CallGraphCache.scala
Note

Creating a new cache is comparatively expensive and depends on the number of ObjectTypes in a project.

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

Instance Constructors

  1. new CallGraphCache(project: SomeProject)

    Permalink

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val NullPointerExceptionDefaultConstructor: Option[Method]

    Permalink
  5. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def getOrElseUpdate(key: ObjectType, contour: Contour)(f: ⇒ Value, syncOnEvaluation: Boolean = true): Value

    Permalink

    If a value is already stored in the cache that value is returned, otherwise f is evaluated and the cache is updated accordingly before the value is returned.

    If a value is already stored in the cache that value is returned, otherwise f is evaluated and the cache is updated accordingly before the value is returned. In some rare cases it may be the case that two or more functions that are associated with the same declaringClass and contour are evaluated concurrently. In such a case the result of only one function is stored in the cache and will later be returned.

  12. def getOrElseUpdate(key: ObjectType)(f: ⇒ Value): Value

    Permalink
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped