Packages

sealed abstract class EscapeProperty extends OrderedProperty with ExplicitlyNamedProperty with EscapePropertyMetaInformation

Specifies the lifetime and accessability of object instance. This is classically used for compiler optimizations such as scalar replacement, stack allocation or removal of synchronization. However, other usages such as finding bugs or helping to identify immutable data-structures are also supported.

Definitions in the Literature

Choi et al. [1] describe two predicates that can be used to describe the properties relevant to escape information.

"Let O be an object instance and M be a method invocation. O is said to escape M, denoted as Escapes(O, M), if the lifetime of O may exceed the lifetime of M."

"Let O be an object instance and T be a thread (instance). O is said to escape T, again denoted as Escapes(O, T), if another thread, T’ != T, may access O."

Furthermore it holds that "For any object O, !Escapes(O, M) implies !Escapes(O, T), where method M is invoked in thread T." [1]

In contrast to this, Kotzmann and Mössenböck [2] describe the escape of an object with the access to this object from other methods or threads.

Definition

This EscapeProperty combines both concepts and is more specific about the reason why an object escapes to facilitate comprehension of the results.

In the following, we provide further details about the different escape properties:

NoEscape refers to the property of an object instance O created in method M for that it lifetime ends with the lifetime of M and no other method than M has access to O. This implies that there is no method M' != M that can access O (at least when disregarding reflection and native code). Objects with this property can be allocated at the stack or even scalar-replaced [2].

An object instance O created in method M and thread T has the property EscapeInCallee, if its lifetime does not exceed the lifetime of M but M passes O as a parameter to a method which does not let O escape any further then EscapeInCallee. This implies that only M and methods M' that are (transitively) called by M have access to O. For objects that have the property EscapeInCallee no synchronization is needed and they can be allocated on the stack.

For objects O, created in method M and thread T, whose lifetime exceeds its method of creation M and is (therefore) accessible by other methods, we provide seven different properties. For all of them we assume that M and all methods called by M do not let O escape the thread T. But it is not guaranteed that O will not escape T via a caller of M. The properties differ in the reason why the lifetime of O exceeds the lifetime of M. In case of EscapeViaReturn O is returned by M. If O has an exception type and is thrown in M, it has the property EscapeViaAbnormalReturn. For both of them it has no consequences if O escapes T via a caller of M. This is, because the execution ends with the (abnormal) return of O. All synchronization mechanisms inside of M or callees of M can be removed. The property EscapeViaParameter describes objects that gets assigned to a parameter of its method of creation (M). If O gets assigned to p.f for a parameter p of M, it could be the case that the actual parameter of p already escaped T. In this case O would also escape T directly via this assignment. Therefore no synchronization for O can be removed. As it could be also the case that O gets assigned to a parameter and returned by M, there are also properties representing the combinations of this kind of escapes. They are EscapeViaParameterAndAbnormalReturn, EscapeViaParameterAndReturn, EscapeViaNormalAndAbnormalReturn and EscapeViaParameterAndNormalAndAbnormalReturn.

