Mercurial > hg > graal-jvmci-8
diff agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @ 1571:2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
Summary: Added new product ObjectAlignmentInBytes flag to control object alignment.
Reviewed-by: twisti, ysr, iveresov
author | kvn |
---|---|
date | Thu, 27 May 2010 18:01:56 -0700 |
parents | bd02caa94611 |
children | 4a2e260bb13a |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu May 27 09:54:07 2010 -0700 +++ b/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) {