Top Description Inners Fields Constructors Methods
jdk.vm.ci.code

public final Class VirtualObject

extends Object
implements JavaValue
Class Inheritance
All Implemented Interfaces
jdk.vm.ci.meta.JavaValue
Imports
java.util.Collections, .IdentityHashMap, .Set, jdk.vm.ci.common.JVMCIError, jdk.vm.ci.meta.JavaKind, .JavaValue, .ResolvedJavaField, .ResolvedJavaType

An instance of this class represents an object whose allocation was removed by escape analysis. The information stored in the VirtualObject is used during deoptimization to recreate the object.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
private final int
private boolean
private JavaKind[]
private final ResolvedJavaType
private JavaValue[]

Constructor Summary

AccessConstructor and Description
private
VirtualObject(ResolvedJavaType type, int id, boolean isAutoBox)

Method Summary

Modifier and TypeMethod and Description
private static StringBuilder
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static VirtualObject

Returns:

a new VirtualObject instance.
get
(ResolvedJavaType
the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
type
,
int
a unique id that identifies the object within the debug information for one position in the compiled code.
id
)

Creates a new VirtualObject for the given type, with the given fields.

public static VirtualObject

Returns:

a new VirtualObject instance.
get
(ResolvedJavaType
the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
type
,
int
a unique id that identifies the object within the debug information for one position in the compiled code.
id
,
boolean
a flag that tells the runtime that the object may be a boxed primitive and that it possibly needs to be obtained from the box cache instead of creating a new instance.
isAutoBox
)

Creates a new VirtualObject for the given type, with the given fields.

public int
getId()

Returns the unique id that identifies the object within the debug information for one position in the compiled code.

public JavaKind
getSlotKind(int index)

Returns the kind of the value at index.

public ResolvedJavaType
getType()

Returns the type of the object whose allocation was removed during compilation.

public JavaValue[]
getValues()

Returns the array containing all the values to be stored into the object when it is recreated.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isAutoBox()

Returns true if the object is a box.

private static boolean
same(Object o1, Object o2)

public void
setValues(JavaValue[]
an array containing all the values to be stored into the object when it is recreated.
values
,
JavaKind[]
an array containing the Java kinds of the values. This must have the same length as values. This array is now owned by this object and must not be mutated by the caller.
slotKinds
)

Overwrites the current set of values with a new one.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

idback to summary
private final int id
isAutoBoxback to summary
private boolean isAutoBox
slotKindsback to summary
private JavaKind[] slotKinds
typeback to summary
private final ResolvedJavaType type
valuesback to summary
private JavaValue[] values

Constructor Detail

VirtualObjectback to summary
private VirtualObject(ResolvedJavaType type, int id, boolean isAutoBox)

Method Detail

appendValueback to summary
private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set<VirtualObject> visited)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public static VirtualObject get(ResolvedJavaType type, int id)

Creates a new VirtualObject for the given type, with the given fields. If type is an instance class then values provides the values for the fields returned by getInstanceFields(true). If type is an array then the length of the values array determines the reallocated array length.

Parameters
type:ResolvedJavaType

the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.

id:int

a unique id that identifies the object within the debug information for one position in the compiled code.

Returns:VirtualObject

a new VirtualObject instance.

getback to summary
public static VirtualObject get(ResolvedJavaType type, int id, boolean isAutoBox)

Creates a new VirtualObject for the given type, with the given fields. If type is an instance class then values provides the values for the fields returned by getInstanceFields(true). If type is an array then the length of the values array determines the reallocated array length.

Parameters
type:ResolvedJavaType

the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.

id:int

a unique id that identifies the object within the debug information for one position in the compiled code.

isAutoBox:boolean

a flag that tells the runtime that the object may be a boxed primitive and that it possibly needs to be obtained from the box cache instead of creating a new instance.

Returns:VirtualObject

a new VirtualObject instance.

getIdback to summary
public int getId()

Returns the unique id that identifies the object within the debug information for one position in the compiled code.

getSlotKindback to summary
public JavaKind getSlotKind(int index)

Returns the kind of the value at index.

getTypeback to summary
public ResolvedJavaType getType()

Returns the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.

getValuesback to summary
public JavaValue[] getValues()

Returns the array containing all the values to be stored into the object when it is recreated. This field is intentional exposed as a mutable array that a compiler may modify (e.g. during register allocation).

Annotations
@SuppressFBWarnings:EI_EXPOSE_REP
justification:`values` is intentional mutable
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isAutoBoxback to summary
public boolean isAutoBox()

Returns true if the object is a box. For boxes the deoptimization would check if the value of the box is in the cache range and try to return a cached object.

sameback to summary
private static boolean same(Object o1, Object o2)
setValuesback to summary
public void setValues(JavaValue[] values, JavaKind[] slotKinds)

Overwrites the current set of values with a new one.

Parameters
values:JavaValue[]

an array containing all the values to be stored into the object when it is recreated.

slotKinds:JavaKind[]

an array containing the Java kinds of the values. This must have the same length as values. This array is now owned by this object and must not be mutated by the caller.

Annotations
@SuppressFBWarnings:EI_EXPOSE_REP2
justification:caller transfers ownership of `slotKinds`
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
verifyLayoutback to summary
public void verifyLayout(VirtualObject.LayoutVerifier verifier)
jdk.vm.ci.code back to summary

public Interface VirtualObject.LayoutVerifier


Method Summary

Modifier and TypeMethod and Description
public int
public default JavaKind

Method Detail

getOffsetback to summary
public int getOffset(ResolvedJavaField field)
getStorageKindback to summary
public default JavaKind getStorageKind(ResolvedJavaField field)