提交 cf39cbf5 编写于 作者: J johnc

6819061: G1: eliminate serial Other times that are proportional to the collection set length

6871109: G1: remove the concept of the scan only prefix
Summary: Removed scan only regions and associated code. The young portion of the collection set is now constructed incrementally - when a young region is retired as the current allocation region it is added to the collection set.
Reviewed-by: apetrusenko, iveresov, tonyp
上级 a22520c1
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -69,9 +69,9 @@ void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
G1CollectorPolicy* g1p = g1h->g1_policy();
if (g1p->adaptive_young_list_length()) {
int regions_visited = 0;
g1h->young_list_rs_length_sampling_init();
while (g1h->young_list_rs_length_sampling_more()) {
g1h->young_list_rs_length_sampling_next();
g1h->young_list()->rs_length_sampling_init();
while (g1h->young_list()->rs_length_sampling_more()) {
g1h->young_list()->rs_length_sampling_next();
++regions_visited;
// we try to yield every time we visit 10 regions
......@@ -162,6 +162,7 @@ void ConcurrentG1RefineThread::run() {
if (_worker_id >= cg1r()->worker_thread_num()) {
run_young_rs_sampling();
terminate();
return;
}
_vtime_start = os::elapsedVTime();
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -733,6 +733,19 @@ public:
// to determine whether any heap regions are located above the finger.
void registerCSetRegion(HeapRegion* hr);
// Registers the maximum region-end associated with a set of
// regions with CM. Again this is used to determine whether any
// heap regions are located above the finger.
void register_collection_set_finger(HeapWord* max_finger) {
// max_finger is the highest heap region end of the regions currently
// contained in the collection set. If this value is larger than
// _min_finger then we need to gray objects.
// This routine is like registerCSetRegion but for an entire
// collection of regions.
if (max_finger > _min_finger)
_should_gray_objects = true;
}
// Returns "true" if at least one mark has been completed.
bool at_least_one_mark_complete() { return _at_least_one_mark_complete; }
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -81,33 +81,29 @@ private:
HeapRegion* _head;
HeapRegion* _scan_only_head;
HeapRegion* _scan_only_tail;
size_t _length;
size_t _scan_only_length;
HeapRegion* _survivor_head;
HeapRegion* _survivor_tail;
size_t _last_sampled_rs_lengths;
size_t _sampled_rs_lengths;
HeapRegion* _curr;
HeapRegion* _curr_scan_only;
HeapRegion* _survivor_head;
HeapRegion* _survivor_tail;
size_t _length;
size_t _survivor_length;
void empty_list(HeapRegion* list);
size_t _last_sampled_rs_lengths;
size_t _sampled_rs_lengths;
void empty_list(HeapRegion* list);
public:
YoungList(G1CollectedHeap* g1h);
void push_region(HeapRegion* hr);
void add_survivor_region(HeapRegion* hr);
HeapRegion* pop_region();
void empty_list();
bool is_empty() { return _length == 0; }
size_t length() { return _length; }
size_t scan_only_length() { return _scan_only_length; }
size_t survivor_length() { return _survivor_length; }
void push_region(HeapRegion* hr);
void add_survivor_region(HeapRegion* hr);
void empty_list();
bool is_empty() { return _length == 0; }
size_t length() { return _length; }
size_t survivor_length() { return _survivor_length; }
void rs_length_sampling_init();
bool rs_length_sampling_more();
......@@ -120,22 +116,21 @@ public:
// for development purposes
void reset_auxilary_lists();
void clear() { _head = NULL; _length = 0; }
void clear_survivors() {
_survivor_head = NULL;
_survivor_tail = NULL;
_survivor_length = 0;
}
HeapRegion* first_region() { return _head; }
HeapRegion* first_scan_only_region() { return _scan_only_head; }
HeapRegion* first_survivor_region() { return _survivor_head; }
HeapRegion* last_survivor_region() { return _survivor_tail; }
HeapRegion* par_get_next_scan_only_region() {
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
HeapRegion* ret = _curr_scan_only;
if (ret != NULL)
_curr_scan_only = ret->get_next_young_region();
return ret;
}
// debugging
bool check_list_well_formed();
bool check_list_empty(bool ignore_scan_only_list,
bool check_sample = true);
bool check_list_empty(bool check_sample = true);
void print();
};
......@@ -405,8 +400,7 @@ public:
assert(_in_cset_fast_test_base != NULL, "sanity");
assert(r->in_collection_set(), "invariant");
int index = r->hrs_index();
assert(0 <= (size_t) index && (size_t) index < _in_cset_fast_test_length,
"invariant");
assert(0 <= index && (size_t) index < _in_cset_fast_test_length, "invariant");
assert(!_in_cset_fast_test_base[index], "invariant");
_in_cset_fast_test_base[index] = true;
}
......@@ -431,6 +425,12 @@ public:
}
}
void clear_cset_fast_test() {
assert(_in_cset_fast_test_base != NULL, "sanity");
memset(_in_cset_fast_test_base, false,
_in_cset_fast_test_length * sizeof(bool));
}
protected:
// Shrink the garbage-first heap by at most the given size (in bytes!).
......@@ -476,6 +476,10 @@ protected:
// regions.
void free_collection_set(HeapRegion* cs_head);
// Abandon the current collection set without recording policy
// statistics or updating free lists.
void abandon_collection_set(HeapRegion* cs_head);
// Applies "scan_non_heap_roots" to roots outside the heap,
// "scan_rs" to roots inside the heap (having done "set_region" to
// indicate the region in which the root resides), and does "scan_perm"
......@@ -488,16 +492,9 @@ protected:
SharedHeap::ScanningOption so,
OopClosure* scan_non_heap_roots,
OopsInHeapRegionClosure* scan_rs,
OopsInHeapRegionClosure* scan_so,
OopsInGenClosure* scan_perm,
int worker_i);
void scan_scan_only_set(OopsInHeapRegionClosure* oc,
int worker_i);
void scan_scan_only_region(HeapRegion* hr,
OopsInHeapRegionClosure* oc,
int worker_i);
// Apply "blk" to all the weak roots of the system. These include
// JNI weak roots, the code cache, system dictionary, symbol table,
// string table, and referents of reachable weak refs.
......@@ -1136,36 +1133,14 @@ public:
void set_region_short_lived_locked(HeapRegion* hr);
// add appropriate methods for any other surv rate groups
void young_list_rs_length_sampling_init() {
_young_list->rs_length_sampling_init();
}
bool young_list_rs_length_sampling_more() {
return _young_list->rs_length_sampling_more();
}
void young_list_rs_length_sampling_next() {
_young_list->rs_length_sampling_next();
}
size_t young_list_sampled_rs_lengths() {
return _young_list->sampled_rs_lengths();
}
size_t young_list_length() { return _young_list->length(); }
size_t young_list_scan_only_length() {
return _young_list->scan_only_length(); }
HeapRegion* pop_region_from_young_list() {
return _young_list->pop_region();
}
HeapRegion* young_list_first_region() {
return _young_list->first_region();
}
YoungList* young_list() { return _young_list; }
// debugging
bool check_young_list_well_formed() {
return _young_list->check_list_well_formed();
}
bool check_young_list_empty(bool ignore_scan_only_list,
bool check_young_list_empty(bool check_heap,
bool check_sample = true);
// *** Stuff related to concurrent marking. It's not clear to me that so
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -61,7 +61,6 @@ class MainBodySummary: public CHeapObj {
define_num_seq(parallel) // parallel only
define_num_seq(ext_root_scan)
define_num_seq(mark_stack_scan)
define_num_seq(scan_only)
define_num_seq(update_rs)
define_num_seq(scan_rs)
define_num_seq(scan_new_refs) // Only for temp use; added to
......@@ -174,8 +173,6 @@ protected:
double* _par_last_ext_root_scan_times_ms;
double* _par_last_mark_stack_scan_times_ms;
double* _par_last_scan_only_times_ms;
double* _par_last_scan_only_regions_scanned;
double* _par_last_update_rs_start_times_ms;
double* _par_last_update_rs_times_ms;
double* _par_last_update_rs_processed_buffers;
......@@ -196,7 +193,6 @@ protected:
bool _adaptive_young_list_length;
size_t _young_list_min_length;
size_t _young_list_target_length;
size_t _young_list_so_prefix_length;
size_t _young_list_fixed_length;
size_t _young_cset_length;
......@@ -234,7 +230,6 @@ private:
TruncatedSeq* _pending_card_diff_seq;
TruncatedSeq* _rs_length_diff_seq;
TruncatedSeq* _cost_per_card_ms_seq;
TruncatedSeq* _cost_per_scan_only_region_ms_seq;
TruncatedSeq* _fully_young_cards_per_entry_ratio_seq;
TruncatedSeq* _partially_young_cards_per_entry_ratio_seq;
TruncatedSeq* _cost_per_entry_ms_seq;
......@@ -249,19 +244,16 @@ private:
TruncatedSeq* _rs_lengths_seq;
TruncatedSeq* _cost_per_byte_ms_during_cm_seq;
TruncatedSeq* _cost_per_scan_only_region_ms_during_cm_seq;
TruncatedSeq* _young_gc_eff_seq;
TruncatedSeq* _max_conc_overhead_seq;
size_t _recorded_young_regions;
size_t _recorded_scan_only_regions;
size_t _recorded_non_young_regions;
size_t _recorded_region_num;
size_t _free_regions_at_end_of_collection;
size_t _scan_only_regions_at_end_of_collection;
size_t _recorded_rs_lengths;
size_t _max_rs_lengths;
......@@ -277,7 +269,6 @@ private:
double _predicted_survival_ratio;
double _predicted_rs_update_time_ms;
double _predicted_rs_scan_time_ms;
double _predicted_scan_only_scan_time_ms;
double _predicted_object_copy_time_ms;
double _predicted_constant_other_time_ms;
double _predicted_young_other_time_ms;
......@@ -344,8 +335,6 @@ public:
bool verify_young_ages();
#endif // PRODUCT
void tag_scan_only(size_t short_lived_scan_only_length);
double get_new_prediction(TruncatedSeq* seq) {
return MAX2(seq->davg() + sigma() * seq->dsd(),
seq->davg() * confidence_factor(seq->num()));
......@@ -431,23 +420,6 @@ public:
get_new_prediction(_partially_young_cost_per_entry_ms_seq);
}
double predict_scan_only_time_ms_during_cm(size_t scan_only_region_num) {
if (_cost_per_scan_only_region_ms_during_cm_seq->num() < 3)
return 1.5 * (double) scan_only_region_num *
get_new_prediction(_cost_per_scan_only_region_ms_seq);
else
return (double) scan_only_region_num *
get_new_prediction(_cost_per_scan_only_region_ms_during_cm_seq);
}
double predict_scan_only_time_ms(size_t scan_only_region_num) {
if (_in_marking_window_im)
return predict_scan_only_time_ms_during_cm(scan_only_region_num);
else
return (double) scan_only_region_num *
get_new_prediction(_cost_per_scan_only_region_ms_seq);
}
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) {
if (_cost_per_byte_ms_during_cm_seq->num() < 3)
return 1.1 * (double) bytes_to_copy *
......@@ -490,24 +462,21 @@ public:
size_t predict_bytes_to_copy(HeapRegion* hr);
double predict_region_elapsed_time_ms(HeapRegion* hr, bool young);
// for use by: calculate_optimal_so_length(length)
void predict_gc_eff(size_t young_region_num,
size_t so_length,
double base_time_ms,
double *gc_eff,
double *pause_time_ms);
// for use by: calculate_young_list_target_config(rs_length)
bool predict_gc_eff(size_t young_region_num,
size_t so_length,
double base_time_with_so_ms,
size_t init_free_regions,
double target_pause_time_ms,
double* gc_eff);
// for use by: calculate_young_list_target_length(rs_length)
bool predict_will_fit(size_t young_region_num,
double base_time_ms,
size_t init_free_regions,
double target_pause_time_ms);
void start_recording_regions();
void record_cset_region(HeapRegion* hr, bool young);
void record_scan_only_regions(size_t scan_only_length);
void record_cset_region_info(HeapRegion* hr, bool young);
void record_non_young_cset_region(HeapRegion* hr);
void set_recorded_young_regions(size_t n_regions);
void set_recorded_young_bytes(size_t bytes);
void set_recorded_rs_lengths(size_t rs_lengths);
void set_predicted_bytes_to_copy(size_t bytes);
void end_recording_regions();
void record_vtime_diff_ms(double vtime_diff_ms) {
......@@ -638,11 +607,74 @@ protected:
void update_recent_gc_times(double end_time_sec, double elapsed_ms);
// The head of the list (via "next_in_collection_set()") representing the
// current collection set.
// current collection set. Set from the incrementally built collection
// set at the start of the pause.
HeapRegion* _collection_set;
// The number of regions in the collection set. Set from the incrementally
// built collection set at the start of an evacuation pause.
size_t _collection_set_size;
// The number of bytes in the collection set before the pause. Set from
// the incrementally built collection set at the start of an evacuation
// pause.
size_t _collection_set_bytes_used_before;
// The associated information that is maintained while the incremental
// collection set is being built with young regions. Used to populate
// the recorded info for the evacuation pause.
enum CSetBuildType {
Active, // We are actively building the collection set
Inactive // We are not actively building the collection set
};
CSetBuildType _inc_cset_build_state;
// The head of the incrementally built collection set.
HeapRegion* _inc_cset_head;
// The tail of the incrementally built collection set.
HeapRegion* _inc_cset_tail;
// The number of regions in the incrementally built collection set.
// Used to set _collection_set_size at the start of an evacuation
// pause.
size_t _inc_cset_size;
// Used as the index in the surving young words structure
// which tracks the amount of space, for each young region,
// that survives the pause.
size_t _inc_cset_young_index;
// The number of bytes in the incrementally built collection set.
// Used to set _collection_set_bytes_used_before at the start of
// an evacuation pause.
size_t _inc_cset_bytes_used_before;
// Used to record the highest end of heap region in collection set
HeapWord* _inc_cset_max_finger;
// The number of recorded used bytes in the young regions
// of the collection set. This is the sum of the used() bytes
// of retired young regions in the collection set.
size_t _inc_cset_recorded_young_bytes;
// The RSet lengths recorded for regions in the collection set
// (updated by the periodic sampling of the regions in the
// young list/collection set).
size_t _inc_cset_recorded_rs_lengths;
// The predicted elapsed time it will take to collect the regions
// in the collection set (updated by the periodic sampling of the
// regions in the young list/collection set).
double _inc_cset_predicted_elapsed_time_ms;
// The predicted bytes to copy for the regions in the collection
// set (updated by the periodic sampling of the regions in the
// young list/collection set).
size_t _inc_cset_predicted_bytes_to_copy;
// Info about marking.
int _n_marks; // Sticky at 2, so we know when we've done at least 2.
......@@ -761,9 +793,8 @@ protected:
double _mark_closure_time_ms;
void calculate_young_list_min_length();
void calculate_young_list_target_config();
void calculate_young_list_target_config(size_t rs_lengths);
size_t calculate_optimal_so_length(size_t young_list_length);
void calculate_young_list_target_length();
void calculate_young_list_target_length(size_t rs_lengths);
public:
......@@ -868,11 +899,6 @@ public:
_par_last_mark_stack_scan_times_ms[worker_i] = ms;
}
void record_scan_only_time(int worker_i, double ms, int n) {
_par_last_scan_only_times_ms[worker_i] = ms;
_par_last_scan_only_regions_scanned[worker_i] = (double) n;
}
void record_satb_drain_time(double ms) {
_cur_satb_drain_time_ms = ms;
_satb_drain_time_set = true;
......@@ -987,20 +1013,67 @@ public:
// Choose a new collection set. Marks the chosen regions as being
// "in_collection_set", and links them together. The head and number of
// the collection set are available via access methods.
virtual void choose_collection_set() = 0;
void clear_collection_set() { _collection_set = NULL; }
virtual bool choose_collection_set() = 0;
// The head of the list (via "next_in_collection_set()") representing the
// current collection set.
HeapRegion* collection_set() { return _collection_set; }
void clear_collection_set() { _collection_set = NULL; }
// The number of elements in the current collection set.
size_t collection_set_size() { return _collection_set_size; }
// Add "hr" to the CS.
void add_to_collection_set(HeapRegion* hr);
// Incremental CSet Support
// The head of the incrementally built collection set.
HeapRegion* inc_cset_head() { return _inc_cset_head; }
// The tail of the incrementally built collection set.
HeapRegion* inc_set_tail() { return _inc_cset_tail; }
// The number of elements in the incrementally built collection set.
size_t inc_cset_size() { return _inc_cset_size; }
// Initialize incremental collection set info.
void start_incremental_cset_building();
void clear_incremental_cset() {
_inc_cset_head = NULL;
_inc_cset_tail = NULL;
}
// Stop adding regions to the incremental collection set
void stop_incremental_cset_building() { _inc_cset_build_state = Inactive; }
// Add/remove information about hr to the aggregated information
// for the incrementally built collection set.
void add_to_incremental_cset_info(HeapRegion* hr, size_t rs_length);
void remove_from_incremental_cset_info(HeapRegion* hr);
// Update information about hr in the aggregated information for
// the incrementally built collection set.
void update_incremental_cset_info(HeapRegion* hr, size_t new_rs_length);
private:
// Update the incremental cset information when adding a region
// (should not be called directly).
void add_region_to_incremental_cset_common(HeapRegion* hr);
public:
// Add hr to the LHS of the incremental collection set.
void add_region_to_incremental_cset_lhs(HeapRegion* hr);
// Add hr to the RHS of the incremental collection set.
void add_region_to_incremental_cset_rhs(HeapRegion* hr);
#ifndef PRODUCT
void print_collection_set(HeapRegion* list_head, outputStream* st);
#endif // !PRODUCT
bool initiate_conc_mark_if_possible() { return _initiate_conc_mark_if_possible; }
void set_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = true; }
void clear_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = false; }
......@@ -1191,7 +1264,7 @@ class G1CollectorPolicy_BestRegionsFirst: public G1CollectorPolicy {
// If the estimated is less then desirable, resize if possible.
void expand_if_possible(size_t numRegions);
virtual void choose_collection_set();
virtual bool choose_collection_set();
virtual void record_collection_pause_start(double start_time_sec,
size_t start_used);
virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes,
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -226,10 +226,6 @@
"the number of regions for which we'll print a surv rate " \
"summary.") \
\
develop(bool, G1UseScanOnlyPrefix, false, \
"It determines whether the system will calculate an optimum " \
"scan-only set.") \
\
product(intx, G1ReservePercent, 10, \
"It determines the minimum reserve we should have in the heap " \
"to minimize the probability of promotion failure.") \
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -450,7 +450,9 @@ HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray,
_young_type(NotYoung), _next_young_region(NULL),
_next_dirty_cards_region(NULL),
_young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
_rem_set(NULL), _zfs(NotZeroFilled)
_rem_set(NULL), _zfs(NotZeroFilled),
_recorded_rs_length(0), _predicted_elapsed_time_ms(0),
_predicted_bytes_to_copy(0)
{
_orig_end = mr.end();
// Note that initialize() will set the start of the unmarked area of the
......@@ -733,7 +735,7 @@ void HeapRegion::print_on(outputStream* st) const {
else
st->print(" ");
if (is_young())
st->print(is_scan_only() ? " SO" : (is_survivor() ? " SU" : " Y "));
st->print(is_survivor() ? " SU" : " Y ");
else
st->print(" ");
if (is_empty())
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -247,7 +247,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
enum YoungType {
NotYoung, // a region is not young
ScanOnly, // a region is young and scan-only
Young, // a region is young
Survivor // a region is young and it contains
// survivor
......@@ -292,6 +291,20 @@ class HeapRegion: public G1OffsetTableContigSpace {
_young_type = new_type;
}
// Cached attributes used in the collection set policy information
// The RSet length that was added to the total value
// for the collection set.
size_t _recorded_rs_length;
// The predicted elapsed time that was added to total value
// for the collection set.
double _predicted_elapsed_time_ms;
// The predicted number of bytes to copy that was added to
// the total value for the collection set.
size_t _predicted_bytes_to_copy;
public:
// If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray,
......@@ -614,7 +627,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
// </PREDICTION>
bool is_young() const { return _young_type != NotYoung; }
bool is_scan_only() const { return _young_type == ScanOnly; }
bool is_survivor() const { return _young_type == Survivor; }
int young_index_in_cset() const { return _young_index_in_cset; }
......@@ -629,12 +641,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
return _surv_rate_group->age_in_group(_age_index);
}
void recalculate_age_in_surv_rate_group() {
assert( _surv_rate_group != NULL, "pre-condition" );
assert( _age_index > -1, "pre-condition" );
_age_index = _surv_rate_group->recalculate_age_index(_age_index);
}
void record_surv_words_in_group(size_t words_survived) {
assert( _surv_rate_group != NULL, "pre-condition" );
assert( _age_index > -1, "pre-condition" );
......@@ -676,8 +682,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
void set_young() { set_young_type(Young); }
void set_scan_only() { set_young_type(ScanOnly); }
void set_survivor() { set_young_type(Survivor); }
void set_not_young() { set_young_type(NotYoung); }
......@@ -775,6 +779,22 @@ class HeapRegion: public G1OffsetTableContigSpace {
_zero_filler = NULL;
}
size_t recorded_rs_length() const { return _recorded_rs_length; }
double predicted_elapsed_time_ms() const { return _predicted_elapsed_time_ms; }
size_t predicted_bytes_to_copy() const { return _predicted_bytes_to_copy; }
void set_recorded_rs_length(size_t rs_length) {
_recorded_rs_length = rs_length;
}
void set_predicted_elapsed_time_ms(double ms) {
_predicted_elapsed_time_ms = ms;
}
void set_predicted_bytes_to_copy(size_t bytes) {
_predicted_bytes_to_copy = bytes;
}
#define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL)
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -55,7 +55,6 @@ SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
void SurvRateGroup::reset()
{
_all_regions_allocated = 0;
_scan_only_prefix = 0;
_setup_seq_num = 0;
_stats_arrays_length = 0;
_accum_surv_rate = 0.0;
......@@ -74,7 +73,7 @@ void SurvRateGroup::reset()
void
SurvRateGroup::start_adding_regions() {
_setup_seq_num = _stats_arrays_length;
_region_num = _scan_only_prefix;
_region_num = 0;
_accum_surv_rate = 0.0;
#if 0
......@@ -163,12 +162,6 @@ SurvRateGroup::next_age_index() {
return (int) ++_all_regions_allocated;
}
void
SurvRateGroup::record_scan_only_prefix(size_t scan_only_prefix) {
guarantee( scan_only_prefix <= _region_num, "pre-condition" );
_scan_only_prefix = scan_only_prefix;
}
void
SurvRateGroup::record_surviving_words(int age_in_group, size_t surv_words) {
guarantee( 0 <= age_in_group && (size_t) age_in_group < _region_num,
......@@ -218,13 +211,12 @@ SurvRateGroup::all_surviving_words_recorded(bool propagate) {
#ifndef PRODUCT
void
SurvRateGroup::print() {
gclog_or_tty->print_cr("Surv Rate Group: %s (%d entries, %d scan-only)",
_name, _region_num, _scan_only_prefix);
gclog_or_tty->print_cr("Surv Rate Group: %s (%d entries)",
_name, _region_num);
for (size_t i = 0; i < _region_num; ++i) {
gclog_or_tty->print_cr(" age %4d surv rate %6.2lf %% pred %6.2lf %%%s",
gclog_or_tty->print_cr(" age %4d surv rate %6.2lf %% pred %6.2lf %%",
i, _surv_rate[i] * 100.0,
_g1p->get_new_prediction(_surv_rate_pred[i]) * 100.0,
(i < _scan_only_prefix) ? " S-O" : " ");
_g1p->get_new_prediction(_surv_rate_pred[i]) * 100.0);
}
}
......
/*
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -41,7 +41,6 @@ private:
int _all_regions_allocated;
size_t _region_num;
size_t _scan_only_prefix;
size_t _setup_seq_num;
public:
......@@ -51,13 +50,11 @@ public:
void reset();
void start_adding_regions();
void stop_adding_regions();
void record_scan_only_prefix(size_t scan_only_prefix);
void record_surviving_words(int age_in_group, size_t surv_words);
void all_surviving_words_recorded(bool propagate);
const char* name() { return _name; }
size_t region_num() { return _region_num; }
size_t scan_only_length() { return _scan_only_prefix; }
double accum_surv_rate_pred(int age) {
assert(age >= 0, "must be");
if ((size_t)age < _stats_arrays_length)
......@@ -82,17 +79,12 @@ public:
int next_age_index();
int age_in_group(int age_index) {
int ret = (int) (_all_regions_allocated - age_index);
int ret = (int) (_all_regions_allocated - age_index);
assert( ret >= 0, "invariant" );
return ret;
}
int recalculate_age_index(int age_index) {
int new_age_index = (int) _scan_only_prefix - age_in_group(age_index);
guarantee( new_age_index >= 0, "invariant" );
return new_age_index;
}
void finished_recalculating_age_indexes() {
_all_regions_allocated = (int) _scan_only_prefix;
_all_regions_allocated = 0;
}
#ifndef PRODUCT
......
/*
* Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -45,7 +45,7 @@ size_t G1MemoryPoolSuper::eden_space_committed(G1CollectedHeap* g1h) {
// See the comment at the top of g1MemoryPool.hpp
size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) {
size_t young_list_length = g1h->young_list_length();
size_t young_list_length = g1h->young_list()->length();
size_t eden_used = young_list_length * HeapRegion::GrainBytes;
size_t survivor_used = survivor_space_used(g1h);
eden_used = subtract_up_to_zero(eden_used, survivor_used);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册