comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @ 23996:11f0412408cd

8173912: [JVMCI] fix memory overhead of JVMCI
author Doug Simon <doug.simon@oracle.com>
date Fri, 03 Feb 2017 21:08:05 +0100
parents 4913d70f630b
children 839dcc4f2cf6
comparison
equal deleted inserted replaced
23995:988dc143e0bf 23996:11f0412408cd
561 return new AssumptionResult<>(result, new ConcreteMethod(method, this, result)); 561 return new AssumptionResult<>(result, new ConcreteMethod(method, this, result));
562 } 562 }
563 return null; 563 return null;
564 } 564 }
565 565
566 FieldInfo createFieldInfo(int index) {
567 return new FieldInfo(index);
568 }
569
566 /** 570 /**
567 * This class represents the field information for one field contained in the fields array of an 571 * This class represents the field information for one field contained in the fields array of an
568 * {@code InstanceKlass}. The implementation is similar to the native {@code FieldInfo} class. 572 * {@code InstanceKlass}. The implementation is similar to the native {@code FieldInfo} class.
569 */ 573 */
570 private class FieldInfo { 574 class FieldInfo {
571 /** 575 /**
572 * Native pointer into the array of Java shorts. 576 * Native pointer into the array of Java shorts.
573 */ 577 */
574 private final long metaspaceData; 578 private final long metaspaceData;
575 579
589 593
590 private int getAccessFlags() { 594 private int getAccessFlags() {
591 return readFieldSlot(config().fieldInfoAccessFlagsOffset); 595 return readFieldSlot(config().fieldInfoAccessFlagsOffset);
592 } 596 }
593 597
598 private int getNameIndex() {
599 return readFieldSlot(config().fieldInfoNameIndexOffset);
600 }
601
594 private int getSignatureIndex() { 602 private int getSignatureIndex() {
595 return readFieldSlot(config().fieldInfoSignatureIndexOffset); 603 return readFieldSlot(config().fieldInfoSignatureIndexOffset);
596 } 604 }
597 605
598 public int getOffset() { 606 public int getOffset() {
608 * on top an array of Java shorts. 616 * on top an array of Java shorts.
609 */ 617 */
610 private int readFieldSlot(int index) { 618 private int readFieldSlot(int index) {
611 int offset = Short.BYTES * index; 619 int offset = Short.BYTES * index;
612 return UNSAFE.getChar(metaspaceData + offset); 620 return UNSAFE.getChar(metaspaceData + offset);
621 }
622
623 /**
624 * Returns the name of this field as a {@link String}. If the field is an internal field the
625 * name index is pointing into the vmSymbols table.
626 */
627 public String getName() {
628 final int nameIndex = getNameIndex();
629 return isInternal() ? config().symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex);
613 } 630 }
614 631
615 /** 632 /**
616 * Returns the signature of this field as {@link String}. If the field is an internal field 633 * Returns the signature of this field as {@link String}. If the field is an internal field
617 * the signature index is pointing into the vmSymbols table. 634 * the signature index is pointing into the vmSymbols table.