An object instance O created in method M and thread T has the property GlobalEscape, if its lifetime may exceed the lifetime of T (and another thread T'! = T gets access to O). For example, this is the case if O gets assigned to a static field (EscapeViaStaticField but also if assigned to a field of an object that has also GlobalEscape as property (EscapeViaHeapObject). Objects that have the property GlobalEscape have to be allocated on the heap and synchronization mechanisms can not be removed/proper synchronization is required if the object is accessed concurrently – the latter may be the goal of static analyses that find concurrency bugs). If the reason for the global escape is unspecified the case class GlobalEscape is used.

The property values are partially ordered and form a lattice. The binary relation of the order is called lessOrEqualRestrictive and describes the restrictiveness of the scope in, which objects exists. The most restrictive (top) value is NoEscape and the least restrictive (bottom) one is GlobalEscape. A dot graph of the lattice can be found under br/src/main/resources/org/opalj/fpcf/properties.

Algorithms are free to over approximate this property, i.e., for object instance O with actual property P it is okay to say O has property P' if P > P' (or in other words, P' is less restrictive than P).

If they simply don't know the actual property they should use AtMost(NoEscape). If we know that the actual property is at most (i.e. not NoEscape), AtMost(EscapeInCallee) should be used. The same holds for every other non-bottom property. E.g. AtMost(EscapeViaParameter) should be used if we know that the actual property is at most EscapeViaParameter (i.e. neither NoEscape nor EscapeInCallee.

org.opalj.ai.DefinitionSiteLike and org.opalj.br.analyses.VirtualFormalParameter are generally used as org.opalj.fpcf.Entity in combination with this property.

VirtualMethodEscapeProperty provides a wrapper of this property addressing aggregated escape information for parameters of methods in a type hierarchy.

[1] Choi, Jong-Deok, Manish Gupta, Mauricio Serrano, Vugranam C. Sreedhar, and Sam Midkiff. "Escape Analysis for Java." In Proceedings of the 14th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, 1–19. OOPSLA ’99. New York, NY, USA: ACM, 1999.

[2] Kotzmann, Thomas, and Hanspeter Mössenböck. “Escape Analysis in the Context of Dynamic Compilation and Deoptimization.” In Proceedings of the 1st ACM/USENIX International Conference on Virtual Execution Environments, 111–120. VEE ’05. New York, NY, USA: ACM, 2005.

Source
EscapeProperty.scala
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EscapeProperty
  2. EscapePropertyMetaInformation
  3. ExplicitlyNamedProperty
  4. OrderedProperty
  5. Property
  6. PropertyMetaInformation
  7. PropertyKind
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final type Self = EscapeProperty

Abstract Value Members

  1. abstract def isBottom: Boolean

    Is this the bottom value of the lattice, i.e.

    Is this the bottom value of the lattice, i.e. GlobalEscape, EscapeViaHeapObject or EscapeViaStaticField.

  2. abstract def isTop: Boolean

    Is this the top value of the lattice, i.e.

    Is this the top value of the lattice, i.e. NoEscape.

  3. abstract def lessOrEqualRestrictive(that: EscapeProperty): Boolean

    Tests if this property describes equal or less restricted escapes than the given property. That is if the lifetime OR access bound of the property is greater or equal than that.

    Tests if this property describes equal or less restricted escapes than the given property. That is if the lifetime OR access bound of the property is greater or equal than that. E.g., returns true if this property identifies values which GlobalEscape and the given property (that) refers to values that NoEscape.

    See also

    EscapeProperty for further details.

  4. abstract def meet(that: EscapeProperty): EscapeProperty

    Computes the greatest lower bound of this and that property values.

    Computes the greatest lower bound of this and that property values.

    that

    the other escape property value.

    returns

    the most restrictive escape that is less or equal restrictive than this and that.

    See also

    EscapeProperty.lessOrEqualRestrictive

  5. abstract def propertyName: String

    The name of the property.

    The name of the property.

    Definition Classes
    ExplicitlyNamedProperty
  6. abstract def propertyValueID: Int

    A unique id for every escape property.

    A unique id for every escape property. Used for table switches.

Concrete 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 asAggregatedProperty: VirtualMethodEscapeProperty
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. final def asOrderedProperty: OrderedProperty

    Returns this if this property inherits from OrderedProperty.

    Returns this if this property inherits from OrderedProperty.

    Used, e.g., by the framework to support debugging analyses.

    Definition Classes
    Property
  7. def bottomness: Int

    Returns a value between zero and 9 which describes how close the value is to its absolute bottom.

    Returns a value between zero and 9 which describes how close the value is to its absolute bottom. Zero means the value is very close to the bottom and 9 means the value is far away from the bottom.

    The default value is "5".

    Definition Classes
    OrderedProperty
  8. def checkIsEqualOrBetterThan(e: Entity, other: Self): Unit

    Tests if this property is equal or better than the given one (better means that the value is above the given value in the underlying lattice.)

    Tests if this property is equal or better than the given one (better means that the value is above the given value in the underlying lattice.)

    Definition Classes
    EscapePropertyOrderedProperty
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  14. final def id: Int

    The id uniquely identifies this property's category.

    The id uniquely identifies this property's category. All property objects of the same kind have to use the same id which is guaranteed since they share the same PropertyKey

    Definition Classes
    PropertyMetaInformationPropertyKind
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def isOrderedProperty: Boolean

    Returns true if this property inherits from OrderedProperty.

    Returns true if this property inherits from OrderedProperty.

    Definition Classes
    Property
  17. final def key: PropertyKey[EscapeProperty]

    The key uniquely identifies this property's category.

    The key uniquely identifies this property's category. All property objects of the same kind have to use the same key.

    In general each Property kind is expected to have a companion object that stores the unique PropertyKey.

    Definition Classes
    EscapePropertyPropertyMetaInformation
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. 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 OrderedProperty

Inherited from Property

Inherited from PropertyKind

Inherited from AnyRef

Inherited from Any

Ungrouped