Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 4727:67fdcb391461
7119027: G1: use atomics to update RS length / predict time of inc CSet
Summary: Make sure that the updates to the RS length and inc CSet predicted time are updated in an MT-safe way.
Reviewed-by: brutisso, iveresov
author | tonyp |
---|---|
date | Wed, 21 Dec 2011 07:53:53 -0500 |
parents | 41406797186b |
children | 1cbe7978b021 |
comparison
equal
deleted
inserted
replaced
4726:d15b458c4225 | 4727:67fdcb391461 |
---|---|
586 size_t _inc_cset_bytes_used_before; | 586 size_t _inc_cset_bytes_used_before; |
587 | 587 |
588 // Used to record the highest end of heap region in collection set | 588 // Used to record the highest end of heap region in collection set |
589 HeapWord* _inc_cset_max_finger; | 589 HeapWord* _inc_cset_max_finger; |
590 | 590 |
591 // The RSet lengths recorded for regions in the collection set | 591 // The RSet lengths recorded for regions in the CSet. It is updated |
592 // (updated by the periodic sampling of the regions in the | 592 // by the thread that adds a new region to the CSet. We assume that |
593 // young list/collection set). | 593 // only one thread can be allocating a new CSet region (currently, |
594 // it does so after taking the Heap_lock) hence no need to | |
595 // synchronize updates to this field. | |
594 size_t _inc_cset_recorded_rs_lengths; | 596 size_t _inc_cset_recorded_rs_lengths; |
595 | 597 |
596 // The predicted elapsed time it will take to collect the regions | 598 // A concurrent refinement thread periodcially samples the young |
597 // in the collection set (updated by the periodic sampling of the | 599 // region RSets and needs to update _inc_cset_recorded_rs_lengths as |
598 // regions in the young list/collection set). | 600 // the RSets grow. Instead of having to syncronize updates to that |
601 // field we accumulate them in this field and add it to | |
602 // _inc_cset_recorded_rs_lengths_diffs at the start of a GC. | |
603 ssize_t _inc_cset_recorded_rs_lengths_diffs; | |
604 | |
605 // The predicted elapsed time it will take to collect the regions in | |
606 // the CSet. This is updated by the thread that adds a new region to | |
607 // the CSet. See the comment for _inc_cset_recorded_rs_lengths about | |
608 // MT-safety assumptions. | |
599 double _inc_cset_predicted_elapsed_time_ms; | 609 double _inc_cset_predicted_elapsed_time_ms; |
610 | |
611 // See the comment for _inc_cset_recorded_rs_lengths_diffs. | |
612 double _inc_cset_predicted_elapsed_time_ms_diffs; | |
600 | 613 |
601 // Stash a pointer to the g1 heap. | 614 // Stash a pointer to the g1 heap. |
602 G1CollectedHeap* _g1; | 615 G1CollectedHeap* _g1; |
603 | 616 |
604 // The ratio of gc time to elapsed time, computed over recent pauses. | 617 // The ratio of gc time to elapsed time, computed over recent pauses. |
892 HeapRegion* inc_set_tail() { return _inc_cset_tail; } | 905 HeapRegion* inc_set_tail() { return _inc_cset_tail; } |
893 | 906 |
894 // Initialize incremental collection set info. | 907 // Initialize incremental collection set info. |
895 void start_incremental_cset_building(); | 908 void start_incremental_cset_building(); |
896 | 909 |
910 // Perform any final calculations on the incremental CSet fields | |
911 // before we can use them. | |
912 void finalize_incremental_cset_building(); | |
913 | |
897 void clear_incremental_cset() { | 914 void clear_incremental_cset() { |
898 _inc_cset_head = NULL; | 915 _inc_cset_head = NULL; |
899 _inc_cset_tail = NULL; | 916 _inc_cset_tail = NULL; |
900 } | 917 } |
901 | 918 |
902 // Stop adding regions to the incremental collection set | 919 // Stop adding regions to the incremental collection set |
903 void stop_incremental_cset_building() { _inc_cset_build_state = Inactive; } | 920 void stop_incremental_cset_building() { _inc_cset_build_state = Inactive; } |
904 | 921 |
905 // Add/remove information about hr to the aggregated information | 922 // Add information about hr to the aggregated information for the |
906 // for the incrementally built collection set. | 923 // incrementally built collection set. |
907 void add_to_incremental_cset_info(HeapRegion* hr, size_t rs_length); | 924 void add_to_incremental_cset_info(HeapRegion* hr, size_t rs_length); |
908 void remove_from_incremental_cset_info(HeapRegion* hr); | |
909 | 925 |
910 // Update information about hr in the aggregated information for | 926 // Update information about hr in the aggregated information for |
911 // the incrementally built collection set. | 927 // the incrementally built collection set. |
912 void update_incremental_cset_info(HeapRegion* hr, size_t new_rs_length); | 928 void update_incremental_cset_info(HeapRegion* hr, size_t new_rs_length); |
913 | 929 |