< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java

Print this page




  37   private static AddressField oldGenField;
  38 
  39   private static AddressField youngGenSpecField;
  40   private static AddressField oldGenSpecField;
  41 
  42   private static GenerationFactory genFactory;
  43 
  44   static {
  45     VM.registerVMInitializedObserver(new Observer() {
  46         public void update(Observable o, Object data) {
  47           initialize(VM.getVM().getTypeDataBase());
  48         }
  49       });
  50   }
  51 
  52   private static synchronized void initialize(TypeDataBase db) {
  53     Type type = db.lookupType("GenCollectedHeap");
  54 
  55     youngGenField = type.getAddressField("_young_gen");
  56     oldGenField = type.getAddressField("_old_gen");


  57 
  58     genFactory = new GenerationFactory();
  59 
  60     Type collectorPolicyType = db.lookupType("GenCollectorPolicy");
  61     youngGenSpecField = collectorPolicyType.getAddressField("_young_gen_spec");
  62     oldGenSpecField = collectorPolicyType.getAddressField("_old_gen_spec");
  63   }
  64 
  65   public GenCollectedHeap(Address addr) {
  66     super(addr);
  67   }
  68 
  69   public int nGens() {
  70     return 2; // Young + Old
  71   }
  72 
  73   public Generation getGen(int i) {
  74     if (Assert.ASSERTS_ENABLED) {
  75       Assert.that((i == 0) || (i == 1), "Index " + i +
  76                   " out of range (should be 0 or 1)");
  77     }
  78 
  79     switch (i) {
  80     case 0:
  81       return genFactory.newObject(youngGenField.getValue(addr));
  82     case 1:




  37   private static AddressField oldGenField;
  38 
  39   private static AddressField youngGenSpecField;
  40   private static AddressField oldGenSpecField;
  41 
  42   private static GenerationFactory genFactory;
  43 
  44   static {
  45     VM.registerVMInitializedObserver(new Observer() {
  46         public void update(Observable o, Object data) {
  47           initialize(VM.getVM().getTypeDataBase());
  48         }
  49       });
  50   }
  51 
  52   private static synchronized void initialize(TypeDataBase db) {
  53     Type type = db.lookupType("GenCollectedHeap");
  54 
  55     youngGenField = type.getAddressField("_young_gen");
  56     oldGenField = type.getAddressField("_old_gen");
  57     youngGenSpecField = type.getAddressField("_young_gen_spec");
  58     oldGenSpecField = type.getAddressField("_old_gen_spec");
  59 
  60     genFactory = new GenerationFactory();




  61   }
  62 
  63   public GenCollectedHeap(Address addr) {
  64     super(addr);
  65   }
  66 
  67   public int nGens() {
  68     return 2; // Young + Old
  69   }
  70 
  71   public Generation getGen(int i) {
  72     if (Assert.ASSERTS_ENABLED) {
  73       Assert.that((i == 0) || (i == 1), "Index " + i +
  74                   " out of range (should be 0 or 1)");
  75     }
  76 
  77     switch (i) {
  78     case 0:
  79       return genFactory.newObject(youngGenField.getValue(addr));
  80     case 1:


< prev index next >