Mercurial > hg > truffle
diff src/share/vm/runtime/arguments.cpp @ 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 | 2338d41fbd81 |
children | e9ff18c4ace7 |
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp Thu May 27 09:54:07 2010 -0700 +++ b/src/share/vm/runtime/arguments.cpp Thu May 27 18:01:56 2010 -0700 @@ -1211,8 +1211,44 @@ } #endif // KERNEL +void set_object_alignment() { + // Object alignment. + assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); + MinObjAlignmentInBytes = ObjectAlignmentInBytes; + assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small"); + MinObjAlignment = MinObjAlignmentInBytes / HeapWordSize; + assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect"); + MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; + + LogMinObjAlignmentInBytes = exact_log2(ObjectAlignmentInBytes); + LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; + + // Oop encoding heap max + OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; + +#ifndef KERNEL + // Set CMS global values + CompactibleFreeListSpace::set_cms_values(); +#endif // KERNEL +} + +bool verify_object_alignment() { + // Object alignment. + if (!is_power_of_2(ObjectAlignmentInBytes)) { + jio_fprintf(defaultStream::error_stream(), + "error: ObjectAlignmentInBytes=%d must be power of 2", (int)ObjectAlignmentInBytes); + return false; + } + if ((int)ObjectAlignmentInBytes < BytesPerLong) { + jio_fprintf(defaultStream::error_stream(), + "error: ObjectAlignmentInBytes=%d must be greater or equal %d", (int)ObjectAlignmentInBytes, BytesPerLong); + return false; + } + return true; +} + inline uintx max_heap_for_compressed_oops() { - LP64_ONLY(return oopDesc::OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); + LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); NOT_LP64(ShouldNotReachHere(); return 0); } @@ -1776,6 +1812,8 @@ status = status && verify_interval(TLABWasteTargetPercent, 1, 100, "TLABWasteTargetPercent"); + status = status && verify_object_alignment(); + return status; } @@ -2848,6 +2886,9 @@ UseCompressedOops = false; #endif + // Set object alignment values. + set_object_alignment(); + #ifdef SERIALGC force_serial_gc(); #endif // SERIALGC