< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp

Print this page
@@ -30,10 +30,11 @@
  #include "code/codeCache.hpp"
  #include "gc/shenandoah/shenandoahAsserts.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
  #include "gc/shenandoah/shenandoahRootVerifier.hpp"
+ #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
  #include "gc/shenandoah/shenandoahStringDedup.hpp"
  #include "gc/shenandoah/shenandoahUtils.hpp"
  #include "gc/shared/oopStorage.inline.hpp"
  #include "gc/shared/oopStorageSet.hpp"
  #include "runtime/jniHandles.hpp"

@@ -50,11 +51,11 @@
  ShenandoahGCStateResetter::~ShenandoahGCStateResetter() {
    _heap->_gc_state.set(_gc_state);
    assert(_heap->gc_state() == _gc_state, "Should be restored");
  }
  
- void ShenandoahRootVerifier::roots_do(OopClosure* oops) {
+ void ShenandoahRootVerifier::roots_do(OopIterateClosure* oops) {
    ShenandoahGCStateResetter resetter;
    shenandoah_assert_safepoint();
  
    CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
    CodeCache::blobs_do(&blobs);

@@ -64,26 +65,38 @@
  
    for (auto id : EnumRange<OopStorageSet::StrongId>()) {
      OopStorageSet::storage(id)->oops_do(oops);
    }
  
+   ShenandoahHeap* heap = ShenandoahHeap::heap();
+   if (heap->mode()->is_generational() && heap->is_gc_generation_young()) {
+     shenandoah_assert_safepoint();
+     heap->card_scan()->roots_do(oops);
+   }
+ 
    // Do thread roots the last. This allows verification code to find
    // any broken objects from those special roots first, not the accidental
    // dangling reference from the thread root.
    Threads::possibly_parallel_oops_do(true, oops, NULL);
  }
  
- void ShenandoahRootVerifier::strong_roots_do(OopClosure* oops) {
+ void ShenandoahRootVerifier::strong_roots_do(OopIterateClosure* oops) {
    ShenandoahGCStateResetter resetter;
    shenandoah_assert_safepoint();
  
    CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
    ClassLoaderDataGraph::always_strong_cld_do(&clds);
  
    for (auto id : EnumRange<OopStorageSet::StrongId>()) {
      OopStorageSet::storage(id)->oops_do(oops);
    }
+ 
+   ShenandoahHeap* heap = ShenandoahHeap::heap();
+   if (heap->mode()->is_generational() && heap->is_gc_generation_young()) {
+     heap->card_scan()->roots_do(oops);
+   }
+ 
    // Do thread roots the last. This allows verification code to find
    // any broken objects from those special roots first, not the accidental
    // dangling reference from the thread root.
    CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
    Threads::possibly_parallel_oops_do(true, oops, &blobs);
< prev index next >