Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @ 113:ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author | coleenp |
---|---|
date | Sun, 13 Apr 2008 17:43:42 -0400 |
parents | a61af66fc99e |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
110:a49a647afe9a | 113:ba764ed4b6f2 |
---|---|
31 | 31 |
32 // It would be better if these types could be kept local to the .cpp file, | 32 // It would be better if these types could be kept local to the .cpp file, |
33 // but they must be here to allow ParScanClosure::do_oop_work to be defined | 33 // but they must be here to allow ParScanClosure::do_oop_work to be defined |
34 // in genOopClosures.inline.hpp. | 34 // in genOopClosures.inline.hpp. |
35 | 35 |
36 | |
37 typedef OopTaskQueue ObjToScanQueue; | 36 typedef OopTaskQueue ObjToScanQueue; |
38 typedef OopTaskQueueSet ObjToScanQueueSet; | 37 typedef OopTaskQueueSet ObjToScanQueueSet; |
39 | 38 |
40 // Enable this to get push/pop/steal stats. | 39 // Enable this to get push/pop/steal stats. |
41 const int PAR_STATS_ENABLED = 0; | 40 const int PAR_STATS_ENABLED = 0; |
42 | 41 |
43 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure { | 42 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure { |
43 private: | |
44 ParScanWeakRefClosure* _par_cl; | 44 ParScanWeakRefClosure* _par_cl; |
45 protected: | |
46 template <class T> void do_oop_work(T* p); | |
45 public: | 47 public: |
46 ParKeepAliveClosure(ParScanWeakRefClosure* cl); | 48 ParKeepAliveClosure(ParScanWeakRefClosure* cl); |
47 void do_oop(oop* p); | 49 virtual void do_oop(oop* p); |
50 virtual void do_oop(narrowOop* p); | |
48 }; | 51 }; |
49 | 52 |
50 // The state needed by thread performing parallel young-gen collection. | 53 // The state needed by thread performing parallel young-gen collection. |
51 class ParScanThreadState { | 54 class ParScanThreadState { |
52 friend class ParScanThreadStateSet; | 55 friend class ParScanThreadStateSet; |
56 private: | |
53 ObjToScanQueue *_work_queue; | 57 ObjToScanQueue *_work_queue; |
54 | 58 |
55 ParGCAllocBuffer _to_space_alloc_buffer; | 59 ParGCAllocBuffer _to_space_alloc_buffer; |
56 | 60 |
57 ParScanWithoutBarrierClosure _to_space_closure; // scan_without_gc_barrier | 61 ParScanWithoutBarrierClosure _to_space_closure; // scan_without_gc_barrier |
109 ParScanThreadState(Space* to_space_, ParNewGeneration* gen_, | 113 ParScanThreadState(Space* to_space_, ParNewGeneration* gen_, |
110 Generation* old_gen_, int thread_num_, | 114 Generation* old_gen_, int thread_num_, |
111 ObjToScanQueueSet* work_queue_set_, size_t desired_plab_sz_, | 115 ObjToScanQueueSet* work_queue_set_, size_t desired_plab_sz_, |
112 ParallelTaskTerminator& term_); | 116 ParallelTaskTerminator& term_); |
113 | 117 |
114 public: | 118 public: |
115 ageTable* age_table() {return &_ageTable;} | 119 ageTable* age_table() {return &_ageTable;} |
116 | 120 |
117 ObjToScanQueue* work_queue() { return _work_queue; } | 121 ObjToScanQueue* work_queue() { return _work_queue; } |
118 | 122 |
119 ParGCAllocBuffer* to_space_alloc_buffer() { | 123 ParGCAllocBuffer* to_space_alloc_buffer() { |
193 double term_time() { return _term_time; } | 197 double term_time() { return _term_time; } |
194 | 198 |
195 double elapsed() { | 199 double elapsed() { |
196 return os::elapsedTime() - _start; | 200 return os::elapsedTime() - _start; |
197 } | 201 } |
198 | |
199 }; | 202 }; |
200 | 203 |
201 class ParNewGenTask: public AbstractGangTask { | 204 class ParNewGenTask: public AbstractGangTask { |
202 ParNewGeneration* _gen; | 205 private: |
203 Generation* _next_gen; | 206 ParNewGeneration* _gen; |
204 HeapWord* _young_old_boundary; | 207 Generation* _next_gen; |
208 HeapWord* _young_old_boundary; | |
205 class ParScanThreadStateSet* _state_set; | 209 class ParScanThreadStateSet* _state_set; |
206 | 210 |
207 public: | 211 public: |
208 ParNewGenTask(ParNewGeneration* gen, | 212 ParNewGenTask(ParNewGeneration* gen, |
209 Generation* next_gen, | 213 Generation* next_gen, |
214 | 218 |
215 void work(int i); | 219 void work(int i); |
216 }; | 220 }; |
217 | 221 |
218 class KeepAliveClosure: public DefNewGeneration::KeepAliveClosure { | 222 class KeepAliveClosure: public DefNewGeneration::KeepAliveClosure { |
223 protected: | |
224 template <class T> void do_oop_work(T* p); | |
219 public: | 225 public: |
220 KeepAliveClosure(ScanWeakRefClosure* cl); | 226 KeepAliveClosure(ScanWeakRefClosure* cl); |
221 void do_oop(oop* p); | 227 virtual void do_oop(oop* p); |
228 virtual void do_oop(narrowOop* p); | |
222 }; | 229 }; |
223 | 230 |
224 class EvacuateFollowersClosureGeneral: public VoidClosure { | 231 class EvacuateFollowersClosureGeneral: public VoidClosure { |
225 GenCollectedHeap* _gch; | 232 private: |
226 int _level; | 233 GenCollectedHeap* _gch; |
227 OopsInGenClosure* _scan_cur_or_nonheap; | 234 int _level; |
228 OopsInGenClosure* _scan_older; | 235 OopsInGenClosure* _scan_cur_or_nonheap; |
229 public: | 236 OopsInGenClosure* _scan_older; |
230 EvacuateFollowersClosureGeneral(GenCollectedHeap* gch, int level, | 237 public: |
231 OopsInGenClosure* cur, | 238 EvacuateFollowersClosureGeneral(GenCollectedHeap* gch, int level, |
232 OopsInGenClosure* older); | 239 OopsInGenClosure* cur, |
233 void do_void(); | 240 OopsInGenClosure* older); |
241 virtual void do_void(); | |
234 }; | 242 }; |
235 | 243 |
236 // Closure for scanning ParNewGeneration. | 244 // Closure for scanning ParNewGeneration. |
237 // Same as ScanClosure, except does parallel GC barrier. | 245 // Same as ScanClosure, except does parallel GC barrier. |
238 class ScanClosureWithParBarrier: public ScanClosure { | 246 class ScanClosureWithParBarrier: public ScanClosure { |
239 public: | 247 protected: |
248 template <class T> void do_oop_work(T* p); | |
249 public: | |
240 ScanClosureWithParBarrier(ParNewGeneration* g, bool gc_barrier); | 250 ScanClosureWithParBarrier(ParNewGeneration* g, bool gc_barrier); |
241 void do_oop(oop* p); | 251 virtual void do_oop(oop* p); |
252 virtual void do_oop(narrowOop* p); | |
242 }; | 253 }; |
243 | 254 |
244 // Implements AbstractRefProcTaskExecutor for ParNew. | 255 // Implements AbstractRefProcTaskExecutor for ParNew. |
245 class ParNewRefProcTaskExecutor: public AbstractRefProcTaskExecutor { | 256 class ParNewRefProcTaskExecutor: public AbstractRefProcTaskExecutor { |
246 public: | 257 private: |
247 | 258 ParNewGeneration& _generation; |
259 ParScanThreadStateSet& _state_set; | |
260 public: | |
248 ParNewRefProcTaskExecutor(ParNewGeneration& generation, | 261 ParNewRefProcTaskExecutor(ParNewGeneration& generation, |
249 ParScanThreadStateSet& state_set) | 262 ParScanThreadStateSet& state_set) |
250 : _generation(generation), _state_set(state_set) | 263 : _generation(generation), _state_set(state_set) |
251 { } | 264 { } |
252 | 265 |
253 // Executes a task using worker threads. | 266 // Executes a task using worker threads. |
254 virtual void execute(ProcessTask& task); | 267 virtual void execute(ProcessTask& task); |
255 virtual void execute(EnqueueTask& task); | 268 virtual void execute(EnqueueTask& task); |
256 // Switch to single threaded mode. | 269 // Switch to single threaded mode. |
257 virtual void set_single_threaded_mode(); | 270 virtual void set_single_threaded_mode(); |
258 private: | |
259 ParNewGeneration& _generation; | |
260 ParScanThreadStateSet& _state_set; | |
261 }; | 271 }; |
262 | 272 |
263 | 273 |
264 // A Generation that does parallel young-gen collection. | 274 // A Generation that does parallel young-gen collection. |
265 | 275 |
267 friend class ParNewGenTask; | 277 friend class ParNewGenTask; |
268 friend class ParNewRefProcTask; | 278 friend class ParNewRefProcTask; |
269 friend class ParNewRefProcTaskExecutor; | 279 friend class ParNewRefProcTaskExecutor; |
270 friend class ParScanThreadStateSet; | 280 friend class ParScanThreadStateSet; |
271 | 281 |
282 private: | |
272 // XXX use a global constant instead of 64! | 283 // XXX use a global constant instead of 64! |
273 struct ObjToScanQueuePadded { | 284 struct ObjToScanQueuePadded { |
274 ObjToScanQueue work_queue; | 285 ObjToScanQueue work_queue; |
275 char pad[64 - sizeof(ObjToScanQueue)]; // prevent false sharing | 286 char pad[64 - sizeof(ObjToScanQueue)]; // prevent false sharing |
276 }; | 287 }; |
312 | 323 |
313 // Adjust the tenuring threshold. See the implementation for | 324 // Adjust the tenuring threshold. See the implementation for |
314 // the details of the policy. | 325 // the details of the policy. |
315 virtual void adjust_desired_tenuring_threshold(); | 326 virtual void adjust_desired_tenuring_threshold(); |
316 | 327 |
317 public: | 328 public: |
318 ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level); | 329 ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level); |
319 | 330 |
320 ~ParNewGeneration() { | 331 ~ParNewGeneration() { |
321 for (uint i = 0; i < ParallelGCThreads; i++) | 332 for (uint i = 0; i < ParallelGCThreads; i++) |
322 delete _task_queues->queue(i); | 333 delete _task_queues->queue(i); |