6822407: heapOopSize lookup is incorrect in Serviceability Agent.
authorpoonam
Fri, 27 Mar 2009 10:29:54 -0700
changeset 2356 81a6245db120
parent 2271 ff6d122287cb
child 2357 864b1f6c6bbc
6822407: heapOopSize lookup is incorrect in Serviceability Agent. Summary: heapOopSize symbol should be declared as constant in vmStructs and should not be looked up in readVMIntConstants(). Reviewed-by: never, swamyv, coleenp
hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java	Fri Mar 27 01:35:39 2009 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java	Fri Mar 27 10:29:54 2009 -0700
@@ -306,8 +306,6 @@
 
       entryAddr = entryAddr.addOffsetTo(intConstantEntryArrayStride);
     } while (nameAddr != null);
-      String symbol = "heapOopSize"; // global int constant and value is initialized at runtime.
-      addIntConstant(symbol, (int)lookupInProcess(symbol).getCIntegerAt(0, 4, false));
   }
 
   private void readVMLongConstants() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Mar 27 01:35:39 2009 -0500
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Mar 27 10:29:54 2009 -0700
@@ -342,12 +342,14 @@
       throw new RuntimeException("Attempt to initialize VM twice");
     }
     soleInstance = new VM(db, debugger, debugger.getMachineDescription().isBigEndian());
-    debugger.putHeapConst(soleInstance.getHeapOopSize(), Universe.getNarrowOopBase(),
-                          Universe.getNarrowOopShift());
+
     for (Iterator iter = vmInitializedObservers.iterator(); iter.hasNext(); ) {
       ((Observer) iter.next()).update(null, null);
     }
 
+    debugger.putHeapConst(soleInstance.getHeapOopSize(), Universe.getNarrowOopBase(),
+                          Universe.getNarrowOopShift());
+
   }
 
   /** This is used by the debugging system */
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Mar 27 01:35:39 2009 -0500
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Mar 27 10:29:54 2009 -0700
@@ -1320,6 +1320,7 @@
   /****************/                                                      \
                                                                           \
   declare_constant(oopSize)                                               \
+  declare_constant(heapOopSize)                                           \
   declare_constant(LogBytesPerWord)                                       \
   declare_constant(BytesPerLong)                                          \
                                                                           \