< prev index next >
src/share/vm/gc/g1/g1CollectionSet.hpp
Print this page
rev 11545 : [mq]: 8159978-collection-set-as-array
rev 11546 : [mq]: 8159978-erikh-review
@@ -45,14 +45,14 @@
uint _eden_region_length;
uint _survivor_region_length;
uint _old_region_length;
- // The head of the list (via "next_in_collection_set()") representing the
- // current collection set. Set from the incrementally built collection
- // set at the start of the pause.
- HeapRegion* _head;
+ // The actual collection set as a set of region indices.
+ uint* _collection_set_regions;
+ volatile size_t _collection_set_cur_length;
+ size_t _collection_set_max_length;
// The number of bytes in the collection set before the pause. Set from
// the incrementally built collection set at the start of an evacuation
// pause, and incremented in finalize_old_part() when adding old regions
// (if any) to the collection set.
@@ -69,16 +69,10 @@
Inactive // We are not actively building the collection set
};
CSetBuildType _inc_build_state;
- // The head of the incrementally built collection set.
- HeapRegion* _inc_head;
-
- // The tail of the incrementally built collection set.
- HeapRegion* _inc_tail;
-
// The number of bytes in the incrementally built collection set.
// Used to set _collection_set_bytes_used_before at the start of
// an evacuation pause.
size_t _inc_bytes_used_before;
@@ -103,22 +97,23 @@
double _inc_predicted_elapsed_time_ms;
// See the comment for _inc_recorded_rs_lengths_diffs.
double _inc_predicted_elapsed_time_ms_diffs;
- uint _inc_region_length;
-
G1CollectorState* collector_state();
G1GCPhaseTimes* phase_times();
double predict_region_elapsed_time_ms(HeapRegion* hr);
void verify_young_cset_indices() const NOT_DEBUG_RETURN;
public:
G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy);
~G1CollectionSet();
+ // Set the maximum possible length of the collection set.
+ void set_max_length(uint max_region_length);
+
CollectionSetChooser* cset_chooser();
void init_region_lengths(uint eden_cset_region_length,
uint survivor_cset_region_length);
@@ -131,39 +126,36 @@
uint eden_region_length() const { return _eden_region_length; }
uint survivor_region_length() const { return _survivor_region_length; }
uint old_region_length() const { return _old_region_length; }
- // Incremental CSet Support
-
- // The head of the incrementally built collection set.
- HeapRegion* inc_head() { return _inc_head; }
-
- // The tail of the incrementally built collection set.
- HeapRegion* inc_tail() { return _inc_tail; }
+ // Incremental collection set support
// Initialize incremental collection set info.
void start_incremental_building();
- // Perform any final calculations on the incremental CSet fields
+ // Perform any final calculations on the incremental collection set fields
// before we can use them.
void finalize_incremental_building();
- void clear_incremental() {
- _inc_head = NULL;
- _inc_tail = NULL;
- _inc_region_length = 0;
- }
-
- // Stop adding regions to the incremental collection set
- void stop_incremental_building() { _inc_build_state = Inactive; }
+ // Reset the contents of the collection set.
+ void clear();
- // The head of the list (via "next_in_collection_set()") representing the
- // current collection set.
- HeapRegion* head() { return _head; }
+ // Iterate over the collection set, applying the given HeapRegionClosure on all of them.
+ // If may_be_aborted is true, iteration may be aborted using the return value of the
+ // called closure method.
+ void iterate(HeapRegionClosure* cl, bool may_be_aborted = false);
+
+ // Iterate over the collection set, applying the given HeapRegionClosure on all of them,
+ // trying to optimally spread out starting position of total_workers workers given the
+ // caller's worker_id.
+ // If may_be_aborted is true, iteration may be aborted using the return value of the
+ // called closure method.
+ void iterate_from(HeapRegionClosure* cl, uint worker_id, uint total_workers, bool may_be_aborted = false);
- void clear_head() { _head = NULL; }
+ // Stop adding regions to the incremental collection set.
+ void stop_incremental_building() { _inc_build_state = Inactive; }
size_t recorded_rs_lengths() { return _recorded_rs_lengths; }
size_t bytes_used_before() const {
return _bytes_used_before;
@@ -172,36 +164,35 @@
void reset_bytes_used_before() {
_bytes_used_before = 0;
}
// Choose a new collection set. Marks the chosen regions as being
- // "in_collection_set", and links them together. The head and number of
- // the collection set are available via access methods.
+ // "in_collection_set".
double finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors);
void finalize_old_part(double time_remaining_ms);
- // Add old region "hr" to the CSet.
+ // Add old region "hr" to the collection set.
void add_old_region(HeapRegion* hr);
// Update information about hr in the aggregated information for
// the incrementally built collection set.
void update_young_region_prediction(HeapRegion* hr, size_t new_rs_length);
- // Add hr to the LHS of the incremental collection set.
+ // Add eden region to the collection set.
void add_eden_region(HeapRegion* hr);
- // Add hr to the RHS of the incremental collection set.
+ // Add survivor region to the collection set.
void add_survivor_regions(HeapRegion* hr);
#ifndef PRODUCT
- void print(HeapRegion* list_head, outputStream* st);
+ bool verify_young_ages();
+
+ void print(outputStream* st);
#endif // !PRODUCT
private:
- // Update the incremental cset information when adding a region
- // (should not be called directly).
+ // Update the incremental collection set information when adding a region.
void add_young_region_common(HeapRegion* hr);
-
};
#endif // SHARE_VM_GC_G1_G1COLLECTIONSET_HPP
< prev index next >