Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
1570:de91a2f25c7e | 1571:2d127394260e |
---|---|
91 /** Flag indicating whether UseTLAB is turned on */ | 91 /** Flag indicating whether UseTLAB is turned on */ |
92 private boolean useTLAB; | 92 private boolean useTLAB; |
93 /** alignment constants */ | 93 /** alignment constants */ |
94 private boolean isLP64; | 94 private boolean isLP64; |
95 private int bytesPerLong; | 95 private int bytesPerLong; |
96 private int objectAlignmentInBytes; | |
96 private int minObjAlignmentInBytes; | 97 private int minObjAlignmentInBytes; |
97 private int logMinObjAlignmentInBytes; | 98 private int logMinObjAlignmentInBytes; |
98 private int heapWordSize; | 99 private int heapWordSize; |
99 private int heapOopSize; | 100 private int heapOopSize; |
100 private int oopSize; | 101 private int oopSize; |
311 | 312 |
312 if (debugger != null) { | 313 if (debugger != null) { |
313 isLP64 = debugger.getMachineDescription().isLP64(); | 314 isLP64 = debugger.getMachineDescription().isLP64(); |
314 } | 315 } |
315 bytesPerLong = db.lookupIntConstant("BytesPerLong").intValue(); | 316 bytesPerLong = db.lookupIntConstant("BytesPerLong").intValue(); |
316 minObjAlignmentInBytes = db.lookupIntConstant("MinObjAlignmentInBytes").intValue(); | 317 minObjAlignmentInBytes = getObjectAlignmentInBytes(); |
317 // minObjAlignment = db.lookupIntConstant("MinObjAlignment").intValue(); | 318 if (minObjAlignmentInBytes == 8) { |
318 logMinObjAlignmentInBytes = db.lookupIntConstant("LogMinObjAlignmentInBytes").intValue(); | 319 logMinObjAlignmentInBytes = 3; |
320 } else if (minObjAlignmentInBytes == 16) { | |
321 logMinObjAlignmentInBytes = 4; | |
322 } else { | |
323 throw new RuntimeException("Object alignment " + minObjAlignmentInBytes + " not yet supported"); | |
324 } | |
325 | |
319 heapWordSize = db.lookupIntConstant("HeapWordSize").intValue(); | 326 heapWordSize = db.lookupIntConstant("HeapWordSize").intValue(); |
320 oopSize = db.lookupIntConstant("oopSize").intValue(); | 327 oopSize = db.lookupIntConstant("oopSize").intValue(); |
321 | 328 |
322 intxType = db.lookupType("intx"); | 329 intxType = db.lookupType("intx"); |
323 uintxType = db.lookupType("uintx"); | 330 uintxType = db.lookupType("uintx"); |
490 public int getBytesPerLong() { | 497 public int getBytesPerLong() { |
491 return bytesPerLong; | 498 return bytesPerLong; |
492 } | 499 } |
493 | 500 |
494 /** Get minimum object alignment in bytes. */ | 501 /** Get minimum object alignment in bytes. */ |
495 public int getMinObjAlignment() { | |
496 return minObjAlignmentInBytes; | |
497 } | |
498 | |
499 public int getMinObjAlignmentInBytes() { | 502 public int getMinObjAlignmentInBytes() { |
500 return minObjAlignmentInBytes; | 503 return minObjAlignmentInBytes; |
501 } | 504 } |
502 public int getLogMinObjAlignmentInBytes() { | 505 public int getLogMinObjAlignmentInBytes() { |
503 return logMinObjAlignmentInBytes; | 506 return logMinObjAlignmentInBytes; |
750 Flag flag = getCommandLineFlag("UseCompressedOops"); | 753 Flag flag = getCommandLineFlag("UseCompressedOops"); |
751 compressedOopsEnabled = (flag == null) ? Boolean.FALSE: | 754 compressedOopsEnabled = (flag == null) ? Boolean.FALSE: |
752 (flag.getBool()? Boolean.TRUE: Boolean.FALSE); | 755 (flag.getBool()? Boolean.TRUE: Boolean.FALSE); |
753 } | 756 } |
754 return compressedOopsEnabled.booleanValue(); | 757 return compressedOopsEnabled.booleanValue(); |
758 } | |
759 | |
760 public int getObjectAlignmentInBytes() { | |
761 if (objectAlignmentInBytes == 0) { | |
762 Flag flag = getCommandLineFlag("ObjectAlignmentInBytes"); | |
763 objectAlignmentInBytes = (flag == null) ? 8 : (int)flag.getIntx(); | |
764 } | |
765 return objectAlignmentInBytes; | |
755 } | 766 } |
756 | 767 |
757 // returns null, if not available. | 768 // returns null, if not available. |
758 public Flag[] getCommandLineFlags() { | 769 public Flag[] getCommandLineFlags() { |
759 if (commandLineFlags == null) { | 770 if (commandLineFlags == null) { |