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)
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
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 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. def +(other: String): String

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

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

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

    Permalink
  7. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def ensuring(cond: (CallGraphCache[Contour, Value]) ⇒ Boolean, msg: ⇒ Any): CallGraphCache[Contour, Value]

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

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

    Permalink
    Implicit information
    This member is added by an implicit conversion from CallGraphCache[Contour, Value] to Ensuring[CallGraphCache[Contour, Value]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): CallGraphCache[Contour, Value]

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  18. 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.

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

    Permalink
  20. def hashCode(): Int

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def [B](y: B): (CallGraphCache[Contour, Value], B)

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

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from CallGraphCache[Contour, Value] to any2stringadd[CallGraphCache[Contour, Value]]

Inherited by implicit conversion StringFormat from CallGraphCache[Contour, Value] to StringFormat[CallGraphCache[Contour, Value]]

Inherited by implicit conversion Ensuring from CallGraphCache[Contour, Value] to Ensuring[CallGraphCache[Contour, Value]]

Inherited by implicit conversion ArrowAssoc from CallGraphCache[Contour, Value] to ArrowAssoc[CallGraphCache[Contour, Value]]

Ungrouped