1 /* |
1 /* |
2 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
35 // A memory pool can belong to the heap or the non-heap memory. |
35 // A memory pool can belong to the heap or the non-heap memory. |
36 // A Java virtual machine may also have memory pools belonging to |
36 // A Java virtual machine may also have memory pools belonging to |
37 // both heap and non-heap memory. |
37 // both heap and non-heap memory. |
38 |
38 |
39 // Forward declaration |
39 // Forward declaration |
40 class CompactibleFreeListSpace; |
|
41 class ContiguousSpace; |
|
42 class MemoryManager; |
40 class MemoryManager; |
43 class SensorInfo; |
41 class SensorInfo; |
44 class Generation; |
|
45 class DefNewGeneration; |
|
46 class ThresholdSupport; |
42 class ThresholdSupport; |
47 |
43 |
48 class MemoryPool : public CHeapObj<mtInternal> { |
44 class MemoryPool : public CHeapObj<mtInternal> { |
49 friend class MemoryManager; |
45 friend class MemoryManager; |
50 public: |
46 public: |
142 void oops_do(OopClosure* f); |
138 void oops_do(OopClosure* f); |
143 }; |
139 }; |
144 |
140 |
145 class CollectedMemoryPool : public MemoryPool { |
141 class CollectedMemoryPool : public MemoryPool { |
146 public: |
142 public: |
147 CollectedMemoryPool(const char* name, PoolType type, size_t init_size, size_t max_size, bool support_usage_threshold) : |
143 CollectedMemoryPool(const char* name, size_t init_size, size_t max_size, bool support_usage_threshold) : |
148 MemoryPool(name, type, init_size, max_size, support_usage_threshold, true) {}; |
144 MemoryPool(name, MemoryPool::Heap, init_size, max_size, support_usage_threshold, true) {}; |
149 bool is_collected_pool() { return true; } |
145 bool is_collected_pool() { return true; } |
150 }; |
|
151 |
|
152 class ContiguousSpacePool : public CollectedMemoryPool { |
|
153 private: |
|
154 ContiguousSpace* _space; |
|
155 |
|
156 public: |
|
157 ContiguousSpacePool(ContiguousSpace* space, const char* name, PoolType type, size_t max_size, bool support_usage_threshold); |
|
158 |
|
159 ContiguousSpace* space() { return _space; } |
|
160 MemoryUsage get_memory_usage(); |
|
161 size_t used_in_bytes(); |
|
162 }; |
|
163 |
|
164 class SurvivorContiguousSpacePool : public CollectedMemoryPool { |
|
165 private: |
|
166 DefNewGeneration* _young_gen; |
|
167 |
|
168 public: |
|
169 SurvivorContiguousSpacePool(DefNewGeneration* young_gen, |
|
170 const char* name, |
|
171 PoolType type, |
|
172 size_t max_size, |
|
173 bool support_usage_threshold); |
|
174 |
|
175 MemoryUsage get_memory_usage(); |
|
176 |
|
177 size_t used_in_bytes(); |
|
178 size_t committed_in_bytes(); |
|
179 }; |
|
180 |
|
181 #if INCLUDE_ALL_GCS |
|
182 class CompactibleFreeListSpacePool : public CollectedMemoryPool { |
|
183 private: |
|
184 CompactibleFreeListSpace* _space; |
|
185 public: |
|
186 CompactibleFreeListSpacePool(CompactibleFreeListSpace* space, |
|
187 const char* name, |
|
188 PoolType type, |
|
189 size_t max_size, |
|
190 bool support_usage_threshold); |
|
191 |
|
192 MemoryUsage get_memory_usage(); |
|
193 size_t used_in_bytes(); |
|
194 }; |
|
195 #endif // INCLUDE_ALL_GCS |
|
196 |
|
197 |
|
198 class GenerationPool : public CollectedMemoryPool { |
|
199 private: |
|
200 Generation* _gen; |
|
201 public: |
|
202 GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold); |
|
203 |
|
204 MemoryUsage get_memory_usage(); |
|
205 size_t used_in_bytes(); |
|
206 }; |
146 }; |
207 |
147 |
208 class CodeHeapPool: public MemoryPool { |
148 class CodeHeapPool: public MemoryPool { |
209 private: |
149 private: |
210 CodeHeap* _codeHeap; |
150 CodeHeap* _codeHeap; |