src/share/vm/gc_implementation/parNew/parNewGeneration.cpp

Print this page




 177       }
 178     }
 179     // For the  case of compressed oops, we have a private, non-shared
 180     // overflow stack, so we eagerly drain it so as to more evenly
 181     // distribute load early. Note: this may be good to do in
 182     // general rather than delay for the final stealing phase.
 183     // If applicable, we'll transfer a set of objects over to our
 184     // work queue, allowing them to be stolen and draining our
 185     // private overflow stack.
 186   } while (ParGCTrimOverflow && young_gen()->take_from_overflow_list(this));
 187 }
 188 
 189 bool ParScanThreadState::take_from_overflow_stack() {
 190   assert(ParGCUseLocalOverflow, "Else should not call");
 191   assert(young_gen()->overflow_list() == NULL, "Error");
 192   ObjToScanQueue* queue = work_queue();
 193   Stack<oop, mtGC>* const of_stack = overflow_stack();
 194   const size_t num_overflow_elems = of_stack->size();
 195   const size_t space_available = queue->max_elems() - queue->size();
 196   const size_t num_take_elems = MIN3(space_available / 4,
 197                                      ParGCDesiredObjsFromOverflowList,
 198                                      num_overflow_elems);
 199   // Transfer the most recent num_take_elems from the overflow
 200   // stack to our work queue.
 201   for (size_t i = 0; i != num_take_elems; i++) {
 202     oop cur = of_stack->pop();
 203     oop obj_to_push = cur->forwardee();
 204     assert(Universe::heap()->is_in_reserved(cur), "Should be in heap");
 205     assert(!old_gen()->is_in_reserved(cur), "Should be in young gen");
 206     assert(Universe::heap()->is_in_reserved(obj_to_push), "Should be in heap");
 207     if (should_be_partially_scanned(obj_to_push, cur)) {
 208       assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
 209       obj_to_push = cur;
 210     }
 211     bool ok = queue->push(obj_to_push);
 212     assert(ok, "Should have succeeded");
 213   }
 214   assert(young_gen()->overflow_list() == NULL, "Error");
 215   return num_take_elems > 0;  // was something transferred?
 216 }
 217 




 177       }
 178     }
 179     // For the  case of compressed oops, we have a private, non-shared
 180     // overflow stack, so we eagerly drain it so as to more evenly
 181     // distribute load early. Note: this may be good to do in
 182     // general rather than delay for the final stealing phase.
 183     // If applicable, we'll transfer a set of objects over to our
 184     // work queue, allowing them to be stolen and draining our
 185     // private overflow stack.
 186   } while (ParGCTrimOverflow && young_gen()->take_from_overflow_list(this));
 187 }
 188 
 189 bool ParScanThreadState::take_from_overflow_stack() {
 190   assert(ParGCUseLocalOverflow, "Else should not call");
 191   assert(young_gen()->overflow_list() == NULL, "Error");
 192   ObjToScanQueue* queue = work_queue();
 193   Stack<oop, mtGC>* const of_stack = overflow_stack();
 194   const size_t num_overflow_elems = of_stack->size();
 195   const size_t space_available = queue->max_elems() - queue->size();
 196   const size_t num_take_elems = MIN3(space_available / 4,
 197                                      (size_t)ParGCDesiredObjsFromOverflowList,
 198                                      num_overflow_elems);
 199   // Transfer the most recent num_take_elems from the overflow
 200   // stack to our work queue.
 201   for (size_t i = 0; i != num_take_elems; i++) {
 202     oop cur = of_stack->pop();
 203     oop obj_to_push = cur->forwardee();
 204     assert(Universe::heap()->is_in_reserved(cur), "Should be in heap");
 205     assert(!old_gen()->is_in_reserved(cur), "Should be in young gen");
 206     assert(Universe::heap()->is_in_reserved(obj_to_push), "Should be in heap");
 207     if (should_be_partially_scanned(obj_to_push, cur)) {
 208       assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
 209       obj_to_push = cur;
 210     }
 211     bool ok = queue->push(obj_to_push);
 212     assert(ok, "Should have succeeded");
 213   }
 214   assert(young_gen()->overflow_list() == NULL, "Error");
 215   return num_take_elems > 0;  // was something transferred?
 216 }
 217