comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 3830:f44782f04dd4

7039627: G1: avoid BOT updates for survivor allocations and dirty survivor regions incrementally Summary: Refactor the allocation code during GC to use the G1AllocRegion abstraction. Use separate subclasses of G1AllocRegion for survivor and old regions. Avoid BOT updates and dirty survivor cards incrementally for the former. Reviewed-by: brutisso, johnc, ysr
author tonyp
date Fri, 12 Aug 2011 11:31:06 -0400
parents 14a2fd14c0db
children ff53346271fe
comparison
equal deleted inserted replaced
3829:87e40b34bc2b 3830:f44782f04dd4
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
583 583
584 int _last_satb_drain_processed_buffers; 584 int _last_satb_drain_processed_buffers;
585 int _last_update_rs_processed_buffers; 585 int _last_update_rs_processed_buffers;
586 double _last_pause_time_ms; 586 double _last_pause_time_ms;
587 587
588 size_t _bytes_in_to_space_before_gc;
589 size_t _bytes_in_to_space_after_gc;
590 size_t bytes_in_to_space_during_gc() {
591 return
592 _bytes_in_to_space_after_gc - _bytes_in_to_space_before_gc;
593 }
594 size_t _bytes_in_collection_set_before_gc; 588 size_t _bytes_in_collection_set_before_gc;
589 size_t _bytes_copied_during_gc;
590
595 // Used to count used bytes in CS. 591 // Used to count used bytes in CS.
596 friend class CountCSClosure; 592 friend class CountCSClosure;
597 593
598 // Statistics kept per GC stoppage, pause or full. 594 // Statistics kept per GC stoppage, pause or full.
599 TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec; 595 TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec;
803 799
804 size_t bytes_in_collection_set() { 800 size_t bytes_in_collection_set() {
805 return _bytes_in_collection_set_before_gc; 801 return _bytes_in_collection_set_before_gc;
806 } 802 }
807 803
808 size_t bytes_in_to_space() {
809 return bytes_in_to_space_during_gc();
810 }
811
812 unsigned calc_gc_alloc_time_stamp() { 804 unsigned calc_gc_alloc_time_stamp() {
813 return _all_pause_times_ms->num() + 1; 805 return _all_pause_times_ms->num() + 1;
814 } 806 }
815 807
816 protected: 808 protected:
975 _cum_clear_cc_time_ms += ms; 967 _cum_clear_cc_time_ms += ms;
976 _num_cc_clears++; 968 _num_cc_clears++;
977 } 969 }
978 #endif 970 #endif
979 971
980 // Record the fact that "bytes" bytes allocated in a region. 972 // Record how much space we copied during a GC. This is typically
981 void record_before_bytes(size_t bytes); 973 // called when a GC alloc region is being retired.
982 void record_after_bytes(size_t bytes); 974 void record_bytes_copied_during_gc(size_t bytes) {
975 _bytes_copied_during_gc += bytes;
976 }
977
978 // The amount of space we copied during a GC.
979 size_t bytes_copied_during_gc() {
980 return _bytes_copied_during_gc;
981 }
983 982
984 // Choose a new collection set. Marks the chosen regions as being 983 // Choose a new collection set. Marks the chosen regions as being
985 // "in_collection_set", and links them together. The head and number of 984 // "in_collection_set", and links them together. The head and number of
986 // the collection set are available via access methods. 985 // the collection set are available via access methods.
987 virtual void choose_collection_set(double target_pause_time_ms) = 0; 986 virtual void choose_collection_set(double target_pause_time_ms) = 0;
1189 } 1188 }
1190 } 1189 }
1191 1190
1192 inline bool track_object_age(GCAllocPurpose purpose) { 1191 inline bool track_object_age(GCAllocPurpose purpose) {
1193 return purpose == GCAllocForSurvived; 1192 return purpose == GCAllocForSurvived;
1194 }
1195
1196 inline GCAllocPurpose alternative_purpose(int purpose) {
1197 return GCAllocForTenured;
1198 } 1193 }
1199 1194
1200 static const size_t REGIONS_UNLIMITED = ~(size_t)0; 1195 static const size_t REGIONS_UNLIMITED = ~(size_t)0;
1201 1196
1202 size_t max_regions(int purpose); 1197 size_t max_regions(int purpose);