< prev index next > src/hotspot/share/gc/parallel/psTasks.cpp
8224663: Parallel GC: Use WorkGang (5: ScavengeRootsTask)
* questions.
*
*/
#include "precompiled.hpp"
-#include "aot/aotLoader.hpp"
-#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/parallel/gcTaskManager.hpp"
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
#include "gc/parallel/psCardTable.hpp"
#include "gc/parallel/psClosure.inline.hpp"
#include "gc/parallel/psPromotionManager.hpp"
#include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.inline.hpp"
#include "gc/parallel/psTasks.hpp"
-#include "gc/shared/scavengableNMethods.hpp"
#include "gc/shared/taskqueue.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/thread.hpp"
#include "runtime/vmThread.hpp"
#include "services/management.hpp"
-#if INCLUDE_JVMCI
-#include "jvmci/jvmci.hpp"
-#endif
-
-//
-// ScavengeRootsTask
-//
-
-void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) {
- assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
-
- PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
- PSScavengeRootsClosure roots_closure(pm);
- PSPromoteRootsClosure roots_to_old_closure(pm);
-
- switch (_root_type) {
- case universe:
- Universe::oops_do(&roots_closure);
- break;
-
- case jni_handles:
- JNIHandles::oops_do(&roots_closure);
- break;
-
- case threads:
- {
- ResourceMark rm;
- Threads::oops_do(&roots_closure, NULL);
- }
- break;
-
- case object_synchronizer:
- ObjectSynchronizer::oops_do(&roots_closure);
- break;
-
- case system_dictionary:
- SystemDictionary::oops_do(&roots_closure);
- break;
-
- case class_loader_data:
- {
- PSScavengeCLDClosure cld_closure(pm);
- ClassLoaderDataGraph::cld_do(&cld_closure);
- }
- break;
-
- case management:
- Management::oops_do(&roots_closure);
- break;
-
- case jvmti:
- JvmtiExport::oops_do(&roots_closure);
- break;
-
- case code_cache:
- {
- MarkingCodeBlobClosure code_closure(&roots_to_old_closure, CodeBlobToOopClosure::FixRelocations);
- ScavengableNMethods::nmethods_do(&code_closure);
- AOTLoader::oops_do(&roots_closure);
- }
- break;
-
-#if INCLUDE_JVMCI
- case jvmci:
- JVMCI::oops_do(&roots_closure);
- break;
-#endif
-
- default:
- fatal("Unknown root type");
- }
-
- // Do the real work
- pm->drain_stacks(false);
-}
-
-//
-// ThreadRootsTask
-//
-
-void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) {
- assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
-
- PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
- PSScavengeRootsClosure roots_closure(pm);
- MarkingCodeBlobClosure roots_in_blobs(&roots_closure, CodeBlobToOopClosure::FixRelocations);
-
- _thread->oops_do(&roots_closure, &roots_in_blobs);
-
- // Do the real work
- pm->drain_stacks(false);
-}
//
// StealTask
//
}
}
}
guarantee(pm->stacks_empty(), "stacks should be empty at this point");
}
-
-//
-// OldToYoungRootsTask
-//
-
-void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) {
- // There are not old-to-young pointers if the old gen is empty.
- assert(!_old_gen->object_space()->is_empty(),
- "Should not be called is there is no work");
- assert(_old_gen != NULL, "Sanity");
- assert(_old_gen->object_space()->contains(_gen_top) || _gen_top == _old_gen->object_space()->top(), "Sanity");
- assert(_stripe_number < ParallelGCThreads, "Sanity");
-
- {
- PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
- PSCardTable* card_table = ParallelScavengeHeap::heap()->card_table();
-
- card_table->scavenge_contents_parallel(_old_gen->start_array(),
- _old_gen->object_space(),
- _gen_top,
- pm,
- _stripe_number,
- _stripe_total);
-
- // Do the real work
- pm->drain_stacks(false);
- }
-}
< prev index next >