49 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" 50 #include "gc/shenandoah/shenandoahMemoryPool.hpp" 51 #include "gc/shenandoah/shenandoahMetrics.hpp" 52 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" 53 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" 54 #include "gc/shenandoah/shenandoahPacer.inline.hpp" 55 #include "gc/shenandoah/shenandoahRootProcessor.hpp" 56 #include "gc/shenandoah/shenandoahStringDedup.hpp" 57 #include "gc/shenandoah/shenandoahUtils.hpp" 58 #include "gc/shenandoah/shenandoahVerifier.hpp" 59 #include "gc/shenandoah/shenandoahCodeRoots.hpp" 60 #include "gc/shenandoah/shenandoahVMOperations.hpp" 61 #include "gc/shenandoah/shenandoahWorkGroup.hpp" 62 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp" 63 #include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" 64 #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" 65 #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" 66 #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" 67 #include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" 68 #include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp" 69 #include "memory/metaspace.hpp" 70 #include "oops/compressedOops.inline.hpp" 71 #include "runtime/globals.hpp" 72 #include "runtime/interfaceSupport.inline.hpp" 73 #include "runtime/safepointMechanism.hpp" 74 #include "runtime/vmThread.hpp" 75 #include "services/mallocTracker.hpp" 76 77 #ifdef ASSERT 78 template <class T> 79 void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) { 80 T o = RawAccess<>::oop_load(p); 81 if (! CompressedOops::is_null(o)) { 82 oop obj = CompressedOops::decode_not_null(o); 83 shenandoah_assert_not_forwarded(p, obj); 84 } 85 } 86 87 void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); } 88 void ShenandoahAssertToSpaceClosure::do_oop(oop* p) { do_oop_work(p); } 566 } 567 }; 568 569 void ShenandoahHeap::post_initialize() { 570 CollectedHeap::post_initialize(); 571 MutexLocker ml(Threads_lock); 572 573 ShenandoahInitWorkerGCLABClosure init_gclabs; 574 _workers->threads_do(&init_gclabs); 575 576 // gclab can not be initialized early during VM startup, as it can not determinate its max_size. 577 // Now, we will let WorkGang to initialize gclab when new worker is created. 578 _workers->set_initialize_gclab(); 579 580 _scm->initialize(_max_workers); 581 _full_gc->initialize(_gc_timer); 582 583 ref_processing_init(); 584 585 _heuristics->initialize(); 586 } 587 588 size_t ShenandoahHeap::used() const { 589 return OrderAccess::load_acquire(&_used); 590 } 591 592 size_t ShenandoahHeap::committed() const { 593 OrderAccess::acquire(); 594 return _committed; 595 } 596 597 void ShenandoahHeap::increase_committed(size_t bytes) { 598 assert_heaplock_or_safepoint(); 599 _committed += bytes; 600 } 601 602 void ShenandoahHeap::decrease_committed(size_t bytes) { 603 assert_heaplock_or_safepoint(); 604 _committed -= bytes; 605 } | 49 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" 50 #include "gc/shenandoah/shenandoahMemoryPool.hpp" 51 #include "gc/shenandoah/shenandoahMetrics.hpp" 52 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" 53 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" 54 #include "gc/shenandoah/shenandoahPacer.inline.hpp" 55 #include "gc/shenandoah/shenandoahRootProcessor.hpp" 56 #include "gc/shenandoah/shenandoahStringDedup.hpp" 57 #include "gc/shenandoah/shenandoahUtils.hpp" 58 #include "gc/shenandoah/shenandoahVerifier.hpp" 59 #include "gc/shenandoah/shenandoahCodeRoots.hpp" 60 #include "gc/shenandoah/shenandoahVMOperations.hpp" 61 #include "gc/shenandoah/shenandoahWorkGroup.hpp" 62 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp" 63 #include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" 64 #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" 65 #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" 66 #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" 67 #include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" 68 #include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp" 69 #if INCLUDE_JFR 70 #include "gc/shenandoah/shenandoahJfrSupport.hpp" 71 #endif 72 #include "memory/metaspace.hpp" 73 #include "oops/compressedOops.inline.hpp" 74 #include "runtime/globals.hpp" 75 #include "runtime/interfaceSupport.inline.hpp" 76 #include "runtime/safepointMechanism.hpp" 77 #include "runtime/vmThread.hpp" 78 #include "services/mallocTracker.hpp" 79 80 #ifdef ASSERT 81 template <class T> 82 void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) { 83 T o = RawAccess<>::oop_load(p); 84 if (! CompressedOops::is_null(o)) { 85 oop obj = CompressedOops::decode_not_null(o); 86 shenandoah_assert_not_forwarded(p, obj); 87 } 88 } 89 90 void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); } 91 void ShenandoahAssertToSpaceClosure::do_oop(oop* p) { do_oop_work(p); } 569 } 570 }; 571 572 void ShenandoahHeap::post_initialize() { 573 CollectedHeap::post_initialize(); 574 MutexLocker ml(Threads_lock); 575 576 ShenandoahInitWorkerGCLABClosure init_gclabs; 577 _workers->threads_do(&init_gclabs); 578 579 // gclab can not be initialized early during VM startup, as it can not determinate its max_size. 580 // Now, we will let WorkGang to initialize gclab when new worker is created. 581 _workers->set_initialize_gclab(); 582 583 _scm->initialize(_max_workers); 584 _full_gc->initialize(_gc_timer); 585 586 ref_processing_init(); 587 588 _heuristics->initialize(); 589 590 JFR_ONLY(ShenandoahJFRSupport::register_jfr_type_serializers()); 591 } 592 593 size_t ShenandoahHeap::used() const { 594 return OrderAccess::load_acquire(&_used); 595 } 596 597 size_t ShenandoahHeap::committed() const { 598 OrderAccess::acquire(); 599 return _committed; 600 } 601 602 void ShenandoahHeap::increase_committed(size_t bytes) { 603 assert_heaplock_or_safepoint(); 604 _committed += bytes; 605 } 606 607 void ShenandoahHeap::decrease_committed(size_t bytes) { 608 assert_heaplock_or_safepoint(); 609 _committed -= bytes; 610 } |