< prev index next >

src/hotspot/share/gc/parallel/psPromotionManager.cpp

Print this page

 29 #include "gc/parallel/psPromotionManager.inline.hpp"
 30 #include "gc/parallel/psScavenge.hpp"
 31 #include "gc/shared/continuationGCSupport.inline.hpp"
 32 #include "gc/shared/gc_globals.hpp"
 33 #include "gc/shared/gcTrace.hpp"
 34 #include "gc/shared/partialArraySplitter.inline.hpp"
 35 #include "gc/shared/partialArrayState.hpp"
 36 #include "gc/shared/preservedMarks.inline.hpp"
 37 #include "gc/shared/taskqueue.inline.hpp"
 38 #include "logging/log.hpp"
 39 #include "logging/logStream.hpp"
 40 #include "memory/allocation.inline.hpp"
 41 #include "memory/iterator.inline.hpp"
 42 #include "memory/memRegion.hpp"
 43 #include "memory/padded.inline.hpp"
 44 #include "memory/resourceArea.hpp"
 45 #include "oops/access.inline.hpp"
 46 #include "oops/compressedOops.inline.hpp"
 47 #include "oops/oopsHierarchy.hpp"
 48 #include "utilities/checkedCast.hpp"

 49 
 50 PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = nullptr;
 51 PSPromotionManager::PSScannerTasksQueueSet* PSPromotionManager::_stack_array_depth = nullptr;
 52 PreservedMarksSet*             PSPromotionManager::_preserved_marks_set = nullptr;
 53 PSOldGen*                      PSPromotionManager::_old_gen = nullptr;
 54 MutableSpace*                  PSPromotionManager::_young_space = nullptr;
 55 PartialArrayStateManager*      PSPromotionManager::_partial_array_state_manager = nullptr;
 56 
 57 void PSPromotionManager::initialize() {
 58   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 59 
 60   _old_gen = heap->old_gen();
 61   _young_space = heap->young_gen()->to_space();
 62 
 63   const uint promotion_manager_num = ParallelGCThreads;
 64 
 65   assert(_partial_array_state_manager == nullptr, "Attempt to initialize twice");
 66   _partial_array_state_manager
 67     = new PartialArrayStateManager(promotion_manager_num);
 68 

247   assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity");
248   if (!_old_lab.is_flushed())
249     _old_lab.flush();
250 
251   // Let PSScavenge know if we overflowed
252   if (_young_gen_is_full || _young_gen_has_alloc_failure) {
253     PSScavenge::set_survivor_overflow(true);
254   }
255 }
256 
257 void PSPromotionManager::process_array_chunk(objArrayOop obj, size_t start, size_t end) {
258   PSPushContentsClosure pcc(this);
259   obj->oop_iterate_elements_range(&pcc,
260                                   checked_cast<int>(start),
261                                   checked_cast<int>(end));
262 }
263 
264 void PSPromotionManager::process_array_chunk(PartialArrayState* state, bool stolen) {
265   // Access before release by claim().
266   objArrayOop to_array = objArrayOop(state->destination());


267   PartialArraySplitter::Claim claim =
268     _partial_array_splitter.claim(state, &_claimed_stack_depth, stolen);

269   process_array_chunk(to_array, claim._start, claim._end);
270 }
271 
272 void PSPromotionManager::push_objArray(oop old_obj, oop new_obj) {
273   assert(old_obj->is_forwarded(), "precondition");
274   assert(old_obj->forwardee() == new_obj, "precondition");
275   assert(new_obj->is_objArray(), "precondition");
276 
277   objArrayOop to_array = objArrayOop(new_obj);
278   size_t array_length = to_array->length();
279   size_t initial_chunk_size =
280     // The source array is unused when processing states.
281     _partial_array_splitter.start(&_claimed_stack_depth, nullptr, to_array, array_length, ParGCArrayScanChunk);
282 
283   process_array_chunk(to_array, 0, initial_chunk_size);
284 }
285 
286 oop PSPromotionManager::oop_promotion_failed(oop obj, markWord obj_mark) {
287   assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
288 
289   // Attempt to CAS in the header.
290   // This tests if the header is still the same as when
291   // this started.  If it is the same (i.e., no forwarding
292   // pointer has been installed), then this thread owns
293   // it.
294   if (obj->forward_to_self_atomic(obj_mark) == nullptr) {
295     // We won any races, we "own" this object.

 29 #include "gc/parallel/psPromotionManager.inline.hpp"
 30 #include "gc/parallel/psScavenge.hpp"
 31 #include "gc/shared/continuationGCSupport.inline.hpp"
 32 #include "gc/shared/gc_globals.hpp"
 33 #include "gc/shared/gcTrace.hpp"
 34 #include "gc/shared/partialArraySplitter.inline.hpp"
 35 #include "gc/shared/partialArrayState.hpp"
 36 #include "gc/shared/preservedMarks.inline.hpp"
 37 #include "gc/shared/taskqueue.inline.hpp"
 38 #include "logging/log.hpp"
 39 #include "logging/logStream.hpp"
 40 #include "memory/allocation.inline.hpp"
 41 #include "memory/iterator.inline.hpp"
 42 #include "memory/memRegion.hpp"
 43 #include "memory/padded.inline.hpp"
 44 #include "memory/resourceArea.hpp"
 45 #include "oops/access.inline.hpp"
 46 #include "oops/compressedOops.inline.hpp"
 47 #include "oops/oopsHierarchy.hpp"
 48 #include "utilities/checkedCast.hpp"
 49 #include "utilities/debug.hpp"
 50 
 51 PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = nullptr;
 52 PSPromotionManager::PSScannerTasksQueueSet* PSPromotionManager::_stack_array_depth = nullptr;
 53 PreservedMarksSet*             PSPromotionManager::_preserved_marks_set = nullptr;
 54 PSOldGen*                      PSPromotionManager::_old_gen = nullptr;
 55 MutableSpace*                  PSPromotionManager::_young_space = nullptr;
 56 PartialArrayStateManager*      PSPromotionManager::_partial_array_state_manager = nullptr;
 57 
 58 void PSPromotionManager::initialize() {
 59   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 60 
 61   _old_gen = heap->old_gen();
 62   _young_space = heap->young_gen()->to_space();
 63 
 64   const uint promotion_manager_num = ParallelGCThreads;
 65 
 66   assert(_partial_array_state_manager == nullptr, "Attempt to initialize twice");
 67   _partial_array_state_manager
 68     = new PartialArrayStateManager(promotion_manager_num);
 69 

248   assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity");
249   if (!_old_lab.is_flushed())
250     _old_lab.flush();
251 
252   // Let PSScavenge know if we overflowed
253   if (_young_gen_is_full || _young_gen_has_alloc_failure) {
254     PSScavenge::set_survivor_overflow(true);
255   }
256 }
257 
258 void PSPromotionManager::process_array_chunk(objArrayOop obj, size_t start, size_t end) {
259   PSPushContentsClosure pcc(this);
260   obj->oop_iterate_elements_range(&pcc,
261                                   checked_cast<int>(start),
262                                   checked_cast<int>(end));
263 }
264 
265 void PSPromotionManager::process_array_chunk(PartialArrayState* state, bool stolen) {
266   // Access before release by claim().
267   objArrayOop to_array = objArrayOop(state->destination());
268   precond(to_array->is_array_with_oops());
269 
270   PartialArraySplitter::Claim claim =
271     _partial_array_splitter.claim(state, &_claimed_stack_depth, stolen);
272 
273   process_array_chunk(to_array, claim._start, claim._end);
274 }
275 
276 void PSPromotionManager::push_objArray(oop old_obj, oop new_obj) {
277   assert(old_obj->is_forwarded(), "precondition");
278   assert(old_obj->forwardee() == new_obj, "precondition");
279   precond(new_obj->is_array_with_oops());
280 
281   objArrayOop to_array = objArrayOop(new_obj);
282   size_t array_length = to_array->length();
283   size_t initial_chunk_size =
284     // The source array is unused when processing states.
285     _partial_array_splitter.start(&_claimed_stack_depth, nullptr, to_array, array_length, ParGCArrayScanChunk);
286 
287   process_array_chunk(to_array, 0, initial_chunk_size);
288 }
289 
290 oop PSPromotionManager::oop_promotion_failed(oop obj, markWord obj_mark) {
291   assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
292 
293   // Attempt to CAS in the header.
294   // This tests if the header is still the same as when
295   // this started.  If it is the same (i.e., no forwarding
296   // pointer has been installed), then this thread owns
297   // it.
298   if (obj->forward_to_self_atomic(obj_mark) == nullptr) {
299     // We won any races, we "own" this object.
< prev index next >