--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Apr 19 05:40:21 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Apr 22 10:02:38 2010 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
HeapRegion* _head;
- HeapRegion* _scan_only_head;
- HeapRegion* _scan_only_tail;
+ HeapRegion* _survivor_head;
+ HeapRegion* _survivor_tail;
+
+ HeapRegion* _curr;
+
size_t _length;
- size_t _scan_only_length;
+ size_t _survivor_length;
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 _survivor_length;
-
- void empty_list(HeapRegion* list);
+ 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 @@
// 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 @@
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 @@
}
}
+ 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 @@
// 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 @@
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 @@
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