Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @ 23700:9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 18 Jun 2016 13:19:01 +0200 |
parents | b5557b757040 |
children | 9ac04c6047c8 |
comparison
equal
deleted
inserted
replaced
23699:8f9709f61cd4 | 23700:9e1235406b59 |
---|---|
590 FieldInfo(int index) { | 590 FieldInfo(int index) { |
591 HotSpotVMConfig config = config(); | 591 HotSpotVMConfig config = config(); |
592 // Get Klass::_fields | 592 // Get Klass::_fields |
593 final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); | 593 final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); |
594 assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code"; | 594 assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code"; |
595 metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index; | 595 int offset = config.fieldInfoFieldSlots * Short.BYTES * index; |
596 metaspaceData = metaspaceFields + config.arrayU2DataOffset + offset; | |
596 } | 597 } |
597 | 598 |
598 private int getAccessFlags() { | 599 private int getAccessFlags() { |
599 return readFieldSlot(config().fieldInfoAccessFlagsOffset); | 600 return readFieldSlot(config().fieldInfoAccessFlagsOffset); |
600 } | 601 } |
618 /** | 619 /** |
619 * Helper method to read an entry (slot) from the field array. Currently field info is laid | 620 * Helper method to read an entry (slot) from the field array. Currently field info is laid |
620 * on top an array of Java shorts. | 621 * on top an array of Java shorts. |
621 */ | 622 */ |
622 private int readFieldSlot(int index) { | 623 private int readFieldSlot(int index) { |
623 return UNSAFE.getChar(metaspaceData + Short.BYTES * index); | 624 int offset = Short.BYTES * index; |
625 return UNSAFE.getChar(metaspaceData + offset); | |
624 } | 626 } |
625 | 627 |
626 /** | 628 /** |
627 * Returns the name of this field as a {@link String}. If the field is an internal field the | 629 * Returns the name of this field as a {@link String}. If the field is an internal field the |
628 * name index is pointing into the vmSymbols table. | 630 * name index is pointing into the vmSymbols table. |
657 public boolean hasGenericSignature() { | 659 public boolean hasGenericSignature() { |
658 return (getAccessFlags() & config().jvmAccFieldHasGenericSignature) != 0; | 660 return (getAccessFlags() & config().jvmAccFieldHasGenericSignature) != 0; |
659 } | 661 } |
660 } | 662 } |
661 | 663 |
664 @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE", justification = "comparator is only used transiently") | |
662 private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> { | 665 private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> { |
663 @Override | 666 @Override |
664 public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) { | 667 public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) { |
665 return o1.offset() - o2.offset(); | 668 return o1.offset() - o2.offset(); |
666 } | 669 } |