< prev index next >

src/share/vm/gc/shared/preservedMarks.hpp

Print this page

        

@@ -28,11 +28,11 @@
 #include "memory/allocation.hpp"
 #include "memory/padded.hpp"
 #include "oops/oop.hpp"
 #include "utilities/stack.hpp"
 
-class GCTaskManager;
+class PreservedMarksSet;
 class WorkGang;
 
 class PreservedMarks VALUE_OBJ_CLASS_SPEC {
 private:
   class OopAndMarkOop {

@@ -59,10 +59,11 @@
   inline void push_if_necessary(oop obj, markOop m);
   // Iterate over the stack, restore all preserved marks, and
   // reclaim the memory taken up by the stack segments.
   void restore();
 
+  void restore_and_increment(volatile size_t* const _total_size_addr);
   inline static void init_forwarded_mark(oop obj);
 
   // Assert the stack is empty and has no cached segments.
   void assert_empty() PRODUCT_RETURN;
 

@@ -73,10 +74,27 @@
 class RemoveForwardedPointerClosure: public ObjectClosure {
 public:
   virtual void do_object(oop obj);
 };
 
+class RestorePreservedMarksTaskExecutor {
+public:
+  void virtual restore(PreservedMarksSet* preserved_marks_set,
+                       volatile size_t* total_size_addr) = 0;
+};
+
+class SharedPreservedMarksTaskExecutor : public RestorePreservedMarksTaskExecutor {
+public:
+    WorkGang* workers;
+
+    SharedPreservedMarksTaskExecutor(WorkGang* workers) : workers(workers) { }
+
+    void restore(PreservedMarksSet* preserved_marks_set,
+        volatile size_t* total_size_addr);
+
+};
+
 class PreservedMarksSet : public CHeapObj<mtGC> {
 private:
   // true -> _stacks will be allocated in the C heap
   // false -> _stacks will be allocated in the resource arena
   const bool _in_c_heap;

@@ -89,17 +107,10 @@
   // Stack array (typically, one stack per GC worker) of length _num.
   // This should be != NULL if the stacks have been initialized,
   // or == NULL if they have not.
   Padded<PreservedMarks>* _stacks;
 
-  // Internal version of restore() that uses a WorkGang for parallelism.
-  void restore_internal(WorkGang* workers, volatile size_t* total_size_addr);
-
-  // Internal version of restore() that uses a GCTaskManager for parallelism.
-  void restore_internal(GCTaskManager* gc_task_manager,
-                        volatile size_t* total_size_addr);
-
 public:
   uint num() const { return _num; }
 
   // Return the i'th stack.
   PreservedMarks* get(uint i = 0) const {

@@ -109,18 +120,15 @@
   }
 
   // Allocate stack array.
   void init(uint num);
 
-  // Itrerate over all stacks, restore all presered marks, and reclaim
-  // the memory taken up by the stack segments. If the executor is
-  // NULL, restoration will be done serially. If the executor is not
-  // NULL, restoration could be done in parallel (when it makes
-  // sense). Supported executors: WorkGang (Serial, CMS, G1),
-  // GCTaskManager (PS).
-  template <class E>
-  inline void restore(E* executor);
+  // Iterate over all stacks, restore all preserved marks, and reclaim
+  // the memory taken up by the stack segments.
+  // Supported executors: WorkerPresevedMarksTaskExecutor (Serial, CMS, G1),
+  // PSManagerTaskExecutor (PS).
+  inline void restore(RestorePreservedMarksTaskExecutor* executor);
 
   // Reclaim stack array.
   void reclaim();
 
   // Assert all the stacks are empty and have no cached segments.
< prev index next >