@@ -51,7 +51,7 @@ PSPromotionManager::PSScannerTasksQueueSet* PSPromotionManager::_stack_array_dep
5151PreservedMarksSet* PSPromotionManager::_preserved_marks_set = nullptr ;
5252PSOldGen* PSPromotionManager::_old_gen = nullptr ;
5353MutableSpace* PSPromotionManager::_young_space = nullptr ;
54- PartialArrayStateAllocator * PSPromotionManager::_partial_array_state_allocator = nullptr ;
54+ PartialArrayStateManager * PSPromotionManager::_partial_array_state_manager = nullptr ;
5555
5656void PSPromotionManager::initialize () {
5757 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap ();
@@ -61,21 +61,20 @@ void PSPromotionManager::initialize() {
6161
6262 const uint promotion_manager_num = ParallelGCThreads;
6363
64+ assert (_partial_array_state_manager == nullptr , " Attempt to initialize twice" );
65+ _partial_array_state_manager
66+ = new PartialArrayStateManager (promotion_manager_num);
67+
6468 // To prevent false sharing, we pad the PSPromotionManagers
6569 // and make sure that the first instance starts at a cache line.
6670 assert (_manager_array == nullptr , " Attempt to initialize twice" );
6771 _manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable (promotion_manager_num);
6872
69- assert (_partial_array_state_allocator == nullptr , " Attempt to initialize twice" );
70- _partial_array_state_allocator
71- = new PartialArrayStateAllocator (ParallelGCThreads);
72-
73- _stack_array_depth = new PSScannerTasksQueueSet (ParallelGCThreads);
73+ _stack_array_depth = new PSScannerTasksQueueSet (promotion_manager_num);
7474
7575 // Create and register the PSPromotionManager(s) for the worker threads.
7676 for (uint i=0 ; i<ParallelGCThreads; i++) {
7777 stack_array_depth ()->register_queue (i, _manager_array[i].claimed_stack_depth ());
78- _manager_array[i]._partial_array_state_allocator_index = i;
7978 }
8079 // The VMThread gets its own PSPromotionManager, which is not available
8180 // for work stealing.
@@ -187,7 +186,8 @@ void PSPromotionManager::reset_stats() {
187186
188187// Most members are initialized either by initialize() or reset().
189188PSPromotionManager::PSPromotionManager ()
190- : _partial_array_stepper(ParallelGCThreads, ParGCArrayScanChunk)
189+ : _partial_array_state_allocator(_partial_array_state_manager),
190+ _partial_array_stepper(ParallelGCThreads, ParGCArrayScanChunk)
191191{
192192 // We set the old lab's start array.
193193 _old_lab.set_start_array (old_gen ()->start_array ());
@@ -198,9 +198,6 @@ PSPromotionManager::PSPromotionManager()
198198 _target_stack_size = GCDrainStackTargetSize;
199199 }
200200
201- // Initialize to a bad value; fixed by initialize().
202- _partial_array_state_allocator_index = UINT_MAX;
203-
204201 // let's choose 1.5x the chunk size
205202 _min_array_size_for_chunking = (3 * ParGCArrayScanChunk / 2 );
206203
@@ -317,7 +314,7 @@ void PSPromotionManager::process_array_chunk(PartialArrayState* state) {
317314 process_array_chunk_work<oop>(state->destination (), start, end);
318315 }
319316 // Release reference to state, now that we're done with it.
320- _partial_array_state_allocator-> release (_partial_array_state_allocator_index, state);
317+ _partial_array_state_allocator. release (state);
321318}
322319
323320void PSPromotionManager::push_objArray (oop old_obj, oop new_obj) {
@@ -331,11 +328,10 @@ void PSPromotionManager::push_objArray(oop old_obj, oop new_obj) {
331328 if (step._ncreate > 0 ) {
332329 TASKQUEUE_STATS_ONLY (++_arrays_chunked);
333330 PartialArrayState* state =
334- _partial_array_state_allocator->allocate (_partial_array_state_allocator_index,
335- old_obj, new_obj,
336- step._index ,
337- array_length,
338- step._ncreate );
331+ _partial_array_state_allocator.allocate (old_obj, new_obj,
332+ step._index ,
333+ array_length,
334+ step._ncreate );
339335 for (uint i = 0 ; i < step._ncreate ; ++i) {
340336 push_depth (ScannerTask (state));
341337 }
0 commit comments