< prev index next >

src/hotspot/share/gc/shared/collectedHeap.cpp

Print this page
@@ -221,14 +221,10 @@
  
    if (!is_in(object)) {
      return false;
    }
  
-   if (is_in(object->klass_or_null())) {
-     return false;
-   }
- 
    return true;
  }
  
  // Memory state functions.
  

@@ -251,12 +247,14 @@
    size_t min_size = min_dummy_object_size();
    _lab_alignment_reserve = min_size > (size_t)MinObjAlignment ? align_object_size(min_size) : 0;
  
    const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
    const size_t elements_per_word = HeapWordSize / sizeof(jint);
-   _filler_array_max_size = align_object_size(filler_array_hdr_size() +
-                                              max_len / elements_per_word);
+   int header_size_in_bytes = arrayOopDesc::base_offset_in_bytes(T_INT);
+   assert(header_size_in_bytes % sizeof(jint) == 0, "must be aligned to int");
+   int header_size_in_ints = header_size_in_bytes / sizeof(jint);
+   _filler_array_max_size = align_object_size((header_size_in_ints + max_len) / elements_per_word);
  
    NOT_PRODUCT(_promotion_failure_alot_count = 0;)
    NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;)
  
    if (UsePerfData) {

@@ -413,27 +411,27 @@
    //    header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
    // we'll overflow on the multiply, so we do the divide first.
    // We actually lose a little by dividing first,
    // but that just makes the TLAB  somewhat smaller than the biggest array,
    // which is fine, since we'll be able to fill that.
-   size_t max_int_size = typeArrayOopDesc::header_size(T_INT) +
+   int header_size_in_bytes = typeArrayOopDesc::base_offset_in_bytes(T_INT);
+   assert(header_size_in_bytes % sizeof(jint) == 0, "header size must align to int");
+   size_t max_int_size = header_size_in_bytes / HeapWordSize +
                sizeof(jint) *
                ((juint) max_jint / (size_t) HeapWordSize);
    return align_down(max_int_size, MinObjAlignment);
  }
  
- size_t CollectedHeap::filler_array_hdr_size() {
-   return align_object_offset(arrayOopDesc::header_size(T_INT)); // align to Long
- }
- 
  size_t CollectedHeap::filler_array_min_size() {
-   return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment
+   int aligned_header_size_words = align_up(arrayOopDesc::base_offset_in_bytes(T_INT), HeapWordSize) / HeapWordSize;
+   return align_object_size(aligned_header_size_words); // align to MinObjAlignment
  }
  
  void CollectedHeap::zap_filler_array_with(HeapWord* start, size_t words, juint value) {
-   Copy::fill_to_words(start + filler_array_hdr_size(),
-                       words - filler_array_hdr_size(), value);
+   int payload_start = align_up(arrayOopDesc::base_offset_in_bytes(T_INT), HeapWordSize) / HeapWordSize;
+   Copy::fill_to_words(start + payload_start,
+                       words - payload_start, value);
  }
  
  #ifdef ASSERT
  void CollectedHeap::fill_args_check(HeapWord* start, size_t words)
  {

@@ -453,12 +451,13 @@
  CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
  {
    assert(words >= filler_array_min_size(), "too small for an array");
    assert(words <= filler_array_max_size(), "too big for a single object");
  
-   const size_t payload_size = words - filler_array_hdr_size();
-   const size_t len = payload_size * HeapWordSize / sizeof(jint);
+   const size_t payload_size_bytes = words * HeapWordSize - arrayOopDesc::base_offset_in_bytes(T_INT);
+   assert(payload_size_bytes % sizeof(jint) == 0, "must be int aligned");
+   const size_t len = payload_size_bytes / sizeof(jint);
    assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len);
  
    ObjArrayAllocator allocator(Universe::fillerArrayKlassObj(), words, (int)len, /* do_zero */ false);
    allocator.initialize(start);
    if (DumpSharedSpaces) {
< prev index next >