disable vectors (and don't warn to add incubator module) for jvmci/graal (#12766)
diff --git a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
index 35a4852..73f1f91 100644
--- a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
+++ b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
@@ -117,6 +117,12 @@
"Java runtime is not using Hotspot VM; Java vector incubator API can't be enabled.");
return new DefaultVectorizationProvider();
}
+ // don't use vector module with JVMCI (it does not work)
+ if (Constants.IS_JVMCI_VM) {
+ LOG.warning(
+ "Java runtime is using JVMCI Compiler; Java vector incubator API can't be enabled.");
+ return new DefaultVectorizationProvider();
+ }
// is the incubator module present and readable (JVM providers may to exclude them or it is
// build with jlink)
final var vectorMod = lookupVectorModule();
diff --git a/lucene/core/src/java/org/apache/lucene/util/Constants.java b/lucene/core/src/java/org/apache/lucene/util/Constants.java
index 01ead03..97728f5 100644
--- a/lucene/core/src/java/org/apache/lucene/util/Constants.java
+++ b/lucene/core/src/java/org/apache/lucene/util/Constants.java
@@ -66,6 +66,10 @@
/** True iff the Java VM is based on Hotspot and has the Hotspot MX bean readable by Lucene. */
public static final boolean IS_HOTSPOT_VM = HotspotVMOptions.IS_HOTSPOT_VM;
+ /** True if jvmci is enabled (e.g. graalvm) */
+ public static final boolean IS_JVMCI_VM =
+ HotspotVMOptions.get("UseJVMCICompiler").map(Boolean::valueOf).orElse(false);
+
/** True iff running on a 64bit JVM */
public static final boolean JRE_IS_64BIT = is64Bit();