8086068: VM crashes with "-Xint -XX:+UseCompiler" options
authorthartmann
Thu, 21 Apr 2016 10:52:00 +0200
changeset 38055 9dddf9056918
parent 38053 e6efb2c54538
child 38056 033ebbb3746e
8086068: VM crashes with "-Xint -XX:+UseCompiler" options Summary: Prevent incompatible compiler flag combination. Reviewed-by: zmajo, kvn, ddmitriev
hotspot/src/share/vm/code/codeCache.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/test/compiler/arguments/TestUseCompiler.java
--- a/hotspot/src/share/vm/code/codeCache.cpp	Wed Apr 20 20:40:46 2016 +0300
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Thu Apr 21 10:52:00 2016 +0200
@@ -336,7 +336,7 @@
   if (!SegmentedCodeCache) {
     // No segmentation: use a single code heap
     return (code_blob_type == CodeBlobType::All);
-  } else if (Arguments::mode() == Arguments::_int) {
+  } else if (Arguments::is_interpreter_only()) {
     // Interpreter only: we don't need any method code heaps
     return (code_blob_type == CodeBlobType::NonNMethod);
   } else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) {
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Apr 20 20:40:46 2016 +0300
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Apr 21 10:52:00 2016 +0200
@@ -2620,6 +2620,12 @@
     }
     FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
   }
+  if (UseCompiler && is_interpreter_only()) {
+    if (!FLAG_IS_DEFAULT(UseCompiler)) {
+      warning("UseCompiler disabled due to -Xint.");
+    }
+    FLAG_SET_CMDLINE(bool, UseCompiler, false);
+  }
   return status;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/TestUseCompiler.java	Thu Apr 21 10:52:00 2016 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test TestUseCompiler
+ * @bug 8086068
+ * @summary Tests execution with inconsistent UseCompiler flag combination.
+ * @run main/othervm -Xint -XX:+UseCompiler TestUseCompiler
+ * @run main/othervm -XX:+UseCompiler -Xint TestUseCompiler
+ */
+
+public class TestUseCompiler {
+
+    public static void main(String args[]) {
+        System.out.println("Passed");
+    }
+}
+