< prev index next >

src/share/vm/gc/shenandoah/shenandoahPartialGC.cpp

Print this page
rev 13131 : Improve inlining of the root scanning closure in partial GC.

@@ -29,10 +29,11 @@
 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
 #include "gc/shenandoah/shenandoahConnectionMatrix.inline.hpp"
 #include "gc/shenandoah/shenandoahFreeSet.hpp"
 #include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
+#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
 #include "gc/shenandoah/shenandoahPartialGC.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
 #include "gc/shenandoah/shenandoahTaskqueue.hpp"
 #include "memory/iterator.hpp"
 

@@ -52,27 +53,10 @@
     do_oop_work(p);
   }
   void do_oop(narrowOop* p) { do_oop_work(p); }
 };
 
-class PartialEvacuateUpdateHeapClosure : public ExtendedOopClosure {
-  ShenandoahPartialGC* _partial_gc;
-  Thread* _thread;
-  SCMObjToScanQueue* _queue;
-private:
-  template <class T>
-  void do_oop_work(T* p) {
-    _partial_gc->process_oop<T, true>(p, _thread, _queue);
-  }
-public:
-  PartialEvacuateUpdateHeapClosure(SCMObjToScanQueue* q) :
-    _partial_gc(ShenandoahHeap::heap()->partial_gc()),
-    _thread(Thread::current()), _queue(q) {}
-  void do_oop(oop* p) { do_oop_work(p); }
-  void do_oop(narrowOop* p) { do_oop_work(p); }
-};
-
 class ShenandoahPartialCollectionTask : public AbstractGangTask {
 private:
   ShenandoahRootProcessor* _rp;
   ParallelTaskTerminator* _terminator;
   ShenandoahHeapRegionSet* _root_regions;

@@ -322,41 +306,8 @@
   _heap->collection_set()->clear();
   _heap->clear_cset_fast_test();
   _root_regions->clear();
 }
 
-template <class T, bool UPDATE_MATRIX>
-void ShenandoahPartialGC::process_oop(T* p, Thread* thread, SCMObjToScanQueue* queue) {
-  T o = oopDesc::load_heap_oop(p);
-  if (! oopDesc::is_null(o)) {
-    oop obj = oopDesc::decode_heap_oop_not_null(o);
-    if (_heap->in_collection_set(obj)) {
-      oop forw = ShenandoahBarrierSet::resolve_oop_static_not_null(obj);
-      if (oopDesc::unsafe_equals(obj, forw)) {
-        bool evacuated = false;
-        forw = _heap->evacuate_object(obj, thread, evacuated);
-
-        // Only the thread that succeeded evacuating this object pushes it to its work queue.
-        if (evacuated) {
-          assert(forw->is_oop(), "sanity");
-          bool succeeded = queue->push(SCMTask(forw));
-          assert(succeeded, "must succeed to push to task queue");
-        }
-      }
-      assert(! oopDesc::unsafe_equals(obj, forw) || _heap->cancelled_concgc(), "must be evacuated");
-      // Update reference.
-      oopDesc::encode_store_heap_oop_not_null(p, forw);
-      obj = forw; // For matrix update below.
-    }
-    if (UPDATE_MATRIX) {
-#ifdef ASSERT
-      oop forw = ShenandoahBarrierSet::resolve_oop_static_not_null(obj);
-      assert(oopDesc::unsafe_equals(obj, forw) || _heap->cancelled_concgc(), "must not be evacuated: "PTR_FORMAT" -> "PTR_FORMAT, p2i(obj), p2i(forw));
-#endif
-      _matrix->set_connected(p, obj);
-    }
-  }
-}
-
 SCMObjToScanQueueSet* ShenandoahPartialGC::task_queues() {
   return _task_queues;
 }
< prev index next >