1 package sun.jvm.hotspot.gc_implementation.g1;
   2 
   3 import java.util.Observable;
   4 import java.util.Observer;
   5 
   6 import sun.jvm.hotspot.debugger.Address;
   7 import sun.jvm.hotspot.runtime.VM;
   8 import sun.jvm.hotspot.runtime.VMObject;
   9 import sun.jvm.hotspot.types.CIntegerField;
  10 import sun.jvm.hotspot.types.Type;
  11 import sun.jvm.hotspot.types.TypeDataBase;
  12 
  13 public class G1Allocator extends VMObject {
  14 
  15   //size_t _summary_bytes_used;
  16   static private CIntegerField summaryBytesUsedField;
  17 
  18   static {
  19     VM.registerVMInitializedObserver(new Observer() {
  20       public void update(Observable o, Object data) {
  21         initialize(VM.getVM().getTypeDataBase());
  22       }
  23     });
  24   }
  25 
  26   static private synchronized void initialize(TypeDataBase db) {
  27     Type type = db.lookupType("G1Allocator");
  28 
  29     summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
  30   }
  31 
  32   public long getSummaryBytes() {
  33     return summaryBytesUsedField.getValue(addr);
  34   }
  35 
  36   public G1Allocator(Address addr) {
  37     super(addr);
  38 
  39   }
  40 }