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 73 #include "memory/metaspace.hpp" 74 #include "oops/compressedOops.inline.hpp" 75 #include "runtime/globals.hpp" 76 #include "runtime/interfaceSupport.inline.hpp" 77 #include "runtime/safepointMechanism.hpp" 78 #include "runtime/vmThread.hpp" 79 #include "services/mallocTracker.hpp" 80 81 #ifdef ASSERT 82 template <class T> 83 void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) { 84 T o = RawAccess<>::oop_load(p); 85 if (! CompressedOops::is_null(o)) { 86 oop obj = CompressedOops::decode_not_null(o); 87 shenandoah_assert_not_forwarded(p, obj); 88 } 89 } 90 91 void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); } 92 void ShenandoahAssertToSpaceClosure::do_oop(oop* p) { do_oop_work(p); } 570 } 571 }; 572 573 void ShenandoahHeap::post_initialize() { 574 CollectedHeap::post_initialize(); 575 MutexLocker ml(Threads_lock); 576 577 ShenandoahInitWorkerGCLABClosure init_gclabs; 578 _workers->threads_do(&init_gclabs); 579 580 // gclab can not be initialized early during VM startup, as it can not determinate its max_size. 581 // Now, we will let WorkGang to initialize gclab when new worker is created. 582 _workers->set_initialize_gclab(); 583 584 _scm->initialize(_max_workers); 585 _full_gc->initialize(_gc_timer); 586 587 ref_processing_init(); 588 589 _heuristics->initialize(); 590 591 JFR_ONLY(ShenandoahJFRSupport::register_jfr_type_serializers()); 592 } 593 594 size_t ShenandoahHeap::used() const { 595 return OrderAccess::load_acquire(&_used); 596 } 597 598 size_t ShenandoahHeap::committed() const { 599 OrderAccess::acquire(); 600 return _committed; 601 } 602 603 void ShenandoahHeap::increase_committed(size_t bytes) { 604 assert_heaplock_or_safepoint(); 605 _committed += bytes; 606 } 607 608 void ShenandoahHeap::decrease_committed(size_t bytes) { 609 assert_heaplock_or_safepoint(); 610 _committed -= bytes; 611 } |