public final class LIRKind extends Object
PlatformKind
that gives the
low level representation of the value, and a referenceMask
that describes the location
of object references in the value, and optionally a derivedReferenceBase
.
LIRKind
instancesValue
should get a LIRKind
of the correct
PlatformKind
that also contains the correct reference information. LIRKinds should be created as follows:
If the result value is created from one or more input values, the LIRKind
should be
created with combine(jdk.internal.jvmci.meta.Value...)
(inputs). If the result has a different PlatformKind
than the inputs, combine(jdk.internal.jvmci.meta.Value...)
(inputs).changeType(jdk.internal.jvmci.meta.PlatformKind)
(resultKind) should be used.
If the result is an exact copy of one of the inputs, Value.getLIRKind()
can be used. Note
that this is only correct for move-like operations, like conditional move or compare-and-swap.
For convert operations, combine(jdk.internal.jvmci.meta.Value...)
should be used.
If it is known that the result will be a reference (e.g. pointer arithmetic where the end result
is a valid oop), reference(jdk.internal.jvmci.meta.PlatformKind)
should be used.
If it is known that the result will neither be a reference nor be derived from a reference,
value(jdk.internal.jvmci.meta.PlatformKind)
can be used. If the operation producing this value has inputs, this is very
likely wrong, and combine(jdk.internal.jvmci.meta.Value...)
should be used instead.
If it is known that the result is derived from a reference in a way that the garbage collector
can not track, unknownReference(jdk.internal.jvmci.meta.PlatformKind)
can be used. In most cases,
combine(jdk.internal.jvmci.meta.Value...)
should be used instead, since it is able to detect this automatically.
Modifier and Type | Field and Description |
---|---|
private AllocatableValue |
derivedReferenceBase |
static LIRKind |
Illegal
The non-type.
|
private PlatformKind |
platformKind |
private int |
referenceMask |
private static int |
UNKNOWN_REFERENCE |
Modifier | Constructor and Description |
---|---|
private |
LIRKind(PlatformKind platformKind,
int referenceMask,
AllocatableValue derivedReferenceBase) |
Modifier and Type | Method and Description |
---|---|
LIRKind |
changeType(PlatformKind newPlatformKind)
Create a new
LIRKind with the same reference information and a new
platform kind. |
static LIRKind |
combine(Value... inputs)
Derive a new type from inputs.
|
static LIRKind |
combineDerived(LIRKind kind,
AllocatableValue base1,
AllocatableValue base2)
Helper method to construct derived reference kinds.
|
static AllocatableValue |
derivedBaseFromValue(AllocatableValue value)
Helper method to construct derived reference kinds.
|
static LIRKind |
derivedReference(PlatformKind platformKind,
AllocatableValue base)
Create a
LIRKind of type platformKind that contains a derived reference. |
boolean |
equals(Object obj) |
AllocatableValue |
getDerivedReferenceBase()
Get the base value of a derived reference.
|
PlatformKind |
getPlatformKind()
Get the low level type that is used in code generation.
|
int |
getReferenceCount() |
int |
hashCode() |
boolean |
isDerivedReference()
Check whether this value is a derived reference.
|
boolean |
isReference(int idx)
Check whether the
idx th part of this value is a reference that must be tracked at
safepoints. |
boolean |
isUnknownReference()
Check whether this value is derived from a reference in a non-linear way.
|
boolean |
isValue()
Check whether this kind is a value type that doesn't need to be tracked at safepoints.
|
LIRKind |
makeDerivedReference(AllocatableValue base)
Create a derived reference.
|
LIRKind |
makeUnknownReference()
Create a new
LIRKind with the same type, but marked as containing an
unknownReference(jdk.internal.jvmci.meta.PlatformKind) . |
static LIRKind |
merge(Iterable<LIRKind> kinds) |
static LIRKind |
merge(Value... inputs)
Merge the types of the inputs.
|
static LIRKind |
reference(PlatformKind platformKind)
Create a
LIRKind of type platformKind that contains a single tracked oop
reference. |
LIRKind |
repeat(PlatformKind newPlatformKind)
Create a new
LIRKind with a new platform kind. |
void |
setDerivedReferenceBase(AllocatableValue derivedReferenceBase)
Change the base value of a derived reference.
|
private static PlatformKind |
toStackKind(PlatformKind platformKind) |
String |
toString() |
static LIRKind |
unknownReference(PlatformKind platformKind)
Create a
LIRKind of type platformKind that contains a value that is derived
from a reference in a non-linear way. |
static LIRKind |
value(PlatformKind platformKind)
Create a
LIRKind of type platformKind that contains a primitive value. |
private static boolean |
verifyMerge(LIRKind mergeKind,
Iterable<LIRKind> kinds) |
static boolean |
verifyMoveKinds(LIRKind dst,
LIRKind src) |
public static final LIRKind Illegal
unknownReference(jdk.internal.jvmci.meta.PlatformKind)
, so it can never be part of an oop map.private final PlatformKind platformKind
private final int referenceMask
private AllocatableValue derivedReferenceBase
private static final int UNKNOWN_REFERENCE
private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase)
public static LIRKind value(PlatformKind platformKind)
LIRKind
of type platformKind
that contains a primitive value. Should
be only used when it's guaranteed that the value is not even indirectly derived from a
reference. Otherwise, combine(Value...)
should be used instead.public static LIRKind reference(PlatformKind platformKind)
LIRKind
of type platformKind
that contains a single tracked oop
reference.public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base)
LIRKind
of type platformKind
that contains a derived reference.public static LIRKind unknownReference(PlatformKind platformKind)
LIRKind
of type platformKind
that contains a value that is derived
from a reference in a non-linear way. Values of this LIRKind
can not be live at
safepoints. In most cases, this should not be called directly. combine(jdk.internal.jvmci.meta.Value...)
should be
used instead to automatically propagate this information.public LIRKind makeDerivedReference(AllocatableValue base)
base
- An AllocatableValue
containing the base pointer of the derived reference.public static LIRKind combine(Value... inputs)
PlatformKind
of one of the
inputs. If all inputs are values, the result is a value. Otherwise, the result is an unknown
reference.
This method should be used to construct the result LIRKind
of any operation that
modifies values (e.g. arithmetics).public static LIRKind merge(Value... inputs)
PlatformKind
of one of the
inputs. If all inputs are values (references), the result is a value (reference). Otherwise,
the result is an unknown reference.
This method should be used to construct the result LIRKind
of merge operation that
does not modify values (e.g. phis).public static AllocatableValue derivedBaseFromValue(AllocatableValue value)
null
, and for unknown references it returns
Value.ILLEGAL
.public static LIRKind combineDerived(LIRKind kind, AllocatableValue base1, AllocatableValue base2)
base1
or base2
are set, it creates a derived reference using it as the base. If both are set, the result is
an unknown reference.public static LIRKind merge(Iterable<LIRKind> kinds)
merge(Value...)
private static boolean verifyMerge(LIRKind mergeKind, Iterable<LIRKind> kinds)
public LIRKind changeType(PlatformKind newPlatformKind)
LIRKind
with the same reference information and a new
platform kind. If the new kind is a longer vector than this,
the new elements are marked as untracked values.public LIRKind repeat(PlatformKind newPlatformKind)
LIRKind
with a new platform kind. If the
new kind is longer than this, the reference positions are repeated to fill the vector.public LIRKind makeUnknownReference()
LIRKind
with the same type, but marked as containing an
unknownReference(jdk.internal.jvmci.meta.PlatformKind)
.public PlatformKind getPlatformKind()
public boolean isDerivedReference()
public AllocatableValue getDerivedReferenceBase()
public void setDerivedReferenceBase(AllocatableValue derivedReferenceBase)
public boolean isUnknownReference()
true
, this value must not be live at safepoints.public int getReferenceCount()
public boolean isReference(int idx)
idx
th part of this value is a reference that must be tracked at
safepoints.idx
- The index into the vector if this is a vector kind. Must be 0 if this is a scalar
kind.public boolean isValue()
public static boolean verifyMoveKinds(LIRKind dst, LIRKind src)
private static PlatformKind toStackKind(PlatformKind platformKind)