< prev index next >

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

Print this page
rev 8068 : imported patch parallelscavenge_cleanup


  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(), "Not matching last allocation");
 111 
 112     set_top(obj);
 113     return true;
 114   }
 115 
 116   return false;
 117 }
 118 
 119 // Fill all remaining lab space with an unreachable object.
 120 // The goal is to leave a contiguous parseable span of objects.
 121 void PSOldPromotionLAB::flush() {
 122   assert(_state != flushed, "Attempt to flush PLAB twice");
 123   assert(top() <= end(), "pointers out of order");
 124 
 125   if (_state == zero_size)
 126     return;
 127 
 128   HeapWord* obj = top();
 129 
 130   PSPromotionLAB::flush();
 131 
 132   assert(_start_array != NULL, "Sanity");
 133 
 134   _start_array->allocate_block(obj);
 135 }
 136 
 137 #ifdef ASSERT
 138 
 139 bool PSYoungPromotionLAB::lab_is_valid(MemRegion lab) {
 140   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
 141   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
 142 
 143   MutableSpace* to_space = heap->young_gen()->to_space();
 144   MemRegion used = to_space->used_region();
 145   if (used.contains(lab)) {
 146     return true;
 147   }
 148 
 149   return false;
 150 }
 151 
 152 bool PSOldPromotionLAB::lab_is_valid(MemRegion lab) {
 153   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
 154   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
 155   assert(_start_array->covered_region().contains(lab), "Sanity");
 156 

 157   PSOldGen* old_gen = heap->old_gen();
 158   MemRegion used = old_gen->object_space()->used_region();
 159 
 160   if (used.contains(lab)) {
 161     return true;
 162   }
 163 
 164   return false;
 165 }
 166 
 167 #endif /* ASSERT */


  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(ParallelScavengeHeap::heap()->is_in(obj), "Object outside heap");
 107 
 108   if (contains(obj)) {
 109     HeapWord* object_end = obj + obj_size;
 110     assert(object_end == top(), "Not matching last allocation");
 111 
 112     set_top(obj);
 113     return true;
 114   }
 115 
 116   return false;
 117 }
 118 
 119 // Fill all remaining lab space with an unreachable object.
 120 // The goal is to leave a contiguous parseable span of objects.
 121 void PSOldPromotionLAB::flush() {
 122   assert(_state != flushed, "Attempt to flush PLAB twice");
 123   assert(top() <= end(), "pointers out of order");
 124 
 125   if (_state == zero_size)
 126     return;
 127 
 128   HeapWord* obj = top();
 129 
 130   PSPromotionLAB::flush();
 131 
 132   assert(_start_array != NULL, "Sanity");
 133 
 134   _start_array->allocate_block(obj);
 135 }
 136 
 137 #ifdef ASSERT
 138 
 139 bool PSYoungPromotionLAB::lab_is_valid(MemRegion lab) {
 140   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();


 141   MutableSpace* to_space = heap->young_gen()->to_space();
 142   MemRegion used = to_space->used_region();
 143   if (used.contains(lab)) {
 144     return true;
 145   }
 146 
 147   return false;
 148 }
 149 
 150 bool PSOldPromotionLAB::lab_is_valid(MemRegion lab) {


 151   assert(_start_array->covered_region().contains(lab), "Sanity");
 152 
 153   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 154   PSOldGen* old_gen = heap->old_gen();
 155   MemRegion used = old_gen->object_space()->used_region();
 156 
 157   if (used.contains(lab)) {
 158     return true;
 159   }
 160 
 161   return false;
 162 }
 163 
 164 #endif /* ASSERT */
< prev index next >