8205607: Use oop_iterate instead of oop_iterate_no_header
authorstefank
Tue, 26 Jun 2018 13:54:19 +0200
changeset 50800 6da12aa23b88
parent 50799 f9ae777f71ee
child 50801 94b56c8594ef
8205607: Use oop_iterate instead of oop_iterate_no_header Reviewed-by: pliden, kbarrett
src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp
src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp
src/hotspot/share/gc/g1/g1HeapVerifier.cpp
src/hotspot/share/gc/parallel/mutableSpace.cpp
src/hotspot/share/gc/parallel/mutableSpace.hpp
src/hotspot/share/gc/parallel/psCardTable.cpp
src/hotspot/share/gc/parallel/psOldGen.hpp
src/hotspot/share/gc/shared/cardTableRS.cpp
src/hotspot/share/gc/shared/genCollectedHeap.cpp
src/hotspot/share/gc/shared/genCollectedHeap.hpp
src/hotspot/share/memory/iterator.hpp
src/hotspot/share/oops/instanceKlass.cpp
src/hotspot/share/oops/oop.hpp
src/hotspot/share/oops/oop.inline.hpp
--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -2435,7 +2435,7 @@
   }
 };
 
-class VerifyAllOopsClosure: public OopClosure {
+class VerifyAllOopsClosure: public BasicOopIterateClosure {
  private:
   const CMSCollector*             _collector;
   const CompactibleFreeListSpace* _sp;
@@ -2524,9 +2524,8 @@
     VerifyAllOopsClosure cl(_collector, this, span, past_remark,
       _collector->markBitMap());
 
-    // Iterate over all oops in the heap. Uses the _no_header version
-    // since we are not interested in following the klass pointers.
-    CMSHeap::heap()->oop_iterate_no_header(&cl);
+    // Iterate over all oops in the heap.
+    CMSHeap::heap()->oop_iterate(&cl);
   }
 
   if (VerifyObjectStartArray) {
--- a/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -120,8 +120,7 @@
 
   if (VerifyDuringGC) {
     _verify_closure.set_containing_obj(array);
-    NoHeaderExtendedOopClosure no(&_verify_closure);
-    array->oop_iterate_range(&no, beg_index, end_index);
+    array->oop_iterate_range(&_verify_closure, beg_index, end_index);
     if (_verify_closure.failures()) {
       assert(false, "Failed");
     }
@@ -141,7 +140,7 @@
         return;
       }
       _verify_closure.set_containing_obj(obj);
-      obj->oop_iterate_no_header(&_verify_closure);
+      obj->oop_iterate(&_verify_closure);
       if (_verify_closure.failures()) {
         log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
         assert(false, "Failed");
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -84,7 +84,7 @@
   virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
 };
 
-class G1VerifyOopClosure: public OopClosure {
+class G1VerifyOopClosure: public BasicOopIterateClosure {
 private:
   G1CollectedHeap* _g1h;
   bool             _failures;
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -180,7 +180,7 @@
   }
 };
 
-class VerifyLivenessOopClosure: public OopClosure {
+class VerifyLivenessOopClosure: public BasicOopIterateClosure {
   G1CollectedHeap* _g1h;
   VerifyOption _vo;
 public:
@@ -226,7 +226,7 @@
         guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
       }
 
-      o->oop_iterate_no_header(&isLive);
+      o->oop_iterate(&isLive);
       if (!_hr->obj_allocated_since_prev_marking(o)) {
         size_t obj_size = o->size();    // Make sure we don't overflow
         _live_bytes += (obj_size * HeapWordSize);
@@ -236,7 +236,7 @@
   size_t live_bytes() { return _live_bytes; }
 };
 
-class VerifyArchiveOopClosure: public OopClosure {
+class VerifyArchiveOopClosure: public BasicOopIterateClosure {
   HeapRegion* _hr;
 public:
   VerifyArchiveOopClosure(HeapRegion *hr)
@@ -269,7 +269,7 @@
   void do_object(oop o) {
     VerifyArchiveOopClosure checkOop(_hr);
     assert(o != NULL, "Should not be here for NULL oops");
-    o->oop_iterate_no_header(&checkOop);
+    o->oop_iterate(&checkOop);
   }
 };
 
--- a/src/hotspot/share/gc/parallel/mutableSpace.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/parallel/mutableSpace.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -215,12 +215,12 @@
   return Atomic::cmpxchg(obj, top_addr(), expected_top) == expected_top;
 }
 
-void MutableSpace::oop_iterate_no_header(OopClosure* cl) {
+void MutableSpace::oop_iterate(OopIterateClosure* cl) {
   HeapWord* obj_addr = bottom();
   HeapWord* t = top();
   // Could call objects iterate, but this is easier.
   while (obj_addr < t) {
-    obj_addr += oop(obj_addr)->oop_iterate_no_header(cl);
+    obj_addr += oop(obj_addr)->oop_iterate_size(cl);
   }
 }
 
--- a/src/hotspot/share/gc/parallel/mutableSpace.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/parallel/mutableSpace.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -134,7 +134,7 @@
   bool cas_deallocate(HeapWord *obj, size_t size);
 
   // Iteration.
-  void oop_iterate_no_header(OopClosure* cl);
+  void oop_iterate(OopIterateClosure* cl);
   void object_iterate(ObjectClosure* cl);
 
   // Debugging
--- a/src/hotspot/share/gc/parallel/psCardTable.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/parallel/psCardTable.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -39,7 +39,7 @@
 
 // Checks an individual oop for missing precise marks. Mark
 // may be either dirty or newgen.
-class CheckForUnmarkedOops : public OopClosure {
+class CheckForUnmarkedOops : public BasicOopIterateClosure {
  private:
   PSYoungGen*  _young_gen;
   PSCardTable* _card_table;
@@ -89,7 +89,7 @@
   // fail unless the object head is also unmarked.
   virtual void do_object(oop obj) {
     CheckForUnmarkedOops object_check(_young_gen, _card_table);
-    obj->oop_iterate_no_header(&object_check);
+    obj->oop_iterate(&object_check);
     if (object_check.has_unmarked_oop()) {
       guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
     }
@@ -97,7 +97,7 @@
 };
 
 // Checks for precise marking of oops as newgen.
-class CheckForPreciseMarks : public OopClosure {
+class CheckForPreciseMarks : public BasicOopIterateClosure {
  private:
   PSYoungGen*  _young_gen;
   PSCardTable* _card_table;
@@ -336,7 +336,7 @@
 
   CheckForPreciseMarks check(heap->young_gen(), this);
 
-  old_gen->oop_iterate_no_header(&check);
+  old_gen->oop_iterate(&check);
 
   verify_all_young_refs_precise_helper(old_gen->object_space()->used_region());
 }
--- a/src/hotspot/share/gc/parallel/psOldGen.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/parallel/psOldGen.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -192,7 +192,7 @@
   HeapWord* allocate(size_t word_size);
 
   // Iteration.
-  void oop_iterate_no_header(OopClosure* cl) { object_space()->oop_iterate_no_header(cl); }
+  void oop_iterate(OopIterateClosure* cl) { object_space()->oop_iterate(cl); }
   void object_iterate(ObjectClosure* cl) { object_space()->object_iterate(cl); }
 
   // Debugging - do not use for time critical operations
--- a/src/hotspot/share/gc/shared/cardTableRS.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/shared/cardTableRS.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -330,7 +330,7 @@
 }
 
 
-class VerifyCleanCardClosure: public OopClosure {
+class VerifyCleanCardClosure: public BasicOopIterateClosure {
 private:
   HeapWord* _boundary;
   HeapWord* _begin;
@@ -430,7 +430,7 @@
         VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
         for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
           if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
-            oop(cur)->oop_iterate_no_header(&verify_blk, mr);
+            oop(cur)->oop_iterate(&verify_blk, mr);
           }
         }
       }
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -1042,11 +1042,6 @@
 }
 #endif
 
-void GenCollectedHeap::oop_iterate_no_header(OopClosure* cl) {
-  NoHeaderExtendedOopClosure no_header_cl(cl);
-  oop_iterate(&no_header_cl);
-}
-
 void GenCollectedHeap::oop_iterate(OopIterateClosure* cl) {
   _young_gen->oop_iterate(cl);
   _old_gen->oop_iterate(cl);
--- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -258,7 +258,6 @@
   virtual void verify_nmethod(nmethod* nmethod);
 
   // Iteration functions.
-  void oop_iterate_no_header(OopClosure* cl);
   void oop_iterate(OopIterateClosure* cl);
   void object_iterate(ObjectClosure* cl);
   void safe_object_iterate(ObjectClosure* cl);
--- a/src/hotspot/share/memory/iterator.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/memory/iterator.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -117,16 +117,6 @@
   virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
 };
 
-// Wrapper closure only used to implement oop_iterate_no_header().
-class NoHeaderExtendedOopClosure : public BasicOopIterateClosure {
-  OopClosure* _wrapped_closure;
- public:
-  NoHeaderExtendedOopClosure(OopClosure* cl) : _wrapped_closure(cl) {}
-  // Warning: this calls the virtual version do_oop in the the wrapped closure.
-  virtual void do_oop(oop* p)       { _wrapped_closure->do_oop(p); }
-  virtual void do_oop(narrowOop* p) { _wrapped_closure->do_oop(p); }
-};
-
 class KlassClosure : public Closure {
  public:
   virtual void do_klass(Klass* k) = 0;
--- a/src/hotspot/share/oops/instanceKlass.cpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Tue Jun 26 13:54:19 2018 +0200
@@ -3430,7 +3430,7 @@
 
 // Verification
 
-class VerifyFieldClosure: public OopClosure {
+class VerifyFieldClosure: public BasicOopIterateClosure {
  protected:
   template <class T> void do_oop_work(T* p) {
     oop obj = RawAccess<>::oop_load(p);
@@ -3578,7 +3578,7 @@
 void InstanceKlass::oop_verify_on(oop obj, outputStream* st) {
   Klass::oop_verify_on(obj, st);
   VerifyFieldClosure blk;
-  obj->oop_iterate_no_header(&blk);
+  obj->oop_iterate(&blk);
 }
 
 
--- a/src/hotspot/share/oops/oop.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/oops/oop.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -302,9 +302,6 @@
   template <typename OopClosureType>
   inline void oop_iterate_backwards(OopClosureType* cl);
 
-  inline int oop_iterate_no_header(OopClosure* bk);
-  inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
-
   inline static bool is_instanceof_or_null(oop obj, Klass* klass);
 
   // identity hash; returns the identity hash key (computes it if necessary)
--- a/src/hotspot/share/oops/oop.inline.hpp	Tue Jun 26 12:29:20 2018 -0700
+++ b/src/hotspot/share/oops/oop.inline.hpp	Tue Jun 26 13:54:19 2018 +0200
@@ -463,18 +463,6 @@
   OopIteratorClosureDispatch::oop_oop_iterate_backwards(cl, this, klass());
 }
 
-int oopDesc::oop_iterate_no_header(OopClosure* blk) {
-  // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
-  // the do_oop calls, but turns off all other features in OopIterateClosure.
-  NoHeaderExtendedOopClosure cl(blk);
-  return oop_iterate_size(&cl);
-}
-
-int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
-  NoHeaderExtendedOopClosure cl(blk);
-  return oop_iterate_size(&cl, mr);
-}
-
 bool oopDesc::is_instanceof_or_null(oop obj, Klass* klass) {
   return obj == NULL || obj->klass()->is_subtype_of(klass);
 }