< prev index next >

agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java

Print this page
rev 7420 : [mq]: removeOneContigSpaceGeneration

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -22,17 +22,66 @@
  *
  */
 
 package sun.jvm.hotspot.memory;
 
+import java.io.*;
+import java.util.*;
+
 import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** <P> TenuredGeneration models a heap of old objects contained
+    in a single contiguous space. </P>
+
+    <P> Garbage collection is performed using mark-compact. </P> */
+
+public class TenuredGeneration extends CardGeneration {
+  private static AddressField theSpaceField;
+
+  static {
+    VM.registerVMInitializedObserver(new Observer() {
+        public void update(Observable o, Object data) {
+          initialize(VM.getVM().getTypeDataBase());
+        }
+      });
+  }
+
+  private static synchronized void initialize(TypeDataBase db) {
+    Type type = db.lookupType("TenuredGeneration");
+
+    theSpaceField = type.getAddressField("_the_space");
+  }
 
-public class TenuredGeneration extends OneContigSpaceCardGeneration {
   public TenuredGeneration(Address addr) {
     super(addr);
   }
 
+  public ContiguousSpace theSpace() {
+    return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
+  }
+
+  public boolean isIn(Address p) {
+    return theSpace().contains(p);
+  }
+
+  /** Space queries */
+  public long capacity()            { return theSpace().capacity();                                }
+  public long used()                { return theSpace().used();                                    }
+  public long free()                { return theSpace().free();                                    }
+  public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
+
+  public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+    blk.doSpace(theSpace());
+  }
+
+  public void printOn(PrintStream tty) {
+    tty.print("  old ");
+    theSpace().printOn(tty);
+  }
+
   public Generation.Name kind() {
     return Generation.Name.MARK_SWEEP_COMPACT;
   }
 
   public String name() {
< prev index next >