hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
Print this page
rev 611 : Merge
@@ -1,7 +1,7 @@
/*
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2004-2008 Sun Microsystems, Inc. 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.
@@ -572,10 +572,14 @@
}
} catch (IOException exp) {
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);
}
}
@@ -599,12 +603,11 @@
out.writeInt(DUMMY_STACK_TRACE_ID);
out.writeInt((int) array.getLength());
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));
}
}
protected void writePrimitiveArray(TypeArray array) throws IOException {
@@ -801,12 +804,17 @@
case JVM_SIGNATURE_DOUBLE:
out.writeDouble(((DoubleField)field).getValue(oop));
break;
case JVM_SIGNATURE_CLASS:
case JVM_SIGNATURE_ARRAY: {
+ 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:
throw new RuntimeException("should not reach here");
}