8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
authorkvn
Thu, 01 Mar 2018 09:03:30 -0800
changeset 49191 13378aa8527e
parent 49190 c14c75375fa4
child 49192 6734eeef4283
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization Reviewed-by: thartmann
src/hotspot/share/jvmci/jvmci_globals.cpp
src/hotspot/share/jvmci/jvmci_globals.hpp
src/hotspot/share/runtime/thread.cpp
test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckSmearing.java
test/hotspot/jtreg/compiler/uncommontrap/Test8009761.java
test/hotspot/jtreg/compiler/whitebox/ForceNMethodSweepTest.java
--- a/src/hotspot/share/jvmci/jvmci_globals.cpp	Thu Mar 01 10:56:17 2018 +0100
+++ b/src/hotspot/share/jvmci/jvmci_globals.cpp	Thu Mar 01 09:03:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -80,6 +80,15 @@
     FLAG_SET_DEFAULT(EnableJVMCI, true);
   }
 
+  if (!EnableJVMCI) {
+    // Switch off eager JVMCI initialization if JVMCI is disabled.
+    // Don't throw error if EagerJVMCI is set to allow testing.
+    if (EagerJVMCI) {
+      FLAG_SET_DEFAULT(EagerJVMCI, false);
+    }
+  }
+  JVMCI_FLAG_CHECKED(EagerJVMCI)
+
   CHECK_NOT_SET(JVMCITraceLevel,              EnableJVMCI)
   CHECK_NOT_SET(JVMCICounterSize,             EnableJVMCI)
   CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI)
--- a/src/hotspot/share/jvmci/jvmci_globals.hpp	Thu Mar 01 10:56:17 2018 +0100
+++ b/src/hotspot/share/jvmci/jvmci_globals.hpp	Thu Mar 01 09:03:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -55,6 +55,9 @@
   experimental(bool, BootstrapJVMCI, false,                                 \
           "Bootstrap JVMCI before running Java main method")                \
                                                                             \
+  experimental(bool, EagerJVMCI, false,                                     \
+          "Force eager JVMCI initialization")                               \
+                                                                            \
   experimental(bool, PrintBootstrap, true,                                  \
           "Print JVMCI bootstrap progress and summary")                     \
                                                                             \
--- a/src/hotspot/share/runtime/thread.cpp	Thu Mar 01 10:56:17 2018 +0100
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Mar 01 09:03:30 2018 -0800
@@ -3863,10 +3863,11 @@
 
 #if INCLUDE_JVMCI
   if (EnableJVMCI) {
-    // Initialize JVMCI eagerly if JVMCIPrintProperties is enabled.
+    // Initialize JVMCI eagerly when it is explicitly requested.
+    // Or when JVMCIPrintProperties is enabled.
     // The JVMCI Java initialization code will read this flag and
     // do the printing if it's set.
-    bool init = JVMCIPrintProperties;
+    bool init = EagerJVMCI || JVMCIPrintProperties;
 
     if (!init) {
       // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
--- a/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckSmearing.java	Thu Mar 01 10:56:17 2018 +0100
+++ b/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckSmearing.java	Thu Mar 01 09:03:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -32,6 +32,7 @@
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EagerJVMCI
  *                   compiler.rangechecks.TestRangeCheckSmearing
  *
  */
--- a/test/hotspot/jtreg/compiler/uncommontrap/Test8009761.java	Thu Mar 01 10:56:17 2018 +0100
+++ b/test/hotspot/jtreg/compiler/uncommontrap/Test8009761.java	Thu Mar 01 09:03:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -33,6 +33,7 @@
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *      -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K
+ *      -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EagerJVMCI
  *      -XX:CompileCommand=exclude,compiler.uncommontrap.Test8009761::m2
  *      compiler.uncommontrap.Test8009761
  */
--- a/test/hotspot/jtreg/compiler/whitebox/ForceNMethodSweepTest.java	Thu Mar 01 10:56:17 2018 +0100
+++ b/test/hotspot/jtreg/compiler/whitebox/ForceNMethodSweepTest.java	Thu Mar 01 09:03:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -35,6 +35,7 @@
  *                   -XX:-TieredCompilation -XX:+WhiteBoxAPI
  *                   -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
  *                   -XX:-BackgroundCompilation -XX:-UseCounterDecay
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EagerJVMCI
  *                   compiler.whitebox.ForceNMethodSweepTest
  */