diff src/share/vm/runtime/arguments.cpp @ 1681:126ea7725993

6953477: Increase portability and flexibility of building Hotspot Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail. Reviewed-by: phh, never, coleenp, dholmes
author bobv
date Tue, 03 Aug 2010 08:13:38 -0400
parents 3d90023429ec
children 7fcd5f39bd7a f55c4f82ab9d f8c5d1bdaad4
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Wed Jul 28 17:57:43 2010 -0400
+++ b/src/share/vm/runtime/arguments.cpp	Tue Aug 03 08:13:38 2010 -0400
@@ -2665,6 +2665,28 @@
   }
 #endif
 
+  // If we are running in a headless jre, force java.awt.headless property
+  // to be true unless the property has already been set.
+  // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
+  if (os::is_headless_jre()) {
+    const char* headless = Arguments::get_property("java.awt.headless");
+    if (headless == NULL) {
+      char envbuffer[128];
+      if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
+        if (!add_property("java.awt.headless=true")) {
+          return JNI_ENOMEM;
+        }
+      } else {
+        char buffer[256];
+        strcpy(buffer, "java.awt.headless=");
+        strcat(buffer, envbuffer);
+        if (!add_property(buffer)) {
+          return JNI_ENOMEM;
+        }
+      }
+    }
+  }
+
   if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
@@ -2985,6 +3007,14 @@
     CommandLineFlags::printFlags();
   }
 
+  // Apply CPU specific policy for the BiasedLocking
+  if (UseBiasedLocking) {
+    if (!VM_Version::use_biased_locking() &&
+        !(FLAG_IS_CMDLINE(UseBiasedLocking))) {
+      UseBiasedLocking = false;
+    }
+  }
+
   return JNI_OK;
 }