--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu May 27 09:54:07 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu May 27 18:01:56 2010 -0700
@@ -93,6 +93,7 @@
/** alignment constants */
private boolean isLP64;
private int bytesPerLong;
+ private int objectAlignmentInBytes;
private int minObjAlignmentInBytes;
private int logMinObjAlignmentInBytes;
private int heapWordSize;
@@ -313,9 +314,15 @@
isLP64 = debugger.getMachineDescription().isLP64();
}
bytesPerLong = db.lookupIntConstant("BytesPerLong").intValue();
- minObjAlignmentInBytes = db.lookupIntConstant("MinObjAlignmentInBytes").intValue();
- // minObjAlignment = db.lookupIntConstant("MinObjAlignment").intValue();
- logMinObjAlignmentInBytes = db.lookupIntConstant("LogMinObjAlignmentInBytes").intValue();
+ minObjAlignmentInBytes = getObjectAlignmentInBytes();
+ if (minObjAlignmentInBytes == 8) {
+ logMinObjAlignmentInBytes = 3;
+ } else if (minObjAlignmentInBytes == 16) {
+ logMinObjAlignmentInBytes = 4;
+ } else {
+ throw new RuntimeException("Object alignment " + minObjAlignmentInBytes + " not yet supported");
+ }
+
heapWordSize = db.lookupIntConstant("HeapWordSize").intValue();
oopSize = db.lookupIntConstant("oopSize").intValue();
@@ -492,10 +499,6 @@
}
/** Get minimum object alignment in bytes. */
- public int getMinObjAlignment() {
- return minObjAlignmentInBytes;
- }
-
public int getMinObjAlignmentInBytes() {
return minObjAlignmentInBytes;
}
@@ -754,6 +757,14 @@
return compressedOopsEnabled.booleanValue();
}
+ public int getObjectAlignmentInBytes() {
+ if (objectAlignmentInBytes == 0) {
+ Flag flag = getCommandLineFlag("ObjectAlignmentInBytes");
+ objectAlignmentInBytes = (flag == null) ? 8 : (int)flag.getIntx();
+ }
+ return objectAlignmentInBytes;
+ }
+
// returns null, if not available.
public Flag[] getCommandLineFlags() {
if (commandLineFlags == null) {