aboutsummaryrefslogtreecommitdiff
path: root/agent
diff options
context:
space:
mode:
authorkvn <none@none>2010-05-27 18:01:56 -0700
committerkvn <none@none>2010-05-27 18:01:56 -0700
commit3676652f42ab126cd5638fb60726fa18dee2eb9f (patch)
tree6dbc150748f6c2b0052e467ec431ad601370ff36 /agent
parentd0889992be30776b6fd8f67103b4ee406146737a (diff)
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
Diffstat (limited to 'agent')
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java17
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java2
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java25
3 files changed, 24 insertions, 20 deletions
diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
index 48cb4edbc..e105be303 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
@@ -73,18 +73,11 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
public CompactibleFreeListSpace(Address addr) {
super(addr);
- if ( VM.getVM().isLP64() ) {
- heapWordSize = 8;
- IndexSetStart = 1;
- IndexSetStride = 1;
- }
- else {
- heapWordSize = 4;
- IndexSetStart = 2;
- IndexSetStride = 2;
- }
-
- IndexSetSize = 257;
+ VM vm = VM.getVM();
+ heapWordSize = vm.getHeapWordSize();
+ IndexSetStart = vm.getMinObjAlignmentInBytes() / heapWordSize;
+ IndexSetStride = IndexSetStart;
+ IndexSetSize = 257;
}
// Accessing block offset table
diff --git a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
index cfaed9356..e5f254853 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
@@ -128,7 +128,7 @@ public class Oop {
// Align the object size.
public static long alignObjectSize(long size) {
- return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignment());
+ return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignmentInBytes());
}
// All vm's align longs, so pad out certain offsets.
diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
index fda1e4f39..9798e74f5 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
@@ -93,6 +93,7 @@ public class VM {
/** alignment constants */
private boolean isLP64;
private int bytesPerLong;
+ private int objectAlignmentInBytes;
private int minObjAlignmentInBytes;
private int logMinObjAlignmentInBytes;
private int heapWordSize;
@@ -313,9 +314,15 @@ public class VM {
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 @@ public class VM {
}
/** Get minimum object alignment in bytes. */
- public int getMinObjAlignment() {
- return minObjAlignmentInBytes;
- }
-
public int getMinObjAlignmentInBytes() {
return minObjAlignmentInBytes;
}
@@ -754,6 +757,14 @@ public class VM {
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) {