hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Fri Apr 11 09:56:35 2008 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Sun Apr 13 17:43:42 2008 -0400
@@ -574,6 +574,10 @@
                                    throw new RuntimeException(exp);
                                }
                            }
+                           public void visitCompOopAddress(Address handleAddr) {
+                             throw new RuntimeException(
+                                   " Should not reach here. JNIHandles are not compressed \n");
+                           }
                        });
             } catch (RuntimeException re) {
                 handleRuntimeException(re);
@@ -601,8 +605,7 @@
         writeObjectID(array.getKlass().getJavaMirror());
         final int length = (int) array.getLength();
         for (int index = 0; index < length; index++) {
-            long offset = OBJECT_BASE_OFFSET + index * OBJ_ID_SIZE;
-            OopHandle handle = array.getHandle().getOopHandleAt(offset);
+            OopHandle handle = array.getOopHandleAt(index);
             writeObjectID(getAddressValue(handle));
         }
     }
@@ -803,8 +806,13 @@
             break;
         case JVM_SIGNATURE_CLASS:
         case JVM_SIGNATURE_ARRAY: {
-            OopHandle handle = ((OopField)field).getValueAsOopHandle(oop);
-            writeObjectID(getAddressValue(handle));
+            if (VM.getVM().isCompressedOopsEnabled()) {
+              OopHandle handle = ((NarrowOopField)field).getValueAsOopHandle(oop);
+              writeObjectID(getAddressValue(handle));
+            } else {
+              OopHandle handle = ((OopField)field).getValueAsOopHandle(oop);
+              writeObjectID(getAddressValue(handle));
+            }
             break;
         }
         default: