10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1CollectedHeap.inline.hpp"
27 #include "gc/g1/g1CollectionSet.hpp"
28 #include "gc/g1/g1CollectionSetCandidates.hpp"
29 #include "gc/g1/g1CollectorState.hpp"
30 #include "gc/g1/g1ParScanThreadState.hpp"
31 #include "gc/g1/g1Policy.hpp"
32 #include "gc/g1/heapRegion.inline.hpp"
33 #include "gc/g1/heapRegionRemSet.hpp"
34 #include "gc/g1/heapRegionSet.hpp"
35 #include "logging/logStream.hpp"
36 #include "runtime/orderAccess.hpp"
37 #include "utilities/debug.hpp"
38 #include "utilities/globalDefinitions.hpp"
39 #include "utilities/quickSort.hpp"
40
41 G1CollectorState* G1CollectionSet::collector_state() {
42 return _g1h->collector_state();
43 }
44
45 G1GCPhaseTimes* G1CollectionSet::phase_times() {
46 return _policy->phase_times();
47 }
48
49 double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) {
393 return false;
394 }
395 };
396
397 void G1CollectionSet::print(outputStream* st) {
398 st->print_cr("\nCollection_set:");
399
400 G1PrintCollectionSetDetailClosure cl(st);
401 iterate(&cl);
402 }
403 #endif // !PRODUCT
404
405 double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) {
406 double young_start_time_sec = os::elapsedTime();
407
408 finalize_incremental_building();
409
410 guarantee(target_pause_time_ms > 0.0,
411 "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms);
412
413 size_t pending_cards = _policy->pending_cards_at_gc_start();
414 double base_time_ms = _policy->predict_base_elapsed_time_ms(pending_cards);
415 double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
416
417 log_trace(gc, ergo, cset)("Start choosing CSet. pending cards: " SIZE_FORMAT " predicted base time: %1.2fms remaining time: %1.2fms target pause time: %1.2fms",
418 pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
419
420 // The young list is laid with the survivor regions from the previous
421 // pause are appended to the RHS of the young list, i.e.
422 // [Newly Young Regions ++ Survivors from last pause].
423
424 uint survivor_region_length = survivors->length();
425 uint eden_region_length = _g1h->eden_regions_count();
426 init_region_lengths(eden_region_length, survivor_region_length);
427
428 verify_young_cset_indices();
429
430 // Clear the fields that point to the survivor list - they are all young now.
431 survivors->convert_to_eden();
432
433 _bytes_used_before = _inc_bytes_used_before;
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1CollectedHeap.inline.hpp"
27 #include "gc/g1/g1CollectionSet.hpp"
28 #include "gc/g1/g1CollectionSetCandidates.hpp"
29 #include "gc/g1/g1CollectorState.hpp"
30 #include "gc/g1/g1HotCardCache.hpp"
31 #include "gc/g1/g1ParScanThreadState.hpp"
32 #include "gc/g1/g1Policy.hpp"
33 #include "gc/g1/heapRegion.inline.hpp"
34 #include "gc/g1/heapRegionRemSet.hpp"
35 #include "gc/g1/heapRegionSet.hpp"
36 #include "logging/logStream.hpp"
37 #include "runtime/orderAccess.hpp"
38 #include "utilities/debug.hpp"
39 #include "utilities/globalDefinitions.hpp"
40 #include "utilities/quickSort.hpp"
41
42 G1CollectorState* G1CollectionSet::collector_state() {
43 return _g1h->collector_state();
44 }
45
46 G1GCPhaseTimes* G1CollectionSet::phase_times() {
47 return _policy->phase_times();
48 }
49
50 double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) {
394 return false;
395 }
396 };
397
398 void G1CollectionSet::print(outputStream* st) {
399 st->print_cr("\nCollection_set:");
400
401 G1PrintCollectionSetDetailClosure cl(st);
402 iterate(&cl);
403 }
404 #endif // !PRODUCT
405
406 double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) {
407 double young_start_time_sec = os::elapsedTime();
408
409 finalize_incremental_building();
410
411 guarantee(target_pause_time_ms > 0.0,
412 "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms);
413
414 size_t pending_cards = _policy->pending_cards_at_gc_start() + _g1h->hot_card_cache()->num_entries();
415 double base_time_ms = _policy->predict_base_elapsed_time_ms(pending_cards);
416 double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
417
418 log_trace(gc, ergo, cset)("Start choosing CSet. pending cards: " SIZE_FORMAT " predicted base time: %1.2fms remaining time: %1.2fms target pause time: %1.2fms",
419 pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
420
421 // The young list is laid with the survivor regions from the previous
422 // pause are appended to the RHS of the young list, i.e.
423 // [Newly Young Regions ++ Survivors from last pause].
424
425 uint survivor_region_length = survivors->length();
426 uint eden_region_length = _g1h->eden_regions_count();
427 init_region_lengths(eden_region_length, survivor_region_length);
428
429 verify_young_cset_indices();
430
431 // Clear the fields that point to the survivor list - they are all young now.
432 survivors->convert_to_eden();
433
434 _bytes_used_before = _inc_bytes_used_before;
|