src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1HeapRegionTable.java
changeset 47602 d4380ee1cbe9
parent 47216 71c04702a3d5
child 47619 74f5b6c267e3
equal deleted inserted replaced
47601:f9ace8da5e9c 47602:d4380ee1cbe9
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    27 import java.util.Iterator;
    27 import java.util.Iterator;
    28 import java.util.Observable;
    28 import java.util.Observable;
    29 import java.util.Observer;
    29 import java.util.Observer;
    30 
    30 
    31 import sun.jvm.hotspot.debugger.Address;
    31 import sun.jvm.hotspot.debugger.Address;
       
    32 import sun.jvm.hotspot.debugger.OopHandle;
    32 import sun.jvm.hotspot.runtime.VM;
    33 import sun.jvm.hotspot.runtime.VM;
    33 import sun.jvm.hotspot.runtime.VMObject;
    34 import sun.jvm.hotspot.runtime.VMObject;
    34 import sun.jvm.hotspot.runtime.VMObjectFactory;
    35 import sun.jvm.hotspot.runtime.VMObjectFactory;
    35 import sun.jvm.hotspot.types.AddressField;
    36 import sun.jvm.hotspot.types.AddressField;
    36 import sun.jvm.hotspot.types.CIntegerField;
    37 import sun.jvm.hotspot.types.CIntegerField;
    37 import sun.jvm.hotspot.types.Type;
    38 import sun.jvm.hotspot.types.Type;
    38 import sun.jvm.hotspot.types.TypeDataBase;
    39 import sun.jvm.hotspot.types.TypeDataBase;
       
    40 import sun.jvm.hotspot.utilities.Assert;
    39 
    41 
    40 // Mirror class for G1HeapRegionTable. It's essentially an index -> HeapRegion map.
    42 // Mirror class for G1HeapRegionTable. It's essentially an index -> HeapRegion map.
    41 
    43 
    42 public class G1HeapRegionTable extends VMObject {
    44 public class G1HeapRegionTable extends VMObject {
    43     // HeapRegion** _base;
    45     // HeapRegion** _base;
   130     }
   132     }
   131 
   133 
   132     public G1HeapRegionTable(Address addr) {
   134     public G1HeapRegionTable(Address addr) {
   133         super(addr);
   135         super(addr);
   134     }
   136     }
       
   137 
       
   138     public HeapRegion getByAddress(Address addr) {
       
   139         if (Assert.ASSERTS_ENABLED) {
       
   140             Assert.that(addr instanceof OopHandle, "addr should be OopHandle");
       
   141         }
       
   142 
       
   143         long biasedIndex = addr.asLongValue() >>> shiftBy();
       
   144         return new HeapRegion(addr.addOffsetToAsOopHandle(biasedIndex * HeapRegion.getPointerSize()));
       
   145     }
   135 }
   146 }