org.opalj.ai.domain.l1.ReferenceValues
MultipleReferenceValues
Companion object MultipleReferenceValues
class MultipleReferenceValues extends IsMultipleReferenceValue with (ReferenceValues.this)#TheReferenceValue with MultipleOriginsValue
A MultipleReferenceValues tracks multiple reference values (of type NullValue,
ArrayValue, SObjectValue and MObjectValue) that have different
origins. I.e., per value origin one domain value is used
to abstract over the properties of that respective value.
- Attributes
- protected
- Self Type
- (ReferenceValues.this)#DomainMultipleReferenceValues
- Source
- ReferenceValues.scala
- Alphabetic
- By Inheritance
- MultipleReferenceValues
- MultipleOriginsValue
- ValueWithOriginInformation
- TheReferenceValue
- ReferenceValueLike
- ArrayAbstraction
- ReferenceValue
- TypedValue
- Value
- IsMultipleReferenceValue
- IsReferenceValue
- KnownTypedValue
- KnownValue
- ValueInformation
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new MultipleReferenceValues(values: UIDSet[(ReferenceValues.this)#DomainSingleOriginReferenceValue])
- new MultipleReferenceValues(values: UIDSet[(ReferenceValues.this)#DomainSingleOriginReferenceValue], origins: ValueOrigins, isNull: Answer, isPrecise: Boolean, upperTypeBound: UIDSet[_ <: ReferenceType], refId: (ReferenceValues.this)#RefId)
- isPrecise
trueif the upper type bound of this value precisely captures the runtime type of the value. This basically requires that all non-null values are precise and have the same upper type bound. Null values are ignored. Please note, that the type bound can still have multiple types as long as one type is final and can be assumed to be the subtype of all other types!
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def PCIndependent: Int
- Definition Classes
- Value
- Annotations
- @inline()
- def abstractOverMutableState(): (ReferenceValues.this)#AReferenceValue
- Definition Classes
- TheReferenceValue
- def abstractsOver(other: (ReferenceValues.this)#DomainValue): Boolean
Returns
trueiff the abstract state represented by this value abstracts over the state of the given value.Returns
trueiff the abstract state represented by this value abstracts over the state of the given value. In other words if every possible runtime value represented by the given value is also represented by this value.The abstract state generally encompasses every information that would be considered during a join of
thisvalue and theothervalue and that could lead to a true Update.This method is reflexive, I.e., every value abstracts over itself.
TheIllegalValue only abstracts over itself.
- Definition Classes
- Value
- Note
abstractsOver is only defined for comparable values where both values have the same computational type.
,The default implementation uses the join method of this domain value. Overriding this method is, hence, primarily meaningful for performance reasons.
- See also
isMorePreciseThan
- def adapt(target: TargetDomain, pc: Int): (target)#DomainValue
Adapts this value to the given domain (default: throws a domain exception that adaptation is not supported).
Adapts this value to the given domain (default: throws a domain exception that adaptation is not supported). This method needs to be overridden by concrete
Valueclasses to support the adaptation for a specific domain.Supporting the
adaptmethod is primarily necessary when you want to analyze a method that is called by the currently analyzed method and you need to adapt this domain's values (the actual parameters of the method) to the domain used for analyzing the called method.Additionally, the
adaptmethod is OPAL's main mechanism to enable dynamic domain-adaptation. I.e., to make it possible to change the abstract domain at runtime if the analysis time takes too long using a (more) precise domain.- Definition Classes
- MultipleReferenceValues → Value
- Note
The abstract interpretation framework does not use/call this method. This method is solely predefined to facilitate the development of project-wide analyses.
- def addValue(newValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue): (ReferenceValues.this)#DomainMultipleReferenceValues
- def allValues: Iterable[(ReferenceValues.this)#DomainSingleOriginReferenceValue]
The set of base values (
IsReferenceValue) this value abstracts over.The set of base values (
IsReferenceValue) this value abstracts over. This set is never empty and contains this value if this value does not (further) abstract over other reference values; otherwise it only contains the base values, but notthisvalue.- Definition Classes
- MultipleReferenceValues → ReferenceValue → IsMultipleReferenceValue → IsReferenceValue
- Note
Primarily defined as a convenience interface.
- final def asDomainReferenceValue: (ReferenceValues.this)#DomainReferenceValue
Returns the represented reference value iff this value represents a reference value.
Returns the represented reference value iff this value represents a reference value.
- Definition Classes
- ReferenceValueLike → Value
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asPrimitiveValue: IsPrimitiveValue[_ <: BaseType]
- Definition Classes
- ValueInformation
- final def asReferenceType: ReferenceType
Returns the type of the upper type bound if the upper type bound contains exactly one element.
Returns the type of the upper type bound if the upper type bound contains exactly one element. That is, the function is only always defined iff the type is precise.
- Definition Classes
- IsReferenceValue
- final def asReferenceValue: IsReferenceValue
- Definition Classes
- IsReferenceValue → ValueInformation
- def baseValues: Iterable[(ReferenceValues.this)#DomainSingleOriginReferenceValue]
In general an
IsReferenceValueabstracts over all potential values and this information is sufficient for subsequent analyses; but in some cases, analyzing the set of underlying values may increase the overall precision and this set is returned by this function.In general an
IsReferenceValueabstracts over all potential values and this information is sufficient for subsequent analyses; but in some cases, analyzing the set of underlying values may increase the overall precision and this set is returned by this function. In other words: ifbaseValuesis nonEmpty, then the properties returned bythisvalue are derived from the base values, but still maybe more specific. For example,Object o = _; if(...) o = f() else o = g(); // when we reach this point, we generally don't know if the values returned by f and g // are non-null; hence, o is potentially null. if(o != null) // Now, we know that o is not null, but we still don't know if the values returned // by f OR g were null and we cannot establish that when we don't know to which value // o is actually referring to. u(o);
- returns
The set of values this reference value abstracts over. The set is empty if this value is already a base value and it does not abstract over other values.
- Definition Classes
- MultipleReferenceValues → ReferenceValue → IsReferenceValue
- Note
A reference value which belongs to the base values by some other reference value never has itself as a direct base value.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def computationalType: ComputationalType
The computational type of the value if this object represents a legal value.
The computational type of the value if this object represents a legal value.
The precise computational type is, e.g., needed to calculate the effect of generic stack manipulation instructions (e.g.,
DUP_...andSWAP) on the stack as well as to calculate the jump targets ofRETinstructions and to determine which values are actually copied by, e.g., thedup_XXinstructions.- Definition Classes
- IsReferenceValue → ValueInformation
- Exceptions thrown
IllegalStateExceptionif this value is illegal or void.- Note
The computational type has to be precise/correct.
- def doJoin(joinPC: Int, other: (ReferenceValues.this)#DomainValue): Update[(ReferenceValues.this)#DomainValue]
Joins this value and the given value.
Joins this value and the given value.
Join is called whenever an instruction is evaluated more than once and, hence, the values found on the paths need to be joined. This method is, however, only called if the two values are two different objects (
(this ne value) === true), but both values have the same computational type.This basically implements the join operator of complete lattices.
Example
For example, joining a
DomainValuethat represents the integer value 0 with aDomainValuethat represents the integer value 1 may return a newDomainValuethat precisely captures the range [0..1] or that captures all positive integer values or just some integer value.Contract
thisvalue is always the value that was previously used to perform subsequent computations/analyses. Hence, ifthisvalue subsumes the given value, the result has to be eitherNoUpdateor aMetaInformationUpdate. In case that the given value subsumesthisvalue, the result has to be aStructuralUpdatewith the given value as the new value. Hence, thisjoinoperation is not commutative. If a new (more abstract) abstract value is created that represents both values the result always has to be aStructuralUpdate. If the result is aStructuralUpdatethe framework will continue with the interpretation.The termination of the abstract interpretation directly depends on the fact that at some point all (abstract) values are fixed and don't change anymore. Hence, it is important that the type of the update is only a org.opalj.ai.StructuralUpdate if the value has changed in a way relevant for future computations/analyses involving this value. In other words, when two values are joined it has to be ensured that no fall back to a previous value occurs. E.g., if you join the existing integer value 0 and the given value 1 and the result would be 1, then it must be ensured that a subsequent join with the value 0 will not result in the value 0 again.
Conceptually, the join of an object with itself has to return the object itself. Note, that this is a conceptual requirement as such a call (
this.doJoin(..,this)) will not be performed by the abstract interpretation framework; this case is handled by the join method. However, if the join object is also used by the implementation of the domain itself, it may be necessary to explicitly handle self-joins.Performance
In general, the domain should try to minimize the number of objects that it uses to represent values. That is, two values that are conceptually equal should – whenever possible – use only one object. This has a significant impact on functions such as
join.- Attributes
- protected
- Definition Classes
- MultipleReferenceValues → Value
- final def doPropagateRefinement(refinements: (ReferenceValues.this)#Refinements, operands: (ReferenceValues.this)#Operands, locals: (ReferenceValues.this)#Locals): ((ReferenceValues.this)#Operands, (ReferenceValues.this)#Locals)
- Attributes
- protected[this]
- Definition Classes
- TheReferenceValue
- def doRejoinSingleOriginReferenceValue(joinPC: Int, thisValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue, thatValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue): Update[(ReferenceValues.this)#DomainValue]
Join of a value (
thatValue) with a value (thisValue) referenced by this value.Join of a value (
thatValue) with a value (thisValue) referenced by this value.- Attributes
- protected[this]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
- Definition Classes
- MultipleReferenceValues → AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def hasCategory2ComputationalType: Boolean
Returns
trueif and only if the value has the computational type 2;falsein all other cases (including the case where this value is illegal!).Returns
trueif and only if the value has the computational type 2;falsein all other cases (including the case where this value is illegal!).- Definition Classes
- IsReferenceValue → ValueInformation
- lazy val hashCode: Int
- Definition Classes
- MultipleReferenceValues → AnyRef → Any
- final def isArrayValue: Answer
Returns
Yesif the value is _not null_ and the least upper type bound is anArrayType; the value isUnknownif the least upper type bound isArrayTypebut the value may be null; in all other casesNois returned; in particular if the value is known to be null.Returns
Yesif the value is _not null_ and the least upper type bound is anArrayType; the value isUnknownif the least upper type bound isArrayTypebut the value may be null; in all other casesNois returned; in particular if the value is known to be null.Nois also returned if the value's type isObjectorSeriablizableorCloneable.- Definition Classes
- MultipleReferenceValues → ValueInformation
- final def isIllegalValue: Boolean
Returns
trueiff this value is not a legal value according to the JVM specification.Returns
trueiff this value is not a legal value according to the JVM specification. Such values cannot be used to perform any computations and will generally not occur in static analyses unless the analysis or the bytecode is buggy.- Definition Classes
- KnownValue → ValueInformation
- Note
An IsIllegalValue can always be distinguished from a void value.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isMorePreciseThan(other: (ReferenceValues.this)#DomainValue): Boolean
Returns
trueiff the abstract state represented by this value is strictly more precise than the state of the given value.Returns
trueiff the abstract state represented by this value is strictly more precise than the state of the given value. In other words if every possible runtime value represented by this value is also represented by the given value, but both are not equal; in other words, this method is irreflexive.The considered abstract state generally encompasses every information that would be considered during a join of
thisvalue and theothervalue and that could lead to a StructuralUpdate.- other
Another
DomainValuewith the same computational type as this value. (TheIllegalValuehas no computational type and, hence, a comparison with an IllegalValue is not well defined.)
- val isNull: Answer
If
Yesthe value is known to always benullat runtime.If
Yesthe value is known to always benullat runtime. In this case the upper bound is (has to be) empty. If the answer isUnknownthen the analysis was not able to statically determine whether the value isnullor is notnull. In this case the upper bound is expected to be non-empty. If the answer isNothen the value is statically known not to benull. In this case, the upper bound may precisely identify the runtime type or still just identify an upper bound.- Definition Classes
- MultipleReferenceValues → IsReferenceValue
- val isPrecise: Boolean
Returns
trueif the type information is precise.Returns
trueif the type information is precise. I.e., the type returned byupperTypeBoundprecisely models the runtime type of the value. If,isPrecisereturns true, the type of this value can generally be assumed to represent a class type (not an interface type) or an array type. However, this domain also supports the case thatisPrecisereturnstrueeven though the associated type identifies an interface type or an abstract class type. The later case may be interesting in the context of classes that are generated at run time.- Definition Classes
- MultipleReferenceValues → ReferenceValue → IsReferenceValue
- final def isPrimitiveValue: Boolean
Returns
truein case of a value with primitive type.Returns
truein case of a value with primitive type.- Definition Classes
- IsReferenceValue → ValueInformation
- Exceptions thrown
IllegalStateExceptionif this value is illegal.
- final def isReferenceValue: Boolean
Returns
trueif the value has a reference type.Returns
trueif the value has a reference type.- Definition Classes
- IsReferenceValue → ValueInformation
- Exceptions thrown
IllegalStateExceptionif this value is illegal.
- def isValueASubtypeOf(supertype: ReferenceType)(implicit classHierarchy: ClassHierarchy): Answer
Tests if the type of this value is potentially a subtype of the specified reference type under the assumption that this value is not
null.Tests if the type of this value is potentially a subtype of the specified reference type under the assumption that this value is not
null. This test takes the precision of the type information into account. That is, if the currently available type information is not precise and the given type has a subtype that is always a subtype of the current upper type bound, thenUnknownis returned. Given that it may be computationally intensive to determine whether two types have a common subtype it may be better to just returnUnknownin case that this type and the given type are not in a direct inheritance relationship.Basically, this method implements the same semantics as the
ClassHierarchy'sisSubtypeOfmethod, but it additionally checks if the type of this value could be a subtype of the given supertype. I.e., if this value's type identifies a supertype of the givensupertypeand that type is not known to be precise, the answer isUnknown.For example, assume that the type of this reference value is
java.util.Collectionand we know/have to assume that this is only an upper bound. In this case an answer isNoif and only if it is impossible that the runtime type is a subtype of the given supertype. This condition holds, for example, forjava.io.Filewhich is not a subclass ofjava.util.Collectionand which does not have any further subclasses (in the JDK). I.e., the classesjava.io.Fileandjava.util.Collectionare not in an inheritance relationship. However, if the specified supertype would bejava.util.Listthe answer would be unknown.- Definition Classes
- IsMultipleReferenceValue → IsReferenceValue
- Note
The function
isValueASubtypeOfis not defined ifisNullreturnsYes; ifisNullisUnknownthen the result is given under the assumption that the value is notnullat runtime. In other words, if this value representsnullthis method is not supported. If the value is null, the effect/interpretation of a subtype of query is context dependent (isInstanceOf/checkCast).
- final def isVoid: Boolean
Returns
trueif this value represents void.Returns
trueif this value represents void.- Definition Classes
- KnownTypedValue → ValueInformation
- def join(pc: Int, that: (ReferenceValues.this)#DomainValue): Update[(ReferenceValues.this)#DomainValue]
Checks that the given value and this value are compatible with regard to its computational type and – if so – calls doJoin.
Checks that the given value and this value are compatible with regard to its computational type and – if so – calls doJoin.
See
doJoin(PC,DomainValue)for details.- pc
The program counter of the instruction where the paths converge or
Int.MinValueif the join is done independently of an instruction.- that
The "new" domain value with which this domain value should be joined. The caller has to ensure that the given value and this value are guaranteed to be two different objects.
- returns
MetaInformationUpdateIllegalValue or the result of calling doJoin.
- Definition Classes
- Value
- Note
It is in general not recommended/needed to override this method.
- def leastUpperType: Option[ReferenceType]
The type kind of the values, if the value has a specific type kind;
Noneif and only if the underlying value isnull.The type kind of the values, if the value has a specific type kind;
Noneif and only if the underlying value isnull.- returns
The type/the least upper type bound of the value. If the type is a base type, then the type is necessarily precise. In case of a reference type the type may be an upper type bound or may be precise. In the latter case, it may be possible to get further information using the concrete domain. If the underlying value is
null,Noneis returned.
- Definition Classes
- MultipleReferenceValues → TypedValue → IsReferenceValue
- def length(pc: Int): Computation[(ReferenceValues.this)#DomainValue, (ReferenceValues.this)#ExceptionValue]
- Definition Classes
- MultipleReferenceValues → ArrayAbstraction
- def load(pc: Int, index: (ReferenceValues.this)#DomainValue): (ReferenceValues.this)#ArrayLoadResult
- Definition Classes
- MultipleReferenceValues → ArrayAbstraction
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- val origins: ValueOrigins
- Definition Classes
- MultipleReferenceValues → ValueWithOriginInformation
- def originsIterator: IntIterator
- Definition Classes
- MultipleReferenceValues → ValueWithOriginInformation
- final def propagateRefinement(oldValue: (ReferenceValues.this)#AReferenceValue, newValue: (ReferenceValues.this)#AReferenceValue, operands: (ReferenceValues.this)#Operands, locals: (ReferenceValues.this)#Locals): ((ReferenceValues.this)#Operands, (ReferenceValues.this)#Locals)
Propagate some refinement of the value's properties.
Propagate some refinement of the value's properties.
- Attributes
- protected[this]
- Definition Classes
- TheReferenceValue
- val refId: (ReferenceValues.this)#RefId
Returns the reference id of this object.
Returns the reference id of this object. I.e., an approximation of the object's identity.
- Definition Classes
- MultipleReferenceValues → TheReferenceValue
- def refineIf(refinements: (ReferenceValues.this)#Refinements): Boolean
Returns
true- and updates the refinements map - if this value was refined because it depended on a value that was already refined.Returns
true- and updates the refinements map - if this value was refined because it depended on a value that was already refined.- returns
trueif a refinement was added to the refinements map.
- Attributes
- protected
- Definition Classes
- MultipleReferenceValues → TheReferenceValue
- Note
The refinements map must not contain
thisvalue as a key. The template method doPropagateRefinement already applies all standard refinements.
- def refineIsNull(pc: Int, isNull: Answer, operands: (ReferenceValues.this)#Operands, locals: (ReferenceValues.this)#Locals): ((ReferenceValues.this)#Operands, (ReferenceValues.this)#Locals)
Refines this value's
isNullproperty.Refines this value's
isNullproperty.Precondition
This method is only defined if a previous
isNulltest returnedUnknownand we are now on the branch where we know that the value is now null or is not null.- pc
The program counter of the instruction that was the reason for the refinement.
- isNull
This value's new null-ness property.
isNulleither has to beYesorNo. The refinement toUnknownneither makes sense nor is it supported.- returns
The updated operand stack and register values.
- Definition Classes
- MultipleReferenceValues → TheReferenceValue
- def refineToValue(value: (ReferenceValues.this)#DomainSingleOriginReferenceValue, isNullGoal: Answer, upperTypeBoundGoal: UIDSet[_ <: ReferenceType], operands: (ReferenceValues.this)#Operands, locals: (ReferenceValues.this)#Locals): ((ReferenceValues.this)#Operands, (ReferenceValues.this)#Locals)
- Attributes
- protected[this]
- def refineUpperTypeBound(pc: Int, supertype: ReferenceType, operands: (ReferenceValues.this)#Operands, locals: (ReferenceValues.this)#Locals): ((ReferenceValues.this)#Operands, (ReferenceValues.this)#Locals)
Refines the upper bound of this value's type to the given supertype.
Refines the upper bound of this value's type to the given supertype.
Precondition
This method is only to be called if a previous "subtype of" test (
this.isValueASubtypeOf(supertype)) returnedUnknownand we are now on the branch where the value has to be of the respective type. Hence, this method only handles the case where supertype is more strict than this type's upper type bound.- returns
The updated operand stack and register values.
- Definition Classes
- MultipleReferenceValues → TheReferenceValue
- def rejoinValue(oldValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue, joinValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue, joinedValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue): (ReferenceValues.this)#DomainMultipleReferenceValues
- def store(pc: Int, value: (ReferenceValues.this)#DomainValue, index: (ReferenceValues.this)#DomainValue): (ReferenceValues.this)#ArrayStoreResult
- Definition Classes
- MultipleReferenceValues → ArrayAbstraction
- def summarize(pc: Int): (ReferenceValues.this)#DomainReferenceValue
Summarizes this value by creating a new domain value that abstracts over the properties of all values.
Summarizes this value by creating a new domain value that abstracts over the properties of all values.
The given
pcis used as the program counter of the newly created value.- Definition Classes
- MultipleReferenceValues → Value
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toCanonicalForm: IsReferenceValue
Returns a
ValueInformationobject that just captures the basic information as defined by thisvalueframework.Returns a
ValueInformationobject that just captures the basic information as defined by thisvalueframework. The returned value information object will be independent of the underlying representation from which it was derived.- Definition Classes
- IsMultipleReferenceValue → IsReferenceValue → ValueInformation
- def toString(): String
- Definition Classes
- MultipleReferenceValues → AnyRef → Any
- def update(newValues: UIDSet[(ReferenceValues.this)#DomainSingleOriginReferenceValue], valuesUpdated: Boolean, joinedValue: (ReferenceValues.this)#DomainSingleOriginReferenceValue, newRefId: (ReferenceValues.this)#RefId): (ReferenceValues.this)#DomainMultipleReferenceValues
- Attributes
- protected[ReferenceValues]
- val upperTypeBound: UIDSet[_ <: ReferenceType]
The upper bound of the value's type.
The upper bound of the value's type. The upper bound is empty if this value is
null(i.e.,isNull == Yes). The upper bound is only guaranteed to contain exactly one type if the type is precise. (i.e.,isPrecise == true). Otherwise, the upper type bound may contain one or more types that are not known to be in an inheritance relation, but which will correctly approximate the runtime type.- Definition Classes
- MultipleReferenceValues → IsReferenceValue
- Note
If only a part of a project is analyzed, the class hierarchy may be fragmented and it may happen that two classes that are indeed in an inheritance relation – if we would analyze the complete project – are part of the upper type bound.
- val values: UIDSet[(ReferenceValues.this)#DomainSingleOriginReferenceValue]
- def verificationTypeInfo: VerificationTypeInfo
The type of this value as used by the org.opalj.br.StackMapTable attribute.
The type of this value as used by the org.opalj.br.StackMapTable attribute.
- Definition Classes
- IsMultipleReferenceValue → ValueInformation
- Exceptions thrown
IllegalStateExceptionif this value represents void or a return address value.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated