< prev index next >

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

Print this page




  46 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
  47 #include "gc/shenandoah/shenandoahMemoryPool.hpp"
  48 #include "gc/shenandoah/shenandoahMetrics.hpp"
  49 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
  50 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
  51 #include "gc/shenandoah/shenandoahPacer.inline.hpp"
  52 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
  53 #include "gc/shenandoah/shenandoahStringDedup.hpp"
  54 #include "gc/shenandoah/shenandoahUtils.hpp"
  55 #include "gc/shenandoah/shenandoahVerifier.hpp"
  56 #include "gc/shenandoah/shenandoahCodeRoots.hpp"
  57 #include "gc/shenandoah/shenandoahVMOperations.hpp"
  58 #include "gc/shenandoah/shenandoahWorkGroup.hpp"
  59 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
  60 #include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
  61 #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
  62 #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
  63 #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp"
  64 #include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp"
  65 #include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp"



  66 
  67 #include "memory/metaspace.hpp"
  68 #include "runtime/vmThread.hpp"
  69 #include "services/mallocTracker.hpp"
  70 
  71 ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() : _heap(ShenandoahHeap::heap()) {}
  72 
  73 #ifdef ASSERT
  74 template <class T>
  75 void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) {
  76   T o = RawAccess<>::oop_load(p);
  77   if (! CompressedOops::is_null(o)) {
  78     oop obj = CompressedOops::decode_not_null(o);
  79     shenandoah_assert_not_forwarded(p, obj);
  80   }
  81 }
  82 
  83 void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); }
  84 void ShenandoahAssertToSpaceClosure::do_oop(oop* p)       { do_oop_work(p); }
  85 #endif


 488 
 489 void ShenandoahHeap::post_initialize() {
 490   CollectedHeap::post_initialize();
 491   MutexLocker ml(Threads_lock);
 492 
 493   ShenandoahInitGCLABClosure init_gclabs;
 494   Threads::threads_do(&init_gclabs);
 495   _workers->threads_do(&init_gclabs);
 496   _safepoint_workers->threads_do(&init_gclabs);
 497 
 498   // gclab can not be initialized early during VM startup, as it can not determinate its max_size.
 499   // Now, we will let WorkGang to initialize gclab when new worker is created.
 500   _workers->set_initialize_gclab();
 501 
 502   _scm->initialize(_max_workers);
 503   _full_gc->initialize(_gc_timer);
 504 
 505   ref_processing_init();
 506 
 507   _heuristics->initialize();


 508 }
 509 
 510 size_t ShenandoahHeap::used() const {
 511   return OrderAccess::load_acquire(&_used);
 512 }
 513 
 514 size_t ShenandoahHeap::committed() const {
 515   OrderAccess::acquire();
 516   return _committed;
 517 }
 518 
 519 void ShenandoahHeap::increase_committed(size_t bytes) {
 520   assert_heaplock_or_safepoint();
 521   _committed += bytes;
 522 }
 523 
 524 void ShenandoahHeap::decrease_committed(size_t bytes) {
 525   assert_heaplock_or_safepoint();
 526   _committed -= bytes;
 527 }




  46 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
  47 #include "gc/shenandoah/shenandoahMemoryPool.hpp"
  48 #include "gc/shenandoah/shenandoahMetrics.hpp"
  49 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
  50 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
  51 #include "gc/shenandoah/shenandoahPacer.inline.hpp"
  52 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
  53 #include "gc/shenandoah/shenandoahStringDedup.hpp"
  54 #include "gc/shenandoah/shenandoahUtils.hpp"
  55 #include "gc/shenandoah/shenandoahVerifier.hpp"
  56 #include "gc/shenandoah/shenandoahCodeRoots.hpp"
  57 #include "gc/shenandoah/shenandoahVMOperations.hpp"
  58 #include "gc/shenandoah/shenandoahWorkGroup.hpp"
  59 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
  60 #include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
  61 #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
  62 #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
  63 #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp"
  64 #include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp"
  65 #include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp"
  66 #if INCLUDE_JFR
  67 #include "gc/shenandoah/shenandoahJfrSupport.hpp"
  68 #endif
  69 
  70 #include "memory/metaspace.hpp"
  71 #include "runtime/vmThread.hpp"
  72 #include "services/mallocTracker.hpp"
  73 
  74 ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() : _heap(ShenandoahHeap::heap()) {}
  75 
  76 #ifdef ASSERT
  77 template <class T>
  78 void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) {
  79   T o = RawAccess<>::oop_load(p);
  80   if (! CompressedOops::is_null(o)) {
  81     oop obj = CompressedOops::decode_not_null(o);
  82     shenandoah_assert_not_forwarded(p, obj);
  83   }
  84 }
  85 
  86 void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); }
  87 void ShenandoahAssertToSpaceClosure::do_oop(oop* p)       { do_oop_work(p); }
  88 #endif


 491 
 492 void ShenandoahHeap::post_initialize() {
 493   CollectedHeap::post_initialize();
 494   MutexLocker ml(Threads_lock);
 495 
 496   ShenandoahInitGCLABClosure init_gclabs;
 497   Threads::threads_do(&init_gclabs);
 498   _workers->threads_do(&init_gclabs);
 499   _safepoint_workers->threads_do(&init_gclabs);
 500 
 501   // gclab can not be initialized early during VM startup, as it can not determinate its max_size.
 502   // Now, we will let WorkGang to initialize gclab when new worker is created.
 503   _workers->set_initialize_gclab();
 504 
 505   _scm->initialize(_max_workers);
 506   _full_gc->initialize(_gc_timer);
 507 
 508   ref_processing_init();
 509 
 510   _heuristics->initialize();
 511 
 512   JFR_ONLY(ShenandoahJFRSupport::register_jfr_type_serializers());
 513 }
 514 
 515 size_t ShenandoahHeap::used() const {
 516   return OrderAccess::load_acquire(&_used);
 517 }
 518 
 519 size_t ShenandoahHeap::committed() const {
 520   OrderAccess::acquire();
 521   return _committed;
 522 }
 523 
 524 void ShenandoahHeap::increase_committed(size_t bytes) {
 525   assert_heaplock_or_safepoint();
 526   _committed += bytes;
 527 }
 528 
 529 void ShenandoahHeap::decrease_committed(size_t bytes) {
 530   assert_heaplock_or_safepoint();
 531   _committed -= bytes;
 532 }


< prev index next >