Skip to content

Commit

Permalink
Remove early Panama implementations; remove ByteBufferIndexInput
Browse files Browse the repository at this point in the history
  • Loading branch information
uschindler committed Feb 29, 2024
1 parent bfa64b0 commit 08363cb
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 2,836 deletions.
4 changes: 2 additions & 2 deletions gradle/generation/extract-jdk-apis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def resources = scriptResources(buildscript)
configure(rootProject) {
ext {
// also change this in extractor tool: ExtractForeignAPI
vectorIncubatorJavaVersions = [ JavaVersion.VERSION_20, JavaVersion.VERSION_21, JavaVersion.VERSION_22 ] as Set
vectorIncubatorJavaVersions = [ JavaVersion.VERSION_21, JavaVersion.VERSION_22 ] as Set
}
}

configure(project(":lucene:core")) {
ext {
apijars = layout.projectDirectory.dir("src/generated/jdk")
mrjarJavaVersions = [ 19, 20, 21 ]
mrjarJavaVersions = [ 21 ]
}

configurations {
Expand Down
10 changes: 2 additions & 8 deletions gradle/generation/extract-jdk-apis/ExtractJdkApis.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public final class ExtractJdkApis {
private static final String PATTERN_VECTOR_VM_INTERNALS = "java.base/jdk/internal/vm/vector/VectorSupport{,$Vector,$VectorMask,$VectorPayload,$VectorShuffle}";

static final Map<Integer,List<String>> CLASSFILE_PATTERNS = Map.of(
19, List.of(PATTERN_PANAMA_FOREIGN),
20, List.of(PATTERN_PANAMA_FOREIGN, PATTERN_VECTOR_VM_INTERNALS, PATTERN_VECTOR_INCUBATOR),
21, List.of(PATTERN_PANAMA_FOREIGN)
21, List.of(PATTERN_PANAMA_FOREIGN, PATTERN_VECTOR_VM_INTERNALS, PATTERN_VECTOR_INCUBATOR)
);

public static void main(String... args) throws IOException {
Expand Down Expand Up @@ -143,7 +141,7 @@ static class Cleaner extends ClassVisitor {

@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(Opcodes.V11, access, name, signature, superName, interfaces);
super.visit(Opcodes.V21, access, name, signature, superName, interfaces);
if (isVisible(access)) {
classesToInclude.add(name);
}
Expand Down Expand Up @@ -188,10 +186,6 @@ public void visitInnerClass(String name, String outerName, String innerName, int
}
}

@Override
public void visitPermittedSubclass(String c) {
}

}

}
Binary file removed lucene/core/src/generated/jdk/jdk19.apijar
Binary file not shown.
Binary file removed lucene/core/src/generated/jdk/jdk20.apijar
Binary file not shown.
Binary file modified lucene/core/src/generated/jdk/jdk21.apijar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

package org.apache.lucene.internal.vectorization;

import java.lang.Runtime.Version;
import java.lang.StackWalker.StackFrame;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt;
Expand Down Expand Up @@ -97,20 +95,10 @@ public static VectorizationProvider getInstance() {

private static final Logger LOG = Logger.getLogger(VectorizationProvider.class.getName());

/** The minimal version of Java that has the bugfix for JDK-8301190. */
private static final Version VERSION_JDK8301190_FIXED = Version.parse("20.0.2");

// visible for tests
static VectorizationProvider lookup(boolean testMode) {
final int runtimeVersion = Runtime.version().feature();
if (runtimeVersion >= 20 && runtimeVersion <= 22) {
// is locale sane (only buggy in Java 20)
if (isAffectedByJDK8301190()) {
LOG.warning(
"Java runtime is using a buggy default locale; Java vector incubator API can't be enabled: "
+ Locale.getDefault());
return new DefaultVectorizationProvider();
}
// only use vector module with Hotspot VM
if (!Constants.IS_HOTSPOT_VM) {
LOG.warning(
Expand Down Expand Up @@ -189,15 +177,6 @@ private static Optional<Module> lookupVectorModule() {
.findModule("jdk.incubator.vector");
}

/**
* Check if runtime is affected by JDK-8301190 (avoids assertion when default language is say
* "tr").
*/
private static boolean isAffectedByJDK8301190() {
return VERSION_JDK8301190_FIXED.compareToIgnoreOptional(Runtime.version()) > 0
&& !Objects.equals("I", "i".toUpperCase(Locale.getDefault()));
}

// add all possible callers here as FQCN:
private static final Set<String> VALID_CALLERS = Set.of("org.apache.lucene.util.VectorUtil");

Expand Down
156 changes: 0 additions & 156 deletions lucene/core/src/java/org/apache/lucene/store/ByteBufferGuard.java

This file was deleted.

Loading

0 comments on commit 08363cb

Please sign in to comment.