diff src/share/vm/memory/defNewGeneration.cpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents ba764ed4b6f2
children 60fb9c4db4e6
line wrap: on
line diff
--- a/src/share/vm/memory/defNewGeneration.cpp	Wed Jun 04 13:51:09 2008 -0700
+++ b/src/share/vm/memory/defNewGeneration.cpp	Thu Jun 05 15:57:56 2008 -0700
@@ -214,20 +214,26 @@
   MemRegion fromMR((HeapWord*)from_start, (HeapWord*)to_start);
   MemRegion toMR  ((HeapWord*)to_start, (HeapWord*)to_end);
 
-  eden()->initialize(edenMR, (minimum_eden_size == 0));
-  // If minumum_eden_size != 0, we will not have cleared any
-  // portion of eden above its top. This can cause newly
-  // expanded space not to be mangled if using ZapUnusedHeapArea.
-  // We explicitly do such mangling here.
-  if (ZapUnusedHeapArea && (minimum_eden_size != 0)) {
-    eden()->mangle_unused_area();
+  eden()->set_bounds(edenMR);
+  if (minimum_eden_size == 0) {
+    // The "minimum_eden_size" is really the amount of eden occupied by
+    // allocated objects -- if this is zero, then we can clear the space.
+    eden()->clear();
+  } else {
+    // Otherwise, we will not have cleared eden. This can cause newly
+    // expanded space not to be mangled if using ZapUnusedHeapArea.
+    // We explicitly do such mangling here.
+    if (ZapUnusedHeapArea) {
+      eden()->mangle_unused_area();
+    }
   }
-  from()->initialize(fromMR, true);
-    to()->initialize(toMR  , true);
-  eden()->set_next_compaction_space(from());
+  from()->set_bounds(fromMR); from()->clear();
+    to()->set_bounds(toMR);     to()->clear();
+  // Make sure we compact eden, then from.
   // The to-space is normally empty before a compaction so need
   // not be considered.  The exception is during promotion
   // failure handling when to-space can contain live objects.
+  eden()->set_next_compaction_space(from());
   from()->set_next_compaction_space(NULL);
 }