8245717: VM option "-XX:EnableJVMCIProduct" could not be repetitively enabled

Reviewed-by: dholmes, kvn
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
index 995b234..4788a21 100644
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -3042,6 +3042,10 @@
         return JNI_EINVAL;
       }
     } else if (match_option(option, "-XX:+EnableJVMCIProduct")) {
+      // Just continue, since "-XX:+EnableJVMCIProduct" has been specified before
+      if (EnableJVMCIProduct) {
+        continue;
+      }
       JVMFlag *jvmciFlag = JVMFlag::find_flag("EnableJVMCIProduct");
       // Allow this flag if it has been unlocked.
       if (jvmciFlag != NULL && jvmciFlag->is_unlocked()) {
diff --git a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java
index d0245d0..d577e30 100644
--- a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java
+++ b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8235539
+ * @bug 8235539 8245717
  * @summary Tests effect of -XX:+EnableJVMCIProduct on EnableJVMCI and UseJVMCICompiler
  * @requires vm.jvmci
  * @library /test/lib
@@ -65,6 +65,10 @@
         test("-XX:-EnableJVMCI",
             new Expectation("EnableJVMCI", "false", "command line"),
             new Expectation("UseJVMCICompiler", "false", "default"));
+        test("-XX:+EnableJVMCIProduct",
+            new Expectation("EnableJVMCIProduct", "true", "command line"),
+            new Expectation("EnableJVMCI", "true", "default"),
+            new Expectation("UseJVMCICompiler", "true", "default"));
     }
 
     static void test(String explicitFlag, Expectation... expectations) throws Exception {