Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 526:818efdefcc99
6484956: G1: improve evacuation pause efficiency
Summary: A bunch of performance optimizations to decrease GC pause times in G1.
Reviewed-by: apetrusenko, jmasa, iveresov
author | tonyp |
---|---|
date | Fri, 16 Jan 2009 13:02:20 -0500 |
parents | 65de26b5ea82 |
children | 58054a18d735 |
comparison
equal
deleted
inserted
replaced
519:65de26b5ea82 | 526:818efdefcc99 |
---|---|
245 | 245 |
246 // Summary information about popular objects; method to print it. | 246 // Summary information about popular objects; method to print it. |
247 NumberSeq _pop_obj_rc_at_copy; | 247 NumberSeq _pop_obj_rc_at_copy; |
248 void print_popularity_summary_info() const; | 248 void print_popularity_summary_info() const; |
249 | 249 |
250 // This is used for a quick test on whether a reference points into | |
251 // the collection set or not. Basically, we have an array, with one | |
252 // byte per region, and that byte denotes whether the corresponding | |
253 // region is in the collection set or not. The entry corresponding | |
254 // the bottom of the heap, i.e., region 0, is pointed to by | |
255 // _in_cset_fast_test_base. The _in_cset_fast_test field has been | |
256 // biased so that it actually points to address 0 of the address | |
257 // space, to make the test as fast as possible (we can simply shift | |
258 // the address to address into it, instead of having to subtract the | |
259 // bottom of the heap from the address before shifting it; basically | |
260 // it works in the same way the card table works). | |
261 bool* _in_cset_fast_test; | |
262 | |
263 // The allocated array used for the fast test on whether a reference | |
264 // points into the collection set or not. This field is also used to | |
265 // free the array. | |
266 bool* _in_cset_fast_test_base; | |
267 | |
268 // The length of the _in_cset_fast_test_base array. | |
269 size_t _in_cset_fast_test_length; | |
270 | |
250 volatile unsigned _gc_time_stamp; | 271 volatile unsigned _gc_time_stamp; |
251 | 272 |
252 size_t* _surviving_young_words; | 273 size_t* _surviving_young_words; |
253 | 274 |
254 void setup_surviving_young_words(); | 275 void setup_surviving_young_words(); |
365 virtual void expand(size_t expand_bytes); | 386 virtual void expand(size_t expand_bytes); |
366 | 387 |
367 // Do anything common to GC's. | 388 // Do anything common to GC's. |
368 virtual void gc_prologue(bool full); | 389 virtual void gc_prologue(bool full); |
369 virtual void gc_epilogue(bool full); | 390 virtual void gc_epilogue(bool full); |
391 | |
392 // We register a region with the fast "in collection set" test. We | |
393 // simply set to true the array slot corresponding to this region. | |
394 void register_region_with_in_cset_fast_test(HeapRegion* r) { | |
395 assert(_in_cset_fast_test_base != NULL, "sanity"); | |
396 assert(r->in_collection_set(), "invariant"); | |
397 int index = r->hrs_index(); | |
398 assert(0 <= (size_t) index && (size_t) index < _in_cset_fast_test_length, | |
399 "invariant"); | |
400 assert(!_in_cset_fast_test_base[index], "invariant"); | |
401 _in_cset_fast_test_base[index] = true; | |
402 } | |
403 | |
404 // This is a fast test on whether a reference points into the | |
405 // collection set or not. It does not assume that the reference | |
406 // points into the heap; if it doesn't, it will return false. | |
407 bool in_cset_fast_test(oop obj) { | |
408 assert(_in_cset_fast_test != NULL, "sanity"); | |
409 if (_g1_committed.contains((HeapWord*) obj)) { | |
410 // no need to subtract the bottom of the heap from obj, | |
411 // _in_cset_fast_test is biased | |
412 size_t index = ((size_t) obj) >> HeapRegion::LogOfHRGrainBytes; | |
413 bool ret = _in_cset_fast_test[index]; | |
414 // let's make sure the result is consistent with what the slower | |
415 // test returns | |
416 assert( ret || !obj_in_cs(obj), "sanity"); | |
417 assert(!ret || obj_in_cs(obj), "sanity"); | |
418 return ret; | |
419 } else { | |
420 return false; | |
421 } | |
422 } | |
370 | 423 |
371 protected: | 424 protected: |
372 | 425 |
373 // Shrink the garbage-first heap by at most the given size (in bytes!). | 426 // Shrink the garbage-first heap by at most the given size (in bytes!). |
374 // (Rounds down to a HeapRegion boundary.) | 427 // (Rounds down to a HeapRegion boundary.) |