< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
Print this page
*** 589,599 ****
FieldInfo(int index) {
HotSpotVMConfig config = config();
// Get Klass::_fields
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
! metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index;
}
private int getAccessFlags() {
return readFieldSlot(config().fieldInfoAccessFlagsOffset);
}
--- 589,600 ----
FieldInfo(int index) {
HotSpotVMConfig config = config();
// Get Klass::_fields
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
! int offset = config.fieldInfoFieldSlots * Short.BYTES * index;
! metaspaceData = metaspaceFields + config.arrayU2DataOffset + offset;
}
private int getAccessFlags() {
return readFieldSlot(config().fieldInfoAccessFlagsOffset);
}
*** 617,645 ****
/**
* Helper method to read an entry (slot) from the field array. Currently field info is laid
* on top an array of Java shorts.
*/
private int readFieldSlot(int index) {
! return UNSAFE.getChar(metaspaceData + Short.BYTES * index);
}
/**
* Returns the name of this field as a {@link String}. If the field is an internal field the
* name index is pointing into the vmSymbols table.
*/
public String getName() {
final int nameIndex = getNameIndex();
! return isInternal() ? HotSpotVmSymbols.symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex);
}
/**
* Returns the signature of this field as {@link String}. If the field is an internal field
* the signature index is pointing into the vmSymbols table.
*/
public String getSignature() {
final int signatureIndex = getSignatureIndex();
! return isInternal() ? HotSpotVmSymbols.symbolAt(signatureIndex) : getConstantPool().lookupUtf8(signatureIndex);
}
public JavaType getType() {
String signature = getSignature();
return runtime().lookupType(signature, HotSpotResolvedObjectTypeImpl.this, false);
--- 618,647 ----
/**
* Helper method to read an entry (slot) from the field array. Currently field info is laid
* on top an array of Java shorts.
*/
private int readFieldSlot(int index) {
! int offset = Short.BYTES * index;
! return UNSAFE.getChar(metaspaceData + offset);
}
/**
* Returns the name of this field as a {@link String}. If the field is an internal field the
* name index is pointing into the vmSymbols table.
*/
public String getName() {
final int nameIndex = getNameIndex();
! return isInternal() ? config().symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex);
}
/**
* Returns the signature of this field as {@link String}. If the field is an internal field
* the signature index is pointing into the vmSymbols table.
*/
public String getSignature() {
final int signatureIndex = getSignatureIndex();
! return isInternal() ? config().symbolAt(signatureIndex) : getConstantPool().lookupUtf8(signatureIndex);
}
public JavaType getType() {
String signature = getSignature();
return runtime().lookupType(signature, HotSpotResolvedObjectTypeImpl.this, false);
*** 656,665 ****
--- 658,668 ----
public boolean hasGenericSignature() {
return (getAccessFlags() & config().jvmAccFieldHasGenericSignature) != 0;
}
}
+ @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE", justification = "comparator is only used transiently")
private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> {
@Override
public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) {
return o1.offset() - o2.offset();
}
< prev index next >