--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Wed Feb 18 09:22:37 2015 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Fri Aug 22 10:10:08 2014 +0200
@@ -33,7 +33,7 @@
class SubTasksDone;
// A "GenCollectedHeap" is a SharedHeap that uses generational
-// collection. It is represented with a sequence of Generation's.
+// collection. It has two generations, young and old.
class GenCollectedHeap : public SharedHeap {
friend class GenCollectorPolicy;
friend class Generation;
@@ -63,7 +63,10 @@
private:
int _n_gens;
- Generation* _gens[max_gens];
+
+ Generation* _young_gen;
+ Generation* _old_gen;
+
GenerationSpec** _gen_specs;
// The singleton Gen Remembered Set.
@@ -85,6 +88,11 @@
SubTasksDone* _gen_process_roots_tasks;
SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
+ // Collects the given generation.
+ void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
+ bool run_verification, bool clear_soft_refs,
+ bool restore_marks_for_biased_locking);
+
// In block contents verification, the number of header words to skip
NOT_PRODUCT(static size_t _skip_header_HeapWords;)
@@ -138,8 +146,12 @@
return CollectedHeap::GenCollectedHeap;
}
+ Generation* young_gen() { return _young_gen; }
+ Generation* old_gen() { return _old_gen; }
+
// The generational collector policy.
GenCollectorPolicy* gen_policy() const { return _gen_policy; }
+
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
// Adaptive size policy
@@ -309,20 +321,17 @@
// Update above counter, as appropriate, at the end of a concurrent GC cycle
unsigned int update_full_collections_completed(unsigned int count);
- // Update "time of last gc" for all constituent generations
- // to "now".
+ // Update "time of last gc" for all generations to "now".
void update_time_of_last_gc(jlong now) {
- for (int i = 0; i < _n_gens; i++) {
- _gens[i]->update_time_of_last_gc(now);
- }
+ _young_gen->update_time_of_last_gc(now);
+ _old_gen->update_time_of_last_gc(now);
}
// Update the gc statistics for each generation.
// "level" is the level of the latest collection.
void update_gc_stats(int current_level, bool full) {
- for (int i = 0; i < _n_gens; i++) {
- _gens[i]->update_gc_stats(current_level, full);
- }
+ _young_gen->update_gc_stats(current_level, full);
+ _old_gen->update_gc_stats(current_level, full);
}
// Override.
@@ -366,21 +375,23 @@
// Return the generation before "gen".
Generation* prev_gen(Generation* gen) const {
- int l = gen->level();
- guarantee(l > 0, "Out of bounds");
- return _gens[l-1];
+ guarantee(gen->level() == 1, "Out of bounds");
+ return _young_gen;
}
// Return the generation after "gen".
Generation* next_gen(Generation* gen) const {
- int l = gen->level() + 1;
- guarantee(l < _n_gens, "Out of bounds");
- return _gens[l];
+ guarantee(gen->level() == 0, "Out of bounds");
+ return _old_gen;
}
Generation* get_gen(int i) const {
- guarantee(i >= 0 && i < _n_gens, "Out of bounds");
- return _gens[i];
+ guarantee(i == 0 || i == 1, "Out of bounds");
+ if (i == 0) {
+ return _young_gen;
+ } else {
+ return _old_gen;
+ }
}
int n_gens() const {