< prev index next >

src/share/vm/gc/g1/g1CollectionSet.cpp

Print this page

        

*** 57,72 **** --- 57,74 ---- _survivor_region_length(0), _old_region_length(0), _head(NULL), _bytes_used_before(0), + _bytes_live_before(0), _recorded_rs_lengths(0), // Incremental CSet attributes _inc_build_state(Inactive), _inc_head(NULL), _inc_tail(NULL), _inc_bytes_used_before(0), + _inc_bytes_live_before(0), _inc_recorded_rs_lengths(0), _inc_recorded_rs_lengths_diffs(0), _inc_predicted_elapsed_time_ms(0.0), _inc_predicted_elapsed_time_ms_diffs(0.0) {}
*** 93,102 **** --- 95,105 ---- assert(!hr->in_collection_set(), "should not already be in the CSet"); _g1->register_old_region_with_cset(hr); hr->set_next_in_collection_set(_head); _head = hr; _bytes_used_before += hr->used(); + _bytes_live_before += hr->live_bytes(); size_t rs_length = hr->rem_set()->occupied(); _recorded_rs_lengths += rs_length; _old_region_length += 1; }
*** 105,114 **** --- 108,118 ---- assert(_inc_build_state == Inactive, "Precondition"); _inc_head = NULL; _inc_tail = NULL; _inc_bytes_used_before = 0; + _inc_bytes_live_before = 0; _inc_recorded_rs_lengths = 0; _inc_recorded_rs_lengths_diffs = 0; _inc_predicted_elapsed_time_ms = 0.0; _inc_predicted_elapsed_time_ms_diffs = 0.0;
*** 207,216 **** --- 211,221 ---- size_t used_bytes = hr->used(); _inc_recorded_rs_lengths += rs_length; _inc_predicted_elapsed_time_ms += region_elapsed_time_ms; _inc_bytes_used_before += used_bytes; + _inc_bytes_live_before += hr->live_bytes(); assert(!hr->in_collection_set(), "invariant"); _g1->register_young_region_with_cset(hr); assert(hr->next_in_collection_set() == NULL, "invariant"); }
*** 309,318 **** --- 314,324 ---- // Clear the fields that point to the survivor list - they are all young now. young_list->clear_survivors(); _head = _inc_head; _bytes_used_before = _inc_bytes_used_before; + _bytes_live_before = _inc_bytes_live_before; time_remaining_ms = MAX2(time_remaining_ms - _inc_predicted_elapsed_time_ms, 0.0); log_trace(gc, ergo, cset)("Add young regions to CSet. eden: %u regions, survivors: %u regions, predicted young region time: %1.2fms, target pause time: %1.2fms", eden_region_length, survivor_region_length, _inc_predicted_elapsed_time_ms, target_pause_time_ms);
*** 332,341 **** --- 338,348 ---- if (!collector_state()->gcs_are_young()) { cset_chooser()->verify(); const uint min_old_cset_length = _policy->calc_min_old_cset_length(); const uint max_old_cset_length = _policy->calc_max_old_cset_length(); + const size_t estimated_available_bytes = _policy->available_bytes_estimate(); uint expensive_region_num = 0; bool check_time_remaining = _policy->adaptive_young_list_length(); HeapRegion* hr = cset_chooser()->peek();
*** 360,369 **** --- 367,382 ---- "old %u regions, max %u regions, reclaimable: " SIZE_FORMAT "B (%1.2f%%) threshold: " UINTX_FORMAT "%%", old_region_length(), max_old_cset_length, reclaimable_bytes, reclaimable_perc, G1HeapWastePercent); break; } + // Stop adding regions if the live bytes (according to the last marking) + // added so far would exceed the estimated free bytes. + if ((_bytes_live_before + hr->live_bytes()) > estimated_available_bytes) { + break; + } + double predicted_time_ms = predict_region_elapsed_time_ms(hr); if (check_time_remaining) { if (predicted_time_ms > time_remaining_ms) { // Too expensive for the current CSet.
*** 400,409 **** --- 413,424 ---- hr = cset_chooser()->peek(); } if (hr == NULL) { log_debug(gc, ergo, cset)("Finish adding old regions to CSet (candidate old regions not available)"); + } else if ((_bytes_live_before + hr->live_bytes()) > estimated_available_bytes) { + log_debug(gc, ergo, cset)("Finish adding old regions to CSet (reached estimated free space limit)"); } if (expensive_region_num > 0) { // We print the information once here at the end, predicated on // whether we added any apparently expensive regions or not, to
< prev index next >