< prev index next >

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

Print this page




  26 
  27 
  28 #include "classfile/classLoaderDataGraph.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/shenandoah/shenandoahAsserts.hpp"
  32 #include "gc/shenandoah/shenandoahHeap.hpp"
  33 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
  34 #include "gc/shenandoah/shenandoahRootVerifier.hpp"
  35 #include "gc/shenandoah/shenandoahStringDedup.hpp"
  36 #include "gc/shenandoah/shenandoahUtils.hpp"
  37 #include "gc/shared/weakProcessor.inline.hpp"
  38 #include "memory/universe.hpp"
  39 #include "runtime/thread.hpp"
  40 #include "services/management.hpp"
  41 #include "utilities/debug.hpp"
  42 
  43 // Check for overflow of number of root types.
  44 STATIC_ASSERT((static_cast<uint>(ShenandoahRootVerifier::AllRoots) + 1) > static_cast<uint>(ShenandoahRootVerifier::AllRoots));
  45 
  46 ShenandoahRootVerifier::ShenandoahRootVerifier() : _types(AllRoots) {
  47 }
  48 
  49 void ShenandoahRootVerifier::excludes(RootTypes types) {
  50   _types = static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(_types) & (~static_cast<uint>(types)));
  51 }
  52 
  53 bool ShenandoahRootVerifier::verify(RootTypes type) const {
  54   return (_types & type) != 0;
  55 }
  56 
  57 ShenandoahRootVerifier::RootTypes ShenandoahRootVerifier::combine(RootTypes t1, RootTypes t2) {
  58   return static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(t1) | static_cast<uint>(t2));
  59 }
  60 
  61 void ShenandoahRootVerifier::oops_do(OopClosure* oops) {
  62   CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
  63   if (verify(CodeRoots)) {
  64     shenandoah_assert_locked_or_safepoint(CodeCache_lock);
  65     CodeCache::blobs_do(&blobs);
  66   }




  26 
  27 
  28 #include "classfile/classLoaderDataGraph.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/shenandoah/shenandoahAsserts.hpp"
  32 #include "gc/shenandoah/shenandoahHeap.hpp"
  33 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
  34 #include "gc/shenandoah/shenandoahRootVerifier.hpp"
  35 #include "gc/shenandoah/shenandoahStringDedup.hpp"
  36 #include "gc/shenandoah/shenandoahUtils.hpp"
  37 #include "gc/shared/weakProcessor.inline.hpp"
  38 #include "memory/universe.hpp"
  39 #include "runtime/thread.hpp"
  40 #include "services/management.hpp"
  41 #include "utilities/debug.hpp"
  42 
  43 // Check for overflow of number of root types.
  44 STATIC_ASSERT((static_cast<uint>(ShenandoahRootVerifier::AllRoots) + 1) > static_cast<uint>(ShenandoahRootVerifier::AllRoots));
  45 
  46 ShenandoahRootVerifier::ShenandoahRootVerifier(RootTypes types) : _types(types) {
  47 }
  48 
  49 void ShenandoahRootVerifier::excludes(RootTypes types) {
  50   _types = static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(_types) & (~static_cast<uint>(types)));
  51 }
  52 
  53 bool ShenandoahRootVerifier::verify(RootTypes type) const {
  54   return (_types & type) != 0;
  55 }
  56 
  57 ShenandoahRootVerifier::RootTypes ShenandoahRootVerifier::combine(RootTypes t1, RootTypes t2) {
  58   return static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(t1) | static_cast<uint>(t2));
  59 }
  60 
  61 void ShenandoahRootVerifier::oops_do(OopClosure* oops) {
  62   CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
  63   if (verify(CodeRoots)) {
  64     shenandoah_assert_locked_or_safepoint(CodeCache_lock);
  65     CodeCache::blobs_do(&blobs);
  66   }


< prev index next >