< prev index next >

src/share/vm/gc/parallel/psParallelCompact.cpp

Print this page
rev 10845 : 8150994: UseParallelGC fails with UseDynamicNumberOfGCThreads with specjbb2005
Reviewed-by: tschatzl, kbarrett

*** 1900,1910 **** #ifdef ASSERT for (size_t i = 0; i < ParallelGCThreads + 1; ++i) { ParCompactionManager* const cm = ParCompactionManager::manager_array(int(i)); assert(cm->marking_stack()->is_empty(), "should be empty"); ! assert(ParCompactionManager::region_list(int(i))->is_empty(), "should be empty"); } #endif // ASSERT if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) { HandleMark hm; // Discard invalid handles created during verification --- 1900,1910 ---- #ifdef ASSERT for (size_t i = 0; i < ParallelGCThreads + 1; ++i) { ParCompactionManager* const cm = ParCompactionManager::manager_array(int(i)); assert(cm->marking_stack()->is_empty(), "should be empty"); ! assert(cm->region_stack()->is_empty(), "should be empty"); } #endif // ASSERT if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) { HandleMark hm; // Discard invalid handles created during verification
*** 2210,2250 **** } _total_regions++; } }; ! void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, uint parallel_gc_threads) { GCTraceTime(Trace, gc, phases) tm("Drain Task Setup", &_gc_timer); // Find the threads that are active unsigned int which = 0; - const uint task_count = MAX2(parallel_gc_threads, 1U); - for (uint j = 0; j < task_count; j++) { - q->enqueue(new DrainStacksCompactionTask(j)); - ParCompactionManager::verify_region_list_empty(j); - // Set the region stacks variables to "no" region stack values - // so that they will be recognized and needing a region stack - // in the stealing tasks if they do not get one by executing - // a draining stack. - ParCompactionManager* cm = ParCompactionManager::manager_array(j); - cm->set_region_stack(NULL); - cm->set_region_stack_index((uint)max_uintx); - } - ParCompactionManager::reset_recycled_stack_index(); - // Find all regions that are available (can be filled immediately) and // distribute them to the thread stacks. The iteration is done in reverse // order (high to low) so the regions will be removed in ascending order. const ParallelCompactData& sd = PSParallelCompact::summary_data(); - // A region index which corresponds to the tasks created above. - // "which" must be 0 <= which < task_count - which = 0; // id + 1 is used to test termination so unsigned can // be used with an old_space_id == 0. FillableRegionLogger region_logger; for (unsigned int id = to_space_id; id + 1 > old_space_id; --id) { --- 2210,2233 ---- } _total_regions++; } }; ! void PSParallelCompact::prepare_region_draining_tasks(GCTaskQueue* q, uint parallel_gc_threads) { GCTraceTime(Trace, gc, phases) tm("Drain Task Setup", &_gc_timer); // Find the threads that are active unsigned int which = 0; // Find all regions that are available (can be filled immediately) and // distribute them to the thread stacks. The iteration is done in reverse // order (high to low) so the regions will be removed in ascending order. const ParallelCompactData& sd = PSParallelCompact::summary_data(); which = 0; // id + 1 is used to test termination so unsigned can // be used with an old_space_id == 0. FillableRegionLogger region_logger; for (unsigned int id = to_space_id; id + 1 > old_space_id; --id) {
*** 2256,2271 **** const size_t end_region = sd.addr_to_region_idx(sd.region_align_up(new_top)); for (size_t cur = end_region - 1; cur + 1 > beg_region; --cur) { if (sd.region(cur)->claim_unsafe()) { ! ParCompactionManager::region_list_push(which, cur); region_logger.handle(cur); // Assign regions to tasks in round-robin fashion. ! if (++which == task_count) { ! assert(which <= parallel_gc_threads, ! "Inconsistent number of workers"); which = 0; } } } region_logger.print_line(); --- 2239,2253 ---- const size_t end_region = sd.addr_to_region_idx(sd.region_align_up(new_top)); for (size_t cur = end_region - 1; cur + 1 > beg_region; --cur) { if (sd.region(cur)->claim_unsafe()) { ! ParCompactionManager* cm = ParCompactionManager::manager_array(which); ! cm->region_stack()->push(cur); region_logger.handle(cur); // Assign regions to tasks in round-robin fashion. ! if (++which == parallel_gc_threads) { which = 0; } } } region_logger.print_line();
*** 2420,2430 **** uint active_gc_threads = heap->gc_task_manager()->active_workers(); TaskQueueSetSuper* qset = ParCompactionManager::region_array(); ParallelTaskTerminator terminator(active_gc_threads, qset); GCTaskQueue* q = GCTaskQueue::create(); ! enqueue_region_draining_tasks(q, active_gc_threads); enqueue_dense_prefix_tasks(q, active_gc_threads); enqueue_region_stealing_tasks(q, &terminator, active_gc_threads); { GCTraceTime(Trace, gc, phases) tm("Par Compact", &_gc_timer); --- 2402,2412 ---- uint active_gc_threads = heap->gc_task_manager()->active_workers(); TaskQueueSetSuper* qset = ParCompactionManager::region_array(); ParallelTaskTerminator terminator(active_gc_threads, qset); GCTaskQueue* q = GCTaskQueue::create(); ! prepare_region_draining_tasks(q, active_gc_threads); enqueue_dense_prefix_tasks(q, active_gc_threads); enqueue_region_stealing_tasks(q, &terminator, active_gc_threads); { GCTraceTime(Trace, gc, phases) tm("Par Compact", &_gc_timer);
< prev index next >