33
34
35 const char* ShenandoahGlobalGeneration::name() const {
36 return type() == NON_GEN ? "" : "Global";
37 }
38
39 size_t ShenandoahGlobalGeneration::max_capacity() const {
40 return ShenandoahHeap::heap()->max_capacity();
41 }
42
43 size_t ShenandoahGlobalGeneration::used_regions() const {
44 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
45 assert(heap->mode()->is_generational(), "Region usage accounting is only for generational mode");
46 return heap->old_generation()->used_regions() + heap->young_generation()->used_regions();
47 }
48
49 size_t ShenandoahGlobalGeneration::used_regions_size() const {
50 return ShenandoahHeap::heap()->capacity();
51 }
52
53 size_t ShenandoahGlobalGeneration::soft_max_capacity() const {
54 return ShenandoahHeap::heap()->soft_max_capacity();
55 }
56
57 size_t ShenandoahGlobalGeneration::available() const {
58 // The collector reserve may eat into what the mutator is allowed to use. Make sure we are looking
59 // at what is available to the mutator when reporting how much memory is available.
60 size_t available = this->ShenandoahGeneration::available();
61 return MIN2(available, ShenandoahHeap::heap()->free_set()->available());
62 }
63
64 size_t ShenandoahGlobalGeneration::soft_available() const {
65 size_t available = this->available();
66
67 // Make sure the code below treats available without the soft tail.
68 assert(max_capacity() >= soft_max_capacity(), "Max capacity must be greater than soft max capacity.");
69 size_t soft_tail = max_capacity() - soft_max_capacity();
70 return (available > soft_tail) ? (available - soft_tail) : 0;
71 }
72
73 void ShenandoahGlobalGeneration::set_concurrent_mark_in_progress(bool in_progress) {
74 ShenandoahHeap* heap = ShenandoahHeap::heap();
75 if (in_progress && heap->mode()->is_generational()) {
76 // Global collection has preempted an old generation mark. This is fine
77 // because the global generation includes the old generation, but we
78 // want the global collect to start from a clean slate and we don't want
79 // any stale state in the old generation.
80 assert(!heap->is_concurrent_old_mark_in_progress(), "Old cycle should not be running.");
81 }
82
83 heap->set_concurrent_young_mark_in_progress(in_progress);
84 }
85
86 bool ShenandoahGlobalGeneration::contains(ShenandoahAffiliation affiliation) const {
87 return true;
88 }
89
|
33
34
35 const char* ShenandoahGlobalGeneration::name() const {
36 return type() == NON_GEN ? "" : "Global";
37 }
38
39 size_t ShenandoahGlobalGeneration::max_capacity() const {
40 return ShenandoahHeap::heap()->max_capacity();
41 }
42
43 size_t ShenandoahGlobalGeneration::used_regions() const {
44 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
45 assert(heap->mode()->is_generational(), "Region usage accounting is only for generational mode");
46 return heap->old_generation()->used_regions() + heap->young_generation()->used_regions();
47 }
48
49 size_t ShenandoahGlobalGeneration::used_regions_size() const {
50 return ShenandoahHeap::heap()->capacity();
51 }
52
53 size_t ShenandoahGlobalGeneration::available() const {
54 // The collector reserve may eat into what the mutator is allowed to use. Make sure we are looking
55 // at what is available to the mutator when reporting how much memory is available.
56 size_t available = this->ShenandoahGeneration::available();
57 return MIN2(available, ShenandoahHeap::heap()->free_set()->available());
58 }
59
60 size_t ShenandoahGlobalGeneration::soft_available() const {
61 size_t available = this->available();
62
63 // Make sure the code below treats available without the soft tail.
64 assert(max_capacity() >= ShenandoahHeap::heap()->soft_max_capacity(), "Max capacity must be greater than soft max capacity.");
65 size_t soft_tail = max_capacity() - ShenandoahHeap::heap()->soft_max_capacity();
66 return (available > soft_tail) ? (available - soft_tail) : 0;
67 }
68
69 void ShenandoahGlobalGeneration::set_concurrent_mark_in_progress(bool in_progress) {
70 ShenandoahHeap* heap = ShenandoahHeap::heap();
71 if (in_progress && heap->mode()->is_generational()) {
72 // Global collection has preempted an old generation mark. This is fine
73 // because the global generation includes the old generation, but we
74 // want the global collect to start from a clean slate and we don't want
75 // any stale state in the old generation.
76 assert(!heap->is_concurrent_old_mark_in_progress(), "Old cycle should not be running.");
77 }
78
79 heap->set_concurrent_young_mark_in_progress(in_progress);
80 }
81
82 bool ShenandoahGlobalGeneration::contains(ShenandoahAffiliation affiliation) const {
83 return true;
84 }
85
|