src/share/vm/gc_implementation/shared/ageTable.cpp

Print this page

        

@@ -78,32 +78,41 @@
   }
 }
 
 uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) {
   size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
+  uint result;
+
+  if (AlwaysTenure || NeverTenure) {
+    assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+    result = MaxTenuringThreshold;
+  } else {
   size_t total = 0;
   uint age = 1;
   assert(sizes[0] == 0, "no objects with age zero should be recorded");
   while (age < table_size) {
     total += sizes[age];
     // check if including objects of age 'age' made us pass the desired
     // size, if so 'age' is the new threshold
     if (total > desired_survivor_size) break;
     age++;
   }
-  uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
+    result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
+  }
 
   if (PrintTenuringDistribution || UsePerfData) {
 
     if (PrintTenuringDistribution) {
       gclog_or_tty->cr();
-      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
+      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
+        UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
         desired_survivor_size*oopSize, result, MaxTenuringThreshold);
     }
 
-    total = 0;
-    age = 1;
+    size_t total = 0;
+    uint age = 1;
     while (age < table_size) {
       total += sizes[age];
       if (sizes[age] > 0) {
         if (PrintTenuringDistribution) {
           gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total",