< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java

Print this page




  33 import sun.jvm.hotspot.types.Type;
  34 import sun.jvm.hotspot.types.TypeDataBase;
  35 
  36 public class ZPageTable extends VMObject {
  37     private static long mapFieldOffset;
  38 
  39     static {
  40         VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
  41     }
  42 
  43     static private synchronized void initialize(TypeDataBase db) {
  44         Type type = db.lookupType("ZPageTable");
  45 
  46         mapFieldOffset = type.getAddressField("_map").getOffset();
  47     }
  48 
  49     public ZPageTable(Address addr) {
  50         super(addr);
  51     }
  52 
  53     private ZAddressRangeMapForPageTable map() {
  54         return (ZAddressRangeMapForPageTable)VMObjectFactory.newObject(ZAddressRangeMapForPageTable.class, addr.addOffsetTo(mapFieldOffset));
  55     }
  56 
  57     private ZPageTableEntry getEntry(Address o) {
  58         return new ZPageTableEntry(map().get(o));
  59     }
  60 
  61     ZPage get(Address o) {
  62         return getEntry(o).page();
  63     }
  64 
  65     boolean is_relocating(Address o) {
  66         return getEntry(o).relocating();
  67     }
  68 
  69     private class ZPagesIterator implements Iterator<ZPage> {
  70         private ZAddressRangeMapForPageTable.Iterator mapIter;
  71         private ZPage next;
  72 
  73         ZPagesIterator() {
  74             mapIter = map().new Iterator();
  75             positionToNext();
  76         }
  77 
  78         private ZPage positionToNext() {
  79             ZPage current = next;
  80 
  81             // Find next
  82             ZPage found = null;
  83             while (mapIter.hasNext()) {
  84                 ZPageTableEntry entry = new ZPageTableEntry(mapIter.next());
  85                 if (!entry.isEmpty()) {
  86                     ZPage page = entry.page();
  87                     // Medium pages have repeated entries for all covered slots,
  88                     // therefore we need to compare against the current page.
  89                     if (page != null && !page.equals(current)) {
  90                         found = page;




  33 import sun.jvm.hotspot.types.Type;
  34 import sun.jvm.hotspot.types.TypeDataBase;
  35 
  36 public class ZPageTable extends VMObject {
  37     private static long mapFieldOffset;
  38 
  39     static {
  40         VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
  41     }
  42 
  43     static private synchronized void initialize(TypeDataBase db) {
  44         Type type = db.lookupType("ZPageTable");
  45 
  46         mapFieldOffset = type.getAddressField("_map").getOffset();
  47     }
  48 
  49     public ZPageTable(Address addr) {
  50         super(addr);
  51     }
  52 
  53     private ZGranuleMapForPageTable map() {
  54         return (ZGranuleMapForPageTable)VMObjectFactory.newObject(ZGranuleMapForPageTable.class, addr.addOffsetTo(mapFieldOffset));
  55     }
  56 
  57     private ZPageTableEntry getEntry(Address o) {
  58         return new ZPageTableEntry(map().get(o));
  59     }
  60 
  61     ZPage get(Address o) {
  62         return getEntry(o).page();
  63     }
  64 
  65     boolean is_relocating(Address o) {
  66         return getEntry(o).relocating();
  67     }
  68 
  69     private class ZPagesIterator implements Iterator<ZPage> {
  70         private ZGranuleMapForPageTable.Iterator mapIter;
  71         private ZPage next;
  72 
  73         ZPagesIterator() {
  74             mapIter = map().new Iterator();
  75             positionToNext();
  76         }
  77 
  78         private ZPage positionToNext() {
  79             ZPage current = next;
  80 
  81             // Find next
  82             ZPage found = null;
  83             while (mapIter.hasNext()) {
  84                 ZPageTableEntry entry = new ZPageTableEntry(mapIter.next());
  85                 if (!entry.isEmpty()) {
  86                     ZPage page = entry.page();
  87                     // Medium pages have repeated entries for all covered slots,
  88                     // therefore we need to compare against the current page.
  89                     if (page != null && !page.equals(current)) {
  90                         found = page;


< prev index next >