src/share/vm/runtime/arguments.cpp

changeset 1934
e9ff18c4ace7
parent 1907
c18cbe5936b8
parent 1926
2d127394260e
child 1965
79107c3a6bd5
child 1977
76efbe666d6c
child 1981
1a11430e0326
     1.1 --- a/src/share/vm/runtime/arguments.cpp	Tue Jun 01 11:48:33 2010 -0700
     1.2 +++ b/src/share/vm/runtime/arguments.cpp	Wed Jun 02 22:45:42 2010 -0700
     1.3 @@ -1211,8 +1211,44 @@
     1.4  }
     1.5  #endif // KERNEL
     1.6  
     1.7 +void set_object_alignment() {
     1.8 +  // Object alignment.
     1.9 +  assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
    1.10 +  MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
    1.11 +  assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small");
    1.12 +  MinObjAlignment            = MinObjAlignmentInBytes / HeapWordSize;
    1.13 +  assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect");
    1.14 +  MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1;
    1.15 +
    1.16 +  LogMinObjAlignmentInBytes  = exact_log2(ObjectAlignmentInBytes);
    1.17 +  LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
    1.18 +
    1.19 +  // Oop encoding heap max
    1.20 +  OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
    1.21 +
    1.22 +#ifndef KERNEL
    1.23 +  // Set CMS global values
    1.24 +  CompactibleFreeListSpace::set_cms_values();
    1.25 +#endif // KERNEL
    1.26 +}
    1.27 +
    1.28 +bool verify_object_alignment() {
    1.29 +  // Object alignment.
    1.30 +  if (!is_power_of_2(ObjectAlignmentInBytes)) {
    1.31 +    jio_fprintf(defaultStream::error_stream(),
    1.32 +                "error: ObjectAlignmentInBytes=%d must be power of 2", (int)ObjectAlignmentInBytes);
    1.33 +    return false;
    1.34 +  }
    1.35 +  if ((int)ObjectAlignmentInBytes < BytesPerLong) {
    1.36 +    jio_fprintf(defaultStream::error_stream(),
    1.37 +                "error: ObjectAlignmentInBytes=%d must be greater or equal %d", (int)ObjectAlignmentInBytes, BytesPerLong);
    1.38 +    return false;
    1.39 +  }
    1.40 +  return true;
    1.41 +}
    1.42 +
    1.43  inline uintx max_heap_for_compressed_oops() {
    1.44 -  LP64_ONLY(return oopDesc::OopEncodingHeapMax - MaxPermSize - os::vm_page_size());
    1.45 +  LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size());
    1.46    NOT_LP64(ShouldNotReachHere(); return 0);
    1.47  }
    1.48  
    1.49 @@ -1776,6 +1812,8 @@
    1.50    status = status && verify_interval(TLABWasteTargetPercent,
    1.51                                       1, 100, "TLABWasteTargetPercent");
    1.52  
    1.53 +  status = status && verify_object_alignment();
    1.54 +
    1.55    return status;
    1.56  }
    1.57  
    1.58 @@ -2848,6 +2886,9 @@
    1.59    UseCompressedOops = false;
    1.60  #endif
    1.61  
    1.62 +  // Set object alignment values.
    1.63 +  set_object_alignment();
    1.64 +
    1.65  #ifdef SERIALGC
    1.66    force_serial_gc();
    1.67  #endif // SERIALGC

mercurial