hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Fri Apr 11 09:56:35 2008 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Sun Apr 13 17:43:42 2008 -0400
@@ -53,6 +53,8 @@
   // system obj array klass object
   private static sun.jvm.hotspot.types.OopField systemObjArrayKlassObjField;
 
+  private static AddressField heapBaseField;
+
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -83,6 +85,8 @@
     doubleArrayKlassObjField = type.getOopField("_doubleArrayKlassObj");
 
     systemObjArrayKlassObjField = type.getOopField("_systemObjArrayKlassObj");
+
+    heapBaseField = type.getAddressField("_heap_base");
   }
 
   public Universe() {
@@ -96,6 +100,14 @@
     }
   }
 
+  public static long getHeapBase() {
+    if (heapBaseField.getValue() == null) {
+      return 0;
+    } else {
+      return heapBaseField.getValue().minus(null);
+    }
+  }
+
   /** Returns "TRUE" iff "p" points into the allocated area of the heap. */
   public boolean isIn(Address p) {
     return heap().isIn(p);