src/hotspot/share/gc/parallel/psParallelCompact.cpp
changeset 50058 f7e564cacfbc
parent 50049 9d17c375dc30
child 50277 f84ae8aa5d88
equal deleted inserted replaced
50057:f945444fabc3 50058:f7e564cacfbc
  2047   assert(ParallelScavengeHeap::gc_task_manager() != NULL,
  2047   assert(ParallelScavengeHeap::gc_task_manager() != NULL,
  2048     "shouldn't return NULL");
  2048     "shouldn't return NULL");
  2049   return ParallelScavengeHeap::gc_task_manager();
  2049   return ParallelScavengeHeap::gc_task_manager();
  2050 }
  2050 }
  2051 
  2051 
       
  2052 class PCAddThreadRootsMarkingTaskClosure : public ThreadClosure {
       
  2053 private:
       
  2054   GCTaskQueue* _q;
       
  2055 
       
  2056 public:
       
  2057   PCAddThreadRootsMarkingTaskClosure(GCTaskQueue* q) : _q(q) { }
       
  2058   void do_thread(Thread* t) {
       
  2059     _q->enqueue(new ThreadRootsMarkingTask(t));
       
  2060   }
       
  2061 };
       
  2062 
  2052 void PSParallelCompact::marking_phase(ParCompactionManager* cm,
  2063 void PSParallelCompact::marking_phase(ParCompactionManager* cm,
  2053                                       bool maximum_heap_compaction,
  2064                                       bool maximum_heap_compaction,
  2054                                       ParallelOldTracer *gc_tracer) {
  2065                                       ParallelOldTracer *gc_tracer) {
  2055   // Recursively traverse all live objects and mark them
  2066   // Recursively traverse all live objects and mark them
  2056   GCTraceTime(Info, gc, phases) tm("Marking Phase", &_gc_timer);
  2067   GCTraceTime(Info, gc, phases) tm("Marking Phase", &_gc_timer);
  2075     GCTaskQueue* q = GCTaskQueue::create();
  2086     GCTaskQueue* q = GCTaskQueue::create();
  2076 
  2087 
  2077     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::universe));
  2088     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::universe));
  2078     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::jni_handles));
  2089     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::jni_handles));
  2079     // We scan the thread roots in parallel
  2090     // We scan the thread roots in parallel
  2080     Threads::create_thread_roots_marking_tasks(q);
  2091     PCAddThreadRootsMarkingTaskClosure cl(q);
       
  2092     Threads::java_threads_and_vm_thread_do(&cl);
  2081     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::object_synchronizer));
  2093     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::object_synchronizer));
  2082     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::management));
  2094     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::management));
  2083     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::system_dictionary));
  2095     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::system_dictionary));
  2084     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::class_loader_data));
  2096     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::class_loader_data));
  2085     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::jvmti));
  2097     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::jvmti));