45 class GCHeapSummary;
46 class GCTaskManager;
47 class MemoryManager;
48 class MemoryPool;
49 class PSAdaptiveSizePolicy;
50 class PSCardTable;
51 class PSHeapSummary;
52
53 class ParallelScavengeHeap : public CollectedHeap {
54 friend class VMStructs;
55 private:
56 static PSYoungGen* _young_gen;
57 static PSOldGen* _old_gen;
58
59 // Sizing policy for entire heap
60 static PSAdaptiveSizePolicy* _size_policy;
61 static PSGCAdaptivePolicyCounters* _gc_policy_counters;
62
63 GenerationSizer* _collector_policy;
64
65 SoftRefPolicy _soft_ref_policy;
66
67 // Collection of generations that are adjacent in the
68 // space reserved for the heap.
69 AdjoiningGenerations* _gens;
70 unsigned int _death_march_count;
71
72 // The task manager
73 static GCTaskManager* _gc_task_manager;
74
75 GCMemoryManager* _young_manager;
76 GCMemoryManager* _old_manager;
77
78 MemoryPool* _eden_pool;
79 MemoryPool* _survivor_pool;
80 MemoryPool* _old_pool;
81
82 virtual void initialize_serviceability();
83
84 void trace_heap(GCWhen::Type when, const GCTracer* tracer);
85
86 protected:
87 static inline size_t total_invocations();
88 HeapWord* allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size);
89
90 inline bool should_alloc_in_eden(size_t size) const;
91 inline void death_march_check(HeapWord* const result, size_t size);
92 HeapWord* mem_allocate_old_gen(size_t size);
93
94 public:
95 ParallelScavengeHeap(GenerationSizer* policy) :
96 CollectedHeap(), _collector_policy(policy), _death_march_count(0) { }
97
98 // For use by VM operations
99 enum CollectionType {
100 Scavenge,
101 MarkSweep
102 };
103
104 virtual Name kind() const {
105 return CollectedHeap::Parallel;
106 }
107
108 virtual const char* name() const {
109 return "Parallel";
110 }
111
112 virtual CollectorPolicy* collector_policy() const { return _collector_policy; }
113
114 virtual SoftRefPolicy* soft_ref_policy() { return &_soft_ref_policy; }
115
116 virtual GrowableArray<GCMemoryManager*> memory_managers();
129
130 CardTableBarrierSet* barrier_set();
131 PSCardTable* card_table();
132
133 AdjoiningGenerations* gens() { return _gens; }
134
135 // Returns JNI_OK on success
136 virtual jint initialize();
137
138 void post_initialize();
139 void update_counters();
140
141 // The alignment used for the various areas
142 size_t space_alignment() { return _collector_policy->space_alignment(); }
143 size_t generation_alignment() { return _collector_policy->gen_alignment(); }
144
145 // Return the (conservative) maximum heap alignment
146 static size_t conservative_max_heap_alignment() {
147 return CollectorPolicy::compute_heap_alignment();
148 }
149
150 size_t capacity() const;
151 size_t used() const;
152
153 // Return "true" if all generations have reached the
154 // maximal committed limit that they can reach, without a garbage
155 // collection.
156 virtual bool is_maximal_no_gc() const;
157
158 // Return true if the reference points to an object that
159 // can be moved in a partial collection. For currently implemented
160 // generational collectors that means during a collection of
161 // the young gen.
162 virtual bool is_scavengable(oop obj);
163 virtual void register_nmethod(nmethod* nm);
164 virtual void verify_nmethod(nmethod* nmethod);
165
166 size_t max_capacity() const;
167
168 // Whether p is in the allocated part of the heap
|
45 class GCHeapSummary;
46 class GCTaskManager;
47 class MemoryManager;
48 class MemoryPool;
49 class PSAdaptiveSizePolicy;
50 class PSCardTable;
51 class PSHeapSummary;
52
53 class ParallelScavengeHeap : public CollectedHeap {
54 friend class VMStructs;
55 private:
56 static PSYoungGen* _young_gen;
57 static PSOldGen* _old_gen;
58
59 // Sizing policy for entire heap
60 static PSAdaptiveSizePolicy* _size_policy;
61 static PSGCAdaptivePolicyCounters* _gc_policy_counters;
62
63 GenerationSizer* _collector_policy;
64
65 // is the heap backed by two different memories?
66 bool _is_hetero_heap;
67
68 SoftRefPolicy _soft_ref_policy;
69
70 // Collection of generations that are adjacent in the
71 // space reserved for the heap.
72 AdjoiningGenerations* _gens;
73 unsigned int _death_march_count;
74
75 // The task manager
76 static GCTaskManager* _gc_task_manager;
77
78 GCMemoryManager* _young_manager;
79 GCMemoryManager* _old_manager;
80
81 MemoryPool* _eden_pool;
82 MemoryPool* _survivor_pool;
83 MemoryPool* _old_pool;
84
85 virtual void initialize_serviceability();
86
87 void trace_heap(GCWhen::Type when, const GCTracer* tracer);
88
89 protected:
90 static inline size_t total_invocations();
91 HeapWord* allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size);
92
93 inline bool should_alloc_in_eden(size_t size) const;
94 inline void death_march_check(HeapWord* const result, size_t size);
95 HeapWord* mem_allocate_old_gen(size_t size);
96
97 public:
98 ParallelScavengeHeap(GenerationSizer* policy) :
99 CollectedHeap(), _collector_policy(policy), _is_hetero_heap(false), _death_march_count(0) { }
100
101 // For use by VM operations
102 enum CollectionType {
103 Scavenge,
104 MarkSweep
105 };
106
107 virtual Name kind() const {
108 return CollectedHeap::Parallel;
109 }
110
111 virtual const char* name() const {
112 return "Parallel";
113 }
114
115 virtual CollectorPolicy* collector_policy() const { return _collector_policy; }
116
117 virtual SoftRefPolicy* soft_ref_policy() { return &_soft_ref_policy; }
118
119 virtual GrowableArray<GCMemoryManager*> memory_managers();
132
133 CardTableBarrierSet* barrier_set();
134 PSCardTable* card_table();
135
136 AdjoiningGenerations* gens() { return _gens; }
137
138 // Returns JNI_OK on success
139 virtual jint initialize();
140
141 void post_initialize();
142 void update_counters();
143
144 // The alignment used for the various areas
145 size_t space_alignment() { return _collector_policy->space_alignment(); }
146 size_t generation_alignment() { return _collector_policy->gen_alignment(); }
147
148 // Return the (conservative) maximum heap alignment
149 static size_t conservative_max_heap_alignment() {
150 return CollectorPolicy::compute_heap_alignment();
151 }
152
153 // is the heap backed by two different memories?
154 bool is_hetero_heap() { return _is_hetero_heap; }
155
156 size_t capacity() const;
157 size_t used() const;
158
159 // Return "true" if all generations have reached the
160 // maximal committed limit that they can reach, without a garbage
161 // collection.
162 virtual bool is_maximal_no_gc() const;
163
164 // Return true if the reference points to an object that
165 // can be moved in a partial collection. For currently implemented
166 // generational collectors that means during a collection of
167 // the young gen.
168 virtual bool is_scavengable(oop obj);
169 virtual void register_nmethod(nmethod* nm);
170 virtual void verify_nmethod(nmethod* nmethod);
171
172 size_t max_capacity() const;
173
174 // Whether p is in the allocated part of the heap
|