Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hotspot/share/gc/g1/g1CollectionSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
_survivor_region_length = survivor_cset_region_length;

assert((size_t) young_region_length() == _collection_set_cur_length,
"Young region length %u should match collection set length " SIZE_FORMAT, young_region_length(), _collection_set_cur_length);
"Young region length %u should match collection set length %u", young_region_length(), _collection_set_cur_length);

_old_region_length = 0;
free_optional_regions();
Expand Down Expand Up @@ -130,8 +130,8 @@ void G1CollectionSet::add_old_region(HeapRegion* hr) {
assert(!hr->in_collection_set(), "should not already be in the collection set");
_g1h->register_old_region_with_region_attr(hr);

assert(_collection_set_cur_length < _collection_set_max_length, "Collection set now larger than maximum size.");
_collection_set_regions[_collection_set_cur_length++] = hr->hrm_index();
assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set now larger than maximum size.");

_bytes_used_before += hr->used();
_recorded_rs_length += hr->rem_set()->occupied();
Expand All @@ -153,7 +153,7 @@ void G1CollectionSet::start_incremental_building() {
assert(_collection_set_cur_length == 0, "Collection set must be empty before starting a new collection set.");
assert(_inc_build_state == Inactive, "Precondition");
#ifdef ASSERT
for (size_t i = 0; i < _collection_set_max_length; i++) {
for (uint i = 0; i < _collection_set_max_length; i++) {
_inc_collection_set_stats[i].reset();
}
#endif
Expand Down Expand Up @@ -326,15 +326,15 @@ void G1CollectionSet::add_young_region_common(HeapRegion* hr) {

// We use UINT_MAX as "invalid" marker in verification.
assert(_collection_set_cur_length < (UINT_MAX - 1),
"Collection set is too large with " SIZE_FORMAT " entries", _collection_set_cur_length);
hr->set_young_index_in_cset((uint)_collection_set_cur_length + 1);
"Collection set is too large with %u entries", _collection_set_cur_length);
hr->set_young_index_in_cset(_collection_set_cur_length + 1);

assert(_collection_set_cur_length < _collection_set_max_length, "Collection set larger than maximum allowed.");
_collection_set_regions[_collection_set_cur_length] = hr->hrm_index();
// Concurrent readers must observe the store of the value in the array before an
// update to the length field.
OrderAccess::storestore();
_collection_set_cur_length++;
assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set larger than maximum allowed.");
}

void G1CollectionSet::add_survivor_regions(HeapRegion* hr) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1CollectionSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class G1CollectionSet {
// concurrent readers. This means we are good with using storestore and loadload
// barriers on the writer and reader respectively only.
uint* _collection_set_regions;
volatile size_t _collection_set_cur_length;
size_t _collection_set_max_length;
volatile uint _collection_set_cur_length;
uint _collection_set_max_length;

// When doing mixed collections we can add old regions to the collection set, which
// will be collected only if there is enough time. We call these optional regions.
Expand Down