hotspot/src/share/vm/runtime/arguments.cpp
changeset 6758 2c14f9ec1cbf
parent 6475 ce4e3065a20c
parent 6755 58237fa09b63
child 6985 e9364ec299ac
child 6968 5d1eaf2fd05f
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Oct 01 18:04:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Oct 06 14:18:32 2010 -0700
@@ -1261,12 +1261,30 @@
   // Object alignment.
   if (!is_power_of_2(ObjectAlignmentInBytes)) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must be power of 2", (int)ObjectAlignmentInBytes);
+                "error: ObjectAlignmentInBytes=%d must be power of 2\n",
+                (int)ObjectAlignmentInBytes);
     return false;
   }
   if ((int)ObjectAlignmentInBytes < BytesPerLong) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must be greater or equal %d", (int)ObjectAlignmentInBytes, BytesPerLong);
+                "error: ObjectAlignmentInBytes=%d must be greater or equal %d\n",
+                (int)ObjectAlignmentInBytes, BytesPerLong);
+    return false;
+  }
+  // It does not make sense to have big object alignment
+  // since a space lost due to alignment will be greater
+  // then a saved space from compressed oops.
+  if ((int)ObjectAlignmentInBytes > 256) {
+    jio_fprintf(defaultStream::error_stream(),
+                "error: ObjectAlignmentInBytes=%d must not be greater then 256\n",
+                (int)ObjectAlignmentInBytes);
+    return false;
+  }
+  // In case page size is very small.
+  if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
+    jio_fprintf(defaultStream::error_stream(),
+                "error: ObjectAlignmentInBytes=%d must be less then page size %d\n",
+                (int)ObjectAlignmentInBytes, os::vm_page_size());
     return false;
   }
   return true;