< prev index next >
src/share/vm/gc/g1/g1CollectionSet.cpp
Print this page
*** 394,403 ****
--- 394,414 ----
phase_times()->record_young_cset_choice_time_ms((young_end_time_sec - young_start_time_sec) * 1000.0);
return time_remaining_ms;
}
+ static int compare_region_idx(const void *a, const void*b) {
+ uint const first = *(uint*)a;
+ uint const second = *(uint*)b;
+ assert(first != second, "Two regions with the same index %u in the collection set", first);
+ if (first > second) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+
void G1CollectionSet::finalize_old_part(double time_remaining_ms) {
double non_young_start_time_sec = os::elapsedTime();
double predicted_old_time_ms = 0.0;
if (!collector_state()->gcs_are_young()) {
*** 491,500 ****
--- 502,513 ----
log_debug(gc, ergo, cset)("Finish choosing CSet. old: %u regions, predicted old region time: %1.2fms, time remaining: %1.2f",
old_region_length(), predicted_old_time_ms, time_remaining_ms);
double non_young_end_time_sec = os::elapsedTime();
phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0);
+
+ qsort(_collection_set_regions, _collection_set_cur_length, sizeof(uint), compare_region_idx);
}
#ifdef ASSERT
class G1VerifyYoungCSetIndicesClosure : public HeapRegionClosure {
private:
< prev index next >