1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Apr 10 13:27:35 2013 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Apr 10 10:57:34 2013 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -406,7 +406,6 @@ 1.11 } 1.12 _free_regions_at_end_of_collection = _g1->free_regions(); 1.13 update_young_list_target_length(); 1.14 - _prev_eden_capacity = _young_list_target_length * HeapRegion::GrainBytes; 1.15 1.16 // We may immediately start allocating regions and placing them on the 1.17 // collection set list. Initialize the per-collection set info 1.18 @@ -746,6 +745,7 @@ 1.19 1.20 void G1CollectorPolicy::record_full_collection_start() { 1.21 _full_collection_start_sec = os::elapsedTime(); 1.22 + record_heap_size_info_at_start(); 1.23 // Release the future to-space so that it is available for compaction into. 1.24 _g1->set_full_collection(); 1.25 } 1.26 @@ -788,8 +788,7 @@ 1.27 _stop_world_start = os::elapsedTime(); 1.28 } 1.29 1.30 -void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, 1.31 - size_t start_used) { 1.32 +void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) { 1.33 // We only need to do this here as the policy will only be applied 1.34 // to the GC we're about to start. so, no point is calculating this 1.35 // every time we calculate / recalculate the target young length. 1.36 @@ -803,19 +802,14 @@ 1.37 _trace_gen0_time_data.record_start_collection(s_w_t_ms); 1.38 _stop_world_start = 0.0; 1.39 1.40 + record_heap_size_info_at_start(); 1.41 + 1.42 phase_times()->record_cur_collection_start_sec(start_time_sec); 1.43 - _cur_collection_pause_used_at_start_bytes = start_used; 1.44 - _cur_collection_pause_used_regions_at_start = _g1->used_regions(); 1.45 _pending_cards = _g1->pending_card_num(); 1.46 1.47 _collection_set_bytes_used_before = 0; 1.48 _bytes_copied_during_gc = 0; 1.49 1.50 - YoungList* young_list = _g1->young_list(); 1.51 - _eden_bytes_before_gc = young_list->eden_used_bytes(); 1.52 - _survivor_bytes_before_gc = young_list->survivor_used_bytes(); 1.53 - _capacity_before_gc = _g1->capacity(); 1.54 - 1.55 _last_gc_was_young = false; 1.56 1.57 // do that for any other surv rate groups 1.58 @@ -1153,6 +1147,21 @@ 1.59 byte_size_in_proper_unit((double)(bytes)), \ 1.60 proper_unit_for_byte_size((bytes)) 1.61 1.62 +void G1CollectorPolicy::record_heap_size_info_at_start() { 1.63 + YoungList* young_list = _g1->young_list(); 1.64 + _eden_bytes_before_gc = young_list->eden_used_bytes(); 1.65 + _survivor_bytes_before_gc = young_list->survivor_used_bytes(); 1.66 + _capacity_before_gc = _g1->capacity(); 1.67 + 1.68 + _cur_collection_pause_used_at_start_bytes = _g1->used(); 1.69 + _cur_collection_pause_used_regions_at_start = _g1->used_regions(); 1.70 + 1.71 + size_t eden_capacity_before_gc = 1.72 + (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_bytes_before_gc; 1.73 + 1.74 + _prev_eden_capacity = eden_capacity_before_gc; 1.75 +} 1.76 + 1.77 void G1CollectorPolicy::print_heap_transition() { 1.78 _g1->print_size_transition(gclog_or_tty, 1.79 _cur_collection_pause_used_at_start_bytes, _g1->used(), _g1->capacity()); 1.80 @@ -1183,8 +1192,6 @@ 1.81 EXT_SIZE_PARAMS(_capacity_before_gc), 1.82 EXT_SIZE_PARAMS(used), 1.83 EXT_SIZE_PARAMS(capacity)); 1.84 - 1.85 - _prev_eden_capacity = eden_capacity; 1.86 } 1.87 1.88 void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,