changeset 50035:af1923174c9b

8202642: Replace PAR_OOP_ITERATE with templates Reviewed-by: eosterlund, sjohanss
author stefank
date Mon, 07 May 2018 14:42:10 +0200
parents 01a88f825a84
children e0dbf14885b8
files src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp src/hotspot/share/gc/shared/space.cpp src/hotspot/share/gc/shared/space.hpp src/hotspot/share/gc/shared/space.inline.hpp src/hotspot/share/gc/shared/specialized_oop_closures.hpp
diffstat 6 files changed, 13 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp	Mon May 07 14:42:10 2018 +0200
@@ -60,10 +60,4 @@
   f(CMSKeepAliveClosure,_nv)                              \
   f(CMSInnerParMarkAndPushClosure,_nv)
 
-#define SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f)           \
-  f(MarkRefsIntoAndScanClosure,_nv)                       \
-  f(PushAndMarkClosure,_nv)                               \
-  f(ParMarkRefsIntoAndScanClosure,_nv)                    \
-  f(ParPushAndMarkClosure,_nv)
-
 #endif // SHARE_GC_CMS_CMS_SPECIALIZED_OOP_CLOSURES_HPP
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Mon May 07 14:42:10 2018 +0200
@@ -55,6 +55,7 @@
 #include "gc/shared/genOopClosures.inline.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
 #include "gc/shared/referencePolicy.hpp"
+#include "gc/shared/space.inline.hpp"
 #include "gc/shared/strongRootsScope.hpp"
 #include "gc/shared/taskqueue.inline.hpp"
 #include "gc/shared/weakProcessor.hpp"
--- a/src/hotspot/share/gc/shared/space.cpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/shared/space.cpp	Mon May 07 14:42:10 2018 +0200
@@ -490,23 +490,6 @@
   return true;
 }
 
-#if INCLUDE_CMSGC
-#define ContigSpace_PAR_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)         \
-                                                                            \
-  void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\
-    HeapWord* obj_addr = mr.start();                                        \
-    HeapWord* t = mr.end();                                                 \
-    while (obj_addr < t) {                                                  \
-      assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop");           \
-      obj_addr += oop(obj_addr)->oop_iterate_size(blk);                     \
-    }                                                                       \
-  }
-
-  ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN)
-
-#undef ContigSpace_PAR_OOP_ITERATE_DEFN
-#endif // INCLUDE_CMSGC
-
 void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) {
   if (is_empty()) return;
   HeapWord* obj_addr = bottom();
--- a/src/hotspot/share/gc/shared/space.hpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/shared/space.hpp	Mon May 07 14:42:10 2018 +0200
@@ -608,15 +608,9 @@
     _concurrent_iteration_safe_limit = new_limit;
   }
 
-
-#if INCLUDE_CMSGC
   // In support of parallel oop_iterate.
-  #define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix)  \
-    void par_oop_iterate(MemRegion mr, OopClosureType* blk);
-
-    ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DECL)
-  #undef ContigSpace_PAR_OOP_ITERATE_DECL
-#endif // INCLUDE_CMSGC
+  template <typename OopClosureType>
+  void par_oop_iterate(MemRegion mr, OopClosureType* blk);
 
   // Compaction support
   virtual void reset_after_compaction() {
--- a/src/hotspot/share/gc/shared/space.inline.hpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/shared/space.inline.hpp	Mon May 07 14:42:10 2018 +0200
@@ -377,4 +377,14 @@
   set_saved_mark_word(p);
 }
 
+template <typename OopClosureType>
+void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {
+  HeapWord* obj_addr = mr.start();
+  HeapWord* limit = mr.end();
+  while (obj_addr < limit) {
+    assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop");
+    obj_addr += oop(obj_addr)->oop_iterate_size(blk);
+  }
+}
+
 #endif // SHARE_VM_GC_SHARED_SPACE_INLINE_HPP
--- a/src/hotspot/share/gc/shared/specialized_oop_closures.hpp	Mon May 07 14:42:08 2018 +0200
+++ b/src/hotspot/share/gc/shared/specialized_oop_closures.hpp	Mon May 07 14:42:10 2018 +0200
@@ -80,15 +80,4 @@
 #define ALL_OOP_OOP_ITERATE_CLOSURES_2(f)                         \
   SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
 
-// This macro applies an argument macro to all OopClosures for which we
-// want specialized bodies of a family of methods related to
-// "par_oop_iterate".  The arguments to f are the same as above.
-// The "root_class" is the most general class to define; this may be
-// "OopClosure" in some applications and "OopsInGenClosure" in others.
-
-
-#define ALL_PAR_OOP_ITERATE_CLOSURES(f)                           \
-  f(ExtendedOopClosure,_v)                                        \
-  CMSGC_ONLY(SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f))
-
 #endif // SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP