8224662: Parallel GC: Use WorkGang (4: SharedRestorePreservedMarksTaskExecutor)
authorlkorinth
Fri, 16 Aug 2019 09:18:29 +0200
changeset 57770 b5ca334ed54c
parent 57769 f7ca942a2714
child 57771 50c959cc40e8
8224662: Parallel GC: Use WorkGang (4: SharedRestorePreservedMarksTaskExecutor) Reviewed-by: stefank, kbarrett, tschatzl
src/hotspot/share/gc/parallel/psPromotionManager.cpp
--- a/src/hotspot/share/gc/parallel/psPromotionManager.cpp	Fri Aug 16 09:18:26 2019 +0200
+++ b/src/hotspot/share/gc/parallel/psPromotionManager.cpp	Fri Aug 16 09:18:29 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -240,52 +240,8 @@
   _preserved_marks = preserved_marks;
 }
 
-class ParRestoreGCTask : public GCTask {
-private:
-  const uint _id;
-  PreservedMarksSet* const _preserved_marks_set;
-  volatile size_t* const _total_size_addr;
-
-public:
-  virtual char* name() {
-    return (char*) "preserved mark restoration task";
-  }
-
-  virtual void do_it(GCTaskManager* manager, uint which){
-    _preserved_marks_set->get(_id)->restore_and_increment(_total_size_addr);
-  }
-
-  ParRestoreGCTask(uint id,
-                   PreservedMarksSet* preserved_marks_set,
-                   volatile size_t* total_size_addr)
-    : _id(id),
-      _preserved_marks_set(preserved_marks_set),
-      _total_size_addr(total_size_addr) { }
-};
-
-class PSRestorePreservedMarksTaskExecutor : public RestorePreservedMarksTaskExecutor {
-private:
-  GCTaskManager* _gc_task_manager;
-
-public:
-  PSRestorePreservedMarksTaskExecutor(GCTaskManager* gc_task_manager)
-      : _gc_task_manager(gc_task_manager) { }
-
-  void restore(PreservedMarksSet* preserved_marks_set,
-               volatile size_t* total_size_addr) {
-    // GCTask / GCTaskQueue are ResourceObjs
-    ResourceMark rm;
-
-    GCTaskQueue* q = GCTaskQueue::create();
-    for (uint i = 0; i < preserved_marks_set->num(); i += 1) {
-      q->enqueue(new ParRestoreGCTask(i, preserved_marks_set, total_size_addr));
-    }
-    _gc_task_manager->execute_and_wait(q);
-  }
-};
-
 void PSPromotionManager::restore_preserved_marks() {
-  PSRestorePreservedMarksTaskExecutor task_executor(PSScavenge::gc_task_manager());
+  SharedRestorePreservedMarksTaskExecutor task_executor(&ParallelScavengeHeap::heap()->workers());
   _preserved_marks_set->restore(&task_executor);
 }