public class HotSpotConstantPool extends Object implements ConstantPool, HotSpotProxified
ConstantPool
for HotSpot.Modifier and Type | Class and Description |
---|---|
static class |
HotSpotConstantPool.Bytecodes
Subset of JVM bytecode opcodes used by
HotSpotConstantPool . |
private class |
HotSpotConstantPool.Cache
Represents a
ConstantPoolCache . |
private static class |
HotSpotConstantPool.JVM_CONSTANT
Enum of all
JVM_CONSTANT constants used in the VM. |
private static class |
HotSpotConstantPool.LookupTypeCacheElement |
static class |
HotSpotConstantPool.Options |
private class |
HotSpotConstantPool.ResolvedReferences
Hide the resolved references array in a private class so it cannot be accessed directly.
|
Modifier and Type | Field and Description |
---|---|
private HotSpotConstantPool.Cache |
cache
The constant pool cache of this constant pool.
|
private HotSpotConstantPool.LookupTypeCacheElement |
lastLookupType |
private long |
metaspaceConstantPool
Reference to the C++ ConstantPool object.
|
private HotSpotConstantPool.ResolvedReferences |
resolvedReferences
Resolved references of this constant pool.
|
Constructor and Description |
---|
HotSpotConstantPool(long metaspaceConstantPool) |
Modifier and Type | Method and Description |
---|---|
private void |
assertBounds(int index)
Asserts that the constant pool index
index is in the bounds of the constant pool. |
private void |
assertTag(int index,
HotSpotConstantPool.JVM_CONSTANT tag)
Asserts that the constant pool tag at index
index is equal to tag . |
private void |
assertTagIsFieldOrMethod(int index)
Asserts that the constant pool tag at index
index is a HotSpotConstantPool.JVM_CONSTANT.Fieldref ,
or a HotSpotConstantPool.JVM_CONSTANT.MethodRef , or a HotSpotConstantPool.JVM_CONSTANT.InterfaceMethodref . |
private static int |
decodeConstantPoolCacheIndex(int index)
Decode a constant pool cache index to a constant pool index.
|
private static int |
decodeInvokedynamicIndex(int i)
See
ConstantPool::decode_invokedynamic_index . |
private double |
getDoubleAt(int index)
Gets the double constant pool entry at index
index . |
private long |
getEntryAt(int index)
Gets the constant pool entry at index
index . |
private float |
getFloatAt(int index)
Gets the float constant pool entry at index
index . |
private HotSpotResolvedObjectType |
getHolder()
Gets the holder for this constant pool as
HotSpotResolvedObjectTypeImpl . |
private int |
getIntAt(int index)
Gets the integer constant pool entry at index
index . |
private static JavaType |
getJavaType(long metaspacePointer)
|
private int |
getKlassRefIndexAt(int index)
Gets the klass reference index constant pool entry at index
index . |
private int |
getKlassRefIndexAt(int index,
boolean cached)
Gets the klass reference index constant pool entry at index
index . |
private long |
getLongAt(int index)
Gets the long constant pool entry at index
index . |
private int |
getNameAndTypeAt(int index)
Gets the
JVM_CONSTANT_NameAndType constant pool entry at index index . |
private int |
getNameAndTypeRefIndexAt(int index)
Gets the
JVM_CONSTANT_NameAndType reference index constant pool entry at index
index . |
private String |
getNameRefAt(int index)
Gets the name of a
JVM_CONSTANT_NameAndType constant pool entry at index
index . |
private int |
getNameRefIndexAt(int index)
Gets the name reference index of a
JVM_CONSTANT_NameAndType constant pool entry at
index index . |
private String |
getSignatureRefAt(int index)
Gets the signature of a
JVM_CONSTANT_NameAndType constant pool entry at index
index . |
private int |
getSignatureRefIndexAt(int index)
Gets the signature reference index of a
JVM_CONSTANT_NameAndType constant pool entry
at index index . |
private HotSpotConstantPool.JVM_CONSTANT |
getTagAt(int index)
Gets the constant pool tag at index
index . |
private int |
getUncachedKlassRefIndexAt(int index)
Gets the uncached klass reference index constant pool entry at index
index . |
private static boolean |
isInvokedynamicIndex(int index)
See
ConstantPool::is_invokedynamic_index . |
private boolean |
isInvokeHandle(int methodRefCacheIndex,
HotSpotResolvedObjectTypeImpl klass) |
int |
length() |
void |
loadReferencedType(int cpi,
int opcode) |
JavaConstant |
lookupAppendix(int cpi,
int opcode) |
Object |
lookupConstant(int cpi) |
JavaField |
lookupField(int cpi,
int opcode) |
JavaMethod |
lookupMethod(int cpi,
int opcode) |
Signature |
lookupSignature(int cpi) |
JavaType |
lookupType(int cpi,
int opcode) |
String |
lookupUtf8(int cpi) |
private static int |
rawIndexToConstantPoolIndex(int rawIndex,
int opcode)
Converts a raw index from the bytecodes to a constant pool index by adding a
constant . |
String |
toString() |
private final long metaspaceConstantPool
private volatile HotSpotConstantPool.LookupTypeCacheElement lastLookupType
private final HotSpotConstantPool.Cache cache
private final HotSpotConstantPool.ResolvedReferences resolvedReferences
public HotSpotConstantPool(long metaspaceConstantPool)
private HotSpotResolvedObjectType getHolder()
HotSpotResolvedObjectTypeImpl
.private static int rawIndexToConstantPoolIndex(int rawIndex, int opcode)
constant
.rawIndex
- index from the bytecodeopcode
- bytecode to convert the index forprivate static int decodeConstantPoolCacheIndex(int index)
ConstantPool::decode_cpcache_index
.index
- constant pool cache indexprivate static boolean isInvokedynamicIndex(int index)
ConstantPool::is_invokedynamic_index
.private static int decodeInvokedynamicIndex(int i)
ConstantPool::decode_invokedynamic_index
.private HotSpotConstantPool.JVM_CONSTANT getTagAt(int index)
index
.index
- constant pool indexprivate long getEntryAt(int index)
index
.index
- constant pool indexprivate int getIntAt(int index)
index
.index
- constant pool indexprivate long getLongAt(int index)
index
.index
- constant pool indexprivate float getFloatAt(int index)
index
.index
- constant pool indexprivate double getDoubleAt(int index)
index
.index
- constant pool indexprivate int getNameAndTypeAt(int index)
JVM_CONSTANT_NameAndType
constant pool entry at index index
.index
- constant pool indexJVM_CONSTANT_NameAndType
constant pool entryprivate int getNameAndTypeRefIndexAt(int index)
JVM_CONSTANT_NameAndType
reference index constant pool entry at index
index
.index
- constant pool indexJVM_CONSTANT_NameAndType
reference constant pool entryprivate String getNameRefAt(int index)
JVM_CONSTANT_NameAndType
constant pool entry at index
index
.index
- constant pool indexString
private int getNameRefIndexAt(int index)
JVM_CONSTANT_NameAndType
constant pool entry at
index index
.index
- constant pool indexprivate String getSignatureRefAt(int index)
JVM_CONSTANT_NameAndType
constant pool entry at index
index
.index
- constant pool indexString
private int getSignatureRefIndexAt(int index)
JVM_CONSTANT_NameAndType
constant pool entry
at index index
.index
- constant pool indexprivate int getKlassRefIndexAt(int index, boolean cached)
index
. See
ConstantPool::klass_ref_index_at
.index
- constant pool indexcached
- whether to go through the constant pool cacheprivate int getKlassRefIndexAt(int index)
index
. See
ConstantPool::klass_ref_index_at
.index
- constant pool indexprivate int getUncachedKlassRefIndexAt(int index)
index
. See:
ConstantPool::uncached_klass_ref_index_at
.index
- constant pool indexprivate void assertBounds(int index)
index
is in the bounds of the constant pool.index
- constant pool indexprivate void assertTag(int index, HotSpotConstantPool.JVM_CONSTANT tag)
index
is equal to tag
.index
- constant pool indextag
- expected tagprivate void assertTagIsFieldOrMethod(int index)
index
is a HotSpotConstantPool.JVM_CONSTANT.Fieldref
,
or a HotSpotConstantPool.JVM_CONSTANT.MethodRef
, or a HotSpotConstantPool.JVM_CONSTANT.InterfaceMethodref
.index
- constant pool indexpublic int length()
length
in interface ConstantPool
public Object lookupConstant(int cpi)
lookupConstant
in interface ConstantPool
public String lookupUtf8(int cpi)
lookupUtf8
in interface ConstantPool
public Signature lookupSignature(int cpi)
lookupSignature
in interface ConstantPool
public JavaConstant lookupAppendix(int cpi, int opcode)
lookupAppendix
in interface ConstantPool
private static JavaType getJavaType(long metaspacePointer)
metaspacePointer
- either a metaspace Klass or a metaspace Symbolpublic JavaMethod lookupMethod(int cpi, int opcode)
lookupMethod
in interface ConstantPool
public JavaType lookupType(int cpi, int opcode)
lookupType
in interface ConstantPool
public JavaField lookupField(int cpi, int opcode)
lookupField
in interface ConstantPool
public void loadReferencedType(int cpi, int opcode)
loadReferencedType
in interface ConstantPool
private boolean isInvokeHandle(int methodRefCacheIndex, HotSpotResolvedObjectTypeImpl klass)