6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb

Added new product ObjectAlignmentInBytes flag to control object alignment.

Reviewed-by: twisti, ysr, iveresov
This commit is contained in:
Vladimir Kozlov 2010-05-27 18:01:56 -07:00
parent 05b4f2e796
commit cc18a50e59
29 changed files with 222 additions and 136 deletions

View file

@ -1211,8 +1211,44 @@ void Arguments::set_cms_and_parnew_gc_flags() {
}
#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 @@ bool Arguments::check_vm_args_consistency() {
status = status && verify_interval(TLABWasteTargetPercent,
1, 100, "TLABWasteTargetPercent");
status = status && verify_object_alignment();
return status;
}
@ -2848,6 +2886,9 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
UseCompressedOops = false;
#endif
// Set object alignment values.
set_object_alignment();
#ifdef SERIALGC
force_serial_gc();
#endif // SERIALGC

View file

@ -321,6 +321,9 @@ class CommandLineFlags {
diagnostic(bool, PrintCompressedOopsMode, false, \
"Print compressed oops base address and encoding mode") \
\
lp64_product(intx, ObjectAlignmentInBytes, 8, \
"Default object alignment in bytes, 8 is minimum") \
\
/* UseMembar is theoretically a temp flag used for memory barrier \
* removal testing. It was supposed to be removed before FCS but has \
* been re-added (see 6401008) */ \

View file

@ -1328,14 +1328,6 @@ static inline uint64_t cast_uint64_t(size_t x)
declare_constant(LogBytesPerWord) \
declare_constant(BytesPerLong) \
\
/********************/ \
/* Object alignment */ \
/********************/ \
\
declare_constant(MinObjAlignment) \
declare_constant(MinObjAlignmentInBytes) \
declare_constant(LogMinObjAlignmentInBytes) \
\
/********************************************/ \
/* Generation and Space Hierarchy Constants */ \
/********************************************/ \