< prev index next >

src/share/vm/memory/genCollectedHeap.cpp

Print this page

        

@@ -88,13 +88,10 @@
 }
 
 jint GenCollectedHeap::initialize() {
   CollectedHeap::pre_initialize();
 
-  _n_gens = gen_policy()->number_of_generations();
-  assert(_n_gens == 2, "There is no support for more than two generations");
-
   // While there are no constraints in the GC code that HeapWordSize
   // be any particular value, there are multiple other areas in the
   // system which believe this to be true (e.g. oop->object_size in some
   // cases incorrectly returns the size in wordSize units rather than
   // HeapWordSize).

@@ -198,12 +195,11 @@
   return _young_gen->used() + _old_gen->used();
 }
 
 // Save the "used_region" for generations level and lower.
 void GenCollectedHeap::save_used_regions(int level) {
-  assert(level >= 0, "Illegal level parameter");
-  assert(level < _n_gens, "Illegal level parameter");
+  assert(level == 0 || level == 1, "Illegal level parameter");
   if (level == 1) {
     _old_gen->save_used_region();
   }
   _young_gen->save_used_region();
 }

@@ -415,11 +411,10 @@
          my_thread->is_ConcurrentGC_thread(),
          "incorrect thread type capability");
   assert(Heap_lock->is_locked(),
          "the requesting thread should have the Heap_lock");
   guarantee(!is_gc_active(), "collection is not reentrant");
-  assert(max_level < n_gens(), "sanity check");
 
   if (GC_locker::check_active_before_gc()) {
     return; // GC is disabled (e.g. JNI GetXXXCritical operation)
   }
 

@@ -433,11 +428,11 @@
   print_heap_before_gc();
 
   {
     FlagSetting fl(_is_gc_active, true);
 
-    bool complete = full && (max_level == (n_gens()-1));
+    bool complete = full && (max_level == 1);
     const char* gc_cause_prefix = complete ? "Full GC" : "GC";
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
     // so we can assume here that the next GC id is what we want.
     GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL, GCId::peek());

@@ -505,11 +500,11 @@
     }
 
     // Update "complete" boolean wrt what actually transpired --
     // for instance, a promotion failure could have led to
     // a whole heap collection.
-    complete = complete || (max_level_collected == n_gens() - 1);
+    complete = complete || (max_level_collected == 1);
 
     if (complete) { // We did a "major" collection
       // FIXME: See comment at pre_full_gc_dump call
       post_full_gc_dump(NULL);   // do any post full gc dumps
     }

@@ -777,15 +772,15 @@
   if (cause == GCCause::_scavenge_alot) {
     // minor collection only
     collect(cause, 0);
   } else {
     // Stop-the-world full collection
-    collect(cause, n_gens() - 1);
+    collect(cause, 1);
   }
 #else
     // Stop-the-world full collection
-    collect(cause, n_gens() - 1);
+    collect(cause, 1);
 #endif
   }
 }
 
 void GenCollectedHeap::collect(GCCause::Cause cause, int max_level) {

@@ -796,11 +791,11 @@
 }
 
 void GenCollectedHeap::collect_locked(GCCause::Cause cause) {
   // The caller has the Heap_lock
   assert(Heap_lock->owned_by_self(), "this thread should own the Heap_lock");
-  collect_locked(cause, n_gens() - 1);
+  collect_locked(cause, 1);
 }
 
 // this is the private collection interface
 // The Heap_lock is expected to be held on entry.
 

@@ -852,11 +847,11 @@
   }
 }
 #endif // INCLUDE_ALL_GCS
 
 void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
-   do_full_collection(clear_all_soft_refs, _n_gens - 1);
+   do_full_collection(clear_all_soft_refs, 1);
 }
 
 void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs,
                                           int max_level) {
   int local_max_level;

@@ -884,11 +879,11 @@
     // This time allow the old gen to be collected as well
     do_collection(true                 /* full */,
                   clear_all_soft_refs  /* clear_all_soft_refs */,
                   0                    /* size */,
                   false                /* is_tlab */,
-                  n_gens() - 1         /* max_level */);
+                  1                    /* max_level */);
   }
 }
 
 bool GenCollectedHeap::is_in_young(oop p) {
   bool result = ((HeapWord*)p) < _old_gen->reserved().start();

@@ -1110,13 +1105,11 @@
   assert(_gch != NULL, "Uninitialized access to GenCollectedHeap::heap()");
   assert(_gch->kind() == CollectedHeap::GenCollectedHeap, "not a generational heap");
   return _gch;
 }
 
-
 void GenCollectedHeap::prepare_for_compaction() {
-  guarantee(_n_gens = 2, "Wrong number of generations");
   // Start by compacting into same gen.
   CompactPoint cp(_old_gen);
   _old_gen->prepare_for_compaction(&cp);
   _young_gen->prepare_for_compaction(&cp);
 }
< prev index next >