< prev index next >

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

Print this page
rev 12854 : [mq]: gcinterface.patch

@@ -239,10 +239,30 @@
   }
 
   return full_gc_done;
 }
 
+class CreateThreadRootsTasksClosure : public ThreadClosure {
+
+private:
+  GCTaskQueue* _queue;
+
+public:
+
+  CreateThreadRootsTasksClosure(GCTaskQueue* q) : _queue(q) {
+  }
+
+  void do_thread(Thread* thread) {
+    if (thread->is_Java_thread()) {
+      _queue->enqueue(new ThreadRootsTask((JavaThread*) thread));
+    } else if (thread->is_VM_thread()) {
+      _queue->enqueue(new ThreadRootsTask((VMThread*) thread));
+    }
+  }
+
+};
+
 // This method contains no policy. You should probably
 // be calling invoke() instead.
 bool PSScavenge::invoke_no_policy() {
   assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
   assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");

@@ -377,11 +397,12 @@
       }
 
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::universe));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::jni_handles));
       // We scan the thread roots in parallel
-      Threads::create_thread_roots_tasks(q);
+      CreateThreadRootsTasksClosure cl(q);
+      Threads::threads_do(&cl);
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::object_synchronizer));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::flat_profiler));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::management));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::system_dictionary));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::class_loader_data));
< prev index next >