< prev index next >

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

Print this page




  30 import sun.jvm.hotspot.utilities.BitMap;
  31 import sun.jvm.hotspot.utilities.BitMapInterface;
  32 
  33 /** Discontiguous bitmap for ZGC. */
  34 public class ZExternalBitMap implements BitMapInterface {
  35     private ZPageTable pageTable;
  36     private final long oopSize;
  37 
  38     private HashMap<ZPage, BitMap> pageToBitMap = new HashMap<ZPage, BitMap>();
  39 
  40     public ZExternalBitMap(ZCollectedHeap collectedHeap) {
  41         pageTable = collectedHeap.heap().pageTable();
  42         oopSize = VM.getVM().getOopSize();
  43     }
  44 
  45     private ZPage getPage(long zOffset) {
  46         if (zOffset > ZGlobals.ZAddressOffsetMask) {
  47             throw new RuntimeException("Not a Z offset: " + zOffset);
  48         }
  49 
  50         ZPage page = pageTable.get(ZOop.to_address(zOffset));
  51         if (page == null) {
  52             throw new RuntimeException("Address not in pageTable: " + zOffset);
  53         }
  54         return page;
  55     }
  56 
  57     private BitMap getOrAddBitMap(ZPage page) {
  58         BitMap bitMap = pageToBitMap.get(page);
  59         if (bitMap == null) {
  60             long size = page.size();
  61 
  62             long maxNumObjects = size >>> page.object_alignment_shift();
  63             if (maxNumObjects > Integer.MAX_VALUE) {
  64                 throw new RuntimeException("int overflow");
  65             }
  66             int intMaxNumObjects = (int)maxNumObjects;
  67 
  68             bitMap = new BitMap(intMaxNumObjects);
  69             pageToBitMap.put(page,  bitMap);
  70         }




  30 import sun.jvm.hotspot.utilities.BitMap;
  31 import sun.jvm.hotspot.utilities.BitMapInterface;
  32 
  33 /** Discontiguous bitmap for ZGC. */
  34 public class ZExternalBitMap implements BitMapInterface {
  35     private ZPageTable pageTable;
  36     private final long oopSize;
  37 
  38     private HashMap<ZPage, BitMap> pageToBitMap = new HashMap<ZPage, BitMap>();
  39 
  40     public ZExternalBitMap(ZCollectedHeap collectedHeap) {
  41         pageTable = collectedHeap.heap().pageTable();
  42         oopSize = VM.getVM().getOopSize();
  43     }
  44 
  45     private ZPage getPage(long zOffset) {
  46         if (zOffset > ZGlobals.ZAddressOffsetMask) {
  47             throw new RuntimeException("Not a Z offset: " + zOffset);
  48         }
  49 
  50         ZPage page = pageTable.get(ZUtils.longToAddress(zOffset));
  51         if (page == null) {
  52             throw new RuntimeException("Address not in pageTable: " + zOffset);
  53         }
  54         return page;
  55     }
  56 
  57     private BitMap getOrAddBitMap(ZPage page) {
  58         BitMap bitMap = pageToBitMap.get(page);
  59         if (bitMap == null) {
  60             long size = page.size();
  61 
  62             long maxNumObjects = size >>> page.object_alignment_shift();
  63             if (maxNumObjects > Integer.MAX_VALUE) {
  64                 throw new RuntimeException("int overflow");
  65             }
  66             int intMaxNumObjects = (int)maxNumObjects;
  67 
  68             bitMap = new BitMap(intMaxNumObjects);
  69             pageToBitMap.put(page,  bitMap);
  70         }


< prev index next >