changeset 625:f6c52a081457 jdk6-b17

6788376: allow to ignore unrecognized VM options Summary: Add new product flag -XX:+IgnoreUnrecognizedVMOptions Reviewed-by: ysr, xlu
author andrew
date Fri, 02 Oct 2009 14:03:52 +0100
parents 012339cadcba
children 0c25a03d2c0d d8c5341875cd
files src/share/vm/runtime/arguments.cpp src/share/vm/runtime/globals.hpp test/compiler/6775880/Test.java
diffstat 3 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Thu Oct 01 11:49:20 2009 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Fri Oct 02 14:03:52 2009 +0100
@@ -2501,7 +2501,7 @@
     vm_args.version = JNI_VERSION_1_2;
     vm_args.options = options;
     vm_args.nOptions = i;
-    vm_args.ignoreUnrecognized = false;
+    vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions;
 
     if (PrintVMOptions) {
       const char* tail;
@@ -2548,13 +2548,12 @@
 
   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
   bool settings_file_specified = false;
+  const char* flags_file;
   int index;
   for (index = 0; index < args->nOptions; index++) {
     const JavaVMOption *option = args->options + index;
     if (match_option(option, "-XX:Flags=", &tail)) {
-      if (!process_settings_file(tail, true, args->ignoreUnrecognized)) {
-        return JNI_EINVAL;
-      }
+      flags_file = tail;
       settings_file_specified = true;
     }
     if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
@@ -2563,6 +2562,24 @@
     if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
       PrintVMOptions = false;
     }
+    if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
+      IgnoreUnrecognizedVMOptions = true;
+    }
+    if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
+      IgnoreUnrecognizedVMOptions = false;
+    }
+  }
+
+  if (IgnoreUnrecognizedVMOptions) {
+    // uncast const to modify the flag args->ignoreUnrecognized
+    *(jboolean*)(&args->ignoreUnrecognized) = true;
+  }
+
+  // Parse specified settings file
+  if (settings_file_specified) {
+    if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
+      return JNI_EINVAL;
+    }
   }
 
   // Parse default .hotspotrc settings file
--- a/src/share/vm/runtime/globals.hpp	Thu Oct 01 11:49:20 2009 +0100
+++ b/src/share/vm/runtime/globals.hpp	Fri Oct 02 14:03:52 2009 +0100
@@ -2187,6 +2187,9 @@
   product(bool, PrintVMOptions, trueInDebug,                                \
          "print VM flag settings")                                          \
                                                                             \
+  product(bool, IgnoreUnrecognizedVMOptions, false,                         \
+         "Ignore unrecognized VM options")                                  \
+                                                                            \
   diagnostic(bool, SerializeVMOutput, true,                                 \
          "Use a mutex to serialize output to tty and hotspot.log")          \
                                                                             \
--- a/test/compiler/6775880/Test.java	Thu Oct 01 11:49:20 2009 +0100
+++ b/test/compiler/6775880/Test.java	Fri Oct 02 14:03:52 2009 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * @bug 6775880
  * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
  * @compile -source 1.4 -target 1.4 Test.java
- * @run main/othervm -server -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
  */
 
 public class Test {