src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp

Print this page
rev 2661 : 7021322: assert(object_end <= top()) failed: Object crosses promotion LAB boundary
Summary: Pass the same object size value to both allocate and unallocate_object
Reviewed-by: duke


  85   filler_oop->set_mark(markOopDesc::prototype());
  86   filler_oop->set_klass(Universe::intArrayKlassObj());
  87   const size_t array_length =
  88     pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
  89   assert( (array_length * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, "array too big in PSPromotionLAB");
  90   filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));
  91 
  92 #ifdef ASSERT
  93   // Note that we actually DO NOT want to use the aligned header size!
  94   HeapWord* elt_words = ((HeapWord*)filler_oop) + typeArrayOopDesc::header_size(T_INT);
  95   Copy::fill_to_words(elt_words, array_length, 0xDEAABABE);
  96 #endif
  97 
  98   set_bottom(NULL);
  99   set_end(NULL);
 100   set_top(NULL);
 101 
 102   _state = flushed;
 103 }
 104 
 105 bool PSPromotionLAB::unallocate_object(oop obj) {
 106   assert(Universe::heap()->is_in(obj), "Object outside heap");
 107 
 108   if (contains(obj)) {
 109     HeapWord* object_end = (HeapWord*)obj + obj->size();
 110     assert(object_end <= top(), "Object crosses promotion LAB boundary");
 111 
 112     if (object_end == top()) {
 113       set_top((HeapWord*)obj);
 114       return true;
 115     }
 116   }
 117 
 118   return false;
 119 }
 120 
 121 // Fill all remaining lab space with an unreachable object.
 122 // The goal is to leave a contiguous parseable span of objects.
 123 void PSOldPromotionLAB::flush() {
 124   assert(_state != flushed, "Attempt to flush PLAB twice");
 125   assert(top() <= end(), "pointers out of order");
 126 
 127   if (_state == zero_size)
 128     return;
 129 
 130   HeapWord* obj = top();
 131 
 132   PSPromotionLAB::flush();
 133 




  85   filler_oop->set_mark(markOopDesc::prototype());
  86   filler_oop->set_klass(Universe::intArrayKlassObj());
  87   const size_t array_length =
  88     pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
  89   assert( (array_length * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, "array too big in PSPromotionLAB");
  90   filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));
  91 
  92 #ifdef ASSERT
  93   // Note that we actually DO NOT want to use the aligned header size!
  94   HeapWord* elt_words = ((HeapWord*)filler_oop) + typeArrayOopDesc::header_size(T_INT);
  95   Copy::fill_to_words(elt_words, array_length, 0xDEAABABE);
  96 #endif
  97 
  98   set_bottom(NULL);
  99   set_end(NULL);
 100   set_top(NULL);
 101 
 102   _state = flushed;
 103 }
 104 
 105 bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
 106   assert(Universe::heap()->is_in(obj), "Object outside heap");
 107 
 108   if (contains(obj)) {
 109     HeapWord* object_end = obj + obj_size;
 110     assert(object_end <= top(), "Object crosses promotion LAB boundary");
 111 
 112     if (object_end == top()) {
 113       set_top(obj);
 114       return true;
 115     }
 116   }
 117 
 118   return false;
 119 }
 120 
 121 // Fill all remaining lab space with an unreachable object.
 122 // The goal is to leave a contiguous parseable span of objects.
 123 void PSOldPromotionLAB::flush() {
 124   assert(_state != flushed, "Attempt to flush PLAB twice");
 125   assert(top() <= end(), "pointers out of order");
 126 
 127   if (_state == zero_size)
 128     return;
 129 
 130   HeapWord* obj = top();
 131 
 132   PSPromotionLAB::flush();
 133