diff src/share/vm/runtime/arguments.cpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents d6fe2e4959d6
children b7268662a986
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Fri Apr 11 09:56:35 2008 -0400
+++ b/src/share/vm/runtime/arguments.cpp	Sun Apr 13 17:43:42 2008 -0400
@@ -1163,6 +1163,31 @@
       no_shared_spaces();
     }
   }
+
+#ifdef _LP64
+  // Compressed Headers do not work with CMS, which uses a bit in the klass
+  // field offset to determine free list chunk markers.
+  // Check that UseCompressedOops can be set with the max heap size allocated
+  // by ergonomics.
+  if (!UseConcMarkSweepGC && MaxHeapSize <= (32*G - os::vm_page_size())) {
+    if (FLAG_IS_DEFAULT(UseCompressedOops)) {
+      FLAG_SET_ERGO(bool, UseCompressedOops, true);
+    }
+  } else {
+    if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
+      // If specified, give a warning
+      if (UseConcMarkSweepGC){
+        warning("Compressed Oops does not work with CMS");
+      } else {
+        warning(
+          "Max heap size too large for Compressed Oops");
+      }
+      FLAG_SET_DEFAULT(UseCompressedOops, false);
+    }
+  }
+  // Also checks that certain machines are slower with compressed oops
+  // in vm_version initialization code.
+#endif // _LP64
 }
 
 void Arguments::set_parallel_gc_flags() {