< prev index next >

src/hotspot/share/gc/z/zHeap.cpp

Print this page
rev 60444 : webrev 10 parallel heap iter

@@ -33,10 +33,11 @@
 #include "gc/z/zPageTable.inline.hpp"
 #include "gc/z/zRelocationSet.inline.hpp"
 #include "gc/z/zRelocationSetSelector.inline.hpp"
 #include "gc/z/zResurrection.hpp"
 #include "gc/z/zStat.hpp"
+#include "gc/z/zTask.hpp"
 #include "gc/z/zThread.inline.hpp"
 #include "gc/z/zVerify.hpp"
 #include "gc/z/zWorkers.inline.hpp"
 #include "logging/log.hpp"
 #include "memory/iterator.hpp"

@@ -183,10 +184,30 @@
 void ZHeap::threads_do(ThreadClosure* tc) const {
   _page_allocator.threads_do(tc);
   _workers.threads_do(tc);
 }
 
+// Adapter class from AbstractGangTask to Ztask
+class ZAbstractGangTaskAdapter : public ZTask {
+private:
+  AbstractGangTask* _task;
+
+public:
+  ZAbstractGangTaskAdapter(AbstractGangTask* task) :
+      ZTask(task->name()),
+      _task(task) { }
+
+  virtual void work() {
+    _task->work(ZThread::worker_id());
+  }
+};
+
+void ZHeap::run_task(AbstractGangTask* task) {
+  ZAbstractGangTaskAdapter ztask(task);
+  _workers.run_parallel(&ztask);
+}
+
 void ZHeap::out_of_memory() {
   ResourceMark rm;
 
   ZStatInc(ZCounterOutOfMemory);
   log_info(gc)("Out Of Memory (%s)", Thread::current()->name());
< prev index next